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 |
|---|---|---|---|---|---|---|---|---|---|---|
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/FontSizeViewModel.ets | arkts | getFontSizeItems | 获取字体大小列表
@returns {FontSizeItem[]} 字体大小项数组 | getFontSizeItems(): FontSizeItem[] {
const baseStyle = TnUIGetUIBaseStyle();
return [
new FontSizeItem("font-size-xs", "超小字体", baseStyle.fontSizeXs),
new FontSizeItem("font-size-sm", "小字体", baseStyle.fontSizeSm),
new FontSizeItem("font-size", "默认字体", baseStyle.fontSize),
new FontSizeI... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getFontSizeItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left FontSizeItem AS... | getFontSizeItems(): FontSizeItem[] {
const baseStyle = TnUIGetUIBaseStyle();
return [
new FontSizeItem("font-size-xs", "超小字体", baseStyle.fontSizeXs),
new FontSizeItem("font-size-sm", "小字体", baseStyle.fontSizeSm),
new FontSizeItem("font-size", "默认字体", baseStyle.fontSize),
new FontSizeI... | https://github.com/codelably/tuniao-ui | 4942d38ef6047888f00eb4214cf24f37aa0f0b88 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | getAllFootprints | 获取所有足迹记录,按浏览时间倒序
@returns {Promise<Footprint[]>} 足迹列表 | getAllFootprints(): Promise<Footprint[]> {
return this.dataSource.getAllFootprints();
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getAllFootprints 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 A... | getAllFootprints(): Promise<Footprint[]> {
return this.dataSource.getAllFootprints();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 44c3723bdb0df63d52866c386edc26a84c8208e8 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARRenderer.ets | arkts | getCurrentFps | 获取当前帧率 | public getCurrentFps(): number {
return this.currentFps;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentFps AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#n... | public getCurrentFps(): number {
return this.currentFps;
} | https://github.com/LJ666-ui/harmony-health-care | eae397fc895a100a95845f9dd3e04d6aaf5b7300 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | lastIndexOf | Finds the last occurrence of a character in this String.
@param { char } ch to find
@returns { int } index of the character from the beginning of this string, or -1 if not found
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public lastIndexOf(ch: char): int {
return this.lastIndexOf(ch, this.getLength());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left char A... | public lastIndexOf(ch: char): int {
return this.lastIndexOf(ch, this.getLength());
} | https://gitcode.com/iop123123/arkts-static-skills | 9486659511a7e008c1fc42cf32154da1b4a37817 | gitcode |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/model/repository/RecordRepository.ets | arkts | insertMockData | 🟢 [修复] 插入模拟数据 (补全字段,防止数据库报错) | insertMockData(habitId: number, timestamp: number): Promise<number> {
const store = RdbHelper.getRdbStore();
if (!store) {
return Promise.reject('DB not initialized');
}
const valueBucket: relationalStore.ValuesBucket = {
habitId: habitId,
createTime: timestamp,
mood: 3, // 默认... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left insertMockData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left habitId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | insertMockData(habitId: number, timestamp: number): Promise<number> {
const store = RdbHelper.getRdbStore();
if (!store) {
return Promise.reject('DB not initialized');
}
const valueBucket: relationalStore.ValuesBucket = {
habitId: habitId,
createTime: timestamp,
mood: 3, // 默认... | https://gitcode.com/openharmony/codelabs | 4ff7983d373f4db390f6f092853921bb4e48f7fe | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test49_original_index.ets | arkts | swapFirstLast | --- Index-based swap in array --- | function swapFirstLast(arr: number[]): number[] {
if (arr.length < 2) {
return arr;
}
let temp: number = arr[0];
arr[0] = arr[arr.length - 1];
arr[arr.length - 1] = temp;
return arr;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left swapFirstLast AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function swapFirstLast(arr: number[]): number[] {
if (arr.length < 2) {
return arr;
}
let temp: number = arr[0];
arr[0] = arr[arr.length - 1];
arr[arr.length - 1] = temp;
return arr;
} | https://github.com/miaochiahao/ark-ghidra | de8d8bc23c6ccf55ddaf3ff5143cb905c3dbe2e7 | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | upsertProvider | ============================================================================
写入(DB + state)
============================================================================
新增或更新 provider:写 DB + 同步内存数组 | async upsertProvider(provider: ModelProvider, insertAtFront: boolean = false): Promise<void> {
await this.db.saveProvider(provider, insertAtFront)
const current = this.getProviders()
const next: ModelProvider[] = []
let replaced = false
for (let i = 0; i < current.length; i++) {
if (current[... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left upsertProvider AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left provider AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async upsertProvider(provider: ModelProvider, insertAtFront: boolean = false): Promise<void> {
await this.db.saveProvider(provider, insertAtFront)
const current = this.getProviders()
const next: ModelProvider[] = []
let replaced = false
for (let i = 0; i < current.length; i++) {
if (current[... | https://github.com/LongLiveY96/chatcube | 630008fa7a697c523e416bb28c83b5b9aebbc94a | github |
openharmony/applications_mms | entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets | arkts | autoDeleteInfo | Automatically delete notification information | autoDeleteInfo(e) {
let that = this;
that.tempAutoDeleteInfoSwitch = e.checked;
if (e.checked) {
prompt.showDialog({
title: $r('app.string.enable_auto_delete') + '',
message: $r('app.string.enable_auto_delete_hint') + '',
buttons: [... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left autoDeleteInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left e AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#express... | autoDeleteInfo(e) {
let that = this;
that.tempAutoDeleteInfoSwitch = e.checked;
if (e.checked) {
prompt.showDialog({
title: $r('app.string.enable_auto_delete') + '',
message: $r('app.string.enable_auto_delete_hint') + '',
buttons: [... | https://gitee.com/openharmony/applications_mms.git | ff183109b07f0a371e15d170feed2656a348613c | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets | arkts | forEach | Executes a provided function once per each key/value pair in the LightWeightMap, in insertion order
@param callbackFn to apply | forEach(callbackFn: LightWeightMapCbFn<K, V>): void {
const iter = this.entries();
let res = iter.next();
while (!res.done) {
callbackFn(res.value![1], res.value![0], this);
res = iter.next();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackFn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left LightWei... | forEach(callbackFn: LightWeightMapCbFn<K, V>): void {
const iter = this.entries();
let res = iter.next();
while (!res.done) {
callbackFn(res.value![1], res.value![0], this);
res = iter.next();
}
} | https://gitcode.com/iop123123/arkts-static-skills | b4e2372d8bcd181e5f1f255365310370829e8f40 | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/model/MusicAppState.ets | arkts | getCurrentSongItem | @returns The item at {@link selectIndex}, or undefined. | public getCurrentSongItem(): SongItem | undefined {
return this.resolveSongAtQueueIndex(this.selectIndex);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentSongItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#L... | public getCurrentSongItem(): SongItem | undefined {
return this.resolveSongAtQueueIndex(this.selectIndex);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 70843b3b24156a6f30e913d51f58390d7f4b532f | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | updateCategoryCoversAuto | 自动更新分类封面(从分类中的内容获取封面) | private async updateCategoryCoversAuto(categoryId: string): Promise<void> {
const items = this.categoryManager.getCategoryItemsSorted(categoryId);
const coverPaths: string[] = [];
for (const item of items) {
if (coverPaths.length >= 4) {
break;
}
if (item.contentType === Conten... | 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 updateCategoryCoversAuto AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#L... | private async updateCategoryCoversAuto(categoryId: string): Promise<void> {
const items = this.categoryManager.getCategoryItemsSorted(categoryId);
const coverPaths: string[] = [];
for (const item of items) {
if (coverPaths.length >= 4) {
break;
}
if (item.contentType === Conten... | https://github.com/DaLongZhuaZi/manxia | 3d0a8707b062f8b7f1d6d3cddc8dcf7d418a1801 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/UserLibraryApi.ets | arkts | updateUserItemRating | Updates a user\'s rating for an item.
@summary Updates a user\'s rating for an item.
@param {UserLibraryApiUpdateUserItemRatingRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UserLibraryApi | public async updateUserItemRating(requestParameters: UserLibraryApiUpdateUserItemRatingRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.post({path: `/UserItems/${requestParameters.itemId}/Rating`, parameters: requestParameters, excludeParams: ['itemId']})
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left updateUserItemRating AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Ri... | public async updateUserItemRating(requestParameters: UserLibraryApiUpdateUserItemRatingRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.post({path: `/UserItems/${requestParameters.itemId}/Rating`, parameters: requestParameters, excludeParams: ['itemId']})
... | https://github.com/OHPG/FinSdk | 49adc554e33f1b72e33ceb1c63590ab078904c22 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | destroy | 销毁管理器 | public destroy(): void {
try {
display.off('change');
this.listeners.clear();
this.currentDeviceInfo = null;
this.displayObj = null;
logger.info(TAG, '设备适配管理器已销毁');
} catch (error) {
logger.error(TAG, '销毁设备适配管理器失败', String(error));
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta... | public destroy(): void {
try {
display.off('change');
this.listeners.clear();
this.currentDeviceInfo = null;
this.displayObj = null;
logger.info(TAG, '设备适配管理器已销毁');
} catch (error) {
logger.error(TAG, '销毁设备适配管理器失败', String(error));
}
} | https://github.com/DaLongZhuaZi/manxia | c9f64dc4b32087db608f85c17c4f9a067156fd0d | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/NetworkManager.ets | arkts | getPortForwardingStatus | 获取端口转发状态
通过尝试连接来检测端口是否已激活 | public getPortForwardingStatus(name: string): 'active' | 'inactive' | 'error' {
const forwarding = this.config.portForwardings.find(pf => pf.name === name);
if (!forwarding) {
return 'inactive';
}
// 端口转发已配置,返回 active
// 实际状态需要通过 QEMU Monitor 查询
return 'active';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPortForwardingStatus 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#identifi... | public getPortForwardingStatus(name: string): 'active' | 'inactive' | 'error' {
const forwarding = this.config.portForwardings.find(pf => pf.name === name);
if (!forwarding) {
return 'inactive';
}
// 端口转发已配置,返回 active
// 实际状态需要通过 QEMU Monitor 查询
return 'active';
} | https://github.com/AetheriumSimulator/qemu-hmos | baddb882e6a0418bc345435ef76fcacad9a58ec7 | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getIpAddress | 获取当前设备的IP地址(设备连接Wi-Fi后) | static getIpAddress() {
let ipAddress = wifiManager.getIpInfo().ipAddress;
let ip = (ipAddress >>> 24) + "." + (ipAddress >> 16 & 0xFF) + "." + (ipAddress >> 8 & 0xFF) + "." + (ipAddress & 0xFF);
return ip;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getIpAddress 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 { ... | static getIpAddress() {
let ipAddress = wifiManager.getIpInfo().ipAddress;
let ip = (ipAddress >>> 24) + "." + (ipAddress >> 16 & 0xFF) + "." + (ipAddress >> 8 & 0xFF) + "." + (ipAddress & 0xFF);
return ip;
} | https://github.com/tdcare/tdwebrtc | 43dcf5f6e253fc1e155f17a155a5304a18fb70c9 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TouchInputHandler.ets | arkts | reconcileMouseFingers | 对账:若 primary / second 不在 event.touches 中,视为已抬起并释放。
ArkUI 在 Up/Cancel 事件里 event.touches 是否包含正在抬起的手指行为不一致,
这里统一把 changedTouches(仅对 Up/Cancel)当作"正在抬起"从 active 中剔除,
两种约定都能正确收敛。 | private reconcileMouseFingers(event: TouchEvent): void {
const isLiftEvent = event.type === TouchType.Up || event.type === TouchType.Cancel;
const liftingIds: Set<number> = new Set<number>();
if (isLiftEvent) {
for (const t of event.changedTouches) liftingIds.add(t.id);
}
const activeIds: Se... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left reconcileMouseFingers 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#identi... | private reconcileMouseFingers(event: TouchEvent): void {
const isLiftEvent = event.type === TouchType.Up || event.type === TouchType.Cancel;
const liftingIds: Set<number> = new Set<number>();
if (isLiftEvent) {
for (const t of event.changedTouches) liftingIds.add(t.id);
}
const activeIds: Se... | https://github.com/AlkaidLab/moonlight-harmony | ab5614ee75468fe79480ff1f64d6ceaf1ea78097 | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/pages/CategoryDetailPage.ets | arkts | calculateTotal | 计算总金额 | calculateTotal() {
this.totalAmount = this.bills.reduce((sum, bill) => sum + bill.amount, 0);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calculateTotal 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... | calculateTotal() {
this.totalAmount = this.bills.reduce((sum, bill) => sum + bill.amount, 0);
} | https://github.com/qiuhaotc/HarmonyOSPlayground | ff9156c1bbf1715d9e2fa1b440c3406d6bf99006 | github |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0127/crusie/陈星霖-作业&笔记-0127/MyApplication6/entry/src/main/ets/MainAbility/pages/index.ets | arkts | aboutToAppear | 生命周期 创建自定义组件的新实例后 | aboutToAppear() {
CommonLog.info("aboutToAppear")
this.playerManager.setOnPlayingProgressListener((currentTimeMs) => {
this.currentTimeText = this.getShownTimer(currentTimeMs)
this.currentProgress = Math.floor(currentTimeMs / this.playerManager.getTotalTimeMs() * 100)
if (this.totalTimeText ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
CommonLog.info("aboutToAppear")
this.playerManager.setOnPlayingProgressListener((currentTimeMs) => {
this.currentTimeText = this.getShownTimer(currentTimeMs)
this.currentProgress = Math.floor(currentTimeMs / this.playerManager.getTotalTimeMs() * 100)
if (this.totalTimeText ... | https://gitee.com/openharmony-sig/online_event.git | 194ce71be3a9825edf29015aff0c5c1aa10db886 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/PopupManager.ets | arkts | show | 完全自定义显示,没有外层包裹
@param config
@param wrapBuilder
@param args | async show<T extends object>(config: promptAction.BaseDialogOptions, builder: WrappedBuilder<T[]>, args?: T) {
try {
const windowClass = await window.getLastWindow(getContext())
const uiContext = windowClass.getUIContext()
if (args) {
this.popup = new ComponentContent(uiContext, builder,... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left show AST#identifier#Right AST#ERROR#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#constraint#Left AST#extends#Left extends AS... | async show<T extends object>(config: promptAction.BaseDialogOptions, builder: WrappedBuilder<T[]>, args?: T) {
try {
const windowClass = await window.getLastWindow(getContext())
const uiContext = windowClass.getUIContext()
if (args) {
this.popup = new ComponentContent(uiContext, builder,... | https://github.com/wuba/omni-ui | 0df276f555a1c05cea6464a838c38065abf19de2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | performance | 📊 记录性能相关信息
@param tag - 日志分类标签
@param metric - 性能指标名称
@param value - 性能指标值
@param unit - 单位 | public performance(tag: string, metric: string, value: number, unit: string): void {
this.debug(tag, `📊 性能指标: ${metric} = ${value}${unit}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left performance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | public performance(tag: string, metric: string, value: number, unit: string): void {
this.debug(tag, `📊 性能指标: ${metric} = ${value}${unit}`);
} | https://github.com/DaLongZhuaZi/manxia | d2963130249dfbca884fd288d111d4a10317fa02 | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/interceptor/AuthInterceptor.ets | arkts | constructor | Create a new DynamicTokenProvider.
@param tokenGetter A function that returns the token. | constructor(tokenGetter: () => Promise<string | undefined>) {
this.tokenGetter = tokenGetter;
} | 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#binary_expression#Left AST#call_expression#Left AST#identifier#Left tokenGetter AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ER... | constructor(tokenGetter: () => Promise<string | undefined>) {
this.tokenGetter = tokenGetter;
} | https://github.com/killetom/ktretrofit | a401e28f4d4bb3c995ad0334a76a1e83f257e01c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Byte.ets | arkts | equals | Checks for equality this instance with provided object, treated as a Byte
@param other object to be checked against
@returns true if provided object and this instance have same value, false otherwise
Returns false if type of provided object is not the same as this type | public override equals(other: Object|null): boolean {
if (other instanceof Byte) {
return this.value == (other as Byte).byteValue();
}
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#... | public override equals(other: Object|null): boolean {
if (other instanceof Byte) {
return this.value == (other as Byte).byteValue();
}
return false;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 17c6613d4542ea72821c162f2701fcfa593adba3 | gitee |
dingzhilin1990/zhilinclaw | src/security/SandboxedExecutor.ets | arkts | getSecurityContext | 获取安全上下文 | public getSecurityContext(): SecurityContext {
return this.securityContext;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSecurityContext 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 Sec... | public getSecurityContext(): SecurityContext {
return this.securityContext;
} | https://github.com/dingzhilin1990/zhilinclaw | bab903d17e42d0dc44c4ec4327821bbf763fd3d6 | github |
openharmony/codelabs | ETSUI/SimpleCalculator/entry/src/main/ets/model/CalculateModel.ets | arkts | resourceToString | Convert a resource file to a string.
@param resource Resource file.
@return Character string converted from the resource file. | resourceToString(resource: Resource): string {
if (CheckEmptyUtil.isEmpty(resource)) {
return '';
}
let result = '';
try {
result = getContext(this).resourceManager.getStringSync(resource.id);
} catch(error) {
Logger.error('[CalculateModel] getResourceString fail: '+ JSON.stringi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resourceToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Right AST#)... | resourceToString(resource: Resource): string {
if (CheckEmptyUtil.isEmpty(resource)) {
return '';
}
let result = '';
try {
result = getContext(this).resourceManager.getStringSync(resource.id);
} catch(error) {
Logger.error('[CalculateModel] getResourceString fail: '+ JSON.stringi... | https://gitee.com/openharmony/codelabs.git | 34b71c32a07df8921ea1a9e78ecdd1a44e9545c3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | setRecordProperty | 设置记录属性(避免索引访问) | private setRecordProperty(record: DatabaseRecord, propertyName: string, value: DatabaseValue): void {
// 根据属性名设置对应的属性值
switch (propertyName) {
case 'id':
if (typeof value === 'string' || typeof value === 'number') {
(record as ComicSourceDatabaseRecord).id = String(value);
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setRecordProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private setRecordProperty(record: DatabaseRecord, propertyName: string, value: DatabaseValue): void {
// 根据属性名设置对应的属性值
switch (propertyName) {
case 'id':
if (typeof value === 'string' || typeof value === 'number') {
(record as ComicSourceDatabaseRecord).id = String(value);
}
... | https://github.com/DaLongZhuaZi/manxia | d4e9e8ff5fc43bcd5e7c3f785f25513b50c2b1d4 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | handleControllerButton | ---------------------------------------------------------------------------
内部 — 手柄输入处理
--------------------------------------------------------------------------- | private handleControllerButton(event: ControllerButtonEvent): void {
const buttonValue = event.button as number;
if (event.isPressed) {
this.controllerState.buttonFlags |= buttonValue;
} else {
this.controllerState.buttonFlags &= ~buttonValue;
}
this.sendControllerState(event.controlle... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleControllerButton 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#ident... | private handleControllerButton(event: ControllerButtonEvent): void {
const buttonValue = event.button as number;
if (event.isPressed) {
this.controllerState.buttonFlags |= buttonValue;
} else {
this.controllerState.buttonFlags &= ~buttonValue;
}
this.sendControllerState(event.controlle... | https://github.com/AlkaidLab/moonlight-harmony | 4e441296f871fc3bdba98af51356fed0755ab7a6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ContentFilterManager.ets | arkts | filterContentList | 过滤内容列表(漫画、电子书、小说、图源等) | public filterContentList<T>(items: T[]): T[] {
if (!this.isSFWModeEnabled()) {
logger.debug(TAG, `[NSFW调试] SFW模式未启用,不过滤内容`);
return items;
}
const filtered = items.filter((item: T) => {
// 检查是否为NSFW内容
const itemObj: ESObject = item as ESObject;
const isNSFW: boolean = itemOb... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#binary_expression#Left AST#identifier#Left filterContentList AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( A... | public filterContentList<T>(items: T[]): T[] {
if (!this.isSFWModeEnabled()) {
logger.debug(TAG, `[NSFW调试] SFW模式未启用,不过滤内容`);
return items;
}
const filtered = items.filter((item: T) => {
// 检查是否为NSFW内容
const itemObj: ESObject = item as ESObject;
const isNSFW: boolean = itemOb... | https://github.com/DaLongZhuaZi/manxia | 4ce10da1622d4870c7a4c5b6d44efb4b4dc689cf | github |
honjow/Next2V | shared/src/main/ets/utils/HtmlBlockUtils.ets | arkts | extractDivInnerByClass | Inner HTML of the first <div> whose class attribute contains className. | static extractDivInnerByClass(html: string, className: string): string {
const source = html || ''
const openRe = new RegExp(`<div[^>]*class=['"][^'"]*\\b${className}\\b[^'"]*['"][^>]*>`, 'i')
const open = openRe.exec(source)
if (!open) {
return ''
}
const start = open.index + open[0].le... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractDivInnerByClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | static extractDivInnerByClass(html: string, className: string): string {
const source = html || ''
const openRe = new RegExp(`<div[^>]*class=['"][^'"]*\\b${className}\\b[^'"]*['"][^>]*>`, 'i')
const open = openRe.exec(source)
if (!open) {
return ''
}
const start = open.index + open[0].le... | https://github.com/honjow/Next2V | a36bbafcc6b12e33491a095fd293aaccf162a79a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/CrashRecorderService.ets | arkts | buildCrashReport | 构建崩溃报告内容 | private buildCrashReport(
timestamp: number,
dateStr: string,
errorMessage: string,
stackTrace: string,
logs: LogEntry[]
): string {
const sections: string[] = [];
// 标题
sections.push('╔══════════════════════════════════════════════════════════════╗');
sections.push('║ ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildCrashReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | private buildCrashReport(
timestamp: number,
dateStr: string,
errorMessage: string,
stackTrace: string,
logs: LogEntry[]
): string {
const sections: string[] = [];
// 标题
sections.push('╔══════════════════════════════════════════════════════════════╗');
sections.push('║ ... | https://github.com/DaLongZhuaZi/manxia | 825ae061294c2f8327ef398c08748e81f6a4b8a9 | github |
YDYm233/EasyRandom_HarmonyNextApp | product/wearable/src/main/ets/utils/WearScreenUtil.ets | arkts | listItemSpace | 列表项间距 (vp) | static get listItemSpace(): number {
const screenSize = WearScreenUtil.screenSize;
if (WearScreenUtil.isRoundScreen()) {
if (screenSize === 'small') return 12;
if (screenSize === 'large') return 20; // 暂无此设备,预留
return 16; // standard
}
if (screenSize === 'small') return 8;
if ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left listItemSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | static get listItemSpace(): number {
const screenSize = WearScreenUtil.screenSize;
if (WearScreenUtil.isRoundScreen()) {
if (screenSize === 'small') return 12;
if (screenSize === 'large') return 20; // 暂无此设备,预留
return 16; // standard
}
if (screenSize === 'small') return 8;
if ... | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 1ed0857e6a9fd578751e16bffd26ecfdc487bd3d | github |
751496032/ZRouter | RouterApi/src/main/ets/model/NavDestBuilder.ets | arkts | withParam | 页面跳转携带的参数,键值对的方式
@param key
@param value
@returns | public withParam(key: string, value: ObjectOrNull): NavDestBuilder<T> {
this.paramMap.set(key, value)
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left withParam 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 ... | public withParam(key: string, value: ObjectOrNull): NavDestBuilder<T> {
this.paramMap.set(key, value)
return this
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L92-L95 | 69b35e7e95dbe0638b8103e99a057d98f31e1a12 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Copies all elements of arr to the current Uint8ClampedArray starting from insertPos.
@param arr array to copy data from
@param insertPos start index where data from arr will be inserted
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
public | /* public */ internal set(arr: number[], insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8ClampedArray.length")
}
for (let i = 0; i < arr.length; ++i) {
... | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#id... | /* public */ internal set(arr: number[], insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8ClampedArray.length")
}
for (let i = 0; i < arr.length; ++i) {
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 903a6aba6b4ae65b807c7838e1c92993cccc3086 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/rag/Reranker.ets | arkts | calculateKeywordMatch | 计算关键词匹配度 | private calculateKeywordMatch(query: string, document: string): number {
const queryWords = query.toLowerCase().split(/\s+/);
const docWords = document.toLowerCase().split(/\s+/);
let matchCount = 0;
for (const word of queryWords) {
if (docWords.includes(word)) {
matchCount++;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateKeywordMatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private calculateKeywordMatch(query: string, document: string): number {
const queryWords = query.toLowerCase().split(/\s+/);
const docWords = document.toLowerCase().split(/\s+/);
let matchCount = 0;
for (const word of queryWords) {
if (docWords.includes(word)) {
matchCount++;
... | https://github.com/LJ666-ui/harmony-health-care | 3555c817f1ad1a743851226b850a120df1e5930f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | getConfidenceLevel | 获取置信度等级 | static getConfidenceLevel(confidence: number): string {
if (confidence >= 0.9) {
return CONFIDENCE_LEVEL_HIGH;
} else if (confidence >= 0.7) {
return CONFIDENCE_LEVEL_MEDIUM;
} else if (confidence >= 0.5) {
return CONFIDENCE_LEVEL_LOW;
}
return CONFIDENCE_LEVEL_VERY_LOW;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getConfidenceLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left confidence AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | static getConfidenceLevel(confidence: number): string {
if (confidence >= 0.9) {
return CONFIDENCE_LEVEL_HIGH;
} else if (confidence >= 0.7) {
return CONFIDENCE_LEVEL_MEDIUM;
} else if (confidence >= 0.5) {
return CONFIDENCE_LEVEL_LOW;
}
return CONFIDENCE_LEVEL_VERY_LOW;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | dd97b259a453139b7651763f26e86055f0be70a8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | with | Creates a copy with replaced value on index
@param { int } index - index to change
@param { int } value - value to set
@returns { Uint8ClampedArray } - an Uint8ClampedArray with replaced value on index
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
... | public with(index: int, value: int): Uint8ClampedArray {
let res = new Uint8ClampedArray(this)
res.setUnsafeClamp(index, value)
return res
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | public with(index: int, value: int): Uint8ClampedArray {
let res = new Uint8ClampedArray(this)
res.setUnsafeClamp(index, value)
return res
} | https://gitcode.com/iop123123/arkts-static-skills | f44c949c0d2836bb486d9d754c6a3c2a2ce8b4d5 | gitcode |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V21.ets | arkts | parseItem | item = [groups "."] name [params] ":" value CRLF / [groups "."] "ADR"
[params] ":" addressparts CRLF / [groups "."] "ORG" [params] ":" orgparts
CRLF / [groups "."] "N" [params] ":" nameparts CRLF / [groups "."]
"AGENT" [params] ":" vcard CRLF | protected parseItem(): boolean {
// Reset for an item.
this.mCurrentEncoding = VCardParserImpl_V21.DEFAULT_ENCODING;
const line = this.getNonEmptyLine();
const propertyData: VCardProperty = this.constructPropertyData(line);
const propertyNameUpper: string = propertyData.get... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left parseItem 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 boolea... | protected parseItem(): boolean {
// Reset for an item.
this.mCurrentEncoding = VCardParserImpl_V21.DEFAULT_ENCODING;
const line = this.getNonEmptyLine();
const propertyData: VCardProperty = this.constructPropertyData(line);
const propertyNameUpper: string = propertyData.get... | https://gitee.com/openharmony-tpc/VCard.git | fe56308fdd9e48d44efca40824ec15b0da8b1179 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | parseTxtToc | 解析TXT文件目录 | parseTxtToc(content: string): TxtTocItem[] {
const toc: TxtTocItem[] = [];
const lines = content.split('\n');
let position = 0;
// 按优先级排序规则
const enabledRules = this.txtTocRules.filter((r: TxtTocRule) => r.enabled);
const sortedRules = enabledRules.sort((a: TxtTocRule, b: TxtTocRule) => a.pri... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parseTxtToc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#... | parseTxtToc(content: string): TxtTocItem[] {
const toc: TxtTocItem[] = [];
const lines = content.split('\n');
let position = 0;
// 按优先级排序规则
const enabledRules = this.txtTocRules.filter((r: TxtTocRule) => r.enabled);
const sortedRules = enabledRules.sort((a: TxtTocRule, b: TxtTocRule) => a.pri... | https://github.com/DaLongZhuaZi/manxia | c08b033b9b1747c0f7e33ab27b846fe6dab0efe9 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AccountDAO.ets | arkts | getByBalanceRange | 根据余额范围查询账户
@param min 最小余额
@param max 最大余额
@throws | static async getByBalanceRange(min: number, max: number): Promise<Account[]> {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates('accounts');
predicates.greaterThanOrEqualTo('balance', min);
predicates.lessThanOrEqualTo('balance', max);
const resultS... | 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 getByBalanceRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left min AST#identifier#Right AST#:#Left : ... | static async getByBalanceRange(min: number, max: number): Promise<Account[]> {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates('accounts');
predicates.greaterThanOrEqualTo('balance', min);
predicates.lessThanOrEqualTo('balance', max);
const resultS... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f74590e57382f523835276e8f9e45f9f5bca8d56 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/SandboxManager.ets | arkts | copyFile | 复制文件
[修复] 支持从相册URI(datashare://或file://media/)复制文件 | public async copyFile(sourcePath: string, targetPath: string): Promise<void> {
try {
// 确保目标目录存在
const parentDir = targetPath.substring(0, targetPath.lastIndexOf('/'));
if (parentDir && !await this.exists(parentDir)) {
await this.createDirectory(parentDir);
}
// [修复] 检查是否为相册... | 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 copyFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public async copyFile(sourcePath: string, targetPath: string): Promise<void> {
try {
// 确保目标目录存在
const parentDir = targetPath.substring(0, targetPath.lastIndexOf('/'));
if (parentDir && !await this.exists(parentDir)) {
await this.createDirectory(parentDir);
}
// [修复] 检查是否为相册... | https://github.com/DaLongZhuaZi/manxia | 0c97cac6997aad12b6ae0281d1068da449e8d66a | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AdviceFeedback.ets | arkts | calculateAccuracy | 计算预测准确性(基于实际支出) | calculateAccuracy(): number {
if (this.actualSpending === 0 || this.suggestedBudget === 0) {
return 0;
}
const deviation = Math.abs(this.actualSpending - this.suggestedBudget);
const deviationRate = deviation / this.suggestedBudget;
// 偏差越小,准确性越高
// 偏差<10%: 90-100分
// 偏差10-... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateAccuracy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stat... | calculateAccuracy(): number {
if (this.actualSpending === 0 || this.suggestedBudget === 0) {
return 0;
}
const deviation = Math.abs(this.actualSpending - this.suggestedBudget);
const deviationRate = deviation / this.suggestedBudget;
// 偏差越小,准确性越高
// 偏差<10%: 90-100分
// 偏差10-... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 184c259a4a4bac52b7916e419080d3e072bac705 | github |
imperson123/- | Harmonyos-Application/entry/src/main/ets/pages/ChatStore.ets | arkts | notifyUpdate | 通知UI更新 | private notifyUpdate() {
if (this.observer) {
this.observer(this.messages.slice()); // 返回副本避免直接修改
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyUpdate 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... | private notifyUpdate() {
if (this.observer) {
this.observer(this.messages.slice()); // 返回副本避免直接修改
}
} | https://github.com/imperson123/- | 4d1b5cba74181ddfabf69f65e6ac98e0dd18bacb | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/CheatManager.ets | arkts | ensureCheatsDir | 确保 cheats 目录存在 | private ensureCheatsDir(): boolean {
const dir = this.getCheatsDir();
if (!dir) return false;
try {
if (!fileIo.accessSync(dir)) {
fileIo.mkdirSync(dir, true);
}
return true;
} catch (_e) {
try {
fileIo.mkdirSync(dir, true);
return true;
} catch (e... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureCheatsDir 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 boolea... | private ensureCheatsDir(): boolean {
const dir = this.getCheatsDir();
if (!dir) return false;
try {
if (!fileIo.accessSync(dir)) {
fileIo.mkdirSync(dir, true);
}
return true;
} catch (_e) {
try {
fileIo.mkdirSync(dir, true);
return true;
} catch (e... | https://github.com/richshaw2015/nds | 0acf79850c74464875105b7538bc17ca8b22aa83 | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/service/UserService.ets | arkts | updateUser | 对齐 Compose UserRepository.updateUserInfo:PATCH /user 更新当前登录用户,
成功后把 GitHub 返回的用户详情写回本地 UserDao 缓存。
注意:本方法不依赖实例 store / dao,因此提供静态版本,便于 PersonInfoPage 直接调用。 | static async updateUser(field: string,
value: string,
dao: UserDao | null = null): Promise<UpdateUserResult> {
if (field === undefined || field === null || field.length === 0) {
return new UpdateUserResult(false, 0, 'empty field');
}
const url: str... | 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 updateUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:... | static async updateUser(field: string,
value: string,
dao: UserDao | null = null): Promise<UpdateUserResult> {
if (field === undefined || field === null || field.length === 0) {
return new UpdateUserResult(false, 0, 'empty field');
}
const url: str... | https://github.com/CarGuo/GSYGithubAppOH | 358832100a6a38d1a1cf45d38843a95d648fb027 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets | arkts | prepareTempDirectory | 准备临时工作目录 | private async prepareTempDirectory(chapterId: string): Promise<string> {
const tempDir = `${this.sandboxManager.getDirectory('temp')}/cbz_${chapterId}_${Date.now()}`;
await this.sandboxManager.createDirectory(tempDir);
return tempDir;
} | 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 prepareTempDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left A... | private async prepareTempDirectory(chapterId: string): Promise<string> {
const tempDir = `${this.sandboxManager.getDirectory('temp')}/cbz_${chapterId}_${Date.now()}`;
await this.sandboxManager.createDirectory(tempDir);
return tempDir;
} | https://github.com/DaLongZhuaZi/manxia | 3cc06a83a606182bb697aaf9d4bbf0e96e2ece52 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/SoundPool.ets | arkts | finishPlayCallback | 设置播放完成监听 | async finishPlayCallback(): Promise<void> {
// 播放完成回调
this.soundPool.on('playFinished', async () => {
LogUtil.info(TAG, `recive play finished message`);
});
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left finishPlayCallback AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g... | async finishPlayCallback(): Promise<void> {
// 播放完成回调
this.soundPool.on('playFinished', async () => {
LogUtil.info(TAG, `recive play finished message`);
});
} | https://gitee.com/openharmony-sig/applications_clock.git | 73ceb2f4e3b282bfd21053630f830b55161ad202 | gitee |
Vincent-Leon/zotero-harmony | entry/src/main/ets/data/AttachmentCache.ets | arkts | sanitizeFilename | Hand-rolled sanitiser — ArkTS regex literal support is patchy enough to
not be worth depending on for something this small. Keep ASCII alnum
plus dot/dash/underscore; everything else maps to '_'. | function sanitizeFilename(name: string): string {
let out: string = '';
for (let i = 0; i < name.length; i++) {
const code: number = name.charCodeAt(i);
const isDigit: boolean = code >= 0x30 && code <= 0x39;
const isUpper: boolean = code >= 0x41 && code <= 0x5A;
const isLower: boolean = code >= 0x61... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left sanitizeFilename AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function sanitizeFilename(name: string): string {
let out: string = '';
for (let i = 0; i < name.length; i++) {
const code: number = name.charCodeAt(i);
const isDigit: boolean = code >= 0x30 && code <= 0x39;
const isUpper: boolean = code >= 0x41 && code <= 0x5A;
const isLower: boolean = code >= 0x61... | https://github.com/Vincent-Leon/zotero-harmony | 10d2f7ea1ab3f2b6904404149c65c98d456fcaa7 | github |
openharmony-sig/shimmer-ohos | library/src/main/ets/components/MainPage/Shimmer.ets | arkts | setHeightRatio | Sets the height ratio of the shimmer, multiplied against the total height of the layout. | setHeightRatio(heightRatio: number): Shimmer {
if (heightRatio < 0) {
throw new Error("Given invalid height ratio: " + heightRatio);
}
this.heightRatio = heightRatio;
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHeightRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left heightRatio AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A... | setHeightRatio(heightRatio: number): Shimmer {
if (heightRatio < 0) {
throw new Error("Given invalid height ratio: " + heightRatio);
}
this.heightRatio = heightRatio;
return this
} | https://gitee.com/openharmony-sig/shimmer-ohos.git | 467f2e87adaa1c9184e7c36f1defb8d0779f6d32 | gitee |
openharmony-sig/applications_clock | common/src/main/ets/manager/FormManager.ets | arkts | getPreferences | Get FormManager Preferences instance.
@return Preferences instance | private async getPreferences(): Promise<Preferences> {
preferencesUtil.removePreferencesFromCache(GlobalContext.getContext()
.getObject('clockContext') as Context, FROM_DATA_STORE);
this.preferences = await preferencesUtil.getPreferences(GlobalContext.getContext()
.getObject('clockContext') as Con... | 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 getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async getPreferences(): Promise<Preferences> {
preferencesUtil.removePreferencesFromCache(GlobalContext.getContext()
.getObject('clockContext') as Context, FROM_DATA_STORE);
this.preferences = await preferencesUtil.getPreferences(GlobalContext.getContext()
.getObject('clockContext') as Con... | https://gitee.com/openharmony-sig/applications_clock.git | d7e7e9cf9c44d0d281602cee7b3b3325439814bd | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11Config.ets | arkts | checkUEFISupport | 快速检查 UEFI 支持 | static async checkUEFISupport(): Promise<boolean> {
console.log('[Windows11Tester] 检查 UEFI 支持...');
return Windows11ConfigManager.isUEFIAvailable();
} | 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 checkUEFISupport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | static async checkUEFISupport(): Promise<boolean> {
console.log('[Windows11Tester] 检查 UEFI 支持...');
return Windows11ConfigManager.isUEFIAvailable();
} | https://github.com/AetheriumSimulator/qemu-hmos | d4824b4035854151a9be90672117439c9b9856a4 | github |
openharmony/vendor_isoftstone | yangfan/samples/weatherforecast/entry/src/main/ets/mainability/pages/index.ets | arkts | getRequestWarning | 获得预警信息数据 | getRequestWarning() {
let httpRequest = http.createHttp()
httpRequest.request(this.warningWeatherUrl, (err, data) => {
if (!err) {
if (data.responseCode == 200) {
var getWearingData :WeatherWarning = JSON.parse(data.result.toString())
if (getWearingData.code == 200) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRequestWarning 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#... | getRequestWarning() {
let httpRequest = http.createHttp()
httpRequest.request(this.warningWeatherUrl, (err, data) => {
if (!err) {
if (data.responseCode == 200) {
var getWearingData :WeatherWarning = JSON.parse(data.result.toString())
if (getWearingData.code == 200) {
... | https://gitee.com/openharmony/vendor_isoftstone.git | 54f83c0a53733549932806cacbf8e322f2b297b7 | gitee |
erosTeam/NextE | shared/src/main/ets/network/EhErrorClassifier.ets | arkts | classifyResponse | Classify a completed HTTP response. Returns null when the body is a usable page for `page`. | static classifyResponse(
reqUrl: string,
isEx: boolean,
resp: EhTextResponse,
page: string,
): EhError | null {
const status: number = resp.statusCode
const body: string = resp.body
const host: string = EhErrorClassifier.hostOf(reqUrl)
// --- Status-driven (non-200) ---
if (stat... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left classifyResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reqUrl AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static classifyResponse(
reqUrl: string,
isEx: boolean,
resp: EhTextResponse,
page: string,
): EhError | null {
const status: number = resp.statusCode
const body: string = resp.body
const host: string = EhErrorClassifier.hostOf(reqUrl)
// --- Status-driven (non-200) ---
if (stat... | https://github.com/erosTeam/NextE | d243fc7dd18f30a5e4693d7fa56bc2314714411b | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/ClipboardManager.ets | arkts | initialize | Initialize clipboard manager for a session | initialize(instance: number): void {
this.instance = instance;
this.startLocalClipboardMonitoring();
console.info(`${TAG}: Initialized for instance ${instance}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left instance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | initialize(instance: number): void {
this.instance = instance;
this.startLocalClipboardMonitoring();
console.info(`${TAG}: Initialized for instance ${instance}`);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 048af516f4f88d83298a36a7f194fadce6efecf1 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | setCanvasSize | Set Canvas display state.
@param width
@param height | setCanvasSize(width: number, height: number): void {
Logger.info(TAG, `setCanvasSize: width[${width}], height[${height}]`);
this.displayWidth = width;
this.displayHeight = height;
let limit = this.calcNewLimit();
if (this.isCropShowInitialized) {
this.cropShow.syncLimitRect(limit);
thi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCanvasSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ... | setCanvasSize(width: number, height: number): void {
Logger.info(TAG, `setCanvasSize: width[${width}], height[${height}]`);
this.displayWidth = width;
this.displayHeight = height;
let limit = this.calcNewLimit();
if (this.isCropShowInitialized) {
this.cropShow.syncLimitRect(limit);
thi... | https://gitee.com/openharmony/codelabs.git | 3e4cb50f944978d6fd0f7d20f5caeaea4fbcc40e | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isPartOfSurrogatePair | isPartOfSurrogatePair(char) checks whether the char is low or high surrogate.
@param { char } value the char to be tested.
@returns { boolean }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isPartOfSurrogatePair(value: char): boolean {
return Char.isHighSurrogate(value) || Char.isLowSurrogate(value);
} | 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 isPartOfSurrogatePair AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#... | public static isPartOfSurrogatePair(value: char): boolean {
return Char.isHighSurrogate(value) || Char.isLowSurrogate(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 52698ea488c706f86efb8653da312b5551df23b9 | gitcode |
openharmony-sig/knowledge_demo_entainment | FA/notebook/entry/src/main/ets/common/database/NoteInfoTable.ets | arkts | getRdbStore | RdbStore
获取RdbStore实例
@param callback | getRdbStore(callback) {
// RdbStore存在
if (this.rdbStore) {
callback();
return
}
// StoreConfig
const CONFIG = {
name: STORE_CONFIG.name,
securityLevel: data_rdb.SecurityLevel.S1
}
// RdbStore不存在,获取
data_rdb.getRdbStore(globalThis.context, CONFIG, (err, RdbStore)... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#exp... | getRdbStore(callback) {
// RdbStore存在
if (this.rdbStore) {
callback();
return
}
// StoreConfig
const CONFIG = {
name: STORE_CONFIG.name,
securityLevel: data_rdb.SecurityLevel.S1
}
// RdbStore不存在,获取
data_rdb.getRdbStore(globalThis.context, CONFIG, (err, RdbStore)... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | c39c19eb4de7e4b102b67811f4b663cf94f295b1 | gitee |
fbinba3955/Flymby | common/src/main/ets/utils/StringUtil.ets | arkts | ms2Ticks | ms转化为ticks | static ms2Ticks(timeMs: number): number {
return timeMs * 10000;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left ms2Ticks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeMs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | static ms2Ticks(timeMs: number): number {
return timeMs * 10000;
} | https://github.com/fbinba3955/Flymby | 072c3cc7e23ee635f6818581f2b6cad04c4b2d76 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/BattleAnswerRecorder.ets | arkts | recordAnswer | Moved from the BattlePage onOptionTap / handleSpellSubmit recording
block: word stats + the review-day mark, keyed by the wordId of the
question the player just answered. Falls through silently on an empty
wordId (recorder not ready), like the old inline guard. | recordAnswer(answeredWordId: string, correct: boolean): void {
if (answeredWordId.length === 0) {
return;
}
this.recorder.recordAnswer(answeredWordId, correct);
this.markDailyReviewWordIfNeeded(answeredWordId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left recordAnswer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left answeredWordId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , ... | recordAnswer(answeredWordId: string, correct: boolean): void {
if (answeredWordId.length === 0) {
return;
}
this.recorder.recordAnswer(answeredWordId, correct);
this.markDailyReviewWordIfNeeded(answeredWordId);
} | https://github.com/terryma2024/happyword | 15f189696338412dc04b1c4b1b718e9564e1b6d6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getComicInfo | 获取漫画信息 | public async getComicInfo(comicId: string): Promise<ComicInfo | null> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'id = ?',
[comicId]
);
return records.length > 0 ? this.convertRecordToComicInfo(records[0] as ComicInfoDatabas... | 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 getComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public async getComicInfo(comicId: string): Promise<ComicInfo | null> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'id = ?',
[comicId]
);
return records.length > 0 ? this.convertRecordToComicInfo(records[0] as ComicInfoDatabas... | https://github.com/DaLongZhuaZi/manxia | ce8f97e357e59f0eb2afc3076af9cfdc0de2aa0a | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/arkts/class/Class.ets | arkts | hello | 普通函数定义的是原型方法,动态 this(实例化对象后,可以通过 call() 等修改 this 的指向) | hello() {
return `hello:${this.name}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hello 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#return_statement#Left AST#retur... | hello() {
return `hello:${this.name}`;
} | https://github.com/webabcd/HarmonyDemo | 02b4dfdcf3403ca714ff8be078d07dd2c9f2676a | github |
queueit/harmony-sdk | queueit_sdk/src/main/ets/main/QueueItEngine.ets | arkts | run | --- Public API Methods --- | public async run(): Promise<void> {
Logger.debug(QueueItEngine.TAG, "run() called");
await this.runWithConnection(undefined, undefined);
} | 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 run AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST... | public async run(): Promise<void> {
Logger.debug(QueueItEngine.TAG, "run() called");
await this.runWithConnection(undefined, undefined);
} | https://github.com/queueit/harmony-sdk | c3d2b94f3ed9cd79ded6e9d2476fb392be77a50b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DeepLinkRouter.ets | arkts | mapWebPathToRoute | 将网页路径映射为内部路由路径
/d/{source}/{contentId} → detail/{source}/{contentId}
/n → novel/detail
/s/{source} → search/{source}
/transfer → page/TransferPage | private mapWebPathToRoute(webPath: string): string {
const segments: string[] = webPath.split('/').filter((s: string) => s.length > 0);
if (segments.length === 0) {
return '';
}
const prefix: string = segments[0];
// /d/{source}/{contentId} → detail/{source}/{contentId}
if (prefix === ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapWebPathToRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left webPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private mapWebPathToRoute(webPath: string): string {
const segments: string[] = webPath.split('/').filter((s: string) => s.length > 0);
if (segments.length === 0) {
return '';
}
const prefix: string = segments[0];
// /d/{source}/{contentId} → detail/{source}/{contentId}
if (prefix === ... | https://github.com/DaLongZhuaZi/manxia | 073492830f85d220848096038019f5eaebb3b531 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleConfiguration.ets | arkts | loadFromStorage | Two-phase apply. Phase 1 (storage prelude) must be called BEFORE other
modules read the live mutables, invoked by `CountlyInstance` right
after `Storage.init()`. Phase 2 (server fetch) happens in `onInit`
after device-id resolves. | public async loadFromStorage(): Promise<void> {
if (!this.config.storage) {
// No storage, fall back to dev-supplied bootstrap if any.
if (this.config.sdkBehaviorSettings) {
this.applyRawSettings(this.config.sdkBehaviorSettings, 'dev-supplied');
}
return;
}
const stored: st... | 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 loadFromStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public async loadFromStorage(): Promise<void> {
if (!this.config.storage) {
// No storage, fall back to dev-supplied bootstrap if any.
if (this.config.sdkBehaviorSettings) {
this.applyRawSettings(this.config.sdkBehaviorSettings, 'dev-supplied');
}
return;
}
const stored: st... | https://github.com/Countly/countly-sdk-hos | 65a535ee389bc239b2536ba074b4bee6c3b25199 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets | arkts | overshoot | 过冲插值器
动画会超过目标值然后回弹 | static overshoot(tension: number = 2.0): curves.ICurve {
return curves.springCurve(1, 1, 0.1, tension);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left overshoot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tension AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi... | static overshoot(tension: number = 2.0): curves.ICurve {
return curves.springCurve(1, 1, 0.1, tension);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | f407d64b5807bc477a44375429b9534da468986e | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/core/MetadataStorage.ets | arkts | getEntityCount | 获取已注册实体数量
@returns 实体数量 | getEntityCount(): number {
return this.entities.size
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEntityCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getEntityCount(): number {
return this.entities.size
} | https://github.com/offlinecat-dev/OCNetORM | b5ada50f9050e96ac01419b678b90061394fd92c | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | titleBarAvatar | Tap a contact's avatar to go to the contact details page. | titleBarAvatar() {
var actionData = {
phoneNumber: this.strContactsNumber,
pageFlag: common.contactPage.PAGE_FLAG_CONTACT_DETAILS
};
this.jumpToContact(actionData);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left titleBarAvatar 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... | titleBarAvatar() {
var actionData = {
phoneNumber: this.strContactsNumber,
pageFlag: common.contactPage.PAGE_FLAG_CONTACT_DETAILS
};
this.jumpToContact(actionData);
} | https://gitee.com/openharmony/applications_mms.git | e9aeb65da1b5d5858d2ef370fed683eda7b771a1 | gitee |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/input/search/components/MixedStyleSearch.ets | arkts | searchRowStyle | Extract common Row styles | @Extend(Row)
function searchRowStyle() {
.width(SizeToken.SIZE_PERCENT_100)
.borderRadius(CornerRadiusToken.CORNER_RADIUS_16)
.backgroundColor($r('sys.color.comp_background_list_card'))
.padding(PaddingToken.PADDING_12VP)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Row AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | @Extend(Row)
function searchRowStyle() {
.width(SizeToken.SIZE_PERCENT_100)
.borderRadius(CornerRadiusToken.CORNER_RADIUS_16)
.backgroundColor($r('sys.color.comp_background_list_card'))
.padding(PaddingToken.PADDING_12VP)
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 02b6165b2b6adcc234decbdbfa7cd58314f7851b | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | topicDetail | 获取话题详情 | static topicDetail(id: number, postNumber: number = 0): string {
if (postNumber > 0) {
return `/t/${id}/${postNumber}.json`;
}
return `/t/${id}.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left topicDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | static topicDetail(id: number, postNumber: number = 0): string {
if (postNumber > 0) {
return `/t/${id}/${postNumber}.json`;
}
return `/t/${id}.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 58e1c2d068ca916245dc70ea873d8529a01a5959 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/types/ExportTypes.ets | arkts | toJSON | 转换为JSON格式
@returns JSON对象 | toJSON(): Record<string, Object> {
const result: Record<string, Object> = {
'name': this.name,
'code': this.code,
'message': this.message
};
if (this.details !== undefined) {
result['details'] = this.details as Object;
}
if (this.stack !== undefined) {
result['stack']... | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left toJSON 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 : A... | toJSON(): Record<string, Object> {
const result: Record<string, Object> = {
'name': this.name,
'code': this.code,
'message': this.message
};
if (this.details !== undefined) {
result['details'] = this.details as Object;
}
if (this.stack !== undefined) {
result['stack']... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9920c9989ab47b3a3e2638e6a9e2bc6b5db82342 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/VariableReplacer.ets | arkts | mergeContexts | 合并多个上下文 | static mergeContexts(...contexts: VariableContext[]): VariableContext {
const merged: VariableContext = {};
for (let i = 0; i < contexts.length; i++) {
const context: VariableContext = contexts[i];
const keys: string[] = Object.keys(context);
for (const key of keys) {
const value: O... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left mergeContexts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left contexts AST#identifier#Right AST#... | static mergeContexts(...contexts: VariableContext[]): VariableContext {
const merged: VariableContext = {};
for (let i = 0; i < contexts.length; i++) {
const context: VariableContext = contexts[i];
const keys: string[] = Object.keys(context);
for (const key of keys) {
const value: O... | https://github.com/DaLongZhuaZi/manxia | d5e1a550245dbc501c5d8e65b2d15e0b89d6338c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Exception.ets | arkts | constructor | Constructs a new empty exception instance | constructor () {
this.msg = "";
this.cause = this;
this.provisionStackTrace();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor () {
this.msg = "";
this.cause = this;
this.provisionStackTrace();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6c83903977c6cbd51f88075a63fb0c09d8d8da9c | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | findIndex | Finds an index of the first element in the Float32Array that satisfies the condition
@param fn condition
@returns the index of the first element that satisfies fn | public findIndex(fn: (val: float) => boolean): int {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.findIndex(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public findIndex(fn: (val: float) => boolean): int {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.findIndex(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b6f82b8fd0ae4fee8d30a56434ac7bade67ea8a7 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TaskExecutor.ets | arkts | executeConditional | 条件执行步骤 | private async executeConditional(task: TaskDefinition, context: TaskContext): Promise<void> {
for (const step of task.steps) {
// 条件执行模式下,每个步骤都必须有条件
if (step.condition && this.evaluateCondition(step.condition, context)) {
await this.executeStep(step, context);
// 条件执行模式下,只执行第一个满足条件的步骤
... | 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 executeConditional AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Le... | private async executeConditional(task: TaskDefinition, context: TaskContext): Promise<void> {
for (const step of task.steps) {
// 条件执行模式下,每个步骤都必须有条件
if (step.condition && this.evaluateCondition(step.condition, context)) {
await this.executeStep(step, context);
// 条件执行模式下,只执行第一个满足条件的步骤
... | https://github.com/DaLongZhuaZi/manxia | b2259332e3a62ab736bd6266df93da75a793cde8 | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateRipple | 涟漪振动 — 由强到弱的衰减振动,模拟水波扩散 | static vibrateRipple(): void {
VibratorManager.logExecution('vibrateRipple');
VibratorManager.vibratePattern([150, 50, 100, 50, 60, 50, 30], 1, VibrationUsage.TOUCH);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateRipple 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#expressi... | static vibrateRipple(): void {
VibratorManager.logExecution('vibrateRipple');
VibratorManager.vibratePattern([150, 50, 100, 50, 60, 50, 30], 1, VibrationUsage.TOUCH);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 05083a49c48974f72f2b023be28701a92a390f86 | github |
offlinecat-dev/OCNetORM | example/UsageExample.ets | arkts | createArticle | ============================================
第三步:CRUD 操作示例
============================================
创建文章 | async function createArticle(title: string, content: string, authorId: number): Promise<SaveResult> {
const repository = new Repository('ArticleEntity')
const articleData = new EntityData('ArticleEntity')
articleData.addProperty('title', title, 'string')
articleData.addProperty('content', content, 'string')
... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left createArticle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type... | async function createArticle(title: string, content: string, authorId: number): Promise<SaveResult> {
const repository = new Repository('ArticleEntity')
const articleData = new EntityData('ArticleEntity')
articleData.addProperty('title', title, 'string')
articleData.addProperty('content', content, 'string')
... | https://github.com/offlinecat-dev/OCNetORM | 666eee4436bd4a9697270dbd0522a44ed7229188 | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | setLoop | Playback mode. The options are as follows: true: playing a single video; false: playing a cyclic video. | setLoop() {
this.loop = !this.loop;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLoop 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... | setLoop() {
this.loop = !this.loop;
} | https://gitee.com/openharmony/codelabs.git | 192adb1b0633f1969a9b2379bd24f53af24cb391 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DataValidator.ets | arkts | validateNonEmptyArray | 验证数组是否非空
@param value - 要验证的数组
@param fieldName - 字段名称
@returns 验证结果 | static validateNonEmptyArray<T>(value: T[] | undefined | null, fieldName: string = 'array'): ValidationResult {
const errors: string[] = [];
if (value === null || value === undefined) {
errors.push(`${fieldName} 不能为空`);
} else if (!Array.isArray(value)) {
errors.push(`${fieldName} 必须是数组类型... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left validateNonEmptyArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left... | static validateNonEmptyArray<T>(value: T[] | undefined | null, fieldName: string = 'array'): ValidationResult {
const errors: string[] = [];
if (value === null || value === undefined) {
errors.push(`${fieldName} 不能为空`);
} else if (!Array.isArray(value)) {
errors.push(`${fieldName} 必须是数组类型... | https://github.com/DaLongZhuaZi/manxia | 8173745db019d2119d59327ff95006efaf379a8e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/AiKeyService.ets | arkts | getRecommendation | 根据游戏名称获取推荐的按键布局
@param gameName 游戏名称
@returns 推荐的按键定义列表和说明 | async getRecommendation(gameName: string): Promise<AiKeyRecommendation> {
const messages: AiMessage[] = [
{ role: 'system', content: this.loadSystemPrompt() },
{ role: 'user', content: `为游戏「${gameName}」生成触屏按键布局` },
];
const responseText = await this.nvHttp.aiCompletion(messages, 4096);
r... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecommendation AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left gameName AST#identifier#Right AST#type_annotation#Left AST#:#... | async getRecommendation(gameName: string): Promise<AiKeyRecommendation> {
const messages: AiMessage[] = [
{ role: 'system', content: this.loadSystemPrompt() },
{ role: 'user', content: `为游戏「${gameName}」生成触屏按键布局` },
];
const responseText = await this.nvHttp.aiCompletion(messages, 4096);
r... | https://github.com/AlkaidLab/moonlight-harmony | 1a006916ef7d5ff77b95b7c2341c29c92168a905 | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets | arkts | dispose | 停止监听并清理资源 | dispose(): void {
this.unregisterWindowSizeChange()
this.unregisterAvoidAreaChange()
this.unregisterFoldStatusChange()
this.observers.clear()
this.mainWindow = null
this.cachedSafeTopVp = 0
this.cachedSafeBottomVp = 0
this.cachedKeyboardVisible = false
this.cachedFoldPosture = Fold... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dispose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | dispose(): void {
this.unregisterWindowSizeChange()
this.unregisterAvoidAreaChange()
this.unregisterFoldStatusChange()
this.observers.clear()
this.mainWindow = null
this.cachedSafeTopVp = 0
this.cachedSafeBottomVp = 0
this.cachedKeyboardVisible = false
this.cachedFoldPosture = Fold... | https://github.com/Xiwei753/xiezuoruanjian | 0895b1f407600677efda2f26c8904d1f4e1eec9b | github |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/GestureUtils.ets | arkts | calculateVelocity | 计算手势速度
@param state - 当前手势状态
@param currentX - 当前X坐标
@param currentY - 当前Y坐标
@returns 速度值 | static calculateVelocity(
state: GestureState,
currentX: number,
currentY: number
): number {
const deltaX: number = currentX - state.currentX;
const deltaY: number = currentY - state.currentY;
return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateVelocity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static calculateVelocity(
state: GestureState,
currentX: number,
currentY: number
): number {
const deltaX: number = currentX - state.currentX;
const deltaY: number = currentY - state.currentY;
return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
} | https://github.com/kumaleap/ArkSwipeDeck | 0090d1d6cecce98c78a7e2f77b71b64cb41d5eb0 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/DeviceManager.ets | arkts | sendCommand | 发送命令到设备
@param deviceId 设备ID
@param command 设备命令
@returns Promise<void> | public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> {
const deviceInfo = this.devices.get(deviceId);
if (!deviceInfo) {
throw new Error(`Device not found: ${deviceId}`);
}
const controller = this.controllers.get(deviceInfo.deviceType);
if (!controller) {
... | 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> {
const deviceInfo = this.devices.get(deviceId);
if (!deviceInfo) {
throw new Error(`Device not found: ${deviceId}`);
}
const controller = this.controllers.get(deviceInfo.deviceType);
if (!controller) {
... | https://github.com/LJ666-ui/harmony-health-care | dd7d229ae1d7c1bf3e3b0615fff0caedc8804f4f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | every | Checks that all elements of Uint32Array satisfy the passed function
@param fn check function
@returns true if all elements satisfy fn | public every(fn: (element: number, index: int, array: Uint32Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Rig... | public every(fn: (element: number, index: int, array: Uint32Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 15d116dfa454f895c732f8f9b608f390343623a4 | gitee |
seagazer/cclyric | lib/src/main/ets/CcLyricController.ets | arkts | setAlignMode | Set the align mode, must set before bind the CcLyricView.
@param mode The align mode.{@link AlignMode} | setAlignMode(mode: AlignMode): CcLyricController {
this.alignMode = mode
this.resize()
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAlignMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AlignMode AST#identifier#Right AST#)#Left )... | setAlignMode(mode: AlignMode): CcLyricController {
this.alignMode = mode
this.resize()
return this
} | https://github.com/seagazer/cclyric | d42915f29d067039f59ad3c8116bf8ea31843c51 | github |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnBadgePage.ets | arkts | BadgeDemoBlock | 徽标演示用内容块构建器 | @Builder
function BadgeDemoBlock() {
Row()
.width(40)
.height(40)
.borderRadius(8)
.backgroundColor("#f2f3f5");
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left BadgeDemoBlock AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#... | @Builder
function BadgeDemoBlock() {
Row()
.width(40)
.height(40)
.borderRadius(8)
.backgroundColor("#f2f3f5");
} | https://github.com/codelably/tuniao-ui | b716ba06458215ca6da6e6e9bba8d98a2376fd3d | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | setMinMaxScaleX | Sets the minimum and maximum scale factors for the x-axis
@param minScaleX
@param maxScaleX | public setMinMaxScaleX(minScaleX: number, maxScaleX: number) {
if (minScaleX < 1)
minScaleX = 1;
if (maxScaleX == 0.0)
maxScaleX = Number.MAX_VALUE;
this.mMinScaleX = minScaleX;
this.mMaxScaleX = maxScaleX;
this.limitTransAndScale(this.mMatrixTouch, this.mContentRect);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinMaxScaleX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minScaleX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | public setMinMaxScaleX(minScaleX: number, maxScaleX: number) {
if (minScaleX < 1)
minScaleX = 1;
if (maxScaleX == 0.0)
maxScaleX = Number.MAX_VALUE;
this.mMinScaleX = minScaleX;
this.mMaxScaleX = maxScaleX;
this.limitTransAndScale(this.mMatrixTouch, this.mContentRect);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 26e22accbb6b3038a1757fece9c8c0b5541883fb | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieDataSet.ets | arkts | setHighlightColor | Sets the color for the highlighted sector (null for using entry color) | public setHighlightColor( /*@Nullable*/
color: number): void {
this.mHighlightColor = color;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighlightColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#comment#Left /*@Nullable*/ AST#comment#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Lef... | public setHighlightColor( /*@Nullable*/
color: number): void {
this.mHighlightColor = color;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 2db8c20cf66d7441f235088bdf177e9dba151c52 | gitee |
Your-USTC/DailyNic_HMOS | entry/src/main/ets/utils/Classes/ScheduleManager.ets | arkts | getLatestWeek | 获取课程列表中的最大周数
@param timetable 课程列表
@returns 最大周数(数字),如果发生错误则返回0 | getLatestWeek(timetable: classAttribute[]): number {
try {
let latestWeek: number = 0;
timetable.forEach(singleClass => {
latestWeek = Math.max(latestWeek, singleClass.weekOfTerm[singleClass.weekOfTerm.length - 1]);
});
return latestWeek;
} catch(err) {
return 0;
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLatestWeek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timetable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left classAt... | getLatestWeek(timetable: classAttribute[]): number {
try {
let latestWeek: number = 0;
timetable.forEach(singleClass => {
latestWeek = Math.max(latestWeek, singleClass.weekOfTerm[singleClass.weekOfTerm.length - 1]);
});
return latestWeek;
} catch(err) {
return 0;
}
... | https://github.com/Your-USTC/DailyNic_HMOS | 4fbfc5f507684b5ce7085f8d4531605c73242e13 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/PanZoomHandler.ets | arkts | inverseTransform | 坐标逆变换:将屏幕触摸坐标转换为未缩放的 XComponent 坐标
对齐 Android Game.getStreamViewRelativeNormalizedXY() | inverseTransform(screenX: number, screenY: number): PointXY {
const result: PointXY = {
x: (screenX - this.translateX) / this.scaleFactor,
y: (screenY - this.translateY) / this.scaleFactor
};
return result;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left inverseTransform AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left screenX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST... | inverseTransform(screenX: number, screenY: number): PointXY {
const result: PointXY = {
x: (screenX - this.translateX) / this.scaleFactor,
y: (screenY - this.translateY) / this.scaleFactor
};
return result;
} | https://github.com/AlkaidLab/moonlight-harmony | e2fa9ccb96a7df21fc6ca12ef8d1ce9acd5f7380 | github |
ibestservices/ibest-ui-v2 | library/src/main/ets/components/caliper/index.ets | arkts | initScaleList | 初始化刻度列表 | initScaleList(){
let list: IBestCaliperScale[] = []
const scaleSize = this.scales * this.scaleSize
for (let i = this.startNum; i <= this.endNum; i = addNumber(i, this.scaleSize)) {
list.push({
value: i,
isBig: i % scaleSize === 0
})
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initScaleList 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... | initScaleList(){
let list: IBestCaliperScale[] = []
const scaleSize = this.scales * this.scaleSize
for (let i = this.startNum; i <= this.endNum; i = addNumber(i, this.scaleSize)) {
list.push({
value: i,
isBig: i % scaleSize === 0
})
... | https://github.com/ibestservices/ibest-ui-v2/blob/6d385eaa20c466e6ade180801d5549908f20417f/library/src/main/ets/components/caliper/index.ets#L104-L119 | c15b54fb755e4a47f524f659f0d7bc20d10642db | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getDefaultCellularDataSlotId | 获取默认移动数据的SIM卡,使用Promise方式作为异步方法。
@returns | static async getDefaultCellularDataSlotId(): Promise<number> {
return data.getDefaultCellularDataSlotId();
} | 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 getDefaultCellularDataSlotId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi... | static async getDefaultCellularDataSlotId(): Promise<number> {
return data.getDefaultCellularDataSlotId();
} | https://github.com/tdcare/tdwebrtc | 130c91ea82d6636420f7c95342ee28950e41b941 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleConsent.ets | arkts | cancelPendingTimers | Cancel any pending coalesced consent snapshot. Called from
CountlyInstance.halt so a detached instance's timer doesn't fire after
shutdown (would produce "already halted" races in tests). | public cancelPendingTimers(): void {
if (this.pendingCoalesceTimer !== null) {
clearTimeout(this.pendingCoalesceTimer);
this.pendingCoalesceTimer = null;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cancelPendingTimers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ex... | public cancelPendingTimers(): void {
if (this.pendingCoalesceTimer !== null) {
clearTimeout(this.pendingCoalesceTimer);
this.pendingCoalesceTimer = null;
}
} | https://github.com/Countly/countly-sdk-hos | c82e5b856843c3538c2129b4f9020fa63c28287b | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getTopicWebRepliesAll | Fetch all reply pages in parallel. Returns merged replies sorted by page order,
plus the page count. An optional onProgress callback fires after each page completes. | async getTopicWebRepliesAll(
topicId: number,
cookie: string = '',
onProgress?: (loaded: number, total: number) => void,
): Promise<V2exTopicWebRepliesAllResult> {
return this.topicWebRepliesClient().getAll(topicId, cookie, onProgress)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTopicWebRepliesAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left topicId AST#identifier#Right AST#type_annotation#Left AST... | async getTopicWebRepliesAll(
topicId: number,
cookie: string = '',
onProgress?: (loaded: number, total: number) => void,
): Promise<V2exTopicWebRepliesAllResult> {
return this.topicWebRepliesClient().getAll(topicId, cookie, onProgress)
} | https://github.com/honjow/Next2V | 8ff1434efa3c37716bdb36b688c27ecf7a6776c2 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | exportPublicKeyDer | 导出公钥为 DER 格式 | static async exportPublicKeyDer(publicKey: cryptoFramework.PubKey): Promise<Uint8Array> {
const blob = publicKey.getEncoded();
return new Uint8Array(blob.data);
} | 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 exportPublicKeyDer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left publicKey AST#identifier#Right AST#:#... | static async exportPublicKeyDer(publicKey: cryptoFramework.PubKey): Promise<Uint8Array> {
const blob = publicKey.getEncoded();
return new Uint8Array(blob.data);
} | https://github.com/AlkaidLab/moonlight-harmony | 35228da195e7e1b965c592f9e5a2a659a967ff39 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/InputInterceptorService.ets | arkts | isActive | 查询是否处于活跃状态 | isActive(): boolean {
if (this.native) {
return this.native.isKeyInterceptorActive();
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_... | isActive(): boolean {
if (this.native) {
return this.native.isKeyInterceptorActive();
}
return false;
} | https://github.com/AlkaidLab/moonlight-harmony | 020d0c26973350f4f03f6d40a5b88b44477fe5d4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates a copy of Uint8ClampedArray.
@param other data initializer | public constructor(other: Uint8ClampedArray) {
this.buffer = other.buffer.slice(0, other.buffer.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uin... | public constructor(other: Uint8ClampedArray) {
this.buffer = other.buffer.slice(0, other.buffer.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c1abf49aa5310165869364c0c6e71c2211e83b37 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets | arkts | pause | Pause music. | public pause() {
Logger.info(TAG, 'AVPlayer pause() isPrepared:' + this.isPrepared + ', state:' + this.state);
if (this.isPrepared && this.state == AudioPlayerState.PLAY && this.avPlayer) {
this.avPlayer.pause().then(() => {
this.state = AudioPlayerState.PAUSE;
this.updateIsPlay(false);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pause 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#;#L... | public pause() {
Logger.info(TAG, 'AVPlayer pause() isPrepared:' + this.isPrepared + ', state:' + this.state);
if (this.isPrepared && this.state == AudioPlayerState.PLAY && this.avPlayer) {
this.avPlayer.pause().then(() => {
this.state = AudioPlayerState.PAUSE;
this.updateIsPlay(false);
... | https://gitee.com/harmonyos/codelabs.git | b2a659835c205f947db30ab1a0069fab3b388f9e | gitee |
iop123123/arkts-static-skills | linter/linter/examples/hello.ok.ets | arkts | main | expect: ok
evidence: minimal valid static-ArkTS program. | function main(): void {
console.log("hi");
} | 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 {
console.log("hi");
} | https://gitcode.com/iop123123/arkts-static-skills | e0d90ddabb883caba17f5f42be6f5851a7dda947 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toInt | Returns value of this instance
@returns { int }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toInt(): int {
return this.value.toInt();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#identifier#Left toInt AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Righ... | public override toInt(): int {
return this.value.toInt();
} | https://gitcode.com/iop123123/arkts-static-skills | 6d08ebf7a1744a562be685f9e7950ea8e5002b9e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildFavoritesActions | 构建收藏获取操作序列 | buildFavoritesActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'favorites');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少收藏工作流配置'
);
}
return this.processActions(workflow, {});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildFavoritesActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfig... | buildFavoritesActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'favorites');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少收藏工作流配置'
);
}
return this.processActions(workflow, {});
} | https://github.com/DaLongZhuaZi/manxia | db50dd7c6c525c6aa90b6258cb06771636e20ca1 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | resetSession | 重置会话状态(串流结束时调用)
与 cleanup() 不同,此方法保留单例和驱动生命周期,只重置会话相关状态
同时清理设备缓存,避免下次进入串流时先重放旧连接再扫描导致重复识别 | resetSession(): void {
console.info('[GAMEPAD] 重置会话状态');
// 停止鼠标模拟 & 震动
this.mouseEmulationService.cleanup();
this.vibrationService.stopAll();
// 重置触摸板鼠标状态
this.touchpadLastX = -1;
this.touchpadLastY = -1;
if (this.gcAxisFlushTimerId !== -1) {
clearTimeout(this.gcAxisFlush... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | resetSession(): void {
console.info('[GAMEPAD] 重置会话状态');
// 停止鼠标模拟 & 震动
this.mouseEmulationService.cleanup();
this.vibrationService.stopAll();
// 重置触摸板鼠标状态
this.touchpadLastX = -1;
this.touchpadLastY = -1;
if (this.gcAxisFlushTimerId !== -1) {
clearTimeout(this.gcAxisFlush... | https://github.com/AlkaidLab/moonlight-harmony | f18c189bd87f39b984e4a798e4756b8e79ff83cd | github |
wanrenhuifu/JLU | harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/utils/UserStore.ets | arkts | deleteUserToken | 删除token | async deleteUserToken(){
const store = await this.getUserStore()
store.deleteSync(this.key)
store.flush()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteUserToken AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#... | async deleteUserToken(){
const store = await this.getUserStore()
store.deleteSync(this.key)
store.flush()
} | https://github.com/wanrenhuifu/JLU | 7ce0f5acdb72de87b97ae9156518ac73ac989b0b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.