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 |
|---|---|---|---|---|---|---|---|---|---|---|
offlinecat-dev/OCNetORM | example/repository/UserRepository.ets | arkts | restoreUser | 恢复被删除的用户
@param id 用户ID
@returns 恢复结果 | async restoreUser(id: number): Promise<SaveResult> {
return await this.repository.restore(id)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left restoreUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async restoreUser(id: number): Promise<SaveResult> {
return await this.repository.restore(id)
} | https://github.com/offlinecat-dev/OCNetORM | 76e5a9274b1a1c7f0ab2f581d6dcb8e81567bd55 | github |
Joker-x-dev/HarmonyKit | feature/main/src/main/ets/view/NavigationPage.ets | arkts | build | 构建导航页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.navigation"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.NavigationConten... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.navigation"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.NavigationConten... | https://github.com/Joker-x-dev/HarmonyKit | 3a96bea092204a9f81bc4f673af365ba05a17982 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets | arkts | getGlobalWebViewController | 获取全局WebView控制器(所有引擎共享) | getGlobalWebViewController(): webview.WebviewController | null {
if (!this.globalWebViewController) {
logger.warn(TAG, '全局WebView控制器未设置');
}
return this.globalWebViewController;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getGlobalWebViewController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#L... | getGlobalWebViewController(): webview.WebviewController | null {
if (!this.globalWebViewController) {
logger.warn(TAG, '全局WebView控制器未设置');
}
return this.globalWebViewController;
} | https://github.com/DaLongZhuaZi/manxia | 02e84cc4d729c0f63dbf75a4be66f2109379a459 | github |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/orientationDevelopment/entry/src/main/ets/pages/ScreenRotationA.ets | arkts | build | [End orientation] | build() {
Text('你好')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Text('你好')
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 36d12a9f42cffd863ee1001cf5bc4665a72d2049 | gitcode |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets | arkts | stopAlarm | Stop alarm
@param alarmInfo Alarm information | async stopAlarm(alarmInfo: AlarmInfo): Promise<void> {
if (!alarmInfo?.id) {
LogUtil.error(TAG, 'Execute method stopAlarm failed, params is incorrect.');
return;
}
this.cancelSnoozeInput();
LogUtil.info(TAG, 'alarm stop alarmInfo = ' + JSON.stringify(alarmInfo))
await AlarmStateManager... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left stopAlarm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#... | async stopAlarm(alarmInfo: AlarmInfo): Promise<void> {
if (!alarmInfo?.id) {
LogUtil.error(TAG, 'Execute method stopAlarm failed, params is incorrect.');
return;
}
this.cancelSnoozeInput();
LogUtil.info(TAG, 'alarm stop alarmInfo = ' + JSON.stringify(alarmInfo))
await AlarmStateManager... | https://gitee.com/openharmony-sig/applications_clock.git | 77b0d5d1bba0c96cd52270bba0485af9aa65b75f | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | getSummaryStats | 获取汇总统计(串流结束后使用,回退到最后有效快照) | getSummaryStats(): StreamStats {
const current = this.getStats();
if (current.renderedFps > 0 || current.latency > 0) return current;
return this.lastValidStats || current;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSummaryStats 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 StreamStats AST#identifier#Right AST#ERROR#Rig... | getSummaryStats(): StreamStats {
const current = this.getStats();
if (current.renderedFps > 0 || current.latency > 0) return current;
return this.lastValidStats || current;
} | https://github.com/AlkaidLab/moonlight-harmony | a61ebb599d7d781729e97a9c760b78719bba5e6b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getSurfaceColor | 获取表面色 | public getSurfaceColor(): string {
return AppColors.surface;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSurfaceColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST... | public getSurfaceColor(): string {
return AppColors.surface;
} | https://github.com/DaLongZhuaZi/manxia | 480c6a4cae91daf9b116c3ca2f21a61068d57098 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | setTitleCallbacks | 设置标题生成回调 | setTitleCallbacks(callbacks: TitleGenerationCallbacks | null): void {
this.titleCallbacks = callbacks
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTitleCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbacks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left TitleG... | setTitleCallbacks(callbacks: TitleGenerationCallbacks | null): void {
this.titleCallbacks = callbacks
} | https://github.com/LongLiveY96/chatcube | 76c087709b0762a843970dc1116fc31074b3e328 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitRepeatedSfixed32 | 访问 repeated sfixed32 字段 | visitRepeatedSfixed32(value: number[], fieldNumber: number): void {
for (const item of value) {
this.visitSfixed32(item, fieldNumber)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedSfixed32 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 num... | visitRepeatedSfixed32(value: number[], fieldNumber: number): void {
for (const item of value) {
this.visitSfixed32(item, fieldNumber)
}
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 554efd4341689ad4eed34d69e98ec5db47c9789d | gitcode |
m-harmongos/harmongos-projects | AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | queryDatabaseAlarms | 查询提醒任务列表 | private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) {
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
if (preference) {
preference.get(CommonConstants.ALARM_KEY).then((data: string) => {
if (data) {
this.alarms = JSON.par... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left queryDatabaseAlarms AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Lef... | private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) {
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
if (preference) {
preference.get(CommonConstants.ALARM_KEY).then((data: string) => {
if (data) {
this.alarms = JSON.par... | https://github.com/m-harmongos/harmongos-projects | b3b9c4ef7efe70357e51702b4ceab7ffbe72aae6 | github |
openharmony/codelabs | Security/StringCipherArkTS/entry/src/main/ets/common/utils/DataTransformUtil.ets | arkts | base64ToUint8Array | Base64 to uint8Array.
@param content Base64 data.
@returns Uint8Array data. | base64ToUint8Array(content: string): Uint8Array {
let uint8ArrayData: Uint8Array = (this.base64Helper as util.Base64Helper).decodeSync(content);
return uint8ArrayData;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left base64ToUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | base64ToUint8Array(content: string): Uint8Array {
let uint8ArrayData: Uint8Array = (this.base64Helper as util.Base64Helper).decodeSync(content);
return uint8ArrayData;
} | https://gitee.com/openharmony/codelabs.git | a4abc9c1b6af7575c76cbdb299c35d82ccd0832c | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | findLast | Finds the last element in the Uint8ClampedArray that satisfies the condition
@param { function } fn - condition
@returns { number } - the last element that satisfies fn
@throws { Error } - If the element cannot be found, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): number {
for (let i = this.lengthInt - 1; i >= 0; i--) {
let val = this.getUnsafe(i).toDouble()
if (fn(val, i, this)) {
return val
}
}
throw new Error("Uin... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast 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#:... | public findLast(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): number {
for (let i = this.lengthInt - 1; i >= 0; i--) {
let val = this.getUnsafe(i).toDouble()
if (fn(val, i, this)) {
return val
}
}
throw new Error("Uin... | https://gitcode.com/iop123123/arkts-static-skills | 70494dc3453f101f07e6b7bead358b89a3e5515b | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | countReset | Resets the counter for a specific label
@param {string} [label='default'] - The label of the counter to reset
@returns {void} | public countReset(label?: string): void {
const key = label ?? 'default'
this.counters.delete(key)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left countReset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right... | public countReset(label?: string): void {
const key = label ?? 'default'
this.counters.delete(key)
} | https://gitcode.com/iop123123/arkts-static-skills | 1d965ff1cb612f834a6db6e23c9faa97091b652b | gitcode |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/MainAbility/pages/music2.ets | arkts | <arrow> | duration: 1000 - 一秒钟, 这里是时间,ms 为单位 curve: Curve.EaseInOut, -加速度,减速度 ?? | () => {
this.pointerAngle = 39;
}) | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#=>#Left => AST#=>#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#assignment_expression#Left AST#member_expressio... | () => {
this.pointerAngle = 39;
}) | https://gitee.com/openharmony-sig/online_event.git | 7837a8ff7da883cdd63e187c8ed2adbe9e8d807a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | syncData | 数据同步测试 | public async syncData(): Promise<SyncResult> {
try {
// 模拟数据同步过程
await new Promise<void>(resolve => setTimeout(resolve, 1000));
logger.info(TAG, '数据同步测试完成');
const result: SyncResult = { success: true, message: '数据同步成功' };
return result;
} catch (error) {
logger.erro... | 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 syncData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ... | public async syncData(): Promise<SyncResult> {
try {
// 模拟数据同步过程
await new Promise<void>(resolve => setTimeout(resolve, 1000));
logger.info(TAG, '数据同步测试完成');
const result: SyncResult = { success: true, message: '数据同步成功' };
return result;
} catch (error) {
logger.erro... | https://github.com/DaLongZhuaZi/manxia | aade88850551287ac7c811a189776c161035f53e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/BackgroundStreamService.ets | arkts | startContinuousTask | 启动 AUDIO_PLAYBACK 类型长时任务
配合 AVSession 防止系统冻结进程 | private async startContinuousTask(): Promise<void> {
try {
// 创建 WantAgent(点击通知时跳转回应用)
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [{
bundleName: 'com.alkaidlab.sdream',
abilityName: 'EntryAbility'
}],
actionType: wantAgent.OperationType.START_AB... | 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 startContinuousTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async startContinuousTask(): Promise<void> {
try {
// 创建 WantAgent(点击通知时跳转回应用)
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [{
bundleName: 'com.alkaidlab.sdream',
abilityName: 'EntryAbility'
}],
actionType: wantAgent.OperationType.START_AB... | https://github.com/AlkaidLab/moonlight-harmony | 0be2d09324eea4317a00e09cd04ed56461f68f75 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets | arkts | loginByPassword | 密码登录实现
@param {Record<string, string>} params - 登录参数
@returns {Promise<NetworkResponse<Auth>>} 登录结果 | async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>> {
const response: AxiosResponse<NetworkResponse<Auth>> =
await NetworkClient.http.post("user/login/password", params);
return response.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginByPassword AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>> {
const response: AxiosResponse<NetworkResponse<Auth>> =
await NetworkClient.http.post("user/login/password", params);
return response.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 0a9e6a237457d57a6eb95fc6468f2d917a52715a | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | getOrientation | returns the orientation of the legend
@return | public getOrientation(): LegendOrientation {
return this.mOrientation;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOrientation 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 LegendO... | public getOrientation(): LegendOrientation {
return this.mOrientation;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 12d0888935b653f94eb664a94ad0043154bbf5cc | gitee |
arkui-x/samples | CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets | arkts | initColor | 设置子窗口蒙层颜色 | initColor() {
try {
// 获取指定resource对象对应的字符串
this.maskColor = context.resourceManager.getStringSync($r('app.string.custom_dialog_mask_color').id);
console.log("getStringSync: " + this.maskColor)
} catch (err) {
console.error(`getStringSync failed, code is ${err.code}, message is ${err.m... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initColor 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... | initColor() {
try {
// 获取指定resource对象对应的字符串
this.maskColor = context.resourceManager.getStringSync($r('app.string.custom_dialog_mask_color').id);
console.log("getStringSync: " + this.maskColor)
} catch (err) {
console.error(`getStringSync failed, code is ${err.code}, message is ${err.m... | https://gitcode.com/arkui-x/samples | 4e78ca9fd10f70ef6724b749877fdd36b3d5ceb9 | gitcode |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | imageHStack | 图片拼接(横向)
@param inputs 输入图片路径数组
@param output 输出图片路径 | public static imageHStack(inputs: string[], output: string): string[] {
const cmd: string[] = ['ffmpeg'];
for (const input of inputs) {
cmd.push('-i', input);
}
let filterInputs = '';
for (let i = 0; i < inputs.length; i++) {
filterInputs += `[${i}:v]`;
}
cmd.push(
... | 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 imageHStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inputs AST#identifier#Right AST#:#Left : AS... | public static imageHStack(inputs: string[], output: string): string[] {
const cmd: string[] = ['ffmpeg'];
for (const input of inputs) {
cmd.push('-i', input);
}
let filterInputs = '';
for (let i = 0; i < inputs.length; i++) {
filterInputs += `[${i}:v]`;
}
cmd.push(
... | https://github.com/jjjjjjava/ffmpeg_tools | edcea7b510f4f9260fe920df2b8d04e3245bbb66 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | getCurrentEpisode | 获取当前播放的Episode | getCurrentEpisode(): Episode | null {
return this.currentEpisode;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentEpisode 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#ide... | getCurrentEpisode(): Episode | null {
return this.currentEpisode;
} | https://github.com/pangpang20/antennaPodHM | c8af067d905830193aeb69b974b9394172996ee7 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets | arkts | getDeviceInfo | 获取设备信息 | getDeviceInfo() {
// 产品名称,可用于区分 模拟器(emulator)、真机(产品型号)
this.marketName = deviceInfo.marketName
// 系统版本
this.osFullName = deviceInfo.osFullName
// 系统软件API版本(API 9、11、12 等)
this.sdkApiVersion = deviceInfo.sdkApiVersion.toString()
// 设备类型,可用于区分 手机、平板、PC、车机、手表、电视 等
this.deviceType = device... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDeviceInfo 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... | getDeviceInfo() {
// 产品名称,可用于区分 模拟器(emulator)、真机(产品型号)
this.marketName = deviceInfo.marketName
// 系统版本
this.osFullName = deviceInfo.osFullName
// 系统软件API版本(API 9、11、12 等)
this.sdkApiVersion = deviceInfo.sdkApiVersion.toString()
// 设备类型,可用于区分 手机、平板、PC、车机、手表、电视 等
this.deviceType = device... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 40c358fed2b2004a3ab4d8bdddc1e6bef04142d5 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current Int16Array using range [begin, this.length).
@param { int } begin - start index to be taken into slice
@returns { Int16Array } - a new Int16Array with elements of current Int16Array[begin, this.length)
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public slice(begin: int): Int16Array {
return this.sliceFromTo(begin, this.lengthInt)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public slice(begin: int): Int16Array {
return this.sliceFromTo(begin, this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | 783389367ed8e336dbeda23ae275453a3980fa59 | gitcode |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/model/CityModel.ets | arkts | getLatitudeDMS | 获取纬度(度分秒格式) | getLatitudeDMS(): string {
return CityModel.decimalToDMS(this.getLatitudeDecimal());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLatitudeDMS 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#stateme... | getLatitudeDMS(): string {
return CityModel.decimalToDMS(this.getLatitudeDecimal());
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | ae7c26b868b414c0df91cde3ad53753fa87e6810 | github |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/SocialListSettings.ets | arkts | reset | 重置黑名单与收藏到默认(清空 manager、加载标志位) | reset(): void {
this.blacklistManager = new FilterListManager<BlacklistEntry>()
this.favoritesLoaded = false
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | reset(): void {
this.blacklistManager = new FilterListManager<BlacklistEntry>()
this.favoritesLoaded = false
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/SocialListSettings.ets#L119-L122 | 7ce97c12fc7f4332f1ee593c09a4034ff789ef8e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSource.ets | arkts | getAllLibraryMangas | 获取所有库中的漫画(使用服务器端排序)
@param sortType 排序类型
@param sortDirection 排序方向 | private async getAllLibraryMangas(sortType: MangaSortType = 'TITLE', sortDirection: SortDirection = 'ASC'): Promise<ComicInfo[]> {
// 分批获取所有漫画
const batchSize = 100;
let offset = 0;
let allMangas: ComicInfo[] = [];
let hasMore = true;
const canUseServerOrder = await this.supportsMangaOrder();
... | 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 getAllLibraryMangas AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sortType AST#identifier#Right AST... | private async getAllLibraryMangas(sortType: MangaSortType = 'TITLE', sortDirection: SortDirection = 'ASC'): Promise<ComicInfo[]> {
// 分批获取所有漫画
const batchSize = 100;
let offset = 0;
let allMangas: ComicInfo[] = [];
let hasMore = true;
const canUseServerOrder = await this.supportsMangaOrder();
... | https://github.com/DaLongZhuaZi/manxia | f6f3a2e3fd1445427fa64c0fba49789cbf904b7d | github |
openharmony/applications_photos | common/src/main/ets/default/model/common/HistogramManager.ets | arkts | dataPrepare | 直方图数据准备,利用worker执行耗时操作
@param itemId
@param mediaType | async dataPrepare(uri: string): Promise<void> {
Log.info(TAG, 'photo detail, histogram start processing');
let pixelBuffer = await this.extractPixels(uri);
TraceControllerUtils.startTrace('dataPrepare');
let resultArray = new Uint32Array(Constants.PIXEL_NUMBER * Constants.RGB_CHANNELS);
let counte... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left dataPrepare AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uri AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async dataPrepare(uri: string): Promise<void> {
Log.info(TAG, 'photo detail, histogram start processing');
let pixelBuffer = await this.extractPixels(uri);
TraceControllerUtils.startTrace('dataPrepare');
let resultArray = new Uint32Array(Constants.PIXEL_NUMBER * Constants.RGB_CHANNELS);
let counte... | https://gitee.com/openharmony/applications_photos.git | ad2cb8cb3ccdc4c0032c4d8ed10644fa5590df1a | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/FinalizationQueue.ets | arkts | getSize | Returns size of the FinalizationQueue
@returns size of the FinalizationQueue | public getSize(): int {
let count: int;
for (let i = this.idxarr[0]; i != -1; i = this.idxarr[i]) {
count++;
}
return count;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi... | public getSize(): int {
let count: int;
for (let i = this.idxarr[0]; i != -1; i = this.idxarr[i]) {
count++;
}
return count;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 605b1cfb227ee04cd9081679298d350ca6037a60 | gitee |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/LightSensingService.ets | arkts | getCurrentLux | 获取当前照度值 | getCurrentLux(): number {
return this.currentLux;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentLux 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#statemen... | getCurrentLux(): number {
return this.currentLux;
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | ead07c68a61b1dd61889245d3b37c61eb8945830 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets | arkts | onSelectedChange | 当选择"下载列表"时,显示下载列表相应内容,选择其他选项时,不显示内容,仅用于ux展示 | onSelectedChange(): void {
// 显示下载列表内容
if (this.tabSelectedIndexes[0] === 1) {
this.downloadPageOpacity = 1;
this.isDownloadPageEnabled = true;
this.downloadPageVisibility = Visibility.Visible;
this.historyPageVisibility = Visibility.None;
} else if (this.tabSelectedIndexes[0] === ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSelectedChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#co... | onSelectedChange(): void {
// 显示下载列表内容
if (this.tabSelectedIndexes[0] === 1) {
this.downloadPageOpacity = 1;
this.isDownloadPageEnabled = true;
this.downloadPageVisibility = Visibility.Visible;
this.historyPageVisibility = Visibility.None;
} else if (this.tabSelectedIndexes[0] === ... | https://github.com/openharmony/applications_app_samples | 0d068d37931424f926835139137a9a7e2aee06aa | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | pop | Retrieves and removes the bit element to the end of this bit vector.
@returns { int | undefined } The boolean type, if the bit push successfully, return true, else return false. | public pop(): int | undefined {
if (this._length === 0) {
return undefined;
}
return this.getBitUnsafe(--this._length);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pop AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call... | public pop(): int | undefined {
if (this._length === 0) {
return undefined;
}
return this.getBitUnsafe(--this._length);
} | https://gitcode.com/iop123123/arkts-static-skills | e77bdd406d867867e490cf46f469861e67cc04ec | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | padEnd | The padEnd() method pads the current string with a given string (repeated, if needed)
so that the resulting string reaches a given length.
The padding is applied from the end of the current string.
@param { int } end of the resulting string once the current str has been padded
@param { String } [fillString] to pad the ... | public padEnd(end: int, fillString?: String): String {
const str = fillString ?? '\u0020'
if (this.getLength() >= end || str.getLength() == 0) {
return this;
}
let arr : ValueArray<char> = new ValueArray<char>(end);
let length = this.getLength();
let strLe... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left end AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#id... | public padEnd(end: int, fillString?: String): String {
const str = fillString ?? '\u0020'
if (this.getLength() >= end || str.getLength() == 0) {
return this;
}
let arr : ValueArray<char> = new ValueArray<char>(end);
let length = this.getLength();
let strLe... | https://gitcode.com/iop123123/arkts-static-skills | 7a1d5b121ead4b69d0ef0349b7a0faa25d31906d | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | $_invoke | Creates a new instance of a String from short
@param { short } value The value to be converted to a string.
@returns { string } A new String instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: short): string {
return new String(value);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left short ... | static $_invoke(value: short): string {
return new String(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 5edc98f54a904bedc184bf2348d3cc6f67b80a25 | gitcode |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicPlayerService.ets | arkts | getVolume | 获取当前音量 | getVolume(): number {
// AVPlayer 没有直接的 getVolume 方法,需要自己维护
// 这里返回默认值
return 0.5;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getVolume 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_bl... | getVolume(): number {
// AVPlayer 没有直接的 getVolume 方法,需要自己维护
// 这里返回默认值
return 0.5;
} | https://github.com/cpdd5201314/harmonyOS-music-app | 1fc69241e523fbe37d682235b3d781cff87bac92 | github |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | connect | 建立 WebSocket 连接 | private connect(): void {
if (this.ws !== null) {
LogUtil.warn(`${TAG} WebSocket 已存在,跳过重复连接`);
return;
}
this.ws = webSocket.createWebSocket();
this.ws.on('open', () => {
LogUtil.info(`${TAG} WebSocket 已连接`);
this.isConnected = true;
this.lastMsgTime = Date.now();
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left connect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | private connect(): void {
if (this.ws !== null) {
LogUtil.warn(`${TAG} WebSocket 已存在,跳过重复连接`);
return;
}
this.ws = webSocket.createWebSocket();
this.ws.on('open', () => {
LogUtil.info(`${TAG} WebSocket 已连接`);
this.isConnected = true;
this.lastMsgTime = Date.now();
... | https://github.com/tdcare/tdwebrtc | 2215a7a4c4c4bb52583655c4843d9c05f26dede3 | github |
HarmonyOS_Samples/BestPracticeSnippets | TaskPoolPractice/entry/src/main/ets/pages/test.ets | arkts | copy | [End abc] | function copy(pathDir: string) {
// [Start src]
let srcPath = pathDir + "/srcDir/test.txt";
let dstPath = pathDir + "/dstDir/test.txt";
fileIo.copyFileSync(srcPath, dstPath);
// [End src]
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left copy AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pathDir AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS... | function copy(pathDir: string) {
// [Start src]
let srcPath = pathDir + "/srcDir/test.txt";
let dstPath = pathDir + "/dstDir/test.txt";
fileIo.copyFileSync(srcPath, dstPath);
// [End src]
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 876d8834553ec589862b3816e8d11eddcc6c8dd2 | gitcode |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets | arkts | getEntityPathInfo | 获取实体路径配置
@returns {Promise<NetworkResponse<Unknown>>} 路径配置 | async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.get("base/comm/eps");
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEntityPathInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.get("base/comm/eps");
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | c2e295c65166aa62a5bbf6ae80217b87eefcc36c | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets | arkts | leaveToHome | Cleanup helper used at the tail of every test in this file. The
key difference vs `tapConfigCancelShared` is that we never assume
ConfigCancelButton is reachable — pressing back twice (Pack →
Config → Home) is enough on this page chain, and polling
`HomeStartButton` instead of asserting once tolerates HomePage's
onPage... | async function leaveToHome(driver: Driver): Promise<void> {
try {
for (let i: number = 0; i < 6; i++) {
const home: Component | null =
await driver.findComponent(ON.id('HomeStartButton'));
if (home !== null) {
// Give HomePage.onPageShow → applyActivePacks one tick to
// re-res... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left leaveToHome AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#type_... | async function leaveToHome(driver: Driver): Promise<void> {
try {
for (let i: number = 0; i < 6; i++) {
const home: Component | null =
await driver.findComponent(ON.id('HomeStartButton'));
if (home !== null) {
// Give HomePage.onPageShow → applyActivePacks one tick to
// re-res... | https://github.com/terryma2024/happyword | f892411605a8a49257acd3357212886c5682aade | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | setBottomBarStyle | 设置底栏样式 | async setBottomBarStyle(style: string): Promise<void> {
await this.setString(SettingKeys.BOTTOM_BAR_STYLE, style);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setBottomBarStyle AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left style AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async setBottomBarStyle(style: string): Promise<void> {
await this.setString(SettingKeys.BOTTOM_BAR_STYLE, style);
} | https://github.com/DaLongZhuaZi/manxia | d65acfde558fe8aa764607bff1e48d568c1c56f2 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Atomics.ets | arkts | add | BigInt64Array | public static add(typedArray: BigInt64Array, index: int, value: long): long {
throw new Error("not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typedArray A... | public static add(typedArray: BigInt64Array, index: int, value: long): long {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ef9a6691a9fad9f104d833a3b4e6691f756550f7 | gitee |
the-wwyang/kids-learning-app | src/main/ets/common/ThemeManager.ets | arkts | getThemeById | 根据ID获取主题 | public getThemeById(themeId: string): ThemeConfig | null {
for (let i = 0; i < ThemeManager.THEMES.length; i++) {
if (ThemeManager.THEMES[i].id === themeId) {
return ThemeManager.THEMES[i];
}
}
return null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getThemeById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left themeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | public getThemeById(themeId: string): ThemeConfig | null {
for (let i = 0; i < ThemeManager.THEMES.length; i++) {
if (ThemeManager.THEMES[i].id === themeId) {
return ThemeManager.THEMES[i];
}
}
return null;
} | https://github.com/the-wwyang/kids-learning-app | a768cc35a6c5ee59ff8efa06ba71f9fbff1c992a | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F001_hello_world/entry/src/main/ets/utils/I18nUtil.ets | arkts | getSystemLanguage | 获取当前系统语言
@returns 当前语言代码 | static getSystemLanguage(): string {
return i18n.System.getAppPreferredLanguage();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSystemLanguage 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 A... | static getSystemLanguage(): string {
return i18n.System.getAppPreferredLanguage();
} | https://github.com/mqxu/HarmonyOS_In_Action | a8090137808b1b57dc9a5ae85124d4a15d05c9f4 | github |
CLMC2025/Vignette | entry/src/main/ets/utils/TimerManager.ets | arkts | getActiveTimerCount | 获取当前活跃的定时器数量 | getActiveTimerCount(): number {
return this.timers.size;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getActiveTimerCount 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#st... | getActiveTimerCount(): number {
return this.timers.size;
} | https://github.com/CLMC2025/Vignette | 8755f9f1aea01f2eab1fa3742fbe89a0a10f4f0e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Long.ets | arkts | toString | Converts this object to a string
@param radix the radix base for string representation
@returns result of the conversion | public toString(radix: int): string {
if (radix < 2 || radix > 36) {
throw new RangeError('Radix must be between 2 and 36')
}
if (this.value == 0) {
return '0'
}
// NOTE (igorlegalov): workaround for #26305, replace with 0 when the circular dependency... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left radix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig... | public toString(radix: int): string {
if (radix < 2 || radix > 36) {
throw new RangeError('Radix must be between 2 and 36')
}
if (this.value == 0) {
return '0'
}
// NOTE (igorlegalov): workaround for #26305, replace with 0 when the circular dependency... | https://gitcode.com/iop123123/arkts-static-skills | 727464d1ad93daffff971dfc1981a9e8a0ce3ef7 | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/view/BuiltInColorPage.ets | arkts | build | 构建内置颜色展示页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "内置颜色",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ColorContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "内置颜色",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ColorContent();
}
} | https://github.com/codelably/tuniao-ui | f14d6de556314f10cdd3e5c4f742e7794307d481 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Map.ets | arkts | get | Returns a value assosiated with key if present, or a default value otherwise
@param k the key to find in the Map
@param def a value to return if key is not in the Map
@returns value if key presents, def otherwise | get(k: K, def: V): V {
let r = lookupTree(this.tree, k);
if (r != null) {
return r!;
} else {
return def;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left K AST#identifier#Right AST#,#Left , AST#,#Right AST#ide... | get(k: K, def: V): V {
let r = lookupTree(this.tree, k);
if (r != null) {
return r!;
} else {
return def;
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9ee601d7354f4d90a022b4857d8514d951ee25b6 | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/GoalEditPage.ets | arkts | getUnitForType | 获取目标类型对应的单位 | getUnitForType(type: GoalType): string {
switch (type) {
case GoalType.WEIGHT:
return 'kg';
case GoalType.STEPS:
return '步';
case GoalType.WATER:
return 'ml';
case GoalType.SLEEP:
return '小时';
case GoalType.EXERCISE:
return '分钟';
default:... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUnitForType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GoalType AST#identifier#Right AST#)#Left ... | getUnitForType(type: GoalType): string {
switch (type) {
case GoalType.WEIGHT:
return 'kg';
case GoalType.STEPS:
return '步';
case GoalType.WATER:
return 'ml';
case GoalType.SLEEP:
return '小时';
case GoalType.EXERCISE:
return '分钟';
default:... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 06d35945c0deff3fb0ed972691213aefa12c7dfd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | next | Returns the next element in the iteration.
@returns { IteratorResult<T> } - The next element in the iteration.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | override next(): IteratorResult<T> {
return this.it.next()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left next 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#:#Ri... | override next(): IteratorResult<T> {
return this.it.next()
} | https://gitcode.com/iop123123/arkts-static-skills | c46d1672f752ac69ba072be9cd899626a24ad7ca | gitcode |
Dige945/EmoCollector | entry/src/main/ets/service/AIService.ets | arkts | buildPrompt | 构建分析提示词 | private buildPrompt(records: MoodData[]): string {
let prompt = '我今天记录了以下心情:\n\n';
records.forEach((record: MoodData, index: number) => {
const moodLabel = this.getMoodLabel(record.moodScore);
const time = this.formatTime(record.timestamp);
prompt += `${index + 1}. ${time} - ${moodLa... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildPrompt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expr... | private buildPrompt(records: MoodData[]): string {
let prompt = '我今天记录了以下心情:\n\n';
records.forEach((record: MoodData, index: number) => {
const moodLabel = this.getMoodLabel(record.moodScore);
const time = this.formatTime(record.timestamp);
prompt += `${index + 1}. ${time} - ${moodLa... | https://github.com/Dige945/EmoCollector | f433fbe49424aa256135ba93a4dde0ae8c424e4c | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | playNextAuto | Advances playback according to play mode (order, random, single-cycle).
@param isFromControl True when invoked from user/system control (vs track completion). | public playNextAuto(isFromControl: boolean) {
Logger.info(TAG, 'playNextAuto mode:' + this.playMode);
switch (this.playMode) {
case MusicPlayMode.SINGLE_CYCLE:
if (isFromControl) {
this.playNext();
} else if (this.avPlayer) {
try {
this.avPlayer.play();
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playNextAuto AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFromControl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | public playNextAuto(isFromControl: boolean) {
Logger.info(TAG, 'playNextAuto mode:' + this.playMode);
switch (this.playMode) {
case MusicPlayMode.SINGLE_CYCLE:
if (isFromControl) {
this.playNext();
} else if (this.avPlayer) {
try {
this.avPlayer.play();
... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 2ccac9e3e2f223ba40b9001b908a586ffabff90e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/InvisibleWebViewComponent.ets | arkts | onInitialUrlChange | 监听初始URL变化 | onInitialUrlChange() {
if (this.initialUrl && this.initialUrl !== 'about:blank') {
logger.debug(TAG, `初始URL变化: ${this.initialUrl}`);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onInitialUrlChange 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... | onInitialUrlChange() {
if (this.initialUrl && this.initialUrl !== 'about:blank') {
logger.debug(TAG, `初始URL变化: ${this.initialUrl}`);
}
} | https://github.com/DaLongZhuaZi/manxia | 475cc365a2e0c74c4a3679ff046c722cc8572862 | github |
openharmony-sig/ohos_video_trimmer | entry/src/main/ets/pages/Video.ets | arkts | build | @Link textValue: string | build() {
Stack() {
Column() {
LoadingProgress()
.color(Color.Blue)
.width(100)
}
}.width(200)
.height(200)
// dialog默认的borderRadius为24vp,如果需要使用border属性,请和borderRadius属性一起使用。
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack() {
Column() {
LoadingProgress()
.color(Color.Blue)
.width(100)
}
}.width(200)
.height(200)
// dialog默认的borderRadius为24vp,如果需要使用border属性,请和borderRadius属性一起使用。
} | https://gitee.com/openharmony-sig/ohos_video_trimmer.git | fe6f4cf53e1151ea5183d87bb8040ffdff53ee9d | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/SettingsUtil.ets | arkts | saveFamilyInfo | 保存家属信息 | async saveFamilyInfo(familyInfo: object): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
const jsonStr: string = JSON.stringify(familyInfo);
await this.dataPreferences.put('family_info', jsonStr);
await this.dataPreferences.flush();
} catch (e) {
con... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveFamilyInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left familyInfo AST#identifier#Righ... | async saveFamilyInfo(familyInfo: object): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
const jsonStr: string = JSON.stringify(familyInfo);
await this.dataPreferences.put('family_info', jsonStr);
await this.dataPreferences.flush();
} catch (e) {
con... | https://github.com/LJ666-ui/harmony-health-care | e11ace1428f1d956c6449eabd080c74e7fd65493 | github |
openharmony-sig/knowledge_demo_entainment | FA/GuoChat/entry/src/main/ets/MainAbility/common/listitem/MomentListItem.ets | arkts | build | 图片宽度(用于刷新现实正确的图片比例) | build(){
Column(){
//动态内容布局
Flex({direction: FlexDirection.Row , justifyContent: FlexAlign.Start , alignItems: ItemAlign.Start}){
//头像
Flex({ direction: FlexDirection.Row , justifyContent: FlexAlign.Center , alignItems: ItemAlign.Center}){
Image($rawfile(this.momentItem.headI... | 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(){
//动态内容布局
Flex({direction: FlexDirection.Row , justifyContent: FlexAlign.Start , alignItems: ItemAlign.Start}){
//头像
Flex({ direction: FlexDirection.Row , justifyContent: FlexAlign.Center , alignItems: ItemAlign.Center}){
Image($rawfile(this.momentItem.headI... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 3dbde78cfd54b32f9f8a71235f8348db7087baf6 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/ScopeRegistry.ets | arkts | getScope | 获取实体的作用域函数
@param entityName 实体名称
@param scopeName 作用域名称
@returns 作用域函数,不存在返回 null | getScope(entityName: string, scopeName: string): ScopeFunction | null {
const entityScopes = this.scopes.get(entityName)
if (entityScopes === undefined) {
return null
}
const scopeFunction = entityScopes.get(scopeName)
return scopeFunction !== undefined ? scopeFunction : null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getScope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | getScope(entityName: string, scopeName: string): ScopeFunction | null {
const entityScopes = this.scopes.get(entityName)
if (entityScopes === undefined) {
return null
}
const scopeFunction = entityScopes.get(scopeName)
return scopeFunction !== undefined ? scopeFunction : null
} | https://github.com/offlinecat-dev/OCNetORM | b3b7e4dfd75e459d9b03ad42d56a122707a4ce95 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test26_original_index.ets | arkts | testFromCharCode | --- String.fromCharCode chain --- | function testFromCharCode(): string {
let s: string = String.fromCharCode(72) + String.fromCharCode(105) + String.fromCharCode(33);
return s;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testFromCharCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testFromCharCode(): string {
let s: string = String.fromCharCode(72) + String.fromCharCode(105) + String.fromCharCode(33);
return s;
} | https://github.com/miaochiahao/ark-ghidra | a8160e93aa01901fb369d7645425bd222262e2d7 | github |
XXYoLoong/SchoolSmart | entry/src/main/ets/components/indexpages/CampusEnvMonitor.ets | arkts | fetchSensorData | 方法:fetchSensorData 模拟获取各个地点的传感器数据,并更新状态 | fetchSensorData() {
// 遍历 locations 数组,为每个地点生成随机数据
this.locations = this.locations.map((location: LocationData) => {
return {
name: location.name, // 保留原有名称
temperature: Math.random() * 10 + 20, // 生成 20-30°C 的随机温度
humidity: Math.random() * 50 + 30, // 生成 30%-80% 的随机湿度
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fetchSensorData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | fetchSensorData() {
// 遍历 locations 数组,为每个地点生成随机数据
this.locations = this.locations.map((location: LocationData) => {
return {
name: location.name, // 保留原有名称
temperature: Math.random() * 10 + 20, // 生成 20-30°C 的随机温度
humidity: Math.random() * 50 + 30, // 生成 30%-80% 的随机湿度
... | https://github.com/XXYoLoong/SchoolSmart | 93ae4c6caf072b95bea30f8626564d8e3497e3f8 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets | arkts | spring | 创建弹簧动画配置 | static spring(): AnimationConfig {
let config = new AnimationConfig();
config.duration = 300;
config.interpolator = InterpolatorType.SPRING;
let springConfig: SpringConfig = {
stiffness: 1,
damping: 0.8,
mass: 1
};
config.springConfig = springConfig;
return config;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left spring 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 AnimationConfig... | static spring(): AnimationConfig {
let config = new AnimationConfig();
config.duration = 300;
config.interpolator = InterpolatorType.SPRING;
let springConfig: SpringConfig = {
stiffness: 1,
damping: 0.8,
mass: 1
};
config.springConfig = springConfig;
return config;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | aaaf0cd13d49f1804b2092fc5ff81032c73d1196 | gitcode |
dividez/harmonyos-games | features/number/src/main/ets/services/PreferencesUtil.ets | arkts | deletePreferences | 从内存中移除指定文件对应的Preferences单实例。
移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题。 | async deletePreferences() {
await dataPreferences.deletePreferences(context, PREFERENCES_NAME).then(() => {
console.info(`Succeeded in delete preferences`);
}).catch((err: BusinessError) => {
console.error(`Failed to get preferences, Cause:` + err);
});
this.preferences = undefined;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deletePreferences AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS... | async deletePreferences() {
await dataPreferences.deletePreferences(context, PREFERENCES_NAME).then(() => {
console.info(`Succeeded in delete preferences`);
}).catch((err: BusinessError) => {
console.error(`Failed to get preferences, Cause:` + err);
});
this.preferences = undefined;
} | https://github.com/dividez/harmonyos-games | 330724065742b3cfc0875157aad37fd42da56624 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/bookmarks/classes/meowBookmarkStash.ets | arkts | importHTMLfromDocuments | Files
Import bookmarks from HTML file in documents.
This would push the imported bookmarks to the root. | async importHTMLfromDocuments(putIn: meowBookmarkItem = this.root) {
const result = await fileDocumentPick2Path(['.html'], 1);
if (!result.succeed) {
meow(`Failed to pick HTML from documents.`, 'meowBookmarkStash][importHTMLfromDocuments', meowLevel.WARN);
return false;
}
// Parse the HTM... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importHTMLfromDocuments AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left putIn AST#identifier#Right AST#type_annotation#Left AST... | async importHTMLfromDocuments(putIn: meowBookmarkItem = this.root) {
const result = await fileDocumentPick2Path(['.html'], 1);
if (!result.succeed) {
meow(`Failed to pick HTML from documents.`, 'meowBookmarkStash][importHTMLfromDocuments', meowLevel.WARN);
return false;
}
// Parse the HTM... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 2b9b0b0ccf84419446d0c20465a22f18fa409932 | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | toggleTopicFavoriteWithCookie | Site favorite/unfavorite topic (requires Cookie session)
- Returns favorite state after operation | async toggleTopicFavoriteWithCookie(cookie: string, topicId: number): Promise<boolean> {
const toggle = await this.getTopicFavoriteToggleActionWithCookie(cookie, topicId)
return this.executeTopicFavoriteToggleWithCookie(cookie, topicId, toggle)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left toggleTopicFavoriteWithCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier#Right AST#type_annotation#L... | async toggleTopicFavoriteWithCookie(cookie: string, topicId: number): Promise<boolean> {
const toggle = await this.getTopicFavoriteToggleActionWithCookie(cookie, topicId)
return this.executeTopicFavoriteToggleWithCookie(cookie, topicId, toggle)
} | https://github.com/honjow/Next2V | 9d027ce7003c35754ede0dc83b4e95a4ab34d52f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TouchInputHandler.ets | arkts | setLowLatencyTouch | 配置低延迟触摸参数(从设置读取后调用) | setLowLatencyTouch(enable: boolean): void {
this.mouseLongPressTime = enable
? TouchInputHandler.MOUSE_LONG_PRESS_TIME_LOW_LATENCY
: TouchInputHandler.MOUSE_LONG_PRESS_TIME_NORMAL;
this.mouseDeadzoneTime = enable
? TouchInputHandler.MOUSE_DEADZONE_TIME_LOW_LATENCY
: TouchInputHandler.M... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLowLatencyTouch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#... | setLowLatencyTouch(enable: boolean): void {
this.mouseLongPressTime = enable
? TouchInputHandler.MOUSE_LONG_PRESS_TIME_LOW_LATENCY
: TouchInputHandler.MOUSE_LONG_PRESS_TIME_NORMAL;
this.mouseDeadzoneTime = enable
? TouchInputHandler.MOUSE_DEADZONE_TIME_LOW_LATENCY
: TouchInputHandler.M... | https://github.com/AlkaidLab/moonlight-harmony | 0c4257a5580a6eefe26dea40b37eaa5029e98a2e | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/param/shared/utils/ComponentAttrUtils.ets | arkts | getRectInfoById | 获取组件id对应的位置信息 | public static getRectInfoById(context: UIContext, id: string): RectInfoInPx {
if (!context || !id) {
throw CustomExceptions.EMPTY_OBJECT_EXCEPTION;
}
let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id);
hilog.info(0x0000, 'ComponentAttrUtils', 'the... | 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 getRectInfoById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left... | public static getRectInfoById(context: UIContext, id: string): RectInfoInPx {
if (!context || !id) {
throw CustomExceptions.EMPTY_OBJECT_EXCEPTION;
}
let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id);
hilog.info(0x0000, 'ComponentAttrUtils', 'the... | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/param/shared/utils/ComponentAttrUtils.ets#L27-L57 | 982581edc4dc19932e82aa16194c757833ac20ff | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | getMyDocuments | 获取我的文档(我创建的) | async getMyDocuments(params?: { status?: DocumentStatus; page?: number; pageSize?: number }): Promise<ApiResponse<{ documents: KnowledgeDocument[]; total: number }>> {
return this.client.get<{ documents: KnowledgeDocument[]; total: number }>('/api/v1/knowledge/my', params as Record<string, any>)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMyDocuments AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_an... | async getMyDocuments(params?: { status?: DocumentStatus; page?: number; pageSize?: number }): Promise<ApiResponse<{ documents: KnowledgeDocument[]; total: number }>> {
return this.client.get<{ documents: KnowledgeDocument[]; total: number }>('/api/v1/knowledge/my', params as Record<string, any>)
} | https://github.com/David8Idira/AI-OA | c29815c21cdd80946e089654fd3458130daaff80 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets | arkts | saveSourceFiles | 保存各个图源的JSON文件 | private async saveSourceFiles(sourceConfigs: Record<string, string>): Promise<void> {
const entries: Array<[string, string]> = Object.entries(sourceConfigs);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
const pkg = entry[0];
const config = entry[1];
try {
... | 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 saveSourceFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left sourceConfigs AST#... | private async saveSourceFiles(sourceConfigs: Record<string, string>): Promise<void> {
const entries: Array<[string, string]> = Object.entries(sourceConfigs);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
const pkg = entry[0];
const config = entry[1];
try {
... | https://github.com/DaLongZhuaZi/manxia | 2d8dca08b6259fdb415ffd66adad1fddf0b0defa | github |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/AnimationUtils.ets | arkts | createSpringCurve | 创建弹簧曲线动画
@param stiffness - 刚度
@param damping - 阻尼
@param mass - 质量
@returns 弹簧曲线 | static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = AnimationConstants.SPRING_MASS
): ICurve {
return curves.springCurve(stiffness, damping, mass, 0);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createSpringCurve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stiffness AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignmen... | static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = AnimationConstants.SPRING_MASS
): ICurve {
return curves.springCurve(stiffness, damping, mass, 0);
} | https://github.com/kumaleap/ArkSwipeDeck | 372dae4d65f81e11c181098629cc1c21be103781 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | pathname | Gets the pathname portion of the URL.
@return {string} Returns the pathname portion of the URL. | get pathname(): string {
return this.cPathname;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left pathname 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 AS... | get pathname(): string {
return this.cPathname;
} | https://gitcode.com/iop123123/arkts-static-skills | fa01e5f7b21fa3c27e56fac88ec01e8fe1c500d2 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | muteConversation | 静音会话
@param conversationId 会话ID | async muteConversation(conversationId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/mute`, {})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left muteConversation AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left A... | async muteConversation(conversationId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/mute`, {})
} | https://github.com/David8Idira/AI-OA | 3c2747631247795a53a3a43b8061ec80dfc11e63 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/FuzzyMatchUtil.ets | arkts | loadJsonObject | load the categories of all pages, including index pages, components, practical examples and articles,
corresponding to the intent, from the designated file.
@param filename
@param props
@returns | public static loadJsonObject(filename: string = '', props: Array<string | number> = []): Array<object> {
Logger.debug(TAG_IO, `@loadJsonObject: loading file: ${filename}`);
try {
let context: Context | undefined = AppStorage.get(StorageKey.CONTEXT_ENTRY);
if (!context) {
Logger.error(TAG_I... | 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 loadJsonObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left filename AST#identifier#Right AST#:#Left... | public static loadJsonObject(filename: string = '', props: Array<string | number> = []): Array<object> {
Logger.debug(TAG_IO, `@loadJsonObject: loading file: ${filename}`);
try {
let context: Context | undefined = AppStorage.get(StorageKey.CONTEXT_ENTRY);
if (!context) {
Logger.error(TAG_I... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | d0b3e5b81a42f07e6518ffb6422873f87e05f7db | gitcode |
rg2304luyue/ToDoList | entry/src/main/ets/pages/ToDoListPage.ets | arkts | getFormattedTime | 获取当前格式化的时间 (YYYY-MM-DD HH:mm) | getFormattedTime(): string {
let date = new Date();
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormattedTime 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#state... | getFormattedTime(): string {
let date = new Date();
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
} | https://github.com/rg2304luyue/ToDoList | ae3db8b50cdf45154ed6405c929406443055fe21 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/InputInterceptorService.ets | arkts | start | 启动按键拦截器
@param callback 接收拦截到的按键事件
@returns 0 成功,其他为错误码 | start(callback: KeyInterceptCallback): number {
if (this.active) {
this.stop();
}
if (!this.native) {
console.warn('InputInterceptor: Native 模块不可用');
return -1;
}
const result = this.native.addKeyInterceptor(callback);
if (result === 0) {
this.active = true;
con... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left start 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 KeyInterceptCallback AST#identifier#Right AST#... | start(callback: KeyInterceptCallback): number {
if (this.active) {
this.stop();
}
if (!this.native) {
console.warn('InputInterceptor: Native 模块不可用');
return -1;
}
const result = this.native.addKeyInterceptor(callback);
if (result === 0) {
this.active = true;
con... | https://github.com/AlkaidLab/moonlight-harmony | e9ca4fb6aaa309835d3fe16cf229e5b4f1f321f3 | github |
openharmony-sig/fluttertpc_qr_code_scanner | ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets | arkts | setPreView | 设置预览流 | setPreView() {
// 获取profile对象
let profiles: camera.CameraOutputCapability =
this.cameraManager!.getSupportedOutputCapability(this.curcamerasDevice,
camera.SceneMode.NORMAL_PHOTO); // 获取对应相机设备profiles
let previewProfiles: Array<camera.Profile> = profiles.previewProfiles;
let previewProfil... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPreView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | setPreView() {
// 获取profile对象
let profiles: camera.CameraOutputCapability =
this.cameraManager!.getSupportedOutputCapability(this.curcamerasDevice,
camera.SceneMode.NORMAL_PHOTO); // 获取对应相机设备profiles
let previewProfiles: Array<camera.Profile> = profiles.previewProfiles;
let previewProfil... | https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git | 6c06880451b89a453b7910b95968a559af80ac2c | gitee |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/PlatformViewsChannel.ets | arkts | constructor | Constructs a {@code PlatformViewsChannel} that connects Android to the Dart code running in
{@code dartExecutor}.
<p>The given {@code dartExecutor} is permitted to be idle or executing code.
<p>See {@link DartExecutor}. | constructor(dartExecutor: DartExecutor) {
this.channel = new MethodChannel(dartExecutor, "flutter/platform_views", StandardMethodCodec.INSTANCE);
this.parsingHandler.platformChannel = this;
this.channel.setMethodCallHandler(this.parsingHandler);
} | 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 dartExecutor AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DartExecutor AST#iden... | constructor(dartExecutor: DartExecutor) {
this.channel = new MethodChannel(dartExecutor, "flutter/platform_views", StandardMethodCodec.INSTANCE);
this.parsingHandler.platformChannel = this;
this.channel.setMethodCallHandler(this.parsingHandler);
} | https://gitee.com/openharmony-sig/flutter_engine.git | 2dd8c2f2c10672108d4cdf1ecbbb4b34b0ae8bcb | gitee |
silence17/harmonydemo | entry/src/main/ets/pages/RankPage.ets | arkts | aboutToDisappear | 组件的声明周期 @Component
在自定义组件即将销毁时执行 | aboutToDisappear(){
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | aboutToDisappear(){
} | https://github.com/silence17/harmonydemo | 4db4732b025ae334d575e5c3021a678b63abb3a7 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | big | The big() method creates a string that embeds a string in a <big> element (<big>str</big>), which causes a string to be displayed in a big font. | public big(): String{
return this.CreateHTMLString("big", "")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left big AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right... | public big(): String{
return this.CreateHTMLString("big", "")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 89f41a889c3ce368af98b29ebe6214ad43dffa3f | gitee |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/model/SmartLock.ets | arkts | turnOn | 实现抽象方法:开锁逻辑
异步处理:模拟设备联网通信的延迟(300ms) | async turnOn(): Promise<void> {
try {
await delay(100); // 模拟设备响应延迟(如蓝牙连接、云端校验)
this.status = 'on';
logAction(`${this.getInfo()} 已开锁`);
} catch(error) {
console.error(`error: ${(error as Error).message}`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left turnOn 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_type#... | async turnOn(): Promise<void> {
try {
await delay(100); // 模拟设备响应延迟(如蓝牙连接、云端校验)
this.status = 'on';
logAction(`${this.getInfo()} 已开锁`);
} catch(error) {
console.error(`error: ${(error as Error).message}`);
}
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | b7895c1ac6e496cc2ecc30eb5157fd7cc9a514df | gitcode |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets | arkts | consumeKeyboardAvoidModeSnapshot | 获取并清除键盘避让模式快照
@returns {KeyboardAvoidMode | null} 之前模式 | consumeKeyboardAvoidModeSnapshot(): KeyboardAvoidMode | null {
if (!this.hasKeyboardAvoidModeSnapshot) {
return null;
}
this.hasKeyboardAvoidModeSnapshot = false;
return this.previousKeyboardAvoidMode;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left consumeKeyboardAvoidModeSnapshot 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#... | consumeKeyboardAvoidModeSnapshot(): KeyboardAvoidMode | null {
if (!this.hasKeyboardAvoidModeSnapshot) {
return null;
}
this.hasKeyboardAvoidModeSnapshot = false;
return this.previousKeyboardAvoidMode;
} | https://github.com/Joker-x-dev/CoolMallArkTS | a71491b9d987c60d83bf5ddba17b223abefd994e | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/XAxis.ets | arkts | getXAxisLabelPosition | 获取标签绘制位置
@returns 绘制位置 | public getXAxisLabelPosition(): XAxisLabelPosition {
return this.xAxisLabelPosition;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getXAxisLabelPosition 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 ... | public getXAxisLabelPosition(): XAxisLabelPosition {
return this.xAxisLabelPosition;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 562b48954a4f04b2202a704694d32cedda7db5cb | gitee |
openharmony/codelabs | ETSUI/SwiperArkTS/entry/src/main/ets/view/play/CommentView.ets | arkts | textStyle | Text style.
@param fontSize Font size.
@param fonWeight Font weight. | @Extend(Text)
function textStyle(fontSize: Resource, fonWeight: number) {
.fontSize(fontSize)
.fontWeight(fonWeight)
.fontColor($r('app.color.start_window_background'))
.textAlign(TextAlign.Center)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function textStyle(fontSize: Resource, fonWeight: number) {
.fontSize(fontSize)
.fontWeight(fonWeight)
.fontColor($r('app.color.start_window_background'))
.textAlign(TextAlign.Center)
} | https://gitee.com/openharmony/codelabs.git | f738e27260c7f1ee23486d0623b0db66ce0b0e06 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | getDuplicateDetectionTitleWeight | 获取重复检测标题权重 | async getDuplicateDetectionTitleWeight(): Promise<number> {
return this.getNumber(SettingKeys.DUPLICATE_DETECTION_TITLE_WEIGHT, 0.7);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getDuplicateDetectionTitleWeight AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#form... | async getDuplicateDetectionTitleWeight(): Promise<number> {
return this.getNumber(SettingKeys.DUPLICATE_DETECTION_TITLE_WEIGHT, 0.7);
} | https://github.com/DaLongZhuaZi/manxia | 3318fba7b4e6eb97db324bcbdcc96701d65d61da | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/navigation/NavigationDemo3.ets | arkts | updateProgress | 更新指定页面的转场动画的进度 | updateProgress(progress: number) {
if (!this.proxy?.updateTransition) {
return;
}
progress = this.operation == NavigationOperation.PUSH ? 1 - progress : progress;
this.proxy?.updateTransition(progress);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left progress AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AS... | updateProgress(progress: number) {
if (!this.proxy?.updateTransition) {
return;
}
progress = this.operation == NavigationOperation.PUSH ? 1 - progress : progress;
this.proxy?.updateTransition(progress);
} | https://github.com/webabcd/HarmonyDemo | bd877f3b81258932e90b86e087db4923859e7100 | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/AccountManager.ets | arkts | renameBillsForSourceAccount | 账户改名后同步账单来源账户字段。 | private static async renameBillsForSourceAccount(originalName: string, nextName: string): Promise<void> {
const predicates = new relationalStore.RdbPredicates(BILL_TABLE_NAME);
predicates.equalTo('account', originalName);
const data: relationalStore.ValuesBucket = {
account: nextName,
updated_... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left renameBillsForSourceAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left or... | private static async renameBillsForSourceAccount(originalName: string, nextName: string): Promise<void> {
const predicates = new relationalStore.RdbPredicates(BILL_TABLE_NAME);
predicates.equalTo('account', originalName);
const data: relationalStore.ValuesBucket = {
account: nextName,
updated_... | https://github.com/ZestBox-18/kitebook-frontend | db50b13b83718b9bb114a8966a93474f85b6ab96 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an object of FixedArray<int>.
@param { FixedArray<int> } arr - An instance of the FixedArray type to convert to an array.
@returns { Uint8ClampedArray } - A new Uint8ClampedArray
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: FixedArray<int>): Uint8ClampedArray {
let result = new Uint8ClampedArray(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: FixedArray<int>): Uint8ClampedArray {
let result = new Uint8ClampedArray(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 8fd99ee15c769499d27c0ce1e6eaa0680c1b9c1b | gitcode |
YANGZX22/Voot | entry/src/main/ets/storage/AsrModelStorage.ets | arkts | setCurrentModel | 设置当前使用的模型 | static async setCurrentModel(ctx: common.UIAbilityContext, model: AsrModelType): Promise<void> {
const config = await AsrModelStorage.loadConfig(ctx);
config.currentModel = model;
await AsrModelStorage.saveConfig(ctx, config);
} | 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 setCurrentModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AS... | static async setCurrentModel(ctx: common.UIAbilityContext, model: AsrModelType): Promise<void> {
const config = await AsrModelStorage.loadConfig(ctx);
config.currentModel = model;
await AsrModelStorage.saveConfig(ctx, config);
} | https://github.com/YANGZX22/Voot | 7588aad79efc72763a5eb8ea19f14c9d2b19ea3f | github |
openharmony/codelabs | Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getFormData | Get form and update data.
@param {formId} formId Form ID.
@param {number} stepValue Value of steps.
@param {number} dimensionFlag Card Specifications.
@param {DataRdb.RdbStore} rdbStore rdbStore RDB database. | function getFormData(formId: string, stepValue: number, dimensionFlag: number, rdbStore: DataRdb.RdbStore) {
ChartDataUtils.getFormData(formId, stepValue, dimensionFlag, rdbStore)
.then((formData: FormData) => {
FormProvider.updateForm(formData.formId, FormBindingData.createFormBindingData(formData));
}... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getFormData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left formId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function getFormData(formId: string, stepValue: number, dimensionFlag: number, rdbStore: DataRdb.RdbStore) {
ChartDataUtils.getFormData(formId, stepValue, dimensionFlag, rdbStore)
.then((formData: FormData) => {
FormProvider.updateForm(formData.formId, FormBindingData.createFormBindingData(formData));
}... | https://gitee.com/openharmony/codelabs.git | e1eaf7640dff15c4540be60552fd7d3088667566 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/deepseek/SiliconFlowClient.ets | arkts | getSessionHistory | 获取会话历史 | getSessionHistory(sessionId: string): ChatMessage[] | null {
const session = this.sessions.get(sessionId);
return session ? [...session.messages] : null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSessionHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | getSessionHistory(sessionId: string): ChatMessage[] | null {
const session = this.sessions.get(sessionId);
return session ? [...session.messages] : null;
} | https://github.com/LJ666-ui/harmony-health-care | f1ff1676303ff7915c6f896e6b7a3664d5f18ecf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/CrashRecorderService.ets | arkts | initialize | 初始化闪退记录服务
应在 EntryAbility 的 onCreate 中尽早调用 | public initialize(context: common.UIAbilityContext): void {
try {
this.context = context;
this.crashLogsDir = `${context.filesDir}/crash_logs`;
// 确保崩溃日志目录存在
this.ensureCrashLogsDir();
// 注册全局异常监听
this.registerErrorObserver();
// 仅在首次初始化时检查上次崩溃记录,避免重复读取/重复日志
if (... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initialize 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_expression#... | public initialize(context: common.UIAbilityContext): void {
try {
this.context = context;
this.crashLogsDir = `${context.filesDir}/crash_logs`;
// 确保崩溃日志目录存在
this.ensureCrashLogsDir();
// 注册全局异常监听
this.registerErrorObserver();
// 仅在首次初始化时检查上次崩溃记录,避免重复读取/重复日志
if (... | https://github.com/DaLongZhuaZi/manxia | fa615c2b2a9484e34637abec14a15acbaa78c3c9 | github |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/services/PreferencesService.ets | arkts | loadHistory | ─── History ─────────────────────────────────────────────────────────────── | static loadHistory(): ConversionRecord[] {
return PreferencesService.parseList(AppStorage.get<string>(PrefKeys.HISTORY_JSON));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left loadHistory 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 Conversion... | static loadHistory(): ConversionRecord[] {
return PreferencesService.parseList(AppStorage.get<string>(PrefKeys.HISTORY_JSON));
} | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | 07ee418fd379a5aa7e53165d0a3d741212987b34 | github |
ibestservices/ibest-ui | library/src/main/ets/components/waterMark/index.ets | arkts | drawCanvasItem | 创建矩阵绘制canvas | drawCanvasItem(data: IBestDrawCanvasItemArgs) {
const width = data.width
const height = data.height
const rotateDeg = data.rotateDeg
const callback = data.callback
const countData = this.getXYCount(width, height)
const countX = countData.countX
const countY = countData.countY
// 根据计算出的数量创建矩阵
// i是Y轴
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawCanvasItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IBestDrawCanvasItemArgs AS... | drawCanvasItem(data: IBestDrawCanvasItemArgs) {
const width = data.width
const height = data.height
const rotateDeg = data.rotateDeg
const callback = data.callback
const countData = this.getXYCount(width, height)
const countX = countData.countX
const countY = countData.countY
// 根据计算出的数量创建矩阵
// i是Y轴
... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/waterMark/index.ets#L133-L160 | a5bd1cdc849f0ac5c9ea4b1f07a82c7f516b46ce | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardBuilder.ets | arkts | escapeCharacters | Append '\' to the characters which should be escaped. The character set is different
not only between vCard 2.1 and vCard 3.0 but also among each device.
Note that Quoted-Printable string must not be input here. | private escapeCharacters(unescaped: string): string {
if (TextUtils.isEmpty(unescaped)) {
return "";
}
const tmpBuilder = new StringBuilder();
const length = unescaped.length;
for (let i = 0; i < length; i++) {
let ch = unescaped.charAt(i);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeCharacters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left unescaped AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private escapeCharacters(unescaped: string): string {
if (TextUtils.isEmpty(unescaped)) {
return "";
}
const tmpBuilder = new StringBuilder();
const length = unescaped.length;
for (let i = 0; i < length; i++) {
let ch = unescaped.charAt(i);
... | https://gitee.com/openharmony-tpc/VCard.git | 631b60fd5aefedf2196d3688f74229624b20bab7 | gitee |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/UserInfoRepository.ets | arkts | getPersonInfo | 获取用户个人信息
@returns {Promise<NetworkResponse<User>>} 用户信息响应 | async getPersonInfo(): Promise<NetworkResponse<User>> {
return this.networkDataSource.getPersonInfo();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPersonInfo 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#generi... | async getPersonInfo(): Promise<NetworkResponse<User>> {
return this.networkDataSource.getPersonInfo();
} | https://github.com/Joker-x-dev/CoolMallArkTS | bb15a1f7ee50f53296e88c23836ea9c06190a235 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/FTPStorage.ets | arkts | ensureConnected | 确保已连接 | private async ensureConnected(): Promise<IFTPHandler> {
if (!this.handler) {
hilog.error(DOMAIN, TAG, 'Storage handler not initialized');
throw new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.ftp_not_init')));
}
if (!this.config) {
hilog.err... | 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 ensureConnected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async ensureConnected(): Promise<IFTPHandler> {
if (!this.handler) {
hilog.error(DOMAIN, TAG, 'Storage handler not initialized');
throw new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.ftp_not_init')));
}
if (!this.config) {
hilog.err... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPStorage.ets#L95-L119 | cc80162cdfe12032db238db22aa21f4c36603c36 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | readInt32LE | Reads a signed 32-bit integer from the buffer at the specified offset using little-endian format
@param {int} [offset=0] - Number of bytes to skip before reading
@returns {long} The read value | public readInt32LE(offset: int = 0): long {
let lengthOffset: int = this.length - 4;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= ${leng... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readInt32LE 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#assignment_express... | public readInt32LE(offset: int = 0): long {
let lengthOffset: int = this.length - 4;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= ${leng... | https://gitcode.com/iop123123/arkts-static-skills | ebf775845159e0dbd31691e4355362852b3b2089 | gitcode |
openharmony/arkui_ace_engine | examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets | arkts | constructor | -- Constructor (low level) and fields --
Creates a new QR Code segment with the given attributes and data.
The character count (numChars) must agree with the mode and the bit buffer length,
but the constraint isn't checked. The given bit buffer is cloned and stored. | public constructor(
// The mode indicator of this segment.
public readonly mode: QrSegment.Mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#comment#Left // The mode indicator of this segment. AST#comment#Right AST#ER... | public constructor(
// The mode indicator of this segment.
public readonly mode: QrSegment.Mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the ... | https://gitee.com/openharmony/arkui_ace_engine.git | c1ecc23009e763fca0433ee39668502151481b1e | gitee |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/component/preference/view/UserPrivacyDialog.ets | arkts | buttonTextStyle | 按钮文本样式 | @Extend(Text)
function buttonTextStyle() {
.fontColor('#007DFF')
.fontSize('16fp')
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.layoutWeight(1)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function buttonTextStyle() {
.fontColor('#007DFF')
.fontSize('16fp')
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.layoutWeight(1)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 09bef7a0e03e6c74f1e6768a696da86c27e60238 | gitcode |
apap6628114/nga_oh | entry/src/main/ets/service/NgaClient.ets | arkts | ngaGet | ============== NGA 核心 ============== | async function ngaGet(path: string, params: Record<string, string>,
cookies?: Cookies, extraHeaders?: Record<string, string>): Promise<object> {
return ngaRequest(path, http.RequestMethod.GET, params, '', cookies, '', extraHeaders);
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left ngaGet AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotat... | async function ngaGet(path: string, params: Record<string, string>,
cookies?: Cookies, extraHeaders?: Record<string, string>): Promise<object> {
return ngaRequest(path, http.RequestMethod.GET, params, '', cookies, '', extraHeaders);
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/service/NgaClient.ets#L291-L294 | 771141d40ce9c18ee146245412a070ddbcc5de95 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/RustDeskLanDiscoveryService.ets | arkts | stopScanInternal | ============================================================
内部实现
============================================================ | private stopScanInternal(): void {
this.scanning = false;
if (this.scanTimer >= 0) {
clearTimeout(this.scanTimer);
this.scanTimer = -1;
}
if (this.udp !== null) {
try {
this.udp.off('message');
this.udp.close();
} catch (_e) {
// ignore
}
thi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopScanInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ex... | private stopScanInternal(): void {
this.scanning = false;
if (this.scanTimer >= 0) {
clearTimeout(this.scanTimer);
this.scanTimer = -1;
}
if (this.udp !== null) {
try {
this.udp.off('message');
this.udp.close();
} catch (_e) {
// ignore
}
thi... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 1fc5272560d61b002c0ffcc5f10e58acf0c3f7ed | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/storage/PreferencesUtil.ets | arkts | delete | 删除指定 key | static async delete(key: string): Promise<void> {
if (PreferencesUtil.preferencesInstance === null) {
return;
}
try {
await PreferencesUtil.preferencesInstance.delete(key);
await PreferencesUtil.preferencesInstance.flush();
} catch (err) {
hilog.error(0x0000, TAG, 'delete faile... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | static async delete(key: string): Promise<void> {
if (PreferencesUtil.preferencesInstance === null) {
return;
}
try {
await PreferencesUtil.preferencesInstance.delete(key);
await PreferencesUtil.preferencesInstance.flush();
} catch (err) {
hilog.error(0x0000, TAG, 'delete faile... | https://github.com/Amaz1ny/HarmonyDO-public | 71db11bb54ff1ed440e01ad6e4ee9f5dfac213df | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/left_shift/left_shift_ubyte.ets | arkts | main | ---
desc: check left shift operation for unsigned byte
--- | function main(): void {
const a: ubyte = {{v.left}}
const b: int = {{v.right}}
assert (a << b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ubyte = {{v.left}}
const b: int = {{v.right}}
assert (a << b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 739de00d822a33b55a718730093888ce767736e0 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getComicSourceByPkg | 根据 pkg 获取图源记录 | async getComicSourceByPkg(pkg: string): Promise<ComicSourceDatabaseRecord | null> {
try {
const sql: string = 'SELECT * FROM comic_source WHERE pkg = ?';
const result: DatabaseRecord[] = await this.databaseManager.querySql(sql, [pkg]);
if (result && result.length > 0) {
return result[0] ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getComicSourceByPkg AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pkg AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async getComicSourceByPkg(pkg: string): Promise<ComicSourceDatabaseRecord | null> {
try {
const sql: string = 'SELECT * FROM comic_source WHERE pkg = ?';
const result: DatabaseRecord[] = await this.databaseManager.querySql(sql, [pkg]);
if (result && result.length > 0) {
return result[0] ... | https://github.com/DaLongZhuaZi/manxia | e9f254ee70af5a49fa7093cf6a1396df9b73d2ab | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.