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 |
|---|---|---|---|---|---|---|---|---|---|---|
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineSurfaceManagerBridge.ets | arkts | removeSurfaceListener | Unregisters a native surface listener. | removeSurfaceListener(listener: ISurfaceListener): void {
const idx = this._registeredListeners.indexOf(listener);
if (idx >= 0) {
this._registeredListeners.splice(idx, 1);
}
unregisterA2UISurfaceListener(this.instanceId, listener);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeSurfaceListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ISurfaceListener AST#identifie... | removeSurfaceListener(listener: ISurfaceListener): void {
const idx = this._registeredListeners.indexOf(listener);
if (idx >= 0) {
this._registeredListeners.splice(idx, 1);
}
unregisterA2UISurfaceListener(this.instanceId, listener);
} | https://github.com/AGenUI/AGenUI | e6ceb6fe50da30792bc0d7b10dbabad6a8a54f65 | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets | arkts | hideRefundModal | 隐藏退款原因选择弹窗
@returns {void} 无返回值 | hideRefundModal(): void {
this.refundModalVisible = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hideRefundModal 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_bl... | hideRefundModal(): void {
this.refundModalVisible = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS | ca5e36229a6e9367399797e655edb123f7c5590f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a Uint8Array with the same ArrayBuffer
@param begin start index, inclusive
@returns new Uint8Array with the same ArrayBuffer
public | /* public */ internal subarray(begin: int): Uint8Array {
return this.subarray(begin, this.length)
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Lef... | /* public */ internal subarray(begin: int): Uint8Array {
return this.subarray(begin, this.length)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f2282895984c7bbb7807e75d04c0a98826ae35bf | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/AudioFocusManager.ets | arkts | releaseFocus | Release audio focus | static async releaseFocus(): Promise<void> {
if (!isAudioFocusHeld) {
console.info(`${TAG}: Audio focus not held, skip release`);
return;
}
console.info(`${TAG}: Releasing audio focus`);
try {
isAudioFocusHeld = false;
console.info(`${TAG}: Audio focus released`);
... | 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 releaseFocus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async releaseFocus(): Promise<void> {
if (!isAudioFocusHeld) {
console.info(`${TAG}: Audio focus not held, skip release`);
return;
}
console.info(`${TAG}: Releasing audio focus`);
try {
isAudioFocusHeld = false;
console.info(`${TAG}: Audio focus released`);
... | https://github.com/tangwengang-del/freerdp-harmonyos | f9796e30edf0a0f8d068424f16d2e8ca9e744a12 | github |
Joker-x-dev/CoolMallArkTS | core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets | arkts | toEntity | 将领域模型转换为数据库实体
@param {Cart} cart 购物车领域模型
@returns {CartEntity} 数据库实体 | private toEntity(cart: Cart): CartEntity {
const entity: CartEntity = new CartEntity();
entity.goodsId = cart.goodsId;
entity.goodsName = cart.goodsName;
entity.goodsMainPic = cart.goodsMainPic;
entity.specJson = JSON.stringify(cart.spec ?? []);
return entity;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left toEntity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cart AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Cart... | private toEntity(cart: Cart): CartEntity {
const entity: CartEntity = new CartEntity();
entity.goodsId = cart.goodsId;
entity.goodsName = cart.goodsName;
entity.goodsMainPic = cart.goodsMainPic;
entity.specJson = JSON.stringify(cart.spec ?? []);
return entity;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 239d0b116694cbb657cac92def1c1efa5f3c78c0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | extractAllText | 提取所有文本(包括子元素) | private extractAllText(html: string): string {
return html.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractAllText 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#identifier#Lef... | private extractAllText(html: string): string {
return html.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim();
} | https://github.com/DaLongZhuaZi/manxia | e049747c8cd6d4cb80f48e90d7921a7c670a0603 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AdviceFeedbackDAO.ets | arkts | insert | 插入反馈记录 | static async insert(feedback: AdviceFeedback): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const valueBucket: relationalStore.ValuesBucket = {
user_id: feedback.userId,
advice_id: feedback.adviceId,
advice_type: feedback.adviceType,
category_id:... | 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 insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left feedback AST#identifier#Right AST#:#Left : AST#:#... | static async insert(feedback: AdviceFeedback): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const valueBucket: relationalStore.ValuesBucket = {
user_id: feedback.userId,
advice_id: feedback.adviceId,
advice_type: feedback.adviceType,
category_id:... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | d79209ea72b37225f2770431f71554a955cc43bc | github |
HarmonyOS_Samples/BestPracticeSnippets | UseSendable/entry/src/main/ets/pages/InterThreadCommunication2.ets | arkts | getAddress | [EndExclude store] | @Concurrent
function getAddress() {
let address = singleton.getAddress();
hilog.info(0x0000, 'TAG', '%{public}s', 'taskpool:: address is ' + address);
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left getAddress AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#L... | @Concurrent
function getAddress() {
let address = singleton.getAddress();
hilog.info(0x0000, 'TAG', '%{public}s', 'taskpool:: address is ' + address);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 05109ebf42e71fa8e2e8c310e889fa3cea2b5657 | gitcode |
CarGuo/GSYGithubAppOH | entry/src/main/ets/service/RepositoryService.ets | arkts | createIssue | 创建 Issue —— 对齐 RN [issueActions.createIssue](https://github.com/CarGuo/GSYGithubApp/blob/master/app/components/RepositoryIssueListPage.js#L229-L245)
POST /repos/{owner}/{repo}/issues body={title, body}
成功后将新 issue 插到 store.issues 头部,UI 端通过 @ObjectLink 自动刷新。 | async createIssue(fullName: string,
title: string,
body: string): Promise<RepositoryServiceResult<RepositoryIssueItem | null>> {
const owner: RepoOwnerName = RepoOwnerName.parse(fullName);
if (owner.owner.length === 0 || owner.name.length === 0) {
return new Repos... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createIssue AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fullName AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async createIssue(fullName: string,
title: string,
body: string): Promise<RepositoryServiceResult<RepositoryIssueItem | null>> {
const owner: RepoOwnerName = RepoOwnerName.parse(fullName);
if (owner.owner.length === 0 || owner.name.length === 0) {
return new Repos... | https://github.com/CarGuo/GSYGithubAppOH | 33813c27ad593ce507352a5478b1c08dea7a5658 | github |
openharmony/codelabs | Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets | arkts | initAvSession | Initializing the playback control center.
@param context Context. | public static initAvSession(playBarModel: PlayBarModel) {
return new Promise<string>(async () => {
try {
// Sets the current music metadata.
let metadata = {
assetId: playBarModel!.musicItem!.id.toString(),
title: playBarModel!.musicItem!.name,
artist: playBarMo... | 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 initAvSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left playBarModel AST#identifier#Right AST#:#L... | public static initAvSession(playBarModel: PlayBarModel) {
return new Promise<string>(async () => {
try {
// Sets the current music metadata.
let metadata = {
assetId: playBarModel!.musicItem!.id.toString(),
title: playBarModel!.musicItem!.name,
artist: playBarMo... | https://gitee.com/openharmony/codelabs.git | 4b8ec7bb5a2c150e38b0c50744cde44424c36cff | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | canZoomOutMoreY | Returns true if the chart is not yet fully zoomed out on the y-axis
@return | public canZoomOutMoreY(): boolean {
return this.mScaleY > this.mMinScaleY;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left canZoomOutMoreY 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 A... | public canZoomOutMoreY(): boolean {
return this.mScaleY > this.mMinScaleY;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7aa4c7e68124bef4d6f782322df846d452fb6e22 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AirConditionerController.ets | arkts | subscribeStatusChange | 订阅设备状态变化 | public subscribeStatusChange(deviceId: string, callback: (status: DeviceStatus) => void): string {
const callbacks = this.subscribers.get(deviceId) || [];
callbacks.push(callback);
this.subscribers.set(deviceId, callbacks);
const subscriptionId = `ac_${deviceId}_${Date.now()}`;
console.log(`AirCo... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left subscribeStatusChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , A... | public subscribeStatusChange(deviceId: string, callback: (status: DeviceStatus) => void): string {
const callbacks = this.subscribers.get(deviceId) || [];
callbacks.push(callback);
this.subscribers.set(deviceId, callbacks);
const subscriptionId = `ac_${deviceId}_${Date.now()}`;
console.log(`AirCo... | https://github.com/LJ666-ui/harmony-health-care | 7323637971987401e1efaf7b71533fc8040691c5 | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F002_state_management/entry/src/main/ets/utils/StateManager.ets | arkts | syncValue | 同步状态值(用于 @Link 场景)
@param sourceValue 源值
@param targetValue 目标值
@returns 同步后的值 | static syncValue<T>(sourceValue: T, targetValue: T): T {
return sourceValue;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left syncValue 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 ( AST#(#Rig... | static syncValue<T>(sourceValue: T, targetValue: T): T {
return sourceValue;
} | https://github.com/mqxu/HarmonyOS_In_Action | f5e9a5ef405731a31043e3e9cadcf6602c98bc13 | github |
openharmony/app_samples | ETSUI/Gallery/entry/src/main/ets/MainAbility/common/components/getColor.ets | arkts | rgbToHex | rgb2hex | rgbToHex(rgb) {
let arr = rgb.split(/\D+/);
let r = arr[1]
let g = arr[2]
let b = arr[3]
return '#' + ((r << 16) | (g << 8) | b).toString(16)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left rgbToHex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rgb AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_... | rgbToHex(rgb) {
let arr = rgb.split(/\D+/);
let r = arr[1]
let g = arr[2]
let b = arr[3]
return '#' + ((r << 16) | (g << 8) | b).toString(16)
} | https://gitee.com/openharmony/app_samples.git | 04a6baa65ff41e7839454e80e33e1f6b95a6768c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | hexDecode | Hex解码 | hexDecode(hex: string): string {
let str = '';
for (let i = 0; i < hex.length; i += 2) {
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
}
return str;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hexDecode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#... | hexDecode(hex: string): string {
let str = '';
for (let i = 0; i < hex.length; i += 2) {
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
}
return str;
} | https://github.com/DaLongZhuaZi/manxia | e165d2ff9af61193093b67b73fec08b66cda9f0d | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/pbr_emissive.ets | arkts | setEmissiveChannel | Adjust a single channel of the emissive factor (RGBA) | setEmissiveChannel(idx: number, v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).emissive.factor;
if (idx === 0) { f.x = v / RESO; }
if (idx === 1) { f.y = v / RESO; }
if (idx === 2) { f.z = v / RESO; }
if (idx === 3) { f.w = v / RESO; }
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setEmissiveChannel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left idx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#R... | setEmissiveChannel(idx: number, v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).emissive.factor;
if (idx === 0) { f.x = v / RESO; }
if (idx === 1) { f.y = v / RESO; }
if (idx === 2) { f.z = v / RESO; }
if (idx === 3) { f.w = v / RESO; }
... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 44679668f3ba08ba0b5593aea6510656d4d22748 | gitcode |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/AvPlayManager.ets | arkts | videoSpeedOnePointSeventyFive | 调节1.75倍速 | videoSpeedOnePointSeventyFive(): void {
if (this.avPlayer) {
try {
this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_75_X);
Logger.info(this.tag, 'videoSpeed_1_75');
} catch (e) {
Logger.info(this.tag, `videoSpeed_1_75 err :` + JSON.stringify(e));
}
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left videoSpeedOnePointSeventyFive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#un... | videoSpeedOnePointSeventyFive(): void {
if (this.avPlayer) {
try {
this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_75_X);
Logger.info(this.tag, 'videoSpeed_1_75');
} catch (e) {
Logger.info(this.tag, `videoSpeed_1_75 err :` + JSON.stringify(e));
}
}
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 87cf661c1a28fe6b073e53293f340ab3ad84f8bc | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/AppColors.ets | arkts | shadow | ==================== 阴影 ==================== | static get shadow(): string { return getColorForCurrentTheme(ColorRole.SHADOW); } | 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 shadow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | static get shadow(): string { return getColorForCurrentTheme(ColorRole.SHADOW); } | https://github.com/DaLongZhuaZi/manxia | 99cf246e9432793460bf2249005610ebcdc4a8d9 | github |
openharmony/applications_photos | common/src/main/ets/default/model/common/WorkerThreadPool.ets | arkts | run | 执行workerList中的worker
@param path worker.ts文件路径
@param data 处理的数据
@param byteLengthOfOneGroup 需要以组为单位处理的数据,例如直方图的RGBA像素统计,一组4个字节,该值为4
@param excFunc 主线程回调函数,用于worker结果的数据汇总 | public run(path: string, data: ArrayBuffer, byteLengthOfOneGroup: number, mainThreadCallback: Function) {
Log.info(TAG, 'thread pool start running, capacity: ' + WorkerThreadPool.CAPACITY);
let groupCount = data.byteLength / byteLengthOfOneGroup;
let byteLengthOfOneWorker = Math.floor(groupCount / WorkerT... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left run AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#... | public run(path: string, data: ArrayBuffer, byteLengthOfOneGroup: number, mainThreadCallback: Function) {
Log.info(TAG, 'thread pool start running, capacity: ' + WorkerThreadPool.CAPACITY);
let groupCount = data.byteLength / byteLengthOfOneGroup;
let byteLengthOfOneWorker = Math.floor(groupCount / WorkerT... | https://gitee.com/openharmony/applications_photos.git | d231e74740731f294cc0e74470497a5468caa0b5 | gitee |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicApiClient.ets | arkts | getLocalMusicUrl | 获取本地音乐URL | private static async getLocalMusicUrl(musicInfo: MusicInfo): Promise<string> {
;
if (!musicInfo.id.startsWith('server_')) {
throw new Error('不支持的本地文件');
}
const songId = musicInfo.id.replace('server_', '');
const requestBody = JSON.stringify({ p: songId });
const encodedBody = MusicApi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getLocalMusicUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | private static async getLocalMusicUrl(musicInfo: MusicInfo): Promise<string> {
;
if (!musicInfo.id.startsWith('server_')) {
throw new Error('不支持的本地文件');
}
const songId = musicInfo.id.replace('server_', '');
const requestBody = JSON.stringify({ p: songId });
const encodedBody = MusicApi... | https://github.com/cpdd5201314/harmonyOS-music-app | 1d7650ea02d84d7ad49832a57523113e5c98e7c9 | github |
openharmony-sig/ohos_axios | entry/src/main/ets/pages/Index.ets | arkts | request | request请求 | request() {
this.clear()
this.showUrl = this.getUrl;
this.startTime = new Date().getTime();
axios.request<InfoModel, AxiosResponse<InfoModel>, IdModel>({
url: this.getUrl,
method: 'get',
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left request 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... | request() {
this.clear()
this.showUrl = this.getUrl;
this.startTime = new Date().getTime();
axios.request<InfoModel, AxiosResponse<InfoModel>, IdModel>({
url: this.getUrl,
method: 'get',
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: t... | https://gitee.com/openharmony-sig/ohos_axios.git | 60d28b8ae9f52878b0b2492f7e3ef037be413158 | gitee |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | onContentOverlayClosed | @internal, called by the exported overlay component when dismissed. | public onContentOverlayClosed(status: ContentStatus, data: Record<string, Object>): void {
this.config.logger.w('onContentOverlayClosed, content module is disabled, no-op');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onContentOverlayClosed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | public onContentOverlayClosed(status: ContentStatus, data: Record<string, Object>): void {
this.config.logger.w('onContentOverlayClosed, content module is disabled, no-op');
} | https://github.com/Countly/countly-sdk-hos | d7f2c95829af826a43ba2002e1f6102aae55e9ff | github |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertLength | LENGTH | static convertLength(value: number, from: LengthUnit, to: LengthUnit): number {
const toMeters: Record<LengthUnit, number> = {
[LengthUnit.MILLIMETER]: 0.001,
[LengthUnit.CENTIMETER]: 0.01,
[LengthUnit.METER]: 1,
[LengthUnit.KILOMETER]: 1000,
[LengthUnit.INCH]: 0.0254,
[LengthU... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | static convertLength(value: number, from: LengthUnit, to: LengthUnit): number {
const toMeters: Record<LengthUnit, number> = {
[LengthUnit.MILLIMETER]: 0.001,
[LengthUnit.CENTIMETER]: 0.01,
[LengthUnit.METER]: 1,
[LengthUnit.KILOMETER]: 1000,
[LengthUnit.INCH]: 0.0254,
[LengthU... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | a547e718b5d1c831ceaf635972ff0518bf8ec068 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleEvents.ets | arkts | recordViewEvent | Internal entry used by ModuleViews to emit `[CLY]_view` events while
forcing the event's `id` field to equal the view's id. Without this, view
start/stop events would each generate a fresh event id and the
dashboard's view-id chain (start.id == stop.id, next-view.pvid ==
previous-view.id) would break. | public async recordViewEvent(
viewId: string,
segmentation: SegmentationMap | null,
dur: number
): Promise<void> {
await this.recordEventAt('[CLY]_view', segmentation, 1, 0, dur, this.config.clock.nowMs(), viewId);
} | 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 recordViewEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left viewId AST#identifier#Right AST#:#Left :... | public async recordViewEvent(
viewId: string,
segmentation: SegmentationMap | null,
dur: number
): Promise<void> {
await this.recordEventAt('[CLY]_view', segmentation, 1, 0, dur, this.config.clock.nowMs(), viewId);
} | https://github.com/Countly/countly-sdk-hos | e7374965b6307228fb0680752021ebc86be741b4 | github |
honjow/Next2V | shared/src/main/ets/settings/AccountStore.ets | arkts | applyActiveAccountId | Single chokepoint for the active-account-id AppStorage write: dual-write the V1 key (V1
@StorageLink readers) AND the V2 mirror (read/@Monitor by @ComponentV2 AccountPage /
AccountDetailPage) so they never diverge. This only reflects WHICH account is active; the
switch/remove/restore state machine above still owns the ... | private static applyActiveAccountId(id: string): void {
setAppStorageValue<string>(StorageKeys.ACTIVE_ACCOUNT_ID, id)
connectActiveAccount().id = id
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left applyActiveAccountId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#L... | private static applyActiveAccountId(id: string): void {
setAppStorageValue<string>(StorageKeys.ACTIVE_ACCOUNT_ID, id)
connectActiveAccount().id = id
} | https://github.com/honjow/Next2V | fd8759a6ecba4c21214008e5cb4a57cd76acd3c1 | github |
richshaw2015/nds | ohos/entry/src/test/ThemeManager.test.ets | arkts | getRandomThemeId | 随机选择一个主题 ID
@returns 随机的 NDSThemeId | function getRandomThemeId(): NDSThemeId {
const themeIds = getAllThemeIds();
const randomIndex = Math.floor(Math.random() * themeIds.length);
return themeIds[randomIndex];
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getRandomThemeId 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#type_ident... | function getRandomThemeId(): NDSThemeId {
const themeIds = getAllThemeIds();
const randomIndex = Math.floor(Math.random() * themeIds.length);
return themeIds[randomIndex];
} | https://github.com/richshaw2015/nds | 6bd0766394083844a6aca7543a97c7841e7524da | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | setUrl | 用于设置播放的 URL。
@param url - 要播放的资源 URL。 | async setUrl(url: string) {
const avPlayer = await this.init();
avPlayer.url = url;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | async setUrl(url: string) {
const avPlayer = await this.init();
avPlayer.url = url;
} | https://github.com/yangyongzhen/hmmovie | 2b201ea35a96613a28e28f3c1421e3f8c5762dec | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/NdsRomCache.ets | arkts | cacheRom | 缓存 ROM 文件
@param romUri ROM 的 URI
@param romExtractor ROM 提取器 | cacheRom(romUri: string, romExtractor: RomExtractor): void {
const cacheDir = this.getCacheDir();
if (!cacheDir) {
throw new Error('Cache directory not available - download directory not initialized');
}
// 确保缓存目录存在
try {
const stat = fileIo.statSync(cacheDir);
if (!stat.isDirec... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cacheRom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left romUri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#... | cacheRom(romUri: string, romExtractor: RomExtractor): void {
const cacheDir = this.getCacheDir();
if (!cacheDir) {
throw new Error('Cache directory not available - download directory not initialized');
}
// 确保缓存目录存在
try {
const stat = fileIo.statSync(cacheDir);
if (!stat.isDirec... | https://github.com/richshaw2015/nds | 5447da14f70b983c5c34b801f81466495cb92c28 | github |
openharmony/applications_contacts | feature/call/src/main/ets/missedcall/MissedCallService.ets | arkts | cancelMissedNotificationAction | cancelMissedNotificationAction
@param data MissedCallNotifyData need cancel notify | public async cancelMissedNotificationAction(data: MissedCallNotifyData) {
HiLog.i(TAG, `cancelMissedNotificationAction, ${JSON.stringify(data)}`);
MissedCallNotifier.getInstance().cancelNotificationById(Number(data.id), Number(data.count));
CallLogRepository.getInstance().markMissedCallLogAsRead(data.phon... | 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 cancelMissedNotificationAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right... | public async cancelMissedNotificationAction(data: MissedCallNotifyData) {
HiLog.i(TAG, `cancelMissedNotificationAction, ${JSON.stringify(data)}`);
MissedCallNotifier.getInstance().cancelNotificationById(Number(data.id), Number(data.count));
CallLogRepository.getInstance().markMissedCallLogAsRead(data.phon... | https://gitee.com/openharmony/applications_contacts.git | 0f80128b2684b09f94cabcdb613c6358da316bfa | gitee |
the-wwyang/kids-learning-app | src/main/ets/utils/ArrayUtils.ets | arkts | randomPick | 从数组中随机选择一个元素
@param array 原数组
@returns 随机选中的元素,如果数组为空则返回 undefined
@example
ArrayUtils.randomPick([1, 2, 3]) // 2 (随机返回一个) | static randomPick<T>(array: T[]): T | undefined {
if (array.length === 0) {
return undefined;
}
const randomIndex = Math.floor(Math.random() * array.length);
return array[randomIndex];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left randomPick 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 ( AST#(#Ri... | static randomPick<T>(array: T[]): T | undefined {
if (array.length === 0) {
return undefined;
}
const randomIndex = Math.floor(Math.random() * array.length);
return array[randomIndex];
} | https://github.com/the-wwyang/kids-learning-app | 3d7c8f0de86d96f714f4f39bc23a4c9d19e3fa93 | github |
2763981847/Clock-Alarm | entry/src/main/ets/pages/DetailPage.ets | arkts | initData | 初始化页面数据 | initData() {
this.repeatSettingArr = [
new AlarmSettingItem(DetailConstants.DEFAULT_STRING_REPEAT,
this.alarmItem.repeatType,
AlarmSettingTypes.REPEAT)
];
this.alarmSettingInfoArr = [
new AlarmSettingItem(DetailConstants.DEFAULT_STRING_ALARM_NAME, this.alarmItem.name, AlarmSett... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initData 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 AS... | initData() {
this.repeatSettingArr = [
new AlarmSettingItem(DetailConstants.DEFAULT_STRING_REPEAT,
this.alarmItem.repeatType,
AlarmSettingTypes.REPEAT)
];
this.alarmSettingInfoArr = [
new AlarmSettingItem(DetailConstants.DEFAULT_STRING_ALARM_NAME, this.alarmItem.name, AlarmSett... | https://github.com/2763981847/Clock-Alarm | 7ae1cab36ace4601946f5eb51ed53c3fe65113e9 | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/services/BiometricService.ets | arkts | authenticate | 发起认证
@param context UIAbilityContext,用于解析资源字符串
@returns Promise<boolean> 认证成功返回 true | async authenticate(context: common.Context): Promise<boolean> { // ✅ 新增 context 参数
return new Promise((resolve) => {
try {
const challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
const authParam: userAuth.AuthParam = {
challenge: challenge,
authType: [userAuth.UserAu... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left authenticate AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async authenticate(context: common.Context): Promise<boolean> { // ✅ 新增 context 参数
return new Promise((resolve) => {
try {
const challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
const authParam: userAuth.AuthParam = {
challenge: challenge,
authType: [userAuth.UserAu... | https://gitcode.com/openharmony/codelabs | 41435c0ebb66fc151719afc1416a35597c8fdb1f | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/User.ets | arkts | formattedTimeRead | 格式化阅读时间 | get formattedTimeRead(): string {
const hours: number = Math.floor(this.timeRead / 3600);
if (hours > 0) {
return `${hours}h`;
}
const minutes: number = Math.floor(this.timeRead / 60);
return `${minutes}m`;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left formattedTimeRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string... | get formattedTimeRead(): string {
const hours: number = Math.floor(this.timeRead / 3600);
if (hours > 0) {
return `${hours}h`;
}
const minutes: number = Math.floor(this.timeRead / 60);
return `${minutes}m`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 47a2d2a431a9a4208af139f90856397daf7c3060 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | handleDiscoveredComputer | ═══════════════════════════════════════════════════════════
mDNS 发现
═══════════════════════════════════════════════════════════
处理 mDNS 发现的电脑 | private async handleDiscoveredComputer(discovered: DiscoveredComputer): Promise<void> {
console.info(`ComputerManager: mDNS 发现 ${discovered.name} @ ${discovered.address}:${discovered.port}`);
const existing = this.findComputerByAddress(discovered.address);
if (existing) {
this.mergeDiscoveredInfo(... | 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 handleDiscoveredComputer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left discovered AST#identifier#Ri... | private async handleDiscoveredComputer(discovered: DiscoveredComputer): Promise<void> {
console.info(`ComputerManager: mDNS 发现 ${discovered.name} @ ${discovered.address}:${discovered.port}`);
const existing = this.findComputerByAddress(discovered.address);
if (existing) {
this.mergeDiscoveredInfo(... | https://github.com/AlkaidLab/moonlight-harmony | 4fce010ceda23bda1323860a2d2e7f2b32578f86 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | constructor | constructor() creates a default Char object.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.value = c'\u0000';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.value = c'\u0000';
} | https://gitcode.com/iop123123/arkts-static-skills | 94c9fc4a8348341a70eec7ee80214553ced30a4a | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | floor | Return a new Decimal whose value is `n` round to an integer using `ROUND_FLOOR`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type | static floor(n: Value): Decimal {
return new Decimal(n).floor();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left floor AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | static floor(n: Value): Decimal {
return new Decimal(n).floor();
} | https://gitcode.com/iop123123/arkts-static-skills | 0adcc9e3e9ebfa0bc334789a4df766dfcda1716a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets | arkts | setTimeout | 托管的 setTimeout
@param callback 回调函数
@param delay 延迟时间(毫秒)
@returns 定时器 ID | setTimeout(callback: Function, delay: number = 0): number {
this.checkDestroyed('setTimeout');
this.checkTimerLimit();
const timerId = ++this.timerIdCounter;
const actualTimerId = setTimeout(() => {
this.timers.delete(timerId);
if (!this.isDestroyed) {
try {
callback... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#,#Left ... | setTimeout(callback: Function, delay: number = 0): number {
this.checkDestroyed('setTimeout');
this.checkTimerLimit();
const timerId = ++this.timerIdCounter;
const actualTimerId = setTimeout(() => {
this.timers.delete(timerId);
if (!this.isDestroyed) {
try {
callback... | https://github.com/DaLongZhuaZi/manxia | 4b45a8e96452e212d673826866a7cfa009bf4e3d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getSelfElement | 获取自身元素 | private getSelfElement(element: string, tag: string): string[] {
if (tag === '*') return [element];
const elementTag = this.getTagName(element);
return elementTag === tag ? [element] : [];
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSelfElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | private getSelfElement(element: string, tag: string): string[] {
if (tag === '*') return [element];
const elementTag = this.getTagName(element);
return elementTag === tag ? [element] : [];
} | https://github.com/DaLongZhuaZi/manxia | 6a23f66e5e27d108f07e72221c73dbe6ffbdd7a0 | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | setBackgroundMode | 设置背景显示模式 | static setBackgroundMode(mode: number): boolean {
return MelonDSNative.native.setBackgroundMode(mode);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setBackgroundMode 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#Lef... | static setBackgroundMode(mode: number): boolean {
return MelonDSNative.native.setBackgroundMode(mode);
} | https://github.com/richshaw2015/nds | 39c898a3d8b877f881dcdb00735b859602deee96 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | like | 单个字段的模糊匹配条件
@param field 字段
@param value 值
@returns Wrapper | like(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} like ?`)
this.valueList.push(value)
}
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left like AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig... | like(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} like ?`)
this.valueList.push(value)
}
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L188-L194 | 1d5d465ee04461d9101792de9c123faf3186b4c1 | github |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/pages/Index.ets | arkts | aboutToDisappear | 首页离开时注销账单刷新监听,避免重复注册。 | aboutToDisappear(): void {
if (this.billSyncListenerId >= 0) {
billSyncController.unregister(this.billSyncListenerId)
this.billSyncListenerId = -1
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
if (this.billSyncListenerId >= 0) {
billSyncController.unregister(this.billSyncListenerId)
this.billSyncListenerId = -1
}
} | https://github.com/ZestBox-18/kitebook-frontend | 7e59bf02ce4ef8df752c7c1308055a49cdc89706 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | startTimers | 启动定时任务 | private startTimers(): void {
if (this.config.enableAutoBackup && !this.backupTimer) {
this.backupTimer = setInterval(() => {
this.backupData().catch((error: BusinessError) => {
logger.error(TAG, '自动备份失败', String(error));
});
}, this.config.backupInterval);
}
if (thi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startTimers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void... | private startTimers(): void {
if (this.config.enableAutoBackup && !this.backupTimer) {
this.backupTimer = setInterval(() => {
this.backupData().catch((error: BusinessError) => {
logger.error(TAG, '自动备份失败', String(error));
});
}, this.config.backupInterval);
}
if (thi... | https://github.com/DaLongZhuaZi/manxia | 99f5593a67bf2257a395f2e4cad5ccc96beddca6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/NotificationManager.ets | arkts | sendPdfImportCompleteNotification | 发送 PDF 导入完成通知 | public async sendPdfImportCompleteNotification(
taskId: string,
fileName: string
): Promise<boolean> {
const config: NotificationConfig = {
id: this.getNotificationId(taskId),
title: 'PDF导入完成',
text: fileName,
type: NotificationType.PDF_IMPORT_COMPLETE
};
return this.send... | 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 sendPdfImportCompleteNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#... | public async sendPdfImportCompleteNotification(
taskId: string,
fileName: string
): Promise<boolean> {
const config: NotificationConfig = {
id: this.getNotificationId(taskId),
title: 'PDF导入完成',
text: fileName,
type: NotificationType.PDF_IMPORT_COMPLETE
};
return this.send... | https://github.com/DaLongZhuaZi/manxia | afa7111cfd4f7a28b6c51f668b2a526bd910df29 | github |
wuba/omni-ui | omni_component/src/main/ets/components/step/OmniSteps.ets | arkts | _getIndexIcon | 获取未开始的index步骤 | _getIndexIcon(index: number) {
if (index != 0) {
return $r(`app.media.icon_step_${index + 1}`)
}
return this.horizontalStepsStyle.doingIcon
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left _getIndexIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ... | _getIndexIcon(index: number) {
if (index != 0) {
return $r(`app.media.icon_step_${index + 1}`)
}
return this.horizontalStepsStyle.doingIcon
} | https://github.com/wuba/omni-ui | c3ebc6a0fce9ca73a68d7527cbf713276856a1de | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/ThemeManager.ets | arkts | addListener | 添加主题变更监听器
@param listener 监听器回调函数 | public addListener(listener: (theme: NDSTheme) => void): void {
this.listeners.add(listener);
console.info(`${TAG} Listener added, total: ${this.listeners.size}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#argument... | public addListener(listener: (theme: NDSTheme) => void): void {
this.listeners.add(listener);
console.info(`${TAG} Listener added, total: ${this.listeners.size}`);
} | https://github.com/richshaw2015/nds | 60e07b130fb4f5ce901bcf2a8bb42dce5481858d | github |
SMAT-Lab/HapRepair | data/pairs/problem_code/hp-arkui-no-func-as-arg-for-reusable-component_232.ets | arkts | calculatePrice | 模拟一个耗时的价格计算函数 | calculatePrice(productName: string): number {
let price = 0;
for (let i = 0; i < 100000; i++) {
price += i;
}
return price;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculatePrice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | calculatePrice(productName: string): number {
let price = 0;
for (let i = 0; i < 100000; i++) {
price += i;
}
return price;
} | https://github.com/SMAT-Lab/HapRepair | d4e299fb09cb07b8399b611ec40ae8ff21749fbe | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | getAbrCapabilities | ---------------------------------------------------------------------------
智能码率 (ABR) API
---------------------------------------------------------------------------
查询服务端 ABR 能力 | async getAbrCapabilities(): Promise<AbrCapabilities> {
try {
const baseUrl = await this.getHttpsBaseUrl();
const url = `${baseUrl}/api/abr/capabilities`;
const response = await this.doRequest(url, { useClientCert: true });
return JSON.parse(response) as AbrCapabilities;
} catch {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAbrCapabilities 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 getAbrCapabilities(): Promise<AbrCapabilities> {
try {
const baseUrl = await this.getHttpsBaseUrl();
const url = `${baseUrl}/api/abr/capabilities`;
const response = await this.doRequest(url, { useClientCert: true });
return JSON.parse(response) as AbrCapabilities;
} catch {
... | https://github.com/AlkaidLab/moonlight-harmony | bf493c0d956a7c80712ddf75b43549f72ecfca7a | github |
HarmonyOS_Samples/sample_in_harmonyos | products/pc/src/main/ets/uiextensionability/pages/Index.ets | arkts | build | [Start overflow] | build() {
Stack({ alignContent: Alignment.BottomStart }) {
RelativeContainer() {
// [StartExclude overflow]
Image($r('app.media.Fluffy_BG'))
.height(`100%`)
.borderRadius(this.formRadius)
Image($r(`app.media.${this.fluffyImage}`))
.objectFit(ImageFit.Fi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack({ alignContent: Alignment.BottomStart }) {
RelativeContainer() {
// [StartExclude overflow]
Image($r('app.media.Fluffy_BG'))
.height(`100%`)
.borderRadius(this.formRadius)
Image($r(`app.media.${this.fluffyImage}`))
.objectFit(ImageFit.Fi... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | f1de38672ff8f820e77e2e7d9171f33a124f8b07 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AccountDAO.ets | arkts | restore | 恢复软删除账户 - 使用 DAOHelper 统一方法 | static async restore(accountId: number): Promise<void> {
await DAOHelper.restore('accounts', 'account_id', accountId, '[AccountDAO]');
} | 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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accountId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async restore(accountId: number): Promise<void> {
await DAOHelper.restore('accounts', 'account_id', accountId, '[AccountDAO]');
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 04359f8fa817be86e38dba60a95d35dea0ecac64 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | checkNotCreated | Functions that verifies that this can be modified | protected checkNotCreated(): void throws {
if (this.typ != null) throw new TypeAPICreateException("type already created, no modifications allowed")
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left checkNotCreated 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#unary_express... | protected checkNotCreated(): void throws {
if (this.typ != null) throw new TypeAPICreateException("type already created, no modifications allowed")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cbd2712b2b16f0c60f3bd24bec245b23d59b7b20 | gitee |
OHPG/FinSdk | jellyfin/src/main/ets/api/UserLibraryApi.ets | arkts | deleteUserItemRating | deleteUserItemRating
@summary Deletes a user\'s saved personal rating for an item.
@param {UserLibraryApiDeleteUserItemRatingRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UserLibraryApi | public async deleteUserItemRating(requestParameters: UserLibraryApiDeleteUserItemRatingRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.delete({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 deleteUserItemRating AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Ri... | public async deleteUserItemRating(requestParameters: UserLibraryApiDeleteUserItemRatingRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.delete({path: `/UserItems/${requestParameters.itemId}/Rating`, parameters: requestParameters, excludeParams: ['itemId']})... | https://github.com/OHPG/FinSdk | 42af5b41877355f7fa81d52d98d1c3bf3708c8c1 | github |
HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | entry/src/main/ets/utils/Logger.ets | arkts | constructor | Constructor.
@param prefix Identifies the log tag.
@param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF | constructor(prefix: string, domain: number) {
this.prefix = prefix;
this.domain = domain;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right... | constructor(prefix: string, domain: number) {
this.prefix = prefix;
this.domain = domain;
} | https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | df6ea3076dcb826ad1645fb847ec3c8eefb63e48 | gitcode |
openharmony-sig/knowledge_demo_entainment | FA/weather-forecast/entry/src/main/ets/pages/view/SideBarContent.ets | arkts | calculatePoint | 点位置计算 | calculatePoint() {
if (this.weatherUiModel.hourlyTemp.length > 0) {
for (var i = 0; i < 5; i++) {
let tempArg = parseInt(this.weatherUiModel.hourlyTemp[0].temp)
if (i == 0) {
this.pointArr[i] = this.lineHeight - tempArg
} else {
this.pointArr[i] = this.lineHeight ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calculatePoint 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... | calculatePoint() {
if (this.weatherUiModel.hourlyTemp.length > 0) {
for (var i = 0; i < 5; i++) {
let tempArg = parseInt(this.weatherUiModel.hourlyTemp[0].temp)
if (i == 0) {
this.pointArr[i] = this.lineHeight - tempArg
} else {
this.pointArr[i] = this.lineHeight ... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 5dcc7f7fa531937113c5ecdfcfca3a7d92f8ed31 | gitee |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/GestureUtils.ets | arkts | shouldTriggerSwipe | 判断是否应该触发滑动
@param state - 手势状态
@param threshold - 滑动阈值
@returns 是否应该滑动 | static shouldTriggerSwipe(state: GestureState, threshold: number): boolean {
const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY);
return distance >= threshold;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left shouldTriggerSwipe 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#L... | static shouldTriggerSwipe(state: GestureState, threshold: number): boolean {
const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY);
return distance >= threshold;
} | https://github.com/kumaleap/ArkSwipeDeck | 0ce64c41c26f74d0b9a325db0f3a1b6d4ba27b65 | github |
the-wwyang/kids-learning-app | src/main/ets/services/ScoreService.ets | arkts | checkLevelUp | 检查是否升级 | public checkLevelUp(oldExp: number, newExp: number): boolean {
const oldLevel = this.calculateLevel(oldExp);
const newLevel = this.calculateLevel(newExp);
return newLevel > oldLevel;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left checkLevelUp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left oldExp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | public checkLevelUp(oldExp: number, newExp: number): boolean {
const oldLevel = this.calculateLevel(oldExp);
const newLevel = this.calculateLevel(newExp);
return newLevel > oldLevel;
} | https://github.com/the-wwyang/kids-learning-app | 9d5b6373768f135b42471bbc409b6a55d0d97a02 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | setMinimumScaleX | Sets the minimum scale factor for the x-axis
@param xScale | public setMinimumScaleX(xScale: number) {
if (xScale < 1)
xScale = 1;
this.mMinScaleX = xScale;
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 setMinimumScaleX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xScale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setMinimumScaleX(xScale: number) {
if (xScale < 1)
xScale = 1;
this.mMinScaleX = xScale;
this.limitTransAndScale(this.mMatrixTouch, this.mContentRect);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f1b8382e37e5642e37867866f1816b856df2edc6 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setFullYear | Sets the full year for a specified date according to local time.
@param { int } value new year
@param { int } month new month
@param { int } date new date
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setFullYear(value: int, month: int, date: int): long {
this.setFullYear(value);
this.setMonth(month);
this.setDate(date);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFullYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public setFullYear(value: int, month: int, date: int): long {
this.setFullYear(value);
this.setMonth(month);
this.setDate(date);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | 9018235241cd427f685a128095426704b9e67b94 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/StateManagement/entry/src/main/ets/segment/segment8.ets | arkts | isCollected | 3.Calculate whether the current article is favorite or not according to the favorite information array | isCollected(): boolean {
return this.collectedIds.some((id: string) => id === this.articleItem.id);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCollected 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#stateme... | isCollected(): boolean {
return this.collectedIds.some((id: string) => id === this.articleItem.id);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | e9078b1ec08dbecb0eb547ddb1e8e66c5fc66282 | gitcode |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/JMap.ets | arkts | containsObj | 判断MAP中是否含有指定VALUE的元素 | containsObj(_key:T1,_value:T2):boolean {
let bln = false;
try {
for (let i = 0; i < this.elements.length; i++) {
if (this.elements[i].value == _value && this.elements[i].key == _key) {
bln = true;
}
}
} catch (e) {
bln = false;
}
return bln;
}; | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left containsObj AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T1 AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#R... | containsObj(_key:T1,_value:T2):boolean {
let bln = false;
try {
for (let i = 0; i < this.elements.length; i++) {
if (this.elements[i].value == _value && this.elements[i].key == _key) {
bln = true;
}
}
} catch (e) {
bln = false;
}
return bln;
}; | https://gitee.com/openharmony-sig/commons-cli.git | e35b4e04c954771e3e1fc27f4925ac6ce3cf448a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | toggleEBookPrivacy | 切换电子书的隐私状态 | private async toggleEBookPrivacy(bookId: string, isPrivate: boolean): Promise<void> {
try {
logger.info(TAG, `切换电子书隐私状态: ${bookId}, isPrivate=${isPrivate}`);
// 更新数据库
const dbManager = DatabaseManager.getInstance();
const sql = 'UPDATE ebook_info SET isPrivate = ? WHERE id = ?';
... | 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 toggleEBookPrivacy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#... | private async toggleEBookPrivacy(bookId: string, isPrivate: boolean): Promise<void> {
try {
logger.info(TAG, `切换电子书隐私状态: ${bookId}, isPrivate=${isPrivate}`);
// 更新数据库
const dbManager = DatabaseManager.getInstance();
const sql = 'UPDATE ebook_info SET isPrivate = ? WHERE id = ?';
... | https://github.com/DaLongZhuaZi/manxia | 937fddba6db989ceee06fe6be36fb0ca0abc5c4f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartBudgetService.ets | arkts | generateForecasts | 生成预测结果 | private static generateForecasts(
historicalData: CategoryHistoricalData[],
config: ForecastEngineConfig,
targetMonth: string
): ForecastResult[] {
const forecasts: ForecastResult[] = [];
for (const data of historicalData) {
if (data.monthlyAmounts.length === 0) {
continue;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left generateForecasts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left historicalData AST#identifier#Righ... | private static generateForecasts(
historicalData: CategoryHistoricalData[],
config: ForecastEngineConfig,
targetMonth: string
): ForecastResult[] {
const forecasts: ForecastResult[] = [];
for (const data of historicalData) {
if (data.monthlyAmounts.length === 0) {
continue;
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 75ce8f338558fce4a59e02799d47750405da511f | github |
Explore-In-HMOS-Wearable/currency-converter | entry/src/main/ets/viewmodel/CurrencyViewModel.ets | arkts | searchCurrency | Search for currencies by name or code | searchCurrency(query: string): CurrencyData[] {
if (!query || query.trim() === '') {
return this.allCurrencyData;
}
const searchQuery = query.toLowerCase().trim();
return this.allCurrencyData.filter(currency =>
currency.name.toLowerCase().includes(searchQuery) ||
currency.code.toLowerC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchCurrency 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#identifier#Left string AST#identifier#Rig... | searchCurrency(query: string): CurrencyData[] {
if (!query || query.trim() === '') {
return this.allCurrencyData;
}
const searchQuery = query.toLowerCase().trim();
return this.allCurrencyData.filter(currency =>
currency.name.toLowerCase().includes(searchQuery) ||
currency.code.toLowerC... | https://github.com/Explore-In-HMOS-Wearable/currency-converter | a3e9a2f63530e6825d4d01d2c72da9b4ea86ca3f | github |
fbinba3955/Flymby | common/src/main/ets/utils/DateUtil.ets | arkts | isYesterday | 判断是否为昨天
@param timestamp 时间戳
@returns 是否为昨天 | static isYesterday(timestamp: number): boolean {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const targetDate = new Date(timestamp);
return yesterday.getFullYear() === targetDate.getFullYear() &&
yesterday.getMonth() === targetDate.getMonth() &&
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isYesterday 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#number#R... | static isYesterday(timestamp: number): boolean {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const targetDate = new Date(timestamp);
return yesterday.getFullYear() === targetDate.getFullYear() &&
yesterday.getMonth() === targetDate.getMonth() &&
... | https://github.com/fbinba3955/Flymby | 3ee63070e0311283efd8e24fcd8e902bcace43d3 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | clear | Clears all elements from the list. | public clear(): void {
this.buffer.clear();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public clear(): void {
this.buffer.clear();
} | https://gitcode.com/iop123123/arkts-static-skills | 4d47278142a52d710cd2cfb10103ce9904ecd7e2 | gitcode |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/MainViewMdoel.ets | arkts | initMyProfile | 初始化登录用户的资料 | initMyProfile() {
console.log('MainViewModel: initMyProfile')
//网络请求获取profile数据
Request.getInstance().getRequest(this, UserAPI.GetAuthorizedProfile(), [], {
//错误回调函数
onError() {
},
//成功回调函数
onSuccess(viewModel, result) {
console.info('Http result:' + result)
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initMyProfile 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... | initMyProfile() {
console.log('MainViewModel: initMyProfile')
//网络请求获取profile数据
Request.getInstance().getRequest(this, UserAPI.GetAuthorizedProfile(), [], {
//错误回调函数
onError() {
},
//成功回调函数
onSuccess(viewModel, result) {
console.info('Http result:' + result)
... | https://gitee.com/openharmony-sig/online_event.git | 232cd197bc7e7ea16254e22c48d825a54954426c | gitee |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/AuthRepository.ets | arkts | loginByPassword | 密码登录
@param params 登录参数,包含用户名、密码等
@returns 包含认证信息的网络响应 | async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.loginByPassword(params);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginByPassword AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.loginByPassword(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | ee2456f9f0d1b95e7ef92b6f9a1436a9f46df11a | github |
openharmony-sig/aki | example/ohos/2_applicationInfo/entry/src/main/ets/pages/index.ets | arkts | constructor | 接受鸿蒙 ApplicationInfo 信息进行等价类的构造 | constructor(info: bundleManager.ApplicationInfo) {
this.name = info.name;
this.descriptionId = info.descriptionId;
this.systemApp = info.systemApp;
this.permissions = info.permissions;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left bu... | constructor(info: bundleManager.ApplicationInfo) {
this.name = info.name;
this.descriptionId = info.descriptionId;
this.systemApp = info.systemApp;
this.permissions = info.permissions;
} | https://gitee.com/openharmony-sig/aki.git | 4eb03537ba6bff9b50109fee3d7a372c1a5b7719 | gitee |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | all | 静态方法:所有边距相同 | public static all(value: number): EdgeInsets {
return new EdgeInsets(value, value, value, value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left all AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#id... | public static all(value: number): EdgeInsets {
return new EdgeInsets(value, value, value, value);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L526-L528 | fb5a0ac7e8cf81af450de19b9d9d161123eccdba | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/ReminderDAO.ets | arkts | getActiveReminders | 查询活跃的提醒 | static async getActiveReminders(userId: number): Promise<Reminder[]> {
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FROM ${Reminder.tableName}
WHERE user_id = ? AND is_active = 1 AND is_deleted = 0
ORDER BY next_reminder_date ASC`;
let rs: relation... | 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 getActiveReminders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef... | static async getActiveReminders(userId: number): Promise<Reminder[]> {
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FROM ${Reminder.tableName}
WHERE user_id = ? AND is_active = 1 AND is_deleted = 0
ORDER BY next_reminder_date ASC`;
let rs: relation... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | d68dde48389ce1bfcae9b6c23264372582c1c65f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | getGrade | 根据分数确定等级 | static getGrade(score: number): string {
if (score >= 90) {
return GRADE_EXCELLENT;
}
if (score >= 75) {
return GRADE_GOOD;
}
if (score >= 60) {
return GRADE_FAIR;
}
if (score >= 40) {
return GRADE_POOR;
}
return GRADE_CRITICAL;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getGrade AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left score AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | static getGrade(score: number): string {
if (score >= 90) {
return GRADE_EXCELLENT;
}
if (score >= 75) {
return GRADE_GOOD;
}
if (score >= 60) {
return GRADE_FAIR;
}
if (score >= 40) {
return GRADE_POOR;
}
return GRADE_CRITICAL;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0ace7a5767dce14d2a8ba546e07c9ef040a65485 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/types/ExportTypes.ets | arkts | toString | 转换为字符串
@returns 错误的字符串表示 | toString(): string {
return `${this.name} [${this.code}]: ${this.message}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | toString(): string {
return `${this.name} [${this.code}]: ${this.message}`;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 80e672cd46205717d29a1553ee75944ce53bd86e | github |
YANGZX22/Voot | entry/src/main/ets/services/ModelDownloadService.ets | arkts | getModelDir | 获取模型目录路径 | private getModelDir(context: common.UIAbilityContext): string {
const modelInfo = ASR_MODELS[AsrModelType.SENSE_VOICE_MULTI];
return `${context.filesDir}/${modelInfo.folderName}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getModelDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_express... | private getModelDir(context: common.UIAbilityContext): string {
const modelInfo = ASR_MODELS[AsrModelType.SENSE_VOICE_MULTI];
return `${context.filesDir}/${modelInfo.folderName}`;
} | https://github.com/YANGZX22/Voot | 6b882f4996918accbcdadf41dcd0812d751046f0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | getAvailableLoadSlots | 获取需要继续加载的任务数量
@param isOnline 是否为在线漫画
@param currentLoadingCount 当前正在加载的数量
@returns 还可以加载的数量 | getAvailableLoadSlots(isOnline: boolean, currentLoadingCount: number): number {
const maxConcurrent = this.getMaxConcurrent(isOnline);
return Math.max(0, maxConcurrent - currentLoadingCount);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAvailableLoadSlots AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isOnline AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#,#L... | getAvailableLoadSlots(isOnline: boolean, currentLoadingCount: number): number {
const maxConcurrent = this.getMaxConcurrent(isOnline);
return Math.max(0, maxConcurrent - currentLoadingCount);
} | https://github.com/DaLongZhuaZi/manxia | 653d14762577af352b438ecd1be99bb400667320 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/OneDriveManager.ets | arkts | getCacheSize | 获取缓存大小 (MB) | public getCacheSize(): number {
let totalSize = 0;
for (const file of this.cachedFiles.values()) {
totalSize += file.size;
}
return totalSize / (1024 * 1024);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCacheSize 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#nu... | public getCacheSize(): number {
let totalSize = 0;
for (const file of this.cachedFiles.values()) {
totalSize += file.size;
}
return totalSize / (1024 * 1024);
} | https://github.com/AetheriumSimulator/qemu-hmos | 8f14988516016548b54f48f00d448385a5d53e41 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets | arkts | extractZipArchive | 解压ZIP归档文件 | private async extractZipArchive(zipPath: string, targetDir: string): Promise<void> {
try {
await zlib.decompressFile(zipPath, targetDir);
logger.debug(TAG, `解压ZIP归档: ${zipPath} -> ${targetDir}`);
} catch (error) {
logger.error(TAG, '解压ZIP归档失败', error);
throw error as Error;
}
} | 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 extractZipArchive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left zipPath AST#identifier#Right AST#ERROR#Left AST#:#... | private async extractZipArchive(zipPath: string, targetDir: string): Promise<void> {
try {
await zlib.decompressFile(zipPath, targetDir);
logger.debug(TAG, `解压ZIP归档: ${zipPath} -> ${targetDir}`);
} catch (error) {
logger.error(TAG, '解压ZIP归档失败', error);
throw error as Error;
}
} | https://github.com/DaLongZhuaZi/manxia | 9023f22c88ae29eafef2e319571b6bd6f914c472 | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | setCustomScreenRects | 设置自定义屏幕矩形 (来自布局编辑器, px 单位) | static setCustomScreenRects(topX: number, topY: number, topW: number, topH: number,
botX: number, botY: number, botW: number, botH: number): boolean {
return MelonDSNative.native.setCustomScreenRects(topX, topY, topW, topH, botX, botY, botW, botH);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setCustomScreenRects AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left topX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static setCustomScreenRects(topX: number, topY: number, topW: number, topH: number,
botX: number, botY: number, botW: number, botH: number): boolean {
return MelonDSNative.native.setCustomScreenRects(topX, topY, topW, topH, botX, botY, botW, botH);
} | https://github.com/richshaw2015/nds | 447487211a76be9d8561bd75facd7ce754aa78e6 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/common/ReusableDemo.ets | arkts | aboutToReuse | 通过 @Reusable 装饰的组件,从复用缓存中取出并挂载到组件树上时,会走到 aboutToReuse() 方法
如下例:
this.r 获取到的是,组件被放入到缓存之前时 r 参数的值
params.r 获取到的是,组件复用时,外部传递过来的 r 参数的值 | aboutToReuse(params: Record<string, ESObject>) {
MyLog.d(`2 aboutToReuse this.r:${this.r}, params.r:${params.r as number}`)
// 根据组件复用时,外部传递过来的 r 参数的值更新 this.r 的值
this.r = params.r as number
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToReuse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifi... | aboutToReuse(params: Record<string, ESObject>) {
MyLog.d(`2 aboutToReuse this.r:${this.r}, params.r:${params.r as number}`)
// 根据组件复用时,外部传递过来的 r 参数的值更新 this.r 的值
this.r = params.r as number
} | https://github.com/webabcd/HarmonyDemo | 5c6fd1199d25e5b642b6327f2af4d05b0a28a01c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/PieChartRenderer.ets | arkts | getSliceSpace | Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace.
@param dataSet
@return | protected getSliceSpace(dataSet: IPieDataSet): number {
let chartData = this.mChart.getData();
if (!chartData || !this.mViewPortHandler) {
return -1;
}
if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled())
return dataSet.getSliceSpace();
let spaceSizeRatio: number = dataSet.get... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getSliceSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | protected getSliceSpace(dataSet: IPieDataSet): number {
let chartData = this.mChart.getData();
if (!chartData || !this.mViewPortHandler) {
return -1;
}
if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled())
return dataSet.getSliceSpace();
let spaceSizeRatio: number = dataSet.get... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c8fd9dd377ad804b65be2751ae278de63a9e6964 | gitee |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | remove | 删除指定键并 flush
@param {string} key 键
@returns {Promise<void>} Promise<void> | async remove(key: string): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.delete(key);
await prefs.flush();
} catch (error) {
throw this.wrapError(error, `删除键 ${key} 失败`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left remove AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | async remove(key: string): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.delete(key);
await prefs.flush();
} catch (error) {
throw this.wrapError(error, `删除键 ${key} 失败`);
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | df5268bc930669542bb810b95388e717ebbf82b7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | getHistory | 获取浏览记录(需要登录) | async getHistory(page: number = 1): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法获取浏览记录');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_NOT_LOADED,
'配置未加载'
);
}
const startTime = Date.now();
logger.info(TAG, `开始获取浏览记... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getHistory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left page AST#identifier#Right AST#type... | async getHistory(page: number = 1): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法获取浏览记录');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_NOT_LOADED,
'配置未加载'
);
}
const startTime = Date.now();
logger.info(TAG, `开始获取浏览记... | https://github.com/DaLongZhuaZi/manxia | 3a0ee51b3248b7d0b391770f53fd8389100c46ba | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ai/AIOrchestrator.ets | arkts | initialize | 初始化所有AI组件 | async initialize(): Promise<void> {
console.info('[AI-Orch] 正在初始化AI统一调度层...');
try {
// 并行初始化各组件
await Promise.all([
xiaoyiSkillManager.initialize(),
mindSporeEngine.initialize(),
hiAIVisionClient.initialize()
]);
console.info('[AI-Orch] 所有AI组件初始化完成');
} c... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize 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#... | async initialize(): Promise<void> {
console.info('[AI-Orch] 正在初始化AI统一调度层...');
try {
// 并行初始化各组件
await Promise.all([
xiaoyiSkillManager.initialize(),
mindSporeEngine.initialize(),
hiAIVisionClient.initialize()
]);
console.info('[AI-Orch] 所有AI组件初始化完成');
} c... | https://github.com/LJ666-ui/harmony-health-care | d26407a784cbc9de89e14d1bcfb40103216d4942 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/DefaultParser.ets | arkts | getMatchingLongOptions | Gets a list of matching option strings for the given token, depending on the selected partial matching policy.
@param token the token (may contain leading dashes)
@return the list of matching option strings or an empty list if no matching option could be found | private getMatchingLongOptions(token: string): JList<string> {
if (this.allowPartialMatching) {
return this.options.getMatchingOptions(token);
}
let matches: JList<string> = new JList();
if (this.options.hasLongOption(token)) {
let option: CliOption | null = this.options.getOption(token);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getMatchingLongOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private getMatchingLongOptions(token: string): JList<string> {
if (this.allowPartialMatching) {
return this.options.getMatchingOptions(token);
}
let matches: JList<string> = new JList();
if (this.options.hasLongOption(token)) {
let option: CliOption | null = this.options.getOption(token);
... | https://gitee.com/openharmony-sig/commons-cli.git | 8fce753b18e8d65de7f0fae2d1e5d6814a7e0cd6 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | handleTabButtonClick | 底栏按钮点击处理:将 TabIndex 转换为实际 Tabs 组件位置
@param tabIndex TabIndex 枚举值(如 TabIndex.HOME = 0) | private handleTabButtonClick(tabIndex: number, ignoreSuppression: boolean = false): void {
try {
if (!ignoreSuppression && Date.now() < this.suppressTabClickUntil) {
this.suppressTabClickUntil = 0;
return;
}
// 触发震动反馈
this.triggerHapticFeedback();
// 将 TabIndex 转换为实际... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleTabButtonClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tabIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | private handleTabButtonClick(tabIndex: number, ignoreSuppression: boolean = false): void {
try {
if (!ignoreSuppression && Date.now() < this.suppressTabClickUntil) {
this.suppressTabClickUntil = 0;
return;
}
// 触发震动反馈
this.triggerHapticFeedback();
// 将 TabIndex 转换为实际... | https://github.com/DaLongZhuaZi/manxia | 3f04af10e9574e9e65c21846857a426415346351 | github |
HarmonyOS_Samples/HMRouter | entry/src/main/ets/component/live/CommentInput.ets | arkts | buildComment | [Start comment_node_controller] | @Builder
function buildComment(liveComments: LiveCommentsProduct[]) {
// [StartExclude comment_node_controller]
Column() {
List({ space: 16 }) {
ForEach(liveComments, (item: LiveCommentsProduct) => {
ListItem() {
Row() {
Image(item.getAvatar())
.width(50)
... | 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 buildComment AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requ... | @Builder
function buildComment(liveComments: LiveCommentsProduct[]) {
// [StartExclude comment_node_controller]
Column() {
List({ space: 16 }) {
ForEach(liveComments, (item: LiveCommentsProduct) => {
ListItem() {
Row() {
Image(item.getAvatar())
.width(50)
... | https://gitcode.com/HarmonyOS_Samples/HMRouter | ec5debf3ed280348609d13d284e36bc00608c4ca | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Workflow/WorkflowExecutor.ets | arkts | createFromConfig | 从JSON配置创建工作流 | static createFromConfig(config: Record<string, Object>): WorkflowDefinition {
const workflow: WorkflowDefinition = {
name: String(config['name'] || 'unnamed'),
description: config['description'] ? String(config['description']) : undefined,
steps: config['steps'] as WorkflowStep[] || []
};
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFromConfig 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#instantiation... | static createFromConfig(config: Record<string, Object>): WorkflowDefinition {
const workflow: WorkflowDefinition = {
name: String(config['name'] || 'unnamed'),
description: config['description'] ? String(config['description']) : undefined,
steps: config['steps'] as WorkflowStep[] || []
};
... | https://github.com/DaLongZhuaZi/manxia | c18d4bb560430e8f1f6612d78b390d9e1d9707f6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | isLargeFile | 检查文件是否为大文件(超过阈值则建议使用流式导入)
@param filePath 文件路径
@param thresholdMB 阈值(MB),默认5MB
@returns 是否为大文件 | static isLargeFile(filePath: string, thresholdMB: number = 5): boolean {
try {
const stat = SafeFileUtils.statSync(filePath);
return stat.size > thresholdMB * 1024 * 1024;
} catch (error) {
logger.warn(TAG, `检查文件大小失败: ${String(error)}`);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isLargeFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | static isLargeFile(filePath: string, thresholdMB: number = 5): boolean {
try {
const stat = SafeFileUtils.statSync(filePath);
return stat.size > thresholdMB * 1024 * 1024;
} catch (error) {
logger.warn(TAG, `检查文件大小失败: ${String(error)}`);
return false;
}
} | https://github.com/DaLongZhuaZi/manxia | 0a7264b071561798d1dcf1aca5c85bb8c4c2535b | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/AchievementService.ets | arkts | calculateConsecutiveDays | 计算连续运动天数 | private async calculateConsecutiveDays(records: SportData[]): Promise<number> {
if (records.length === 0) {
return 0;
}
// 按日期分组,获取所有有运动的日期
const dateSet = new Set<string>();
records.forEach(record => {
const date = new Date(record.startTime);
const dateKey = `${date.getFullYear... | 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 calculateConsecutiveDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right... | private async calculateConsecutiveDays(records: SportData[]): Promise<number> {
if (records.length === 0) {
return 0;
}
// 按日期分组,获取所有有运动的日期
const dateSet = new Set<string>();
records.forEach(record => {
const date = new Date(record.startTime);
const dateKey = `${date.getFullYear... | https://gitcode.com/openharmony/codelabs | 83b43a5b0b2a34617bdad2a9d150d29536cba5a3 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets | arkts | createSubWindow | 创建子窗口 | private createSubWindow(windowStage: window.WindowStage | null) {
try {
if (!windowStage) {
return;
}
if (PlatformInfo.getPlatform() === PlatformTypeEnum.HARMONYOS) {
windowStage.createSubWindow('mySubWindow', (err: BusinessError, data) => {
if (err.code) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createSubWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Le... | private createSubWindow(windowStage: window.WindowStage | null) {
try {
if (!windowStage) {
return;
}
if (PlatformInfo.getPlatform() === PlatformTypeEnum.HARMONYOS) {
windowStage.createSubWindow('mySubWindow', (err: BusinessError, data) => {
if (err.code) {
... | https://gitcode.com/arkui-x/samples | 0a0cad10d46bf6cbd89e43bef4e80f5c99a37b29 | gitcode |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/OptionGroup.ets | arkts | setRequired | @param required specifies if this group is required | public setRequired(required: boolean): void{
this.required = required;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRequired AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left required AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean... | public setRequired(required: boolean): void{
this.required = required;
} | https://gitee.com/openharmony-sig/commons-cli.git | 7319a9a0a52722a0df087d766be3e72e30af1506 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/ModelManager.ets | arkts | loadModel | 加载模型
@param imagingType 影像类型
@returns 模型对象 | async loadModel(imagingType: ImagingType): Promise<object> {
try {
// 检查缓存
const cachedModel = this.modelCache.get(imagingType);
if (cachedModel) {
console.info(`ModelManager: 使用缓存模型 ${imagingType}`);
return cachedModel;
}
// 更新状态为LOADING
this.updateModelStatus... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadModel AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imagingType AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async loadModel(imagingType: ImagingType): Promise<object> {
try {
// 检查缓存
const cachedModel = this.modelCache.get(imagingType);
if (cachedModel) {
console.info(`ModelManager: 使用缓存模型 ${imagingType}`);
return cachedModel;
}
// 更新状态为LOADING
this.updateModelStatus... | https://github.com/LJ666-ui/harmony-health-care | f7f3c40bf4de62de14b42339d9cec39b40f0e9cc | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getSharedUrl | 获取卡片图片资源
@returns | public getSharedUrl(): ResourceStr {
let imageResource = ZRouter.getParamByKey(CardUtil.KEY_IMAGE_RESOURCE) as ResourceStr;
return imageResource;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSharedUrl 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 ResourceS... | public getSharedUrl(): ResourceStr {
let imageResource = ZRouter.getParamByKey(CardUtil.KEY_IMAGE_RESOURCE) as ResourceStr;
return imageResource;
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L169-L172 | e317c9a549abc28f28f2857196eb629c451ac609 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | internal | Cleans up offheap memory for this context.
Must be called. | internal deinit(): void {
assert this.ctxPtr != 0
TypeCreatorCtx.destroyCtx(this.ctxPtr)
this.ctxPtr = 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left deinit AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#... | internal deinit(): void {
assert this.ctxPtr != 0
TypeCreatorCtx.destroyCtx(this.ctxPtr)
this.ctxPtr = 0
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a37fa22dfaf8f9381dab3bffb6eda47b29f695e5 | gitee |
openharmony-sig/fluttertpc_camerawesome | ohos/ohos/src/main/ets/components/cameraX/CameraState.ets | arkts | pauseRecordingProcess | 暂停录制对应的流程 | async pauseRecordingProcess() {
if (this.avRecorder != undefined && this.avRecorder.state === 'started') { // 仅在started状态下调用pause为合理状态切换
await this.avRecorder.pause();
await this.videoOutput!!.stop(); // 停止相机出流
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pauseRecordingProcess 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 ... | async pauseRecordingProcess() {
if (this.avRecorder != undefined && this.avRecorder.state === 'started') { // 仅在started状态下调用pause为合理状态切换
await this.avRecorder.pause();
await this.videoOutput!!.stop(); // 停止相机出流
}
} | https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git | 51dc4fa9817e941df301102196a330acd6acd461 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ViewModelMapper.ets | arkts | fromPropertyMap | 从属性值 Map 创建 EntityData
@param entityName 实体名称
@param propertyMap 属性值 Map
@returns EntityData 实例 | static fromPropertyMap(entityName: string, propertyMap: Map<string, ValueType>): EntityData {
const entityData = new EntityData(entityName)
propertyMap.forEach((value, key) => {
let propertyType = 'string'
if (typeof value === 'number') {
propertyType = 'number'
} else if (typeof val... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromPropertyMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | static fromPropertyMap(entityName: string, propertyMap: Map<string, ValueType>): EntityData {
const entityData = new EntityData(entityName)
propertyMap.forEach((value, key) => {
let propertyType = 'string'
if (typeof value === 'number') {
propertyType = 'number'
} else if (typeof val... | https://github.com/offlinecat-dev/OCNetORM | 70a7ae4a7d79b2a758f5551416ea3a75dbb80193 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | message | Sets the message of the error.
@param { string } val - New message for the Error
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | set message(val: string) {
this.message_ = val
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left message AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identif... | set message(val: string) {
this.message_ = val
} | https://gitcode.com/iop123123/arkts-static-skills | d6824558966330aecdbedd17ee2acc2142d66262 | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets | arkts | generateInitial | 生成姓名的首字母(支持中文拼音首字母) | private generateInitial(name: string): string {
if (!name || name.trim().length === 0) {
return '#';
}
const firstChar = name.trim().charAt(0);
// 处理英文字符
if (/[A-Za-z]/.test(firstChar)) {
return firstChar.toUpperCase();
}
// 处理中文字符
if (/[\u4e00-\u9fa5]/.test(firstChar)) ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateInitial AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private generateInitial(name: string): string {
if (!name || name.trim().length === 0) {
return '#';
}
const firstChar = name.trim().charAt(0);
// 处理英文字符
if (/[A-Za-z]/.test(firstChar)) {
return firstChar.toUpperCase();
}
// 处理中文字符
if (/[\u4e00-\u9fa5]/.test(firstChar)) ... | https://gitcode.com/openharmony/codelabs | d9ced4456185d7cc7fea9636f4e940f685970574 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | removeLastFound | Removes the last occurrence of the specified element.
@param element The element to remove.
@returns True if the element was removed, otherwise false. | public removeLastFound(element: T): boolean {
let currentNode: ListNode<T> | undefined = this.tail;
while (currentNode !== undefined) {
if (currentNode!.element == element) {
if (currentNode === this.head) {
this.removeByIndex(0);
r... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeLastFound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identif... | public removeLastFound(element: T): boolean {
let currentNode: ListNode<T> | undefined = this.tail;
while (currentNode !== undefined) {
if (currentNode!.element == element) {
if (currentNode === this.head) {
this.removeByIndex(0);
r... | https://gitcode.com/iop123123/arkts-static-skills | ab90fb1991cc5ad294374c0d0f0211e51c66df68 | gitcode |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicPlayerService.ets | arkts | getCurrentTime | 获取当前播放时间(毫秒) | getCurrentTime(): number {
if (this.avPlayer) {
return this.avPlayer.currentTime;
}
return 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentTime 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... | getCurrentTime(): number {
if (this.avPlayer) {
return this.avPlayer.currentTime;
}
return 0;
} | https://github.com/cpdd5201314/harmonyOS-music-app | 18eb025a2950d6d7d49552d81e79310cbc175a4b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CacheConfigManager.ets | arkts | getPreloadConfig | 获取预加载配置 | public getPreloadConfig(): PreloadConfig {
const result: PreloadConfig = {
enabled: this.config.preload.enabled,
rangeNormal: this.config.preload.rangeNormal,
rangeWebtoon: this.config.preload.rangeWebtoon,
maxConcurrent: this.config.preload.maxConcurrent
};
return result;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPreloadConfig 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 Prelo... | public getPreloadConfig(): PreloadConfig {
const result: PreloadConfig = {
enabled: this.config.preload.enabled,
rangeNormal: this.config.preload.rangeNormal,
rangeWebtoon: this.config.preload.rangeWebtoon,
maxConcurrent: this.config.preload.maxConcurrent
};
return result;
} | https://github.com/DaLongZhuaZi/manxia | c00b19b32796c5a43115b3bbb2c03cfd083eb6c7 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | exitBackgroundMode | Exit background mode (resume graphics)
Use when app comes to foreground or screen is unlocked | static exitBackgroundMode(inst: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpExitBackgroundMode(inst);
} catch (e) {
console.error(`${LibFreeRDP.TAG}: exitBackgroundMode er... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left exitBackgroundMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static exitBackgroundMode(inst: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpExitBackgroundMode(inst);
} catch (e) {
console.error(`${LibFreeRDP.TAG}: exitBackgroundMode er... | https://github.com/tangwengang-del/freerdp-harmonyos | 2e86283ca856c8330a46344b53c74feab3ddcf78 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.