nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | handleParameters | handle Parameters, and retrun ArrSrcType. | private handleParameters(sources: FixedArrayUnionType) {
if (sources instanceof FixedArray<string>) {
this.arr = Array.from(sources as FixedArray<string>)
} else if (sources instanceof FixedArray<ArrayBuffer>) {
this.arr = Array.from(sources as FixedArray<... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sources AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private handleParameters(sources: FixedArrayUnionType) {
if (sources instanceof FixedArray<string>) {
this.arr = Array.from(sources as FixedArray<string>)
} else if (sources instanceof FixedArray<ArrayBuffer>) {
this.arr = Array.from(sources as FixedArray<... | https://gitcode.com/iop123123/arkts-static-skills | fa3262c0c36b94850ca38fdf6ad1ea8c241e6d70 | gitcode |
huangyuanlove/HelloArkUI | entry/src/main/ets/pages/playground/take_photo/TakePhotoPage.ets | arkts | createInput | 创建相机输入流 | createInput(): camera.CameraInput | undefined {
// 创建相机输入流
let cameraInput: camera.CameraInput | undefined = undefined;
try {
cameraInput = this.cameraManager.createCameraInput(this.currentCamera);
} catch (error) {
let err = error as BusinessError;
console.error('Failed to createCam... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createInput 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 ... | createInput(): camera.CameraInput | undefined {
// 创建相机输入流
let cameraInput: camera.CameraInput | undefined = undefined;
try {
cameraInput = this.cameraManager.createCameraInput(this.currentCamera);
} catch (error) {
let err = error as BusinessError;
console.error('Failed to createCam... | https://github.com/huangyuanlove/HelloArkUI | 5ed3889944852290e06850c92aa1445ca5e897e8 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | connect | Connect to a remote desktop | static connect(inst: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (instanceState.get(inst)) {
throw new Error('Instance already connected');
}
return freerdpNative!.freerdpConnect(inst);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left connect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | static connect(inst: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (instanceState.get(inst)) {
throw new Error('Instance already connected');
}
return freerdpNative!.freerdpConnect(inst);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 5548e9d8bb5a520772ec863490f03d45bf7f37b1 | github |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/SshClient.ets | arkts | sftpStat | Get file/directory attributes. | async sftpStat(path: string): Promise<SftpFileInfo> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
const json = await ssh.sftpStat(this.handle, path);
return JSON.parse(json) as SftpFileInfo;
} catch (err) {
const msg = (err as Error).message ?... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpStat AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left ... | async sftpStat(path: string): Promise<SftpFileInfo> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
const json = await ssh.sftpStat(this.handle, path);
return JSON.parse(json) as SftpFileInfo;
} catch (err) {
const msg = (err as Error).message ?... | https://github.com/UnbalancedCat/ohos-ssh-core | 715865f72f5e077349fb418ebb1a2bec92ecb644 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Int32 with all elements.
@returns a new Int32Array with elements of current Int32Array | public slice(): Int32Array {
return new Int32Array(this)
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public slice(): Int32Array {
return new Int32Array(this)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 73e05f9667a8747d9c4958fc974e641a59e81dab | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | createBillUpdatedEvent | 创建账单更新事件 | static createBillUpdatedEvent(
userId: number,
billId: number,
version: number,
changesJson: string
): DomainEvent {
const event = new DomainEvent(
'',
EVENT_TYPE_BILL_UPDATED,
AGGREGATE_TYPE_BILL,
billId,
userId,
version,
changesJson,
'',
''... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createBillUpdatedEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | static createBillUpdatedEvent(
userId: number,
billId: number,
version: number,
changesJson: string
): DomainEvent {
const event = new DomainEvent(
'',
EVENT_TYPE_BILL_UPDATED,
AGGREGATE_TYPE_BILL,
billId,
userId,
version,
changesJson,
'',
''... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a0e4d03db0557276aefe23a40d568822ecdceb1a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | forEach | Performs the specified action for each element in Float32Array
@param { function } callbackfn - A function that accepts up to three arguments. forEach calls the
callbackfn function one time for each element in the array.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public forEach(callbackfn: (value: number, index: int, array: Float32Array) => void): void {
for (let i = 0; i < this.lengthInt; ++i) {
callbackfn((this.getUnsafe(i)).toDouble(), i, this)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left forEach AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | public forEach(callbackfn: (value: number, index: int, array: Float32Array) => void): void {
for (let i = 0; i < this.lengthInt; ++i) {
callbackfn((this.getUnsafe(i)).toDouble(), i, this)
}
} | https://gitcode.com/iop123123/arkts-static-skills | 5d709f15b55cd2a5bcf3267bdf168901510bb5f9 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | initializeAppStorage | 初始化AppStorage(从数据库加载设置)
注意:此方法必须在数据库初始化完成后调用 | private async initializeAppStorage(): Promise<void> {
try {
logger.info('EntryAbility', '🔧 开始初始化设置管理器');
// 初始化设置管理器
const settingsManager = SettingsManager.getInstance();
await settingsManager.initialize();
// 同步设置到AppStorage
settingsManager.syncToAppStorage();
... | 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 initializeAppStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | private async initializeAppStorage(): Promise<void> {
try {
logger.info('EntryAbility', '🔧 开始初始化设置管理器');
// 初始化设置管理器
const settingsManager = SettingsManager.getInstance();
await settingsManager.initialize();
// 同步设置到AppStorage
settingsManager.syncToAppStorage();
... | https://github.com/DaLongZhuaZi/manxia | 34b5638203d4d08a724f44efc7d04e3fbc1f6784 | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | getGridHeight | calculated altitude | getGridHeight(data: GridObjectSortComponentItem[], state?: string): number {
let height: number = 0;
let selectLen: number = data.length.toDouble();
data.forEach(item => {
if (item.visibility === Visibility.Hidden) {
selectLen = selectLen - 1;
}
});
let addRow: number = 0;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGridHeight 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#subscript_expression#Left AST#identifier#Left GridObjectSo... | getGridHeight(data: GridObjectSortComponentItem[], state?: string): number {
let height: number = 0;
let selectLen: number = data.length.toDouble();
data.forEach(item => {
if (item.visibility === Visibility.Hidden) {
selectLen = selectLen - 1;
}
});
let addRow: number = 0;
... | https://gitcode.com/openharmony/arkui_ace_engine | 55cb3bbf00ad1c7afc888b965d42d3e811382c60 | gitcode |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/StabilityScenarioEngine.ets | arkts | executeSdkRobustness | S8: SDK Robustness — 12 defensive sub-cases | private executeSdkRobustness(): string {
const results: string[] = [];
let passed = 0;
const total = 12;
// R1: use_after_destroy
try {
const sm = new SurfaceManager(this.context);
sm.beginTextStream();
sm.receiveTextChunk(this.buildCreateSurfaceJSON('r1'));
sm.endTextStre... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeSdkRobustness 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 st... | private executeSdkRobustness(): string {
const results: string[] = [];
let passed = 0;
const total = 12;
// R1: use_after_destroy
try {
const sm = new SurfaceManager(this.context);
sm.beginTextStream();
sm.receiveTextChunk(this.buildCreateSurfaceJSON('r1'));
sm.endTextStre... | https://github.com/AGenUI/AGenUI | e07963df2c28cf6f31c07131063291814bc52df8 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | softDelete | 软删除账本 | static async softDelete(ledgerId: number): Promise<boolean> {
try {
await DAOHelper.softDelete(SharedLedger.tableName, 'ledger_id', ledgerId);
return true;
} catch (error) {
throw DAOHelper.toError('[SharedLedgerDAO] 软删除账本失败', error);
}
} | 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 softDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | static async softDelete(ledgerId: number): Promise<boolean> {
try {
await DAOHelper.softDelete(SharedLedger.tableName, 'ledger_id', ledgerId);
return true;
} catch (error) {
throw DAOHelper.toError('[SharedLedgerDAO] 软删除账本失败', error);
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8286ea6499006227e969421667083939643a3c2d | github |
erosTeam/NextE | feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets | arkts | loadMore | Append the next page at the cursor, with eros_fe's stale-cursor + (gid-keyed) dedup guards. | async loadMore(): Promise<void> {
DiagnosticLogger.info('home-list-anchor', 'load_more_enter', this.debugState())
if (this.isLoading || this.isLoadingMore || !this.hasMore || this.isPopular()) {
DiagnosticLogger.info('home-list-anchor', 'load_more_skip', this.debugState())
return
}
if (thi... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadMore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async loadMore(): Promise<void> {
DiagnosticLogger.info('home-list-anchor', 'load_more_enter', this.debugState())
if (this.isLoading || this.isLoadingMore || !this.hasMore || this.isPopular()) {
DiagnosticLogger.info('home-list-anchor', 'load_more_skip', this.debugState())
return
}
if (thi... | https://github.com/erosTeam/NextE | 94b96b2a33ef4118c67ec13ba046a141543db693 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/class_global_config.ets | arkts | constructor | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
打开文件 //
////////// | constructor() {
// 检测文件存在性
const tmp = load_array(global_config_json)
if (tmp.length != 0) {
// 加载文件
this.version = tmp[0]
this.player_mode = (tmp[1] == 'true') ? true : false
this.dsd_support = (tmp[2] == 'true') ? true : false
this.ui_mode = Number.parseInt(tmp[3])
}... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
// 检测文件存在性
const tmp = load_array(global_config_json)
if (tmp.length != 0) {
// 加载文件
this.version = tmp[0]
this.player_mode = (tmp[1] == 'true') ? true : false
this.dsd_support = (tmp[2] == 'true') ? true : false
this.ui_mode = Number.parseInt(tmp[3])
}... | https://github.com/Nekofox-POT/LinMusic | 545e345a5a09babd9193a1debafc6c4fce692a64 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | print | Implementations for printing primitive types
@param {string | boolean | byte | short | char | int | long | float | double | Any} i - The value to print
@returns {void}
@public
@deprecated Will be removed in future. Please use log instead | public print(i: boolean): void {
this.addToBuffer(new Boolean(i).toString(), LogLevel.PRINTLN)
}; | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left print AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public print(i: boolean): void {
this.addToBuffer(new Boolean(i).toString(), LogLevel.PRINTLN)
}; | https://gitcode.com/iop123123/arkts-static-skills | 618ad7af4d8119a73594179675fd5408dc0bd164 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/HospitalBedController.ets | arkts | sendCommand | 发送控制命令到病床设备 | public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> {
console.log(`HospitalBedController: Sending command to ${deviceId}`, command);
// 解析命令参数
const params = command.params;
let headAngle: number = 0;
let footAngle: number = 0;
let turnOver: boolean = false;
... | 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 sendCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> {
console.log(`HospitalBedController: Sending command to ${deviceId}`, command);
// 解析命令参数
const params = command.params;
let headAngle: number = 0;
let footAngle: number = 0;
let turnOver: boolean = false;
... | https://github.com/LJ666-ui/harmony-health-care | f6275b0c748c9c200bdaed67389a7e413b7716f3 | github |
aimilin6688/KeePassHO | entry/src/main/ets/pages/DatabaseView.ets | arkts | onThemeChanged | 强制组件刷新以应用新主题 | onThemeChanged() {
this.updateUI();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onThemeChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | onThemeChanged() {
this.updateUI();
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/pages/DatabaseView.ets#L1234-L1236 | 6ba8a1b3c3e9ff6cb63c84b59660cedbfc196189 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/EventSourcingService.ets | arkts | getStatistics | 获取事件统计 | static async getStatistics() {
try {
return await DomainEventDAO.getStatistics();
} catch (error) {
console.error('[EventSourcingService] 获取事件统计失败:', error);
throw error instanceof Error ? error : new Error(String(error));
}
} | 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 getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ER... | static async getStatistics() {
try {
return await DomainEventDAO.getStatistics();
} catch (error) {
console.error('[EventSourcingService] 获取事件统计失败:', error);
throw error instanceof Error ? error : new Error(String(error));
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e9af71e6ce50b4580fd38373c362362360d6932c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | zoom | Zooms in or out by the given scale factor. x and y are the coordinates
(in pixels) of the zoom center.
@param scaleX if < 1f --> zoom out, if > 1f --> zoom in
@param scaleY if < 1f --> zoom out, if > 1f --> zoom in
@param x
@param y
public zoom(scaleX:number, scaleY:number, x:number,y:number):void {
this.mViewPortHandl... | public zoom(scaleX: number, scaleY: number, xValue: number, yValue: number, axis?: AxisDependency): void {
if (axis == null || axis == undefined) {
this.mViewPortHandler.zoom(scaleX, scaleY, xValue, -yValue, this.mZoomMatrixBuffer);
this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left zoom AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scaleX AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public zoom(scaleX: number, scaleY: number, xValue: number, yValue: number, axis?: AxisDependency): void {
if (axis == null || axis == undefined) {
this.mViewPortHandler.zoom(scaleX, scaleY, xValue, -yValue, this.mZoomMatrixBuffer);
this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false);
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 16426148161c5d06c8504c949b30e61164b1db46 | gitee |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/services/JumpService.ets | arkts | jumpToWeb | 跳转到 Web 浏览器
@param url 目标 URL | public jumpToWeb(url: string) {
if (!url || !url.startsWith('http')) {
this.logger.error('Invalid URL for web jump');
return;
}
this.logger.info(`Attempting to open web: ${url}`);
if (this.context) {
const want: Want = {
action: 'ohos.want.action.viewData',
entities:... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left jumpToWeb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | public jumpToWeb(url: string) {
if (!url || !url.startsWith('http')) {
this.logger.error('Invalid URL for web jump');
return;
}
this.logger.info(`Attempting to open web: ${url}`);
if (this.context) {
const want: Want = {
action: 'ohos.want.action.viewData',
entities:... | https://gitcode.com/openharmony/codelabs | cf10c865910b677acd5066410864bc3eecd78411 | gitcode |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/pages/connectPage.ets | arkts | build | 默认端口6666 | build() {
Navigation() {
Column({ space: 10 }) {
Image(icon)
.width($r('app.float.connectPage_icon_width'))
.borderRadius($r('app.float.connectPage_icon_borderRadius'))
Text(username)
.fontSize($r('app.float.connectPage_userName_fontSize'))
Text($r('app.... | 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() {
Navigation() {
Column({ space: 10 }) {
Image(icon)
.width($r('app.float.connectPage_icon_width'))
.borderRadius($r('app.float.connectPage_icon_borderRadius'))
Text(username)
.fontSize($r('app.float.connectPage_userName_fontSize'))
Text($r('app.... | https://gitee.com/openharmony/vendor_unionman.git | 893ac9f22b6184e816b39f30619b228b0247926e | gitee |
LZZLHY/hlib | entry/src/main/ets/api/ZLibraryClient.ets | arkts | login | ─── 鉴权 ───────────────────────────────────────────
用户名/邮箱 + 密码登录。成功后会自动给 HttpClient 注入 cookie。
字段名 `user_email` / `user_password` 与 olib 二进制 release 包逆向得到的字段一致。
同时透传 email/password 作为兼容(部分镜像两套字段都接受)。 | async login(email: string, password: string): Promise<User> {
const form: FormParams = {};
form['user_email'] = email;
form['user_password'] = password;
form['email'] = email;
form['password'] = password;
const opts: HttpRequestOptions = { skipAuthCookie: true };
const json: UserEnvelope =... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left login AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left email AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | async login(email: string, password: string): Promise<User> {
const form: FormParams = {};
form['user_email'] = email;
form['user_password'] = password;
form['email'] = email;
form['password'] = password;
const opts: HttpRequestOptions = { skipAuthCookie: true };
const json: UserEnvelope =... | https://github.com/LZZLHY/hlib | a0fc7af1d8349908942421ab88297063821a1bf7 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/pages/DeletePage.ets | arkts | initializeData | Initialize edit page data. | initializeData(): void {
this.contactsDataBase.getEntries(
CommonConstants.CONTACTS_DATABASE_KEY,
(err: BusinessError, entries: distributedKVStore.Entry[]) => {
Logger.info(TAG, `initializeData entries: ${JSON.stringify(entries)}`);
if (err) {
Logger.error(`Fail to get Entrie... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initializeData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | initializeData(): void {
this.contactsDataBase.getEntries(
CommonConstants.CONTACTS_DATABASE_KEY,
(err: BusinessError, entries: distributedKVStore.Entry[]) => {
Logger.info(TAG, `initializeData entries: ${JSON.stringify(entries)}`);
if (err) {
Logger.error(`Fail to get Entrie... | https://gitee.com/harmonyos/codelabs.git | 49744df8a9bf1622b96a4e8a7cf20b09f0be622c | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/LearningRecorder.ets | arkts | attachCloudSync | V0.6.4: register the cloud-sync companion. Pass `undefined` to
detach (used by tests + by binding-removed flow). | attachCloudSync(svc?: CloudSyncLike): void {
this.cloudSync = svc;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left attachCloudSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left svc AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CloudSyncLike AS... | attachCloudSync(svc?: CloudSyncLike): void {
this.cloudSync = svc;
} | https://github.com/terryma2024/happyword | ddf1c57a58f515fd69d1389782a434b71e841604 | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | register | 订阅指定网络状态变化的通知,支持多事件监听回调。
@param netAvailableCallback 订阅网络可用事件回调。
@param netUnavailableCallback 订阅网络不可用事件回调。
@param netCapabilitiesChangeCallback 订阅网络能力变化事件回调。比如切换Wi-Fi、切换VPN、切换为手机流量。
@param netConnectionPropertiesChangeCallback 订阅网络连接信息变化事件回调。比如更改Wi-Fi、切换Wi-Fi、切换蜂窝网络。
@param netBlockStatusChangeCallback 订阅网络阻塞状态事件... | static register(netAvailableCallback?: Callback<connection.NetHandle>,
netUnavailableCallback?: Callback<void>,
netCapabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>,
netConnectionPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>,
netBlockStatusChangeCallback?:... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left netAvailableCallback AST#iden... | static register(netAvailableCallback?: Callback<connection.NetHandle>,
netUnavailableCallback?: Callback<void>,
netCapabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>,
netConnectionPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>,
netBlockStatusChangeCallback?:... | https://github.com/tdcare/tdwebrtc | fa6275e0cf02db8f33e526488a9471648075de04 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/parts/Homepage/addressBar/MeowSuggestions.ets | arkts | visit | Visit a URL.
@param url The url. | visit(url: string) {
this.myUi.requestAddressBarBlur(this.getUIContext());
this.myUi.submitSearchOrLoad(url);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left visit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Le... | visit(url: string) {
this.myUi.requestAddressBarBlur(this.getUIContext());
this.myUi.submitSearchOrLoad(url);
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 41d59d40603bd2ff1cade00fef5d15d1f2fa4b5a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/NotificationManager.ets | arkts | checkPermission | 检查通知权限 | public async checkPermission(): Promise<boolean> {
if (this.isChecking) {
logger.debug(TAG, '正在检查权限,跳过重复检查');
return this.hasPermission;
}
this.isChecking = true;
try {
const isEnabled = await notificationManager.isNotificationEnabled();
this.hasPermission = isEnabled;
l... | 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 checkPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public async checkPermission(): Promise<boolean> {
if (this.isChecking) {
logger.debug(TAG, '正在检查权限,跳过重复检查');
return this.hasPermission;
}
this.isChecking = true;
try {
const isEnabled = await notificationManager.isNotificationEnabled();
this.hasPermission = isEnabled;
l... | https://github.com/DaLongZhuaZi/manxia | 02baa35ea761d6af94902a2c4c2a70b0f8cf9980 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | setHighlightEnabled | Enables / disables highlighting values for all DataSets this data object
contains. If set to true, this means that values can
be highlighted programmatically or by touch gesture. | public setHighlightEnabled(enabled: boolean): void {
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
data.setHighlightEnabled(enabled);
}
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighlightEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public setHighlightEnabled(enabled: boolean): void {
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
data.setHighlightEnabled(enabled);
}
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 927921c4fbb17262822c9e7153ee61ea9208040a | gitee |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/FuzzyMatchUtil.ets | arkts | fuzzyMatchStringParam | round 1 of 3 matching - match page keywords with component description extracted by Xiaoyi from users' input | private static fuzzyMatchStringParam(stringParam: string, intentPageList: IntentJsonEnumDetail[]): FuzzyMatchResult {
let bestMatch1st: IntentJsonEnumDetail[] = [];
let bestMatchScore1st: number = 0;
intentPageList.forEach((intentPage: IntentJsonEnumDetail) => {
if (intentPage?.state && intentPage.s... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left fuzzyMatchStringParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stringParam AST#identifier#Right AST#ERROR#Le... | private static fuzzyMatchStringParam(stringParam: string, intentPageList: IntentJsonEnumDetail[]): FuzzyMatchResult {
let bestMatch1st: IntentJsonEnumDetail[] = [];
let bestMatchScore1st: number = 0;
intentPageList.forEach((intentPage: IntentJsonEnumDetail) => {
if (intentPage?.state && intentPage.s... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 25d7fd9de10d91114129b7444779626b4ec8bdb9 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | sanitizeFileName | 将字符串转换为安全的文件名 | private sanitizeFileName(name: string): string {
// 移除或替换不安全的字符
return name
.replace(/[<>:"/\\|?*]/g, '_')
.replace(/%/g, '_')
.replace(/\s+/g, '_')
.substring(0, 100); // 限制长度
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sanitizeFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private sanitizeFileName(name: string): string {
// 移除或替换不安全的字符
return name
.replace(/[<>:"/\\|?*]/g, '_')
.replace(/%/g, '_')
.replace(/\s+/g, '_')
.substring(0, 100); // 限制长度
} | https://github.com/DaLongZhuaZi/manxia | 62ebcface9c8de3807a1b25053c8a045c32e85aa | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneManager.ets | arkts | requestMicrophonePermission | 请求麦克风权限 | async requestMicrophonePermission(): Promise<boolean> {
try {
const atManager = abilityAccessCtrl.createAtManager();
const permission: Permissions = 'ohos.permission.MICROPHONE';
const result = await atManager.requestPermissionsFromUser(this.context, [permission]);
if (result... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestMicrophonePermission 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#:#Ri... | async requestMicrophonePermission(): Promise<boolean> {
try {
const atManager = abilityAccessCtrl.createAtManager();
const permission: Permissions = 'ohos.permission.MICROPHONE';
const result = await atManager.requestPermissionsFromUser(this.context, [permission]);
if (result... | https://github.com/AlkaidLab/moonlight-harmony | 7a2f2466b755f0dd65464cb315b6317ca2e28877 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | parseAPIWorkflow | 解析API工作流 | private parseAPIWorkflow(workflowObj: Record<string, Object>): Action {
logger.debug(TAG, '解析API工作流');
logger.debug(TAG, `API工作流字段: method=${workflowObj.method}, url=${workflowObj.url}, hasBody=${!!workflowObj.body}, hasExtract=${!!workflowObj.extract}`);
const method = (workflowObj.method as string)... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseAPIWorkflow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left workflowObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | private parseAPIWorkflow(workflowObj: Record<string, Object>): Action {
logger.debug(TAG, '解析API工作流');
logger.debug(TAG, `API工作流字段: method=${workflowObj.method}, url=${workflowObj.url}, hasBody=${!!workflowObj.body}, hasExtract=${!!workflowObj.extract}`);
const method = (workflowObj.method as string)... | https://github.com/DaLongZhuaZi/manxia | bacb1b26050fbf4fca470417c876f117c64d4822 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setExtraLeftOffset | Set an extra offset to be appended to the viewport's left | public setExtraLeftOffset(offset: number) {
this.mExtraLeftOffset = Utils.handleDataValues(offset);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setExtraLeftOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public setExtraLeftOffset(offset: number) {
this.mExtraLeftOffset = Utils.handleDataValues(offset);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 45fa7633c8e70edfa60d2b427754f174ed538b44 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SharedLedgerService.ets | arkts | checkAllApproved | 检查所有审批是否完成
检查所有审批是否完成 | private static async checkAllApproved(billId: number): Promise<boolean> {
try {
const records = await ApprovalRecordDAO.getByBillId(billId);
if (records.length === 0) return true; // 不需要审批
// 检查是否所有记录都是 approved
const allApproved = records.every(r => r.status === 'approved');
... | 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 checkAllApproved AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | private static async checkAllApproved(billId: number): Promise<boolean> {
try {
const records = await ApprovalRecordDAO.getByBillId(billId);
if (records.length === 0) return true; // 不需要审批
// 检查是否所有记录都是 approved
const allApproved = records.every(r => r.status === 'approved');
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 875ab83c8ad84ba0eab63749a115203d58255359 | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Column.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
ColumnSpaceEvenlyStart() { Text("A"); Text("B"); Text("C"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.Start,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.ma... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.Start,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.ma... | https://github.com/Joker-x-dev/CoolMallArkTS | 843cb42e6db55f0b0a88038d516a5f890e958ca1 | github |
HarmonyOS_Samples/BestPracticeSnippets | AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets | arkts | itemGeneratorFunc | [EndExclude positive_of_lazy_for_each]
Execute time-consuming asynchronous functions elsewhere
Simulate time-consuming operations | itemGeneratorFunc() {
let temp: number = 0;
for (let index = 0; index < 1000000; index++) {
temp += 1;
}
this.timeConsumingValue = temp;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left itemGeneratorFunc 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#... | itemGeneratorFunc() {
let temp: number = 0;
for (let index = 0; index < 1000000; index++) {
temp += 1;
}
this.timeConsumingValue = temp;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 486c4f3dafa1a80be65de386ebf384cd9fec9e79 | gitcode |
dingzhilin1990/zhilinclaw | src/security/SecurityContext.ets | arkts | exportAuditLog | 导出审计日志为 JSON | public exportAuditLog(): string {
return JSON.stringify(this.auditLog, null, 2);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left exportAuditLog 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 exportAuditLog(): string {
return JSON.stringify(this.auditLog, null, 2);
} | https://github.com/dingzhilin1990/zhilinclaw | 1cd9e0db8bfa9b479d4e6be05b21159695b00133 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/model/DigitPanelModel.ets | arkts | getInstance | getInstance
@return DigitPanelModel | public static getInstance(): DigitPanelModel {
if (DigitPanelModel.instance == null) {
DigitPanelModel.instance = new DigitPanelModel();
}
return DigitPanelModel.instance;
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): DigitPanelModel {
if (DigitPanelModel.instance == null) {
DigitPanelModel.instance = new DigitPanelModel();
}
return DigitPanelModel.instance;
} | https://gitee.com/openharmony-sig/applications_calculator.git | e4008280568e15eb9033debd6f611273e5a31d2d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DownloadSyncManager.ets | arkts | getDownloadDirPath | 获取Download同步目录路径 | getDownloadDirPath(): string | undefined {
return AppStorage.get<string>('downloadSyncDirPath');
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDownloadDirPath 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#st... | getDownloadDirPath(): string | undefined {
return AppStorage.get<string>('downloadSyncDirPath');
} | https://github.com/DaLongZhuaZi/manxia | 4e459c4d92376991123e0d82d968812151c98c14 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets | arkts | reject | Create a rejected promise
@returns { Promise<void> } rejected promise | static reject(): Promise<void> {
let p = new Promise<void>();
p.rejectImpl(new Error(), false);
return p;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left reject 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#instantiation_expression#Left A... | static reject(): Promise<void> {
let p = new Promise<void>();
p.rejectImpl(new Error(), false);
return p;
} | https://gitcode.com/iop123123/arkts-static-skills | 84fcd9cbcd8726270456a1af130dedc31d9a326b | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderListViewModel.ets | arkts | toPay | 跳转订单支付
@param {Order} order - 订单信息
@returns {void} 无返回值 | toPay(order: Order): void {
const payPrice: number = order.price - order.discountPrice;
OrderNavigator.toPay(order.id, payPrice);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toPay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left order AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Order AST#identifier#Right AST#)#Left ) AST#)#Rig... | toPay(order: Order): void {
const payPrice: number = order.price - order.discountPrice;
OrderNavigator.toPay(order.id, payPrice);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 4fff68fc075012ae58e5126e4a8fae9dc9f067f1 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/PageViewModel.ets | arkts | getData | Processes data obtained from distributed data services.
@param contactData contact data queried from the database. | getData(contactData: distributedKVStore.Entry[]): Array<ListItemData> {
Logger.info(TAG, `getData contactData: ${JSON.stringify(contactData)}`);
let listItems: Array<ListItemData> = [];
if (CheckEmptyUtils.isEmptyArr(contactData)) {
Logger.info(TAG, '[PageViewModel][getData] contactData is empty.');... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contactData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | getData(contactData: distributedKVStore.Entry[]): Array<ListItemData> {
Logger.info(TAG, `getData contactData: ${JSON.stringify(contactData)}`);
let listItems: Array<ListItemData> = [];
if (CheckEmptyUtils.isEmptyArr(contactData)) {
Logger.info(TAG, '[PageViewModel][getData] contactData is empty.');... | https://gitee.com/harmonyos/codelabs.git | 3c08bb022397c6bbd7be742cda4c1529051cbf8f | gitee |
openharmony-sig/applications_clock | product/phone/src/main/ets/IntentAbility/DeleteAlarmIntent.ets | arkts | deleteAlarm | 删除闹钟
id:string | async function deleteAlarm(param: Record<string, Object>): Promise<insightIntent.ExecuteResult> {
LogUtil.info(TEST_ABILITY, 'DeleteAlarm start', JSON.stringify(param))
if (!param.entityId) {
let result: insightIntent.ExecuteResult = {
code: 10030003,
result: {
message: 'DeleteAlarm failed... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left deleteAlarm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left param AST#identifier#Right AST#type_a... | async function deleteAlarm(param: Record<string, Object>): Promise<insightIntent.ExecuteResult> {
LogUtil.info(TEST_ABILITY, 'DeleteAlarm start', JSON.stringify(param))
if (!param.entityId) {
let result: insightIntent.ExecuteResult = {
code: 10030003,
result: {
message: 'DeleteAlarm failed... | https://gitee.com/openharmony-sig/applications_clock.git | a5880ea12d0aab4c543b5d9f384f637a631de8b1 | gitee |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/LaunchStoreRepository.ets | arkts | constructor | 构造函数
@param {LaunchStoreDataSource} [dataSource] 可选自定义数据源 | constructor(dataSource?: LaunchStoreDataSource) {
this.dataSource = dataSource ?? new LaunchStoreDataSourceImpl();
} | 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 dataSource AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | constructor(dataSource?: LaunchStoreDataSource) {
this.dataSource = dataSource ?? new LaunchStoreDataSourceImpl();
} | https://github.com/Joker-x-dev/CoolMallArkTS | a25ae7d782b814afe6e4b2aa4546481b21b6129b | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/TimeUtils.ets | arkts | formatDetailTime | 格式化时间为详细时间字符串
格式:2024-01-15 14:30 | static formatDetailTime(time: Date | null): string {
if (time === null) {
return '';
}
const year: number = time.getFullYear();
const month: string = TimeUtils.padZero(time.getMonth() + 1);
const day: string = TimeUtils.padZero(time.getDate());
const hour: string = TimeUtils.padZero(time... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDetailTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressi... | static formatDetailTime(time: Date | null): string {
if (time === null) {
return '';
}
const year: number = time.getFullYear();
const month: string = TimeUtils.padZero(time.getMonth() + 1);
const day: string = TimeUtils.padZero(time.getDate());
const hour: string = TimeUtils.padZero(time... | https://github.com/Amaz1ny/HarmonyDO-public | d25870c2cc841b3f6e51166c4b336e5dae6fd7c1 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | mod | Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
using rounding mode `rounding`.
@param { Value } x {double | string | Decimal}
@param { Value } y {double | string | Decimal}
@returns { Decimal } the Decimal type | static mod(x: Value, y: Value): Decimal {
return new Decimal(x).mod(y);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left mod AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static mod(x: Value, y: Value): Decimal {
return new Decimal(x).mod(y);
} | https://gitcode.com/iop123123/arkts-static-skills | 136c928f6e9d71918e31f784aa6337e1cab6e341 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/CountlyConfig.ets | arkts | enableAutomaticTriggers | Enable automatic RC downloads on init (if not temp-mode), after a device-ID
change, after exiting temporary-id mode, and when remote-config consent is
granted post-init. Without this flag integrators must call downloadAllKeys
explicitly. | public enableAutomaticTriggers(): RCConfig {
this.automaticTriggers = true;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableAutomaticTriggers 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#Lef... | public enableAutomaticTriggers(): RCConfig {
this.automaticTriggers = true;
return this;
} | https://github.com/Countly/countly-sdk-hos | e5029c0e379094ef94eccf19a6acbfca27492049 | github |
openharmony/arkui_advanced_ui_component | atomicserviceweb/source/atomicserviceweb.ets | arkts | checkUrlNew | 域名黑名单校验 | checkUrlNew(url: string): boolean {
let appId: string | null = this.getAppId();
if (!appId) {
console.error('AtomicServiceWeb checkUrlNew error, appId is invalid');
return false;
}
try {
let shortUrl: string = this.cutUrl(url);
let isInDomainBlockList: boolean = atomicBasicEngi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkUrlNew AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#... | checkUrlNew(url: string): boolean {
let appId: string | null = this.getAppId();
if (!appId) {
console.error('AtomicServiceWeb checkUrlNew error, appId is invalid');
return false;
}
try {
let shortUrl: string = this.cutUrl(url);
let isInDomainBlockList: boolean = atomicBasicEngi... | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 40a08c525d8741323fa29a26fbf13ae27317e010 | gitee |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/LoginView.ets | arkts | validatePhone | 手机号校验 | validatePhone(): boolean {
if (!this.phoneNumber) {
this.showToast('请输入手机号', false);
return false;
}
const phoneRegex = /^1[3-9]\d{9}$/;
if (!phoneRegex.test(this.phoneNumber)) {
this.showToast('请输入正确的手机号', false);
return false;
}
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left validatePhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state... | validatePhone(): boolean {
if (!this.phoneNumber) {
this.showToast('请输入手机号', false);
return false;
}
const phoneRegex = /^1[3-9]\d{9}$/;
if (!phoneRegex.test(this.phoneNumber)) {
this.showToast('请输入正确的手机号', false);
return false;
}
return true;
} | https://github.com/luojiang001/Pulse | d323219840666a29e205a28dc889c01567d6125d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets | arkts | findHeaderEndPosition | 查找头部信息结束位置 | private static findHeaderEndPosition(content: string, chapters: TxtChapterInfo[]): number {
// 如果有章节,返回第一章的起始位置
if (chapters.length > 0) {
return chapters[0].startPosition;
}
// 尝试查找"正文"标记
const zhengwenMatch = content.match(/^[ \s]*正文[ \s]*$/m);
if (zhengwenMatch) {
return zhengw... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left findHeaderEndPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left A... | private static findHeaderEndPosition(content: string, chapters: TxtChapterInfo[]): number {
// 如果有章节,返回第一章的起始位置
if (chapters.length > 0) {
return chapters[0].startPosition;
}
// 尝试查找"正文"标记
const zhengwenMatch = content.match(/^[ \s]*正文[ \s]*$/m);
if (zhengwenMatch) {
return zhengw... | https://github.com/DaLongZhuaZi/manxia | e8ffbed84e4e4d0a3320f555bbd140db40df556e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | entries | Returns a new iterator object that contains all elements in the Set as [value, value] arrays.
@returns {IterableIterator<[K, K]> } - an iterable of [v,v] pairs for every value `v` in the set.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | override entries(): IterableIterator<[K, K]> {
return new SetIteratorImpl<[K, K]>(this.elements.entries())
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#R... | override entries(): IterableIterator<[K, K]> {
return new SetIteratorImpl<[K, K]>(this.elements.entries())
} | https://gitcode.com/iop123123/arkts-static-skills | c8210fe615a74acbef975ea9b32b344b4d673944 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/smartward/core/executors/RuleExecutor.ets | arkts | executeAction | 执行单个动作 | private async executeAction(action: RuleAction, roomId: string): Promise<void> {
switch (action.actionType) {
case 'CONTROL_DEVICE':
if (action.targetDeviceId && action.command) {
await this.controlDevice(action.targetDeviceId, action.params);
}
break;
case 'SEND_ALE... | 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 executeAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left ... | private async executeAction(action: RuleAction, roomId: string): Promise<void> {
switch (action.actionType) {
case 'CONTROL_DEVICE':
if (action.targetDeviceId && action.command) {
await this.controlDevice(action.targetDeviceId, action.params);
}
break;
case 'SEND_ALE... | https://github.com/LJ666-ui/harmony-health-care | 5fd8df8da2c0cfeb186053e5c651815f0a05b855 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSource.ets | arkts | getLibraryMangasPaginated | 获取库中的漫画列表(分页+排序)
@param categoryId 分类ID,-1表示所有,>=0表示特定分类
@param offset 偏移量
@param limit 每页数量
@param sortType 排序类型
@param sortDirection 排序方向 | public async getLibraryMangasPaginated(
categoryId: number = -1,
offset: number = 0,
limit: number = 50,
sortType: MangaSortType = 'TITLE',
sortDirection: SortDirection = 'ASC'
): Promise<PaginatedResult<ComicInfo>> {
// 如果指定了分类,使用 getCategoryMangas 获取该分类的所有漫画,然后手动分页和排序
if (categoryId >=... | AST#ERROR#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 getLibraryMangasPaginated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left categoryId AST#identifier#Right ... | public async getLibraryMangasPaginated(
categoryId: number = -1,
offset: number = 0,
limit: number = 50,
sortType: MangaSortType = 'TITLE',
sortDirection: SortDirection = 'ASC'
): Promise<PaginatedResult<ComicInfo>> {
// 如果指定了分类,使用 getCategoryMangas 获取该分类的所有漫画,然后手动分页和排序
if (categoryId >=... | https://github.com/DaLongZhuaZi/manxia | d4f215f08175b24a84c6e4defc24e320f9e5229b | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t6_arrayLimit | T6: Array limit | t6_arrayLimit(): void {
const opts: ParseOptions = { arrayLimit: 3 };
const r: Record<string, Object> = parse('a[]=1&a[]=2&a[]=3&a[]=4&a[]=5', opts);
const rec: Record<string, Object> = r as Record<string, Object>;
const val: Object = rec['a'];
const passed: boolean = typeof val === 'object' && va... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t6_arrayLimit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | t6_arrayLimit(): void {
const opts: ParseOptions = { arrayLimit: 3 };
const r: Record<string, Object> = parse('a[]=1&a[]=2&a[]=3&a[]=4&a[]=5', opts);
const rec: Record<string, Object> = r as Record<string, Object>;
const val: Object = rec['a'];
const passed: boolean = typeof val === 'object' && va... | https://github.com/wgli-collab/qs-arkts | 374caece7c3df366eb7fcf8c9136201be16399ec | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/division/division_ubyte.ets | arkts | main | ---
desc: check division for unsigned byte operands
--- | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{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: ubyte = {{v.right}}
assert (a / b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e417ad2009745d4059119200f156a48e0d504013 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/AITaskService.ets | arkts | generateTitle | 生成对话标题(兼容旧调用方,仅返回最终标题文本) | async generateTitle(conversationContent: string, locale?: string): Promise<string> {
const result = await this.generateTitleResult(conversationContent, locale)
return result.title
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left generateTitle AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationContent AST#identifier#Right AST#type_annotation#Left... | async generateTitle(conversationContent: string, locale?: string): Promise<string> {
const result = await this.generateTitleResult(conversationContent, locale)
return result.title
} | https://github.com/LongLiveY96/chatcube | da6367524515ce4e6607592692229c6cae52a6e0 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | fetchAndMergeRemoteData | 从远端获取数据并与本地合并 | private static async fetchAndMergeRemoteData(): Promise<void> {
try {
hilog.debug(DOMAIN, TAG, 'Fetching and merging remote data');
// 先触发拉取同步
DistributedKVService.sync(distributedKVStore.SyncMode.PULL_ONLY);
// 读取远端实际的 SyncData(包含正确的 version 和 deviceId)
try {
const remoteS... | 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 fetchAndMergeRemoteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right A... | private static async fetchAndMergeRemoteData(): Promise<void> {
try {
hilog.debug(DOMAIN, TAG, 'Fetching and merging remote data');
// 先触发拉取同步
DistributedKVService.sync(distributedKVStore.SyncMode.PULL_ONLY);
// 读取远端实际的 SyncData(包含正确的 version 和 deviceId)
try {
const remoteS... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L516-L547 | aa79bb3515f9c822f315d57c2192d53ebb208210 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HtmlEntities.ets | arkts | getNamedEntities | 获取命名实体映射表(懒加载) | private static getNamedEntities(): Map<string, string> {
if (HtmlEntities._namedEntities === null) {
HtmlEntities._namedEntities = new Map<string, string>();
const m = HtmlEntities._namedEntities;
// 常用符号
m.set('amp', '&');
m.set('lt', '<');
m.set('gt', '>');
m.set... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getNamedEntities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private static getNamedEntities(): Map<string, string> {
if (HtmlEntities._namedEntities === null) {
HtmlEntities._namedEntities = new Map<string, string>();
const m = HtmlEntities._namedEntities;
// 常用符号
m.set('amp', '&');
m.set('lt', '<');
m.set('gt', '>');
m.set... | https://github.com/DaLongZhuaZi/manxia | 1f1551564ac543fc75cdd5a899331633d26e474d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrCodeGenerator.ets | arkts | placeAlignmentPatterns | Place alignment patterns | placeAlignmentPatterns(version: number): void {
if (version < 2) return;
const positions = ALIGNMENT_POSITIONS[version - 1];
for (const row of positions) {
for (const col of positions) {
// Skip if overlapping with finder patterns
if (row <= 8 && col <= 8) continue;
if (row <... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left placeAlignmentPatterns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left version AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left... | placeAlignmentPatterns(version: number): void {
if (version < 2) return;
const positions = ALIGNMENT_POSITIONS[version - 1];
for (const row of positions) {
for (const col of positions) {
// Skip if overlapping with finder patterns
if (row <= 8 && col <= 8) continue;
if (row <... | https://github.com/AlkaidLab/moonlight-harmony | 3aaa495c76a3ba11beb8e13758e12fbca8baa399 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/SubtitleUtil.ets | arkts | parseSrtFile | 解析SRT文件 | static async parseSrtFile(filePath: string) {
try {
const parser = new ParseSrt(filePath)
const items = await SubtitleUtil.parseSubtitleFile<SrtLine>(
parser,
(line: SrtLine) => ({
startTimestampMillis: line.startTimestampMillis,
endTimestampMillis: line.endTimestam... | 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 parseSrtFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async parseSrtFile(filePath: string) {
try {
const parser = new ParseSrt(filePath)
const items = await SubtitleUtil.parseSubtitleFile<SrtLine>(
parser,
(line: SrtLine) => ({
startTimestampMillis: line.startTimestampMillis,
endTimestampMillis: line.endTimestam... | https://github.com/Yebingiscn/SweetVideo | dce71ea491b8f3e75d481e9c54af210ec909616a | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F002_state_management/entry/src/main/ets/utils/StateManager.ets | arkts | add | 计算两个数字的和
@param a 第一个数字
@param b 第二个数字
@returns 两数之和 | static add(a: number, b: number): number {
return a + b;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static add(a: number, b: number): number {
return a + b;
} | https://github.com/mqxu/HarmonyOS_In_Action | f0e5bda78d5b71cc2dc58a1576d408660ccdd42a | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/StreamMenuManager.ets | arkts | getTouchModeMenuConfig | 获取触摸模式子菜单配置 | getTouchModeMenuConfig(): OptionPickerDialogConfig {
const currentMode = this.viewModel.touchMode;
const options: OptionItem[] = [
{
title: currentMode === 'trackpad' ? '✓ 触摸板模式' : ' 触摸板模式',
subtitle: '相对移动,像使用笔记本触摸板',
value: 'trackpad'
},
{
title: currentMo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTouchModeMenuConfig 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 OptionPickerDialogConfig AST#identifier... | getTouchModeMenuConfig(): OptionPickerDialogConfig {
const currentMode = this.viewModel.touchMode;
const options: OptionItem[] = [
{
title: currentMode === 'trackpad' ? '✓ 触摸板模式' : ' 触摸板模式',
subtitle: '相对移动,像使用笔记本触摸板',
value: 'trackpad'
},
{
title: currentMo... | https://github.com/AlkaidLab/moonlight-harmony | dacb8351230abf694b15058b66eca37080d7c03b | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | getQueryDescription | 获取查询描述(用于调试)
@returns 查询描述字符串 | getQueryDescription(): string {
const parts: Array<string> = []
// SELECT 部分
if (this.selectedColumns.length > 0) {
parts.push('SELECT: ' + this.selectedColumns.join(', '))
} else {
parts.push('SELECT: *')
}
// FROM 部分
parts.push('FROM: ' + this.entityMetadata.tableName)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getQueryDescription 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#st... | getQueryDescription(): string {
const parts: Array<string> = []
// SELECT 部分
if (this.selectedColumns.length > 0) {
parts.push('SELECT: ' + this.selectedColumns.join(', '))
} else {
parts.push('SELECT: *')
}
// FROM 部分
parts.push('FROM: ' + this.entityMetadata.tableName)
... | https://github.com/offlinecat-dev/OCNetORM | 8ce05626b8f546a0f077a979ea1140b04b7788c8 | github |
openharmony/ability_ability_runtime | test/moduletest/ui_extension_ability_test/ui_extension_provider_bundle/entry/src/main/ets/uiextensionability/UIExtensionAbility.ets | arkts | onConnect | just for test connect ui extension ability | onConnect(want: Want) {
console.log(TAG, `onConnect, want: ${JSON.stringify(want)}`);
return this.serviceExtImpl;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onConnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#)... | onConnect(want: Want) {
console.log(TAG, `onConnect, want: ${JSON.stringify(want)}`);
return this.serviceExtImpl;
} | https://gitee.com/openharmony/ability_ability_runtime.git | 51b52ccc40dac5cb6ae43710a84280bd6ca83e9b | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringifyWithGetters | Converts an object to a JavaScript Object Notation (JSON) string,
invoking any instance methods annotated with @JSONStringifyGetter and
including their return values in the output. Each annotated method's name
is used as the JSON key, and its return value is used as the corresponding value.
@param { Any } obj - An obje... | public static stringifyWithGetters(obj: Any): String {
const replacerOpt: ((key: string, value: Any) => Any) | undefined = undefined
return new JSONWriter(replacerOpt, undefined, true).write(obj)
} | 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 stringifyWithGetters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Lef... | public static stringifyWithGetters(obj: Any): String {
const replacerOpt: ((key: string, value: Any) => Any) | undefined = undefined
return new JSONWriter(replacerOpt, undefined, true).write(obj)
} | https://gitcode.com/iop123123/arkts-static-skills | 792ff005d76ecc31970c7c55aee92846425cf333 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | has | Checks if the list contains an element.
@param element The element to check for.
@returns True if the list contains the element. | public has(element: T): boolean {
return this.buffer.has(element);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public has(element: T): boolean {
return this.buffer.has(element);
} | https://gitcode.com/iop123123/arkts-static-skills | 53ee54a1951c7a8992bb6bf7674444bcd6ef71ad | gitcode |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getMediaList | 查询媒体库
@returns | public async getMediaList(): Promise<Array<BaseItemDto>> {
return this.requireApi().getMusicLibrary()
} | 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 getMediaList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async getMediaList(): Promise<Array<BaseItemDto>> {
return this.requireApi().getMusicLibrary()
} | https://github.com/OHPG/FinMusic | a58bf26e45487ddf4ffd5995a15e80b5cc042d9d | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test9_original_index.ets | arkts | testDoWhile | === Round 9: Do-while, labeled break, array every/some/map,
chained method calls, number formatting, escape sequences,
multiple return paths, recursive function ===
--- Do-while loop --- | function testDoWhile(): number {
let n: number = 1;
do {
n = n * 2;
} while (n < 100);
return n;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testDoWhile 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... | function testDoWhile(): number {
let n: number = 1;
do {
n = n * 2;
} while (n < 100);
return n;
} | https://github.com/miaochiahao/ark-ghidra | 71416d8d2b76923b2b6eea8beb0946a2f9702340 | github |
the-wwyang/kids-learning-app | src/main/ets/services/ProfileService.ets | arkts | getCurrentProfileId | 获取当前档案ID | private async getCurrentProfileId(): Promise<string | null> {
if (this.dataPreferences === null) {
return null;
}
try {
const profileId = await this.dataPreferences.get(StorageKeys.CURRENT_PROFILE, '') as string;
return profileId || null;
} catch (err) {
console.error('Profile... | 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 getCurrentProfileId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async getCurrentProfileId(): Promise<string | null> {
if (this.dataPreferences === null) {
return null;
}
try {
const profileId = await this.dataPreferences.get(StorageKeys.CURRENT_PROFILE, '') as string;
return profileId || null;
} catch (err) {
console.error('Profile... | https://github.com/the-wwyang/kids-learning-app | 6eba00b923dffbd8bb42f5db7868ef50a73fa30b | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | search | Gets the search portion of the URL.
@return {string} Returns the search portion of the URL. | get search(): string {
return this.cSearch;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left search 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#... | get search(): string {
return this.cSearch;
} | https://gitcode.com/iop123123/arkts-static-skills | 88da0d9df2cb5406bbf9faa3959993c9c8fa2c0d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets | arkts | prepareAddAnimation | 准备添加动画 | private prepareAddAnimation(
oldPosMap: Map<string, ItemPosition>,
newPosMap: Map<string, ItemPosition>,
pixelMaps: Map<string, PixelMap>
): void {
// 新增的条目:淡入并放大
newPosMap.forEach((newPos, id) => {
const pixelMap = pixelMaps.get(id) || null;
if (!oldPosMap.has(id)) {
const f... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left prepareAddAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left oldPosMap AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | private prepareAddAnimation(
oldPosMap: Map<string, ItemPosition>,
newPosMap: Map<string, ItemPosition>,
pixelMaps: Map<string, PixelMap>
): void {
// 新增的条目:淡入并放大
newPosMap.forEach((newPos, id) => {
const pixelMap = pixelMaps.get(id) || null;
if (!oldPosMap.has(id)) {
const f... | https://github.com/DaLongZhuaZi/manxia | ef9aa31f455e986fb58ec2243d9ae8b81b0e86a5 | github |
openharmony-sig/fluttertpc_qr_code_scanner | ohos/ohos/src/main/ets/components/plugin/OhosQrCodeView.ets | arkts | setTorchMode | 设置手电筒开关 | setTorchMode(result: MethodResult) {
this.isOpen = !this.isOpen;
if (this.isStop) {
result.success(this.isOpen);
return;
}
this.isOpen = this.cameraService?.setTorchMode(this.isOpen, result) || false;
result.success(this.isOpen)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setTorchMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodResult AST#identifie... | setTorchMode(result: MethodResult) {
this.isOpen = !this.isOpen;
if (this.isStop) {
result.success(this.isOpen);
return;
}
this.isOpen = this.cameraService?.setTorchMode(this.isOpen, result) || false;
result.success(this.isOpen)
} | https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git | ae1dbc3423e2f44e63e8fa75f3d9f6365c20504c | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | isAbrEnabled | 智能码率是否启用 | isAbrEnabled(): boolean {
return this.abrService?.isEnabled() ?? false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAbrEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem... | isAbrEnabled(): boolean {
return this.abrService?.isEnabled() ?? false;
} | https://github.com/AlkaidLab/moonlight-harmony | f8993794d5e828641fb2bb44aec6f09903295fc5 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/RecentFilesService.ets | arkts | clearRecentFiles | 清除所有最近打开的文件 | public async clearRecentFiles(): Promise<void> {
try {
if (!this.preferences) {
return;
}
await this.preferences.put(RecentFilesService.RECENT_FILES_KEY, '[]');
await this.preferences.flush();
CacheConstants.deleteAllCache();
} catch (error) {
hilog.error(DOMAIN, TA... | 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 clearRecentFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public async clearRecentFiles(): Promise<void> {
try {
if (!this.preferences) {
return;
}
await this.preferences.put(RecentFilesService.RECENT_FILES_KEY, '[]');
await this.preferences.flush();
CacheConstants.deleteAllCache();
} catch (error) {
hilog.error(DOMAIN, TA... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L412-L424 | 5f09b82a2efcbbdb4f22856d2ec1abfe709a3f8e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Launch.ets | arkts | generateGroupId | This function generates the worker group ID that can be further used to launch coroutines within that group.
@param domain the worker domain.
GENERAL domain includes all non-main and non-EA workers.
EXACT_ID domain includes exact worker id from hint.
MAIN domain includes only main worker.
EXACT_ID domain includes only ... | static generateGroupId(domain: WorkerDomain, hint?: Array<WorkerId>): WorkerGroupId {
return stub.toFixedArray(WorkerGroup.generateGroupIdImpl(domain.valueOf(), hint ?? Array<WorkerId>()));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateGroupId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static generateGroupId(domain: WorkerDomain, hint?: Array<WorkerId>): WorkerGroupId {
return stub.toFixedArray(WorkerGroup.generateGroupIdImpl(domain.valueOf(), hint ?? Array<WorkerId>()));
} | https://gitcode.com/iop123123/arkts-static-skills | 1dfb5bec8b9505757946e9fcd0f6fd1cb35fdbfd | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/ToolRegistry.ets | arkts | isToolRegistered | 检查工具是否已注册 | isToolRegistered(toolId: string): boolean {
return this.tools.has(toolId)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isToolRegistered AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toolId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Lef... | isToolRegistered(toolId: string): boolean {
return this.tools.has(toolId)
} | https://github.com/LongLiveY96/chatcube | 9a6af16da2a17e90df26937d62acfca6412f5802 | github |
Joker-x-dev/CoolMallArkTS | core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets | arkts | aboutToAppear | 页面出现时的生命周期回调
@returns {void} 无返回值 | aboutToAppear(): void {
this.executeRequest();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
this.executeRequest();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2abaaf59bf4f4fa8d6e0f8f86303015f8f7293b7 | github |
honjow/Next2V | shared/src/main/ets/settings/AccountSessionCoordinator.ets | arkts | prepareAddAccount | Enter pending add-account mode without clearing the active runtime identity.
The current cookie/session remains valid until a login success saves a
validated new session and registerCurrentSession switches the active record. | static async prepareAddAccount(context: common.UIAbilityContext): Promise<void> {
const accounts = await AccountStore.getAll(context).catch((_error: Error): AccountRecord[] => [])
console.info('AccountSessionCoordinator: prepareAddAccount pending, preservedActiveId=' +
AccountStore.getActiveId() + ' acc... | 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 prepareAddAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Lef... | static async prepareAddAccount(context: common.UIAbilityContext): Promise<void> {
const accounts = await AccountStore.getAll(context).catch((_error: Error): AccountRecord[] => [])
console.info('AccountSessionCoordinator: prepareAddAccount pending, preservedActiveId=' +
AccountStore.getActiveId() + ' acc... | https://github.com/honjow/Next2V | 90e58ddf98ac6af4fed9ce1e64080b695daedfcd | github |
openharmony/applications_contacts | entry/src/main/ets/model/calllog/CalllogModel.ets | arkts | getAllCalls | Obtains and caches all 2000 call records.
@param {string} DAHelper Database path
@param {string} mergeRule Call Record Type
@param {Object} callBack Call log data | async getAllCalls(param: ContactInfo, actionData: AllCallsGetActionData, mergeRule: MergeRule, callBack: Function,
context?: Context) {
if (context) {
CallLogRepository.getInstance().init(context);
}
HiLog.i(TAG, 'getAllCalls in:' + JSON.stringify(actionData));
CallLogRepository.getInstance(... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllCalls AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left param AST#identifier#Right AST#ty... | async getAllCalls(param: ContactInfo, actionData: AllCallsGetActionData, mergeRule: MergeRule, callBack: Function,
context?: Context) {
if (context) {
CallLogRepository.getInstance().init(context);
}
HiLog.i(TAG, 'getAllCalls in:' + JSON.stringify(actionData));
CallLogRepository.getInstance(... | https://gitee.com/openharmony/applications_contacts.git | 2d3b5e4462bb6284f9d1fbca7c40f93ab9c810ef | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/AudioFocusManager.ets | arkts | getVolume | Get current volume for audio stream
Note: AudioVolumeManager.getVolume is not available in current SDK
Returns a default value. For actual volume control, use system volume UI. | static async getVolume(): Promise<number> {
// AudioVolumeManager doesn't expose getVolume directly in current SDK
// Return a reasonable default value
return 10;
} | 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 getVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | static async getVolume(): Promise<number> {
// AudioVolumeManager doesn't expose getVolume directly in current SDK
// Return a reasonable default value
return 10;
} | https://github.com/tangwengang-del/freerdp-harmonyos | c87fc1c935764b922c847c29d5a6a2a224cdb34b | github |
CLMC2025/Vignette | entry/src/main/ets/sync/webdav/WebDavCrypto.ets | arkts | randomBytes | Generate cryptographically secure random bytes
@param len Number of random bytes to generate
@returns Uint8Array of random bytes
@throws SecureRandomError if secure random generation fails | async function randomBytes(len: number): Promise<Uint8Array> {
try {
const rand = cryptoFramework.createRandom();
const randomBlob = await rand.generateRandom(len);
return new Uint8Array(randomBlob.data);
} catch (e) {
const errMsg = e instanceof Error ? e.message : String(e);
throw new SecureRa... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left randomBytes AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left len AST#identifier#Right AST#type_ann... | async function randomBytes(len: number): Promise<Uint8Array> {
try {
const rand = cryptoFramework.createRandom();
const randomBlob = await rand.generateRandom(len);
return new Uint8Array(randomBlob.data);
} catch (e) {
const errMsg = e instanceof Error ? e.message : String(e);
throw new SecureRa... | https://github.com/CLMC2025/Vignette | 4baf5ba473dbca5908303fbd52d15c223dd4ec63 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets | arkts | createCategoryWithId | 使用指定ID创建新分类(用于TypeShelfManager集成) | async createCategoryWithId(id: string, name: string): Promise<BookshelfCategory> {
// 检查是否已存在
if (this.categories.some(c => c.id === id)) {
logger.warn(TAG, `分类已存在: ${id}`);
const existing = this.categories.find(c => c.id === id);
if (existing) {
return existing;
}
}
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createCategoryWithId 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#:#Lef... | async createCategoryWithId(id: string, name: string): Promise<BookshelfCategory> {
// 检查是否已存在
if (this.categories.some(c => c.id === id)) {
logger.warn(TAG, `分类已存在: ${id}`);
const existing = this.categories.find(c => c.id === id);
if (existing) {
return existing;
}
}
... | https://github.com/DaLongZhuaZi/manxia | 837873c7e8e9a1f6ddabbadb84dc111c37654a81 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/I18nManager.ets | arkts | t | 获取翻译字符串。
优先使用 resourceManager,fallback 返回 key 本身。 | t(key: string): string {
const mgr = this.overrideResMgr ?? this.resMgr;
if (mgr) {
try {
return mgr.getStringByNameSync(key);
} catch (_e) {
// key 不存在于 string.json 中,返回 key 本身
return key;
}
}
// resourceManager 尚未初始化,返回 key
return key;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Right AS... | t(key: string): string {
const mgr = this.overrideResMgr ?? this.resMgr;
if (mgr) {
try {
return mgr.getStringByNameSync(key);
} catch (_e) {
// key 不存在于 string.json 中,返回 key 本身
return key;
}
}
// resourceManager 尚未初始化,返回 key
return key;
} | https://github.com/richshaw2015/nds | 817c83246c33f3cbb1968c04ad340b42b67b847f | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/CategoryManager.ets | arkts | renameBillsForCategory | 分类改名后同步历史账单中的分类名称,避免列表和统计出现断层。 | private static async renameBillsForCategory(category: CategoryBean, nextName: string): Promise<void> {
const predicates = new relationalStore.RdbPredicates(BILL_TABLE_NAME);
predicates.equalTo('category', category.name);
predicates.equalTo('type', category.type);
const data: relationalStore.ValuesBuck... | 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 renameBillsForCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifi... | private static async renameBillsForCategory(category: CategoryBean, nextName: string): Promise<void> {
const predicates = new relationalStore.RdbPredicates(BILL_TABLE_NAME);
predicates.equalTo('category', category.name);
predicates.equalTo('type', category.type);
const data: relationalStore.ValuesBuck... | https://github.com/ZestBox-18/kitebook-frontend | d463e370f1b06c0b2d69adacf41201d0307239f3 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/BreakpointSystem.ets | arkts | getLayoutMode | 根据断点获取布局模式 | static getLayoutMode(breakpoint: BreakpointType): LayoutMode {
switch (breakpoint) {
case 'xs':
case 'sm':
return 'compact'
case 'md':
return 'medium'
case 'lg':
return 'expanded'
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLayoutMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left breakpoint AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static getLayoutMode(breakpoint: BreakpointType): LayoutMode {
switch (breakpoint) {
case 'xs':
case 'sm':
return 'compact'
case 'md':
return 'medium'
case 'lg':
return 'expanded'
}
} | https://github.com/AetheriumSimulator/qemu-hmos | 1f50860473f73ebabb6df3216203f3712e83a741 | github |
openharmony-tpc/MMKV | entry/src/main/ets/pages/index.ets | arkts | clear | test clear | clear() {
let mmkvTemp = this.testInstance('test/AES', 'Tencent MMKV', true, undefined)
mmkvTemp.clearAll()
LogUtil.i('allKeys = ' + mmkvTemp.getAllKeys())
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#le... | clear() {
let mmkvTemp = this.testInstance('test/AES', 'Tencent MMKV', true, undefined)
mmkvTemp.clearAll()
LogUtil.i('allKeys = ' + mmkvTemp.getAllKeys())
} | https://gitee.com/openharmony-tpc/MMKV.git | 1fa6227fc6cbc520330fdf5229199b9aade5e5f8 | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/AnswerValidator.ets | arkts | getEncouragement | 获取鼓励消息
@param consecutiveCorrect 连续答对次数
@returns 鼓励消息 | static getEncouragement(consecutiveCorrect: number): string {
const encouragements = [
'太棒了!继续加油!',
'你真聪明!',
'做得很好!',
'你是数学小天才!',
'继续保持!'
];
// 根据连续答对次数返回不同的鼓励
const index = Math.floor((consecutiveCorrect / 3) - 1) % encouragements.length;
return encouragements[index... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getEncouragement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left consecutiveCorrect AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numbe... | static getEncouragement(consecutiveCorrect: number): string {
const encouragements = [
'太棒了!继续加油!',
'你真聪明!',
'做得很好!',
'你是数学小天才!',
'继续保持!'
];
// 根据连续答对次数返回不同的鼓励
const index = Math.floor((consecutiveCorrect / 3) - 1) % encouragements.length;
return encouragements[index... | https://github.com/the-wwyang/kids-learning-app | 15a882578d4fb1e64bd3cc501a4957b1a91abf32 | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/heima/music/utils/AVPlayerClass.ets | arkts | init | 初始化播放器 | static async init() {
// 创建一个播放器,记录在实例player属性上
AVPlayerClass.player = await media.createAVPlayer()
// 监听播放器的状态
AVPlayerClass.player.on('stateChange', (state) => {
switch (state) {
case 'initialized':
AVPlayerClass.player.prepare()
break
case 'prepared':
... | 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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right... | static async init() {
// 创建一个播放器,记录在实例player属性上
AVPlayerClass.player = await media.createAVPlayer()
// 监听播放器的状态
AVPlayerClass.player.on('stateChange', (state) => {
switch (state) {
case 'initialized':
AVPlayerClass.player.prepare()
break
case 'prepared':
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 91e65d7e5d3c2bb1d5fe8b81f52fb91f3ce74b63 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | calculateTotalDistance | 计算总距离
@param waypoints 途经点列表 | private calculateTotalDistance(waypoints: Waypoint[]): number {
return waypoints.reduce((sum, wp) => sum + wp.distanceFromPrev, 0);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateTotalDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left waypoints AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#s... | private calculateTotalDistance(waypoints: Waypoint[]): number {
return waypoints.reduce((sum, wp) => sum + wp.distanceFromPrev, 0);
} | https://github.com/LJ666-ui/harmony-health-care | e4e9bd55bc67add819256671fedd99b545798573 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/AdbKeyManager.ets | arkts | buildAdbPublicKey | 构建ADB格式的公钥(524字节) | private buildAdbPublicKey(n: bigint, e: number): ArrayBuffer {
const KEY_LENGTH_WORDS = 64; // 2048 bits / 32 bits = 64 words
const r32 = 1n << 32n;
// 计算 r = 2^(KEY_LENGTH_WORDS * 32)
const r = 1n << BigInt(KEY_LENGTH_WORDS * 32);
// 计算 rr = (r^2) mod n
const rr = (r * r) % n;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildAdbPublicKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private buildAdbPublicKey(n: bigint, e: number): ArrayBuffer {
const KEY_LENGTH_WORDS = 64; // 2048 bits / 32 bits = 64 words
const r32 = 1n << 32n;
// 计算 r = 2^(KEY_LENGTH_WORDS * 32)
const r = 1n << BigInt(KEY_LENGTH_WORDS * 32);
// 计算 rr = (r^2) mod n
const rr = (r * r) % n;
... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 827efe3cf3ca3ecea5638527217e4d30fc4eaa64 | github |
Joker-x-dev/HarmonyKit | feature/main/src/main/ets/viewmodel/AboutViewModel.ets | arkts | openUrl | 打开链接
@param {Resource} urlRes - 链接资源
@returns {void} 无返回值 | openUrl(urlRes: Resource): void {
try {
const url: string = this.context.resourceManager.getStringSync(urlRes.id);
const want: Want = {
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url
};
this.context.startAbility(want).catch((err... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left urlRes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Right AST#)#Left ) AST... | openUrl(urlRes: Resource): void {
try {
const url: string = this.context.resourceManager.getStringSync(urlRes.id);
const want: Want = {
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url
};
this.context.startAbility(want).catch((err... | https://github.com/Joker-x-dev/HarmonyKit | dfcc581d4ec6de19a857f64eac40e0c55f513d4c | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/AlbumService.ets | arkts | getAlbumDetail | 根据平台和专辑ID获取专辑详情(公共方法)
@param source 音乐源
@param albumId 专辑ID
@param page 页码
@param limit 每页数量
@returns Promise<AlbumDetail> | public static async getAlbumDetail(
source: string,
albumId: string,
page: number = 1,
limit: number = 200
): Promise<AlbumDetail> {
switch (source) {
case MusicSource.KG:
return AlbumService.getKGAlbumDetail(albumId, page, limit);
case MusicSource.WY:
return AlbumSer... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getAlbumDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sou... | public static async getAlbumDetail(
source: string,
albumId: string,
page: number = 1,
limit: number = 200
): Promise<AlbumDetail> {
switch (source) {
case MusicSource.KG:
return AlbumService.getKGAlbumDetail(albumId, page, limit);
case MusicSource.WY:
return AlbumSer... | https://github.com/cpdd5201314/harmonyOS-music-app | 0456cb4f7ef6245c6fabb919ff990f3871097893 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/parts/Homepage/addressBar/MeowAddressBar.ets | arkts | go | Submit the search / load request. | go() {
this.myUi.submitSearchOrLoad();
this.myUi.requestAddressBarBlur(this.getUIContext());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left go 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#call... | go() {
this.myUi.submitSearchOrLoad();
this.myUi.requestAddressBarBlur(this.getUIContext());
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 77e51897e18f04c528c0015722545321e23fcf56 | github |
xblLab/HarmonyProjectTemplate | commons/lib_account/src/main/ets/services/AccountApi.ets | arkts | handleUserInfo | userinfo赋值
@param user | private handleUserInfo(user: AuthorResponse) {
this.userInfoModel.isLogin = true;
this.userInfoModel.authorId = user.authorId;
this.userInfoModel.authorNickName = user.authorNickName;
this.userInfoModel.authorIcon = user.authorIcon;
this.userInfoModel.authorDesc = user.authorDesc;
this.userInf... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private handleUserInfo(user: AuthorResponse) {
this.userInfoModel.isLogin = true;
this.userInfoModel.authorId = user.authorId;
this.userInfoModel.authorNickName = user.authorNickName;
this.userInfoModel.authorIcon = user.authorIcon;
this.userInfoModel.authorDesc = user.authorDesc;
this.userInf... | https://github.com/xblLab/HarmonyProjectTemplate | 585610a695b42671739d29b7c0a96d8b17cd9e59 | github |
eclipse-oniro4openharmony/f-oh | entry/src/main/ets/data/DataSource.ets | arkts | getAppDetail | 获取应用详情(描述、源码地址、发布时间等) | static getAppDetail(packageName: string, success: (info: AppInfo) => void,
error?: (err: Error) => void) {
fetchJson(api_apps + '/' + packageName).then((text: string) => {
let resp = JSON.parse(text) as ApiAppDetailResponse;
let detail = resp.data;
let info = toAppInfo(detail);
info.de... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left getAppDetail AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left packageName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R... | static getAppDetail(packageName: string, success: (info: AppInfo) => void,
error?: (err: Error) => void) {
fetchJson(api_apps + '/' + packageName).then((text: string) => {
let resp = JSON.parse(text) as ApiAppDetailResponse;
let detail = resp.data;
let info = toAppInfo(detail);
info.de... | https://github.com/eclipse-oniro4openharmony/f-oh | 3f7dc6c8264369874e678b1c0d51116cc19afbe6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | createSlideOutState | 创建滑出动画状态 | public createSlideOutState(direction: 'left' | 'right' | 'up' | 'down'): AnimationState {
switch (direction) {
case 'left':
return {
isPlaying: false,
isCompleted: false,
currentIteration: 0,
progress: 0,
translateX: -100
};
case 'right... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createSlideOutState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left direction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_... | public createSlideOutState(direction: 'left' | 'right' | 'up' | 'down'): AnimationState {
switch (direction) {
case 'left':
return {
isPlaying: false,
isCompleted: false,
currentIteration: 0,
progress: 0,
translateX: -100
};
case 'right... | https://github.com/DaLongZhuaZi/manxia | 3c6d4847147ee3402ebb6ed493ade7fd024a1886 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoader.ets | arkts | loadRelation | 加载关联数据
@param entities 主实体数据数组
@param relationName 关联属性名
@returns 带有关联数据的实体数组
@throws RelationNotFoundError 如果关联关系未注册 | async loadRelation(
entities: Array<EntityData>,
relationName: string,
options: RelationQueryOptions | null = null,
morphWithWhereCallback: ((qb: QueryBuilder) => void) | null = null
): Promise<Array<EntityData>> {
if (entities.length === 0) {
return entities
}
// 获取关联关系元数据
co... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadRelation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entities AST#identifier#Right AS... | async loadRelation(
entities: Array<EntityData>,
relationName: string,
options: RelationQueryOptions | null = null,
morphWithWhereCallback: ((qb: QueryBuilder) => void) | null = null
): Promise<Array<EntityData>> {
if (entities.length === 0) {
return entities
}
// 获取关联关系元数据
co... | https://github.com/offlinecat-dev/OCNetORM | 7748d836e54d6fb81672be17ccf6e4723c72b77c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | moveSource | 移动书源到指定位置
@param sourceId 要移动的书源ID
@param targetIndex 目标位置索引 | async moveSource(sourceId: string, targetIndex: number): Promise<boolean> {
const source = this.sources.get(sourceId);
if (!source || source.enabled === false) {
return false;
}
// 获取当前启用的书源列表(按 customOrder 排序)
const enabledSources = this.getAllSources().filter(s => s.enabled);
cons... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left moveSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async moveSource(sourceId: string, targetIndex: number): Promise<boolean> {
const source = this.sources.get(sourceId);
if (!source || source.enabled === false) {
return false;
}
// 获取当前启用的书源列表(按 customOrder 排序)
const enabledSources = this.getAllSources().filter(s => s.enabled);
cons... | https://github.com/DaLongZhuaZi/manxia | e4fb56aecedb8495d60fdf5dd9a14391b6189c9c | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/ContactListPresenter.ets | arkts | onDeleteDialogConfirm | Confirm button for deleting a dialog box
@param result | onDeleteDialogConfirm(index: number, item: ContactVo) {
HiLog.i(TAG, 'onDeleteDialogConfirm !!! ');
if (this.worker !== undefined) {
this.worker.sendRequest('deleteContactById', {
context: this.context,
contactId: item.contactId
}, (result: number | undefined) => {
if (resu... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDeleteDialogConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identif... | onDeleteDialogConfirm(index: number, item: ContactVo) {
HiLog.i(TAG, 'onDeleteDialogConfirm !!! ');
if (this.worker !== undefined) {
this.worker.sendRequest('deleteContactById', {
context: this.context,
contactId: item.contactId
}, (result: number | undefined) => {
if (resu... | https://gitee.com/openharmony/applications_contacts.git | 338966711e8570b605bef1bd5aa217e9257fc283 | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/PlanService.ets | arkts | getPlanById | 获取计划详情 | async getPlanById(id: string): Promise<Plan | null> {
const plans = await this.getAllPlans();
const plan = plans.find(p => p.id === id);
if (plan) {
await this.updatePlanProgress(plan);
return plan;
}
return null;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPlanById 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 getPlanById(id: string): Promise<Plan | null> {
const plans = await this.getAllPlans();
const plan = plans.find(p => p.id === id);
if (plan) {
await this.updatePlanProgress(plan);
return plan;
}
return null;
} | https://gitcode.com/openharmony/codelabs | 1ac01e8258efcd2acbf3714ce47168c65f8b1192 | gitcode |
heeh02/superconnect | harmony/entry/src/main/ets/input/InputRouter.ets | arkts | onTouch | ── public entry points (the page's gesture callbacks delegate here) ──
Router: pen → verified pressure path; trackpad tool → cursor click/drag; finger → gestures. | onTouch(event: TouchEvent): void {
if (this.surfaceWFn() <= 0 || this.surfaceHFn() <= 0) { return; }
if (event.sourceTool === SourceTool.Pen) {
if (event.type === TouchType.Down) { this.gc.abortForPen(); } // pen took over → release/reset finger FSM
this.pen.onTouch(event);
return;
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTouch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#identifier#Right AST#)#Left ) AS... | onTouch(event: TouchEvent): void {
if (this.surfaceWFn() <= 0 || this.surfaceHFn() <= 0) { return; }
if (event.sourceTool === SourceTool.Pen) {
if (event.type === TouchType.Down) { this.gc.abortForPen(); } // pen took over → release/reset finger FSM
this.pen.onTouch(event);
return;
}
... | https://github.com/heeh02/superconnect | d59e173851c4a6983a3df0106d25b3a5e56ccb7b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.