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 |
|---|---|---|---|---|---|---|---|---|---|---|
xiebyapps/ClipLink | entry/src/main/ets/services/HttpClient.ets | arkts | put | PUT request | async put(path: string, data: object): Promise<void> {
console.info(`[HttpClient] PUT ${this.baseUrl}${path}`);
await this.request(path, http.RequestMethod.PUT, JSON.stringify(data));
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left put AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async put(path: string, data: object): Promise<void> {
console.info(`[HttpClient] PUT ${this.baseUrl}${path}`);
await this.request(path, http.RequestMethod.PUT, JSON.stringify(data));
} | https://github.com/xiebyapps/ClipLink | 716974482a4d1cc686b7e4c4e9998ce20eaa2b16 | github |
apap6628114/nga_oh | entry/src/main/ets/service/api/ThreadApi.ets | arkts | prefetchPostImages | 在帖子数据就绪后,提前预热所有图片的尺寸头 | function prefetchPostImages(posts: PostInfo[]): void {
if (!appStore.settings.enableImageSizePrefetch) {
return
}
let strategy: string = appStore.settings.imageLoadStrategy
if (strategy === ImageLoadStrategy.MANUAL) {
return
}
if (strategy === ImageLoadStrategy.WIFI_ONLY && !isWifiConnected()) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left prefetchPostImages AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left posts AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | function prefetchPostImages(posts: PostInfo[]): void {
if (!appStore.settings.enableImageSizePrefetch) {
return
}
let strategy: string = appStore.settings.imageLoadStrategy
if (strategy === ImageLoadStrategy.MANUAL) {
return
}
if (strategy === ImageLoadStrategy.WIFI_ONLY && !isWifiConnected()) {
... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/service/api/ThreadApi.ets#L125-L146 | fb2fc81461f73a047b51d7cec7b4402b93402eea | github |
LongLiveY96/chatcube | entry/src/main/ets/services/HttpService.ets | arkts | getBinary | 二进制 GET 请求(用于下载文件,带接收进度回调) | async getBinary(
url: string,
headers: Record<string, string>,
onProgress?: BinaryProgressCallback,
runtime?: HttpRequestRuntimeOptions
): Promise<ArrayBuffer> {
const httpRequest = http.createHttp()
let requestId = ''
const controller = runtime?.controller
if (controller !== undefi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBinary 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#:#... | async getBinary(
url: string,
headers: Record<string, string>,
onProgress?: BinaryProgressCallback,
runtime?: HttpRequestRuntimeOptions
): Promise<ArrayBuffer> {
const httpRequest = http.createHttp()
let requestId = ''
const controller = runtime?.controller
if (controller !== undefi... | https://github.com/LongLiveY96/chatcube | 899bef24056bef4ef3217fe9e6fb877b90697834 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ChineseConverter.ets | arkts | addCustomMappings | 批量添加自定义映射 | addCustomMappings(mappings: [string, string][]): void {
mappings.forEach(([simplified, traditional]) => {
this.addCustomMapping(simplified, traditional);
});
logger.info(TAG, `批量添加自定义映射: ${mappings.length}个`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addCustomMappings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#subscript_expression#Left AST#subscript_expression#Left AST#identifier#Left mappings AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#... | addCustomMappings(mappings: [string, string][]): void {
mappings.forEach(([simplified, traditional]) => {
this.addCustomMapping(simplified, traditional);
});
logger.info(TAG, `批量添加自定义映射: ${mappings.length}个`);
} | https://github.com/DaLongZhuaZi/manxia | 0d8df94fe9db27def3d35b8e044116cb20fdf5c3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | setEbookFontSize | 设置电子书阅读字体大小 | async setEbookFontSize(size: number): Promise<void> {
this.settings.ebookFontSize = Math.max(12, Math.min(32, size));
await this.saveSettings();
this.notifyFontChange(FontScene.EBOOK);
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setEbookFontSize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_par... | async setEbookFontSize(size: number): Promise<void> {
this.settings.ebookFontSize = Math.max(12, Math.min(32, size));
await this.saveSettings();
this.notifyFontChange(FontScene.EBOOK);
} | https://github.com/DaLongZhuaZi/manxia | 2ecdb764f0ea6849a74c2002f2853f9c5c3b5d00 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicSearchService.ets | arkts | searchMusic | 根据关键词搜索音乐 | async searchMusic(params: SearchParams): Promise<SearchResult> {
const keyword = params.keyword
const page = params.page || 1
const limit = params.limit || 25
const source = params.source
if (!keyword.trim()) {
const emptyResult: SearchResult = {
list: [],
total: 0,
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchMusic 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 : A... | async searchMusic(params: SearchParams): Promise<SearchResult> {
const keyword = params.keyword
const page = params.page || 1
const limit = params.limit || 25
const source = params.source
if (!keyword.trim()) {
const emptyResult: SearchResult = {
list: [],
total: 0,
... | https://github.com/cpdd5201314/harmonyOS-music-app | 1a1066ff9b07350c5468089f64774ee7d1842bab | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/ImageProcessing/ImageInterceptor.ets | arkts | setCacheEnabled | 启用/禁用缓存 | setCacheEnabled(enabled: boolean): void {
this.cacheEnabled = enabled;
logger.info(TAG, `缓存${enabled ? '已启用' : '已禁用'}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCacheEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Le... | setCacheEnabled(enabled: boolean): void {
this.cacheEnabled = enabled;
logger.info(TAG, `缓存${enabled ? '已启用' : '已禁用'}`);
} | https://github.com/DaLongZhuaZi/manxia | e0407f68c8f7d9a4f726a2268f363556a8afe081 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | setCollectInterval | 设置收集间隔 | public setCollectInterval(interval: number): void {
this.collectInterval = Math.max(500, interval); // 最小500ms
if (this.isEnabled) {
this.stopAutoCollection();
this.startAutoCollection();
}
logger.info(HIDEBUG_COLLECTOR_TAG, `收集间隔已设置为 ${this.collectInterval}ms`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCollectInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left interval AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | public setCollectInterval(interval: number): void {
this.collectInterval = Math.max(500, interval); // 最小500ms
if (this.isEnabled) {
this.stopAutoCollection();
this.startAutoCollection();
}
logger.info(HIDEBUG_COLLECTOR_TAG, `收集间隔已设置为 ${this.collectInterval}ms`);
} | https://github.com/DaLongZhuaZi/manxia | 1ee9bfd1ffe002529c0a3a13f3b6587afd596b33 | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | lunarDayToChinese | 返回农历日期的中文表示
@param day 农历日
@returns | static lunarDayToChinese(day: number): string {
// 转换日期
return Constants.CHINESE_DAY[day - 1];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left lunarDayToChinese AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left day AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static lunarDayToChinese(day: number): string {
// 转换日期
return Constants.CHINESE_DAY[day - 1];
} | https://gitcode.com/arkui-x/samples | 555294a66ebbb02de5546fd5021bfda21f0adcbb | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DependencyContainer.ets | arkts | getCurrentScope | 获取当前作用域 | public getCurrentScope(): string | undefined {
return this.currentScope;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentScope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left... | public getCurrentScope(): string | undefined {
return this.currentScope;
} | https://github.com/DaLongZhuaZi/manxia | 4617391188b087cb6eb7c90fe38fba4f28c0b484 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/UpdateChecker.ets | arkts | autoCheck | 启动时静默自动检查(24h 节流)。永不抛异常。
流程:① 先把上次缓存的红点状态回灌 AppStorage(即时显示,无需联网);
② 距上次检查不足 24h 直接返回;③ 否则联网刷新并写回缓存 + AppStorage。
UI 通过 @StorageProp(UPDATE_AVAILABLE / UPDATE_LATEST_NAME) 订阅显示小红点。 | static async autoCheck(): Promise<void> {
try {
// ① 缓存回灌(即时红点)
const cachedAvail: boolean = await PreferencesStore.getBoolean('settings', KEY_AVAIL, false);
const cachedName: string = await PreferencesStore.getString('settings', KEY_LATEST_NAME, '');
AppStorage.setOrCreate<boolean>(AppSto... | 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 autoCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | static async autoCheck(): Promise<void> {
try {
// ① 缓存回灌(即时红点)
const cachedAvail: boolean = await PreferencesStore.getBoolean('settings', KEY_AVAIL, false);
const cachedName: string = await PreferencesStore.getString('settings', KEY_LATEST_NAME, '');
AppStorage.setOrCreate<boolean>(AppSto... | https://github.com/LZZLHY/hlib | c81fc40ada13c614713c975d97c8b4747affd985 | github |
killetom/ktretrofit | entry/src/main/ets/example/RetrofitConfigExample.ets | arkts | updateUserExample | Update existing user | updateUserExample(id: number, userData: Partial<User>): User {
try {
const userService = this.createUserService();
const call = userService.updateUser(id, userData);
const response = call.execute();
console.log('User updated successfully:', response.body);
return response.get... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateUserExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left ,... | updateUserExample(id: number, userData: Partial<User>): User {
try {
const userService = this.createUserService();
const call = userService.updateUser(id, userData);
const response = call.execute();
console.log('User updated successfully:', response.body);
return response.get... | https://github.com/killetom/ktretrofit | 7707e1bab0180c3d0d9f8c4a29aa89e6478dc2ff | github |
robotzzh/AgricultureApp | entry/src/main/ets/common/History_Info.ets | arkts | save_db | --------------------json转化部分(finished)------------------//
--------------------数据库操作部分(finished)------------------// | save_db(){
// id+4e5为数据库名称
DistributedUtil.putStoreData((this.fieldId+4e5).toString(),this.to_JSON());
console.info('successfully save in db')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left save_db 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#comment#Left // id+4e5为数据库名称 ... | save_db(){
// id+4e5为数据库名称
DistributedUtil.putStoreData((this.fieldId+4e5).toString(),this.to_JSON());
console.info('successfully save in db')
} | https://github.com/robotzzh/AgricultureApp | ba89efcd5d39c94d4e16d344e3236c1bee929893 | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | resume | 恢复播放
@returns Promise<void> 恢复完成后 resolve
@remarks
- 从暂停状态恢复播放
- 如果未暂停,此方法会启动播放
- 会检查解码器是否仍在运行,如果已退出则抛出错误
@throws
- AudioRenderer 未初始化
- 解码器已退出(需要重新创建) | public async resume(): Promise<void> {
if (!this.renderer) {
throw new Error('AudioRenderer not initialized');
}
// Check if decoder is still alive before resuming
if (this.decoder?.isAlive && !this.decoder.isAlive()) {
throw new Error('Decoder has stopped, need to recreate player');
... | 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 resume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ... | public async resume(): Promise<void> {
if (!this.renderer) {
throw new Error('AudioRenderer not initialized');
}
// Check if decoder is still alive before resuming
if (this.decoder?.isAlive && !this.decoder.isAlive()) {
throw new Error('Decoder has stopped, need to recreate player');
... | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L552-L570 | 8dcab2fe9511b99c63d4453837bd438c35e67af7 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ObjectPool.ets | arkts | create | Returns an ObjectPool instance, of a given starting capacity, that recycles instances of a given Poolable object.
@param withCapacity A positive integer value.
@param object An instance of the object that the pool should recycle.
@return | public static create(withCapacity: number, object: Poolable) {
let result = new ObjectPool<Poolable>(withCapacity, object);
result.poolId = ObjectPool.ids;
ObjectPool.ids++;
return result;
} | 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 create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left withCapacity AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public static create(withCapacity: number, object: Poolable) {
let result = new ObjectPool<Poolable>(withCapacity, object);
result.poolId = ObjectPool.ids;
ObjectPool.ids++;
return result;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 26ffaf3bb8e7f938f59653a19dbf79818058e302 | gitee |
erosTeam/NextE | shared/src/main/ets/settings/ThemeSettings.ets | arkts | onSystemColorModeChanged | EnvironmentCallback hook: when the DEVICE flips dark/light and we're in follow-system mode, refresh the
signal so cached sub-tab pills (which never rebuild on their own) recolor immediately. No-op when forced. | static onSystemColorModeChanged(colorMode: ConfigurationConstant.ColorMode): void {
const state: ThemeDisplayState = connectThemeDisplay()
if (state.mode !== ThemeSettings.MODE_SYSTEM) {
return
}
state.effectiveDark = colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left onSystemColorModeChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colorMode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#me... | static onSystemColorModeChanged(colorMode: ConfigurationConstant.ColorMode): void {
const state: ThemeDisplayState = connectThemeDisplay()
if (state.mode !== ThemeSettings.MODE_SYSTEM) {
return
}
state.effectiveDark = colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
} | https://github.com/erosTeam/NextE | 47f47837ccedeedce457becca3d4df2a2906ff3d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Distributed/DistributedReadingService.ets | arkts | attachToReader | 初始化阅读器页面的双向同步监听 | public attachToReader(): void {
if (this.isListening) return;
distributedDataSyncManager.addOnDataChangedCallback(this.onStateChangeCallback);
this.isListening = true;
logger.info(TAG, 'Attached DistributedReadingService to reader session.');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left attachToReader 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... | public attachToReader(): void {
if (this.isListening) return;
distributedDataSyncManager.addOnDataChangedCallback(this.onStateChangeCallback);
this.isListening = true;
logger.info(TAG, 'Attached DistributedReadingService to reader session.');
} | https://github.com/DaLongZhuaZi/manxia | 0b05d57c780104656d2c877c24244c1707199cba | github |
HOSRookie/ohos_glass_ui | library/src/main/ets/constants/GlassStyles.ets | arkts | getShadowByLevel | 根据等级获取阴影配置
@param level 阴影等级,取值 1~4,超出范围返回 LEVEL_1 | static getShadowByLevel(level: number): ShadowOptions {
switch (level) {
case 1:
return GlassShadows.LEVEL_1;
case 2:
return GlassShadows.LEVEL_2;
case 3:
return GlassShadows.LEVEL_3;
case 4:
return GlassShadows.LEVEL_4;
default:
return GlassSh... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getShadowByLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static getShadowByLevel(level: number): ShadowOptions {
switch (level) {
case 1:
return GlassShadows.LEVEL_1;
case 2:
return GlassShadows.LEVEL_2;
case 3:
return GlassShadows.LEVEL_3;
case 4:
return GlassShadows.LEVEL_4;
default:
return GlassSh... | https://github.com/HOSRookie/ohos_glass_ui | 0031c8b8d87cb4bde9de85bd85ace7382b1a5d04 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyStore.ets | arkts | importProfile | 从 JSON 字符串导入配置 | static async importProfile(json: string): Promise<boolean> {
try {
const data = JSON.parse(json) as ExportData;
if (!data.profile || !data.profile.name || !Array.isArray(data.profile.keys)) {
return false;
}
// 避免名称冲突
await CustomKeyStore.ensureInit();
let name = data.p... | 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 importProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST... | static async importProfile(json: string): Promise<boolean> {
try {
const data = JSON.parse(json) as ExportData;
if (!data.profile || !data.profile.name || !Array.isArray(data.profile.keys)) {
return false;
}
// 避免名称冲突
await CustomKeyStore.ensureInit();
let name = data.p... | https://github.com/AlkaidLab/moonlight-harmony | acb1db1157367cb410d94b6301711aef8623be99 | github |
erosTeam/NextE | shared/src/main/ets/network/EhHttpClient.ets | arkts | postJson | POST a JSON body (EH /api.php). Same headers/cookies/retry as getText, plus Content-Type. | async postJson(url: string, body: string): Promise<EhTextResponse> {
let attempt: number = 0
let lastError: Error | null = null
while (attempt < MAX_RETRIES) {
const req: http.HttpRequest = http.createHttp()
try {
const header: Record<string, string> = {
'User-Agent': EhConst... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left postJson AST#identifier#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 ... | async postJson(url: string, body: string): Promise<EhTextResponse> {
let attempt: number = 0
let lastError: Error | null = null
while (attempt < MAX_RETRIES) {
const req: http.HttpRequest = http.createHttp()
try {
const header: Record<string, string> = {
'User-Agent': EhConst... | https://github.com/erosTeam/NextE | 2e311af77ebc5208966c7c5c2f5462ef1705d9b9 | github |
codelably/HCompass | core/network/src/main/ets/DefaultResponseParser.ets | arkts | getCode | 获取响应状态码
@param response 原始响应数据
@returns 状态码 | getCode(response: Unknown): number {
if (!response || typeof response !== 'object') {
return -1;
}
const code = (response as Record<string, T>)[this.config.codeField];
return typeof code === 'number' ? code : -1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Unknown AST#identifier#Right AST#ERROR#Right AST#)#Left ) AS... | getCode(response: Unknown): number {
if (!response || typeof response !== 'object') {
return -1;
}
const code = (response as Record<string, T>)[this.config.codeField];
return typeof code === 'number' ? code : -1;
} | https://github.com/codelably/HCompass | a5eac8c52791a766109e213108c9676fabb7da9c | github |
LiHuaJZOAQ/GuardSysAPP | entry/src/main/ets/pages/WifiManager.ets | arkts | disconnectWifi | 断开WiFi | static async disconnectWifi(): Promise<boolean> {
try {
const isConnected: boolean = wifiManager.isConnected();
if (!isConnected) {
return true;
}
// API 10 没有直接的disconnect方法,使用removeDevice替代
return false;
} catch (err) {
console.error('disconnectWifi failed: ' + JS... | 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 disconnectWifi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | static async disconnectWifi(): Promise<boolean> {
try {
const isConnected: boolean = wifiManager.isConnected();
if (!isConnected) {
return true;
}
// API 10 没有直接的disconnect方法,使用removeDevice替代
return false;
} catch (err) {
console.error('disconnectWifi failed: ' + JS... | https://github.com/LiHuaJZOAQ/GuardSysAPP | d4b0bb53dc735036ecfc2cd48d1daa30dbbaa835 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/ResourceUtil.ets | arkts | getDataByKey | 根据键获取数据
@param content ConfigMapModel
@param key ConfigMapKeyEnum
@returns | private static getDataByKey(content: ConfigMapModel, key: ConfigMapKeyEnum): string {
if (key === ConfigMapKeyEnum.GALLERY_URL) {
return content.galleryUrl
} else if (key === ConfigMapKeyEnum.MIIT_URL) {
return content.miitUrl
} else if (key === ConfigMapKeyEnum.WHITELIST) {
return conte... | 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 getDataByKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left content AST#identifier#Right AST#:#Left... | private static getDataByKey(content: ConfigMapModel, key: ConfigMapKeyEnum): string {
if (key === ConfigMapKeyEnum.GALLERY_URL) {
return content.galleryUrl
} else if (key === ConfigMapKeyEnum.MIIT_URL) {
return content.miitUrl
} else if (key === ConfigMapKeyEnum.WHITELIST) {
return conte... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 6f61b440e9fdb8bcd90192fc361db5cb1f081a3f | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/GuidePage.ets | arkts | getExitAnimation | 获取引导页退出动画
@returns 引导页退出动画 | public getExitAnimation(): AnimatorOptions | null {
return this.exitAnimation;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getExitAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Lef... | public getExitAnimation(): AnimatorOptions | null {
return this.exitAnimation;
} | https://github.com/wuba/omni-ui | 954f1a2d48c31ef131075f5b71edea0df4ca34ff | github |
erosTeam/NextE | feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets | arkts | firstPageHasMore | Whether a fresh first-page load has more: toplist follows parsed ptt nextPage; cursor sources page
while a next cursor exists (popular never pages). | private firstPageHasMore(list: GalleryList): boolean {
if (this.isToplist()) {
return list.nextPage >= 0 && list.nextPage <= list.maxPage
}
if (this.isFavorite()) {
return list.nextPage > 0 || list.nextGid.length > 0
}
return !this.isPopular() && list.nextGid.length > 0
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left firstPageHasMore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private firstPageHasMore(list: GalleryList): boolean {
if (this.isToplist()) {
return list.nextPage >= 0 && list.nextPage <= list.maxPage
}
if (this.isFavorite()) {
return list.nextPage > 0 || list.nextGid.length > 0
}
return !this.isPopular() && list.nextGid.length > 0
} | https://github.com/erosTeam/NextE | c87bd9c834e998101da1fda6f3e41bbd550718b3 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Byte.ets | arkts | createFromJSONValue | Creates a Byte instance based on JSONValue
@param json: JSONValue - a JSON representation
@throws JSONTypeError if json does not encode a valid byte
@returns Byte - byte value decoded from JSON | static createFromJSONValue(json: JSONValue): Byte {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
if (Double.isInteger(num) && Byte.MIN_VALUE <= num && num <= Byte.MAX_VALUE) {
return Byte.valueOf(num as byte)
}
}
t... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFromJSONValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static createFromJSONValue(json: JSONValue): Byte {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
if (Double.isInteger(num) && Byte.MIN_VALUE <= num && num <= Byte.MAX_VALUE) {
return Byte.valueOf(num as byte)
}
}
t... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 105eaf44c02c2eccd3050bd7de577eb4aaf87798 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/GenericHidController.ets | arkts | processButtonsGeneric | 处理按钮 - 通用格式
根据实测数据 (VID 0x413D 手柄):
- B7 (offset+6): 功能按钮
注意: B7=0x02 在空闲状态下也出现,不是 Start 按钮
需要检查其他位是否变化
- bit0 = Back/Select (0x01)
- bit1 = 固定值,忽略
- bit2 = Start (0x04)
- bit3 = Guide (0x08)
- B8 (offset+7): ABXY 按钮
- bit0 = A (0x01)
- bit1 = B (0x02)
- bit2 = X (0x04)
- bit3 = Y (0x08)
- bit4 = LB (0x10)
- bit5 = RB ... | private processButtonsGeneric(byte1: number, byte2: number): void {
// 清除按钮标志(保留方向键和 L3/R3)
const preserveFlags = ButtonFlags.UP_FLAG | ButtonFlags.DOWN_FLAG |
ButtonFlags.LEFT_FLAG | ButtonFlags.RIGHT_FLAG |
ButtonFlags.LS_CLK_FLAG | ButtonFlags.RS_CLK_FLAG;... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processButtonsGeneric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left byte1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private processButtonsGeneric(byte1: number, byte2: number): void {
// 清除按钮标志(保留方向键和 L3/R3)
const preserveFlags = ButtonFlags.UP_FLAG | ButtonFlags.DOWN_FLAG |
ButtonFlags.LEFT_FLAG | ButtonFlags.RIGHT_FLAG |
ButtonFlags.LS_CLK_FLAG | ButtonFlags.RS_CLK_FLAG;... | https://github.com/AlkaidLab/moonlight-harmony | 7d18b8ace326e8c3b5d794f970744be0c72f22d7 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/by_av_player.ets | arkts | set_av_player_callback | audio播放
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
内部函数 //
//////////
audio监听回调 // | private async set_av_player_callback(callback: (avPlayer: media.AVPlayer) => void) {
// 添加保险
if (!this.avPlayer) { return }
// 状态机变化(主)
this.avPlayer.on('stateChange', async (state: string) => {
// 添加保险
if (!this.avPlayer) { return }
// 状态分类
switch (state) {
case 'initi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left set_av_player_callback AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERR... | private async set_av_player_callback(callback: (avPlayer: media.AVPlayer) => void) {
// 添加保险
if (!this.avPlayer) { return }
// 状态机变化(主)
this.avPlayer.on('stateChange', async (state: string) => {
// 添加保险
if (!this.avPlayer) { return }
// 状态分类
switch (state) {
case 'initi... | https://github.com/Nekofox-POT/LinMusic | 6f5bd90055af91bee610ef3ede5f6e2344a1d1c3 | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/utils/StorageUtils.ets | arkts | saveValueSync | 存储key,value到preference缓存里面
@param key
@param value | saveValueSync(key: string, value: preferences.ValueType) {
this.preferences?.putSync(key, value)
this.preferences?.flush((err: BusinessError) => {
if (err) {
console.error(`${this.name} file flush error :${err.message ?? ""}`)
}
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveValueSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ... | saveValueSync(key: string, value: preferences.ValueType) {
this.preferences?.putSync(key, value)
this.preferences?.flush((err: BusinessError) => {
if (err) {
console.error(`${this.name} file flush error :${err.message ?? ""}`)
}
})
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 344d14620a3d0f37f1b22fbae8b1498e24b14d5c | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | submitApproval | 提交审批
@param approvalId 审批ID | async submitApproval(approvalId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/submit`, {})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitApproval AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async submitApproval(approvalId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/submit`, {})
} | https://github.com/David8Idira/AI-OA | d2114a39d1c81d82623ae2c8946843eb38574874 | github |
openharmony/xts_tools | sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/waterflowFad23.ets | arkts | setItemSizeArray | 设置FlowItem的高度数组 | setItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemHeightArray.push(this.getSize());
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setItemSizeArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | setItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemHeightArray.push(this.getSize());
}
} | https://gitee.com/openharmony/xts_tools.git | 42261b807dbaf86c335879e00456438af8ea41cc | gitee |
openharmony-tpc/openharmony_tpc_samples | dialogs/entry/src/main/ets/pages/AnimateContent.ets | arkts | aboutToDisappear | 在自定义组件即将析构销毁时将dialogControlle删除和置空 | aboutToDisappear() {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | aboutToDisappear() {
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | d610a9743cc827d3f21c38358e1abf2df04b5456 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets | arkts | checkIndexExists | 检查索引文件是否存在 | async checkIndexExists(): Promise<boolean> {
if (!this.client && !this.nativeClient) {
return false;
}
try {
const indexPath = `backups/${BACKUP_INDEX_FILE}`;
let content: string = '';
if (this.nativeClient) {
content = await this.nativeClient.getFileContents(indexP... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left checkIndexExists AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef... | async checkIndexExists(): Promise<boolean> {
if (!this.client && !this.nativeClient) {
return false;
}
try {
const indexPath = `backups/${BACKUP_INDEX_FILE}`;
let content: string = '';
if (this.nativeClient) {
content = await this.nativeClient.getFileContents(indexP... | https://github.com/DaLongZhuaZi/manxia | f7f0040d54ba8e89da27430ee43b0c575e4fa5c5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets | arkts | isReady | 检查引擎是否就绪 | isReady(): boolean {
return this.isInitialized;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b... | isReady(): boolean {
return this.isInitialized;
} | https://github.com/DaLongZhuaZi/manxia | 36d7324aa14088915faac43f81fb93f1a3099691 | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/model/PermissionModel.ets | arkts | getInstance | 获取PermissionModel单例实例
@returns {PermissionModel} PermissionModel | static getInstance(): PermissionModel {
if (!PermissionModel.instance) {
PermissionModel.instance = new PermissionModel();
}
return PermissionModel.instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Permission... | static getInstance(): PermissionModel {
if (!PermissionModel.instance) {
PermissionModel.instance = new PermissionModel();
}
return PermissionModel.instance;
} | https://gitcode.com/arkui-x/samples | 6d84edffb40cbeaecbc675378cb5d1386d630159 | gitcode |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | setDrcEnabled | 启用/禁用动态范围压缩(DRC) | public setDrcEnabled(enabled: boolean): void {
if (!this.decoder) {
throw new Error('Decoder not initialized');
}
if (!this.decoder.setDrcEnabled) {
throw new Error('setDrcEnabled is not supported by this decoder');
}
this.decoder.setDrcEnabled(enabled);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrcEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setDrcEnabled(enabled: boolean): void {
if (!this.decoder) {
throw new Error('Decoder not initialized');
}
if (!this.decoder.setDrcEnabled) {
throw new Error('setDrcEnabled is not supported by this decoder');
}
this.decoder.setDrcEnabled(enabled);
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L751-L759 | 4876745bd0d6becccd0c46a3c1bf2af27259c245 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/pages/ControlPage.ets | arkts | toggleControlPanel | 切换控制面板 | toggleControlPanel() {
// 如果当前是隐藏状态(靠边),先显示出来
const isHiddenRight = this.fabX > this.containerWidth - this.FAB_SIZE;
const isHiddenLeft = this.fabX < 0;
if (this.containerWidth > 0 && (isHiddenRight || isHiddenLeft)) {
this.showFab();
return;
}
if (this.showControlPanel || thi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleControlPanel 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... | toggleControlPanel() {
// 如果当前是隐藏状态(靠边),先显示出来
const isHiddenRight = this.fabX > this.containerWidth - this.FAB_SIZE;
const isHiddenLeft = this.fabX < 0;
if (this.containerWidth > 0 && (isHiddenRight || isHiddenLeft)) {
this.showFab();
return;
}
if (this.showControlPanel || thi... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 85fc39f2fee99f60a93d823885e258c2b58b64c0 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/deviceAwareness/facades/DeviceAdaptationFacade.ets | arkts | publishToAppStorage | 发布设备信息到 AppStorage | private publishToAppStorage(info: NGFDeviceInfo): void {
try {
AppStorage.setOrCreate<string>(STORAGE_KEY_DEVICE_TYPE, info.deviceType);
AppStorage.setOrCreate<string>(STORAGE_KEY_ORIENTATION, info.orientation);
AppStorage.setOrCreate<string>(STORAGE_KEY_BREAKPOINT, info.breakpoint);
AppSt... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left publishToAppStorage 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#identifie... | private publishToAppStorage(info: NGFDeviceInfo): void {
try {
AppStorage.setOrCreate<string>(STORAGE_KEY_DEVICE_TYPE, info.deviceType);
AppStorage.setOrCreate<string>(STORAGE_KEY_ORIENTATION, info.orientation);
AppStorage.setOrCreate<string>(STORAGE_KEY_BREAKPOINT, info.breakpoint);
AppSt... | https://github.com/DaLongZhuaZi/NGF | c4c2636d4e38f45658fe7293013da2e6088f104a | github |
erosTeam/NextE | feature/home/src/main/ets/pages/ToplistPage.ets | arkts | toplistPeriodPageBuilder | Global @Builder (no `this`) for RetainedSubtabHost's @BuilderParam. Renders one retained period page,
handed the shared active-key signal. | @Builder
function toplistPeriodPageBuilder(
key: string,
active: ActiveKeyState,
scroller: Scroller,
onDidScroll: (offset: number, state: ScrollState) => void,
) {
ToplistPeriodPage({ periodTl: Number(key), active: active, scroller: scroller, onDidScroll: onDidScroll })
} | 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 toplistPeriodPageBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri... | @Builder
function toplistPeriodPageBuilder(
key: string,
active: ActiveKeyState,
scroller: Scroller,
onDidScroll: (offset: number, state: ScrollState) => void,
) {
ToplistPeriodPage({ periodTl: Number(key), active: active, scroller: scroller, onDidScroll: onDidScroll })
} | https://github.com/erosTeam/NextE | 0dce53b743d8f25c62a7c73bd9b24d32bab05fda | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | fullscreenWindowed | Toggle the windowed fullscreen status of the window. | async fullscreenWindowed() {
this.showMore = false;
switch (this.fullscreenStatus) {
case meowUiFullscreenStatus.NONE:
animateToImmediately(defaultAnimation(), () => {
this.fullscreenStatus = meowUiFullscreenStatus.FULLSCREEN_WINDOWED;
});
break;
case meowUiFullsc... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fullscreenWindowed 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 { A... | async fullscreenWindowed() {
this.showMore = false;
switch (this.fullscreenStatus) {
case meowUiFullscreenStatus.NONE:
animateToImmediately(defaultAnimation(), () => {
this.fullscreenStatus = meowUiFullscreenStatus.FULLSCREEN_WINDOWED;
});
break;
case meowUiFullsc... | https://github.com/awaLiny2333/LinysBrowser_NEXT | d9f42cd99e788d95dca601fb488d4e68ea7100d6 | github |
erikwang2013/erp-php-lite | service/apps/harmonyos/entry/src/main/ets/service/ApiService.ets | arkts | request | 发送请求(自动处理 401 和 token 刷新) | private async request<T>(method: http.RequestMethod, path: string, body?: object, retryCount: number = 0): Promise<ApiResponse<T>> {
const token = TokenManager.getAccessToken();
const options: http.HttpRequestOptions = {
method: method,
header: {
'Content-Type': 'application/json',
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left request AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right A... | private async request<T>(method: http.RequestMethod, path: string, body?: object, retryCount: number = 0): Promise<ApiResponse<T>> {
const token = TokenManager.getAccessToken();
const options: http.HttpRequestOptions = {
method: method,
header: {
'Content-Type': 'application/json',
... | https://github.com/erikwang2013/erp-php-lite | c41c4735aa5c7c61168d5cb7005c24c5cf0d1d03 | github |
ibestservices/ibest-ui | library/src/main/ets/components/guide/index.type.ets | arkts | getHeight | 获取高度
@returns 矩形区域的高 | public getHeight(): number {
return this.bottom - this.top
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHeight 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#numbe... | public getHeight(): number {
return this.bottom - this.top
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/guide/index.type.ets#L51-L53 | 81a9e8dcc3b52b0d2f7ff5eda9f04186f8130e34 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | prepareDynamicFilterData | 准备动态书架筛选数据(从当前所有内容中提取作者、标签、标题关键词、源名称) | private prepareDynamicFilterData(): void {
const keywordSet = new Set<string>();
const imageSourceSet = new Set<string>();
const bookSourceSet = new Set<string>();
// 从漫画中提取标题关键词和图源名称
for (const manga of this.mangaList) {
const tokens = smartTokenize(manga.title);
for (const t of toke... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left prepareDynamicFilterData 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 ... | private prepareDynamicFilterData(): void {
const keywordSet = new Set<string>();
const imageSourceSet = new Set<string>();
const bookSourceSet = new Set<string>();
// 从漫画中提取标题关键词和图源名称
for (const manga of this.mangaList) {
const tokens = smartTokenize(manga.title);
for (const t of toke... | https://github.com/DaLongZhuaZi/manxia | 2f02c14f83ef4ca6d330a61603608467dc2b07bc | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的房联网系统_谭宜潇/SmartHouse/entry/src/main/ets/MainAbility/pages/my/LogIn.ets | arkts | build | 定义controller | build() {
Column() {
Text("注册")
.fontSize(48)
.fontColor(Color.Black)
.fontWeight(FontWeight.Bold)
.margin({ top: '3%' })
Row() {
Text("姓名:")
.fontSize(38)
.fontColor(Color.Black)
.fontWeight(FontWeight.Medium)
.margin({ l... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Text("注册")
.fontSize(48)
.fontColor(Color.Black)
.fontWeight(FontWeight.Bold)
.margin({ top: '3%' })
Row() {
Text("姓名:")
.fontSize(38)
.fontColor(Color.Black)
.fontWeight(FontWeight.Medium)
.margin({ l... | https://gitee.com/openharmony-sig/online_event.git | 56db0c2de51406a4ebed981e83a698f067dfa993 | gitee |
zmuxuny/ai-guardian-star | entry/src/main/ets/database/DatabaseHelper.ets | arkts | _countVideoRecords | 内部:统计视频记录总数 | private async _countVideoRecords(): Promise<number> {
let resultSet: relationalStore.ResultSet | undefined;
try {
resultSet = await this.getStore().querySql("SELECT COUNT(*) AS cnt FROM t_video_record");
if (resultSet.goToNextRow()) {
return resultSet.getLong(resultSet.getColumnIndex("cnt"... | 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 _countVideoRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async _countVideoRecords(): Promise<number> {
let resultSet: relationalStore.ResultSet | undefined;
try {
resultSet = await this.getStore().querySql("SELECT COUNT(*) AS cnt FROM t_video_record");
if (resultSet.goToNextRow()) {
return resultSet.getLong(resultSet.getColumnIndex("cnt"... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L698-L711 | 3339a1c1a33a13267940fb03b6c96d6583b26acd | github |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/view/PlaylistLaneListSection.ets | arkts | build | Builds the scrollable two-lane list of playlist cards. | build() {
Column() {
List({ space: 16 }) {
LazyForEach(this.listVm.songListDataSource, (item: PlaylistSongUi, index: number) => {
ListItem() {
this.PlaylistSongRow(item, index);
}
}, (item: PlaylistSongUi, index?: number) => `pl-${index}-${item.id}`)
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
List({ space: 16 }) {
LazyForEach(this.listVm.songListDataSource, (item: PlaylistSongUi, index: number) => {
ListItem() {
this.PlaylistSongRow(item, index);
}
}, (item: PlaylistSongUi, index?: number) => `pl-${index}-${item.id}`)
}
... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 8db80604c72166555a2ef3dc30f8b6aa4bf62c2c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets | arkts | resetToFirstLaunch | 重置引导状态(模拟首次启动)
用于测试首次启动引导流程 | public static async resetToFirstLaunch(): Promise<void> {
try {
await this.guideManager.initialize();
await this.guideManager.resetGuide();
logger.info(TAG, '✅ 引导状态已重置为首次启动');
return Promise.resolve();
} catch (error) {
logger.error(TAG, '重置引导状态失败', String(error));
return P... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left resetToFirstLaunch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum... | public static async resetToFirstLaunch(): Promise<void> {
try {
await this.guideManager.initialize();
await this.guideManager.resetGuide();
logger.info(TAG, '✅ 引导状态已重置为首次启动');
return Promise.resolve();
} catch (error) {
logger.error(TAG, '重置引导状态失败', String(error));
return P... | https://github.com/DaLongZhuaZi/manxia | 4566384515e7bfb02b6b07180a4b89d9de335eea | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceSelectorEngine.ets | arkts | intersectElements | 获取元素的交集 | private intersectElements(results: SelectorResult[]): ElementInfo[] {
if (results.length === 0) return [];
if (results.length === 1) return results[0].elements || [];
// 简化实现:基于元素位置进行交集计算
let intersection = results[0].elements || [];
for (let i = 1; i < results.length; i++) {
const cur... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left intersectElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscrip... | private intersectElements(results: SelectorResult[]): ElementInfo[] {
if (results.length === 0) return [];
if (results.length === 1) return results[0].elements || [];
// 简化实现:基于元素位置进行交集计算
let intersection = results[0].elements || [];
for (let i = 1; i < results.length; i++) {
const cur... | https://github.com/DaLongZhuaZi/manxia | 40695bf4b67822c8077d1d427741098357d4ccba | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/Retrofit.ets | arkts | build | Build the {@link Retrofit} instance. | build(): Retrofit {
if (!this.baseUrl) {
throw new Error('Base URL is required');
}
return new Retrofit(this);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Retrofit AST#identifier#Right AST#ERROR#Right AST#statem... | build(): Retrofit {
if (!this.baseUrl) {
throw new Error('Base URL is required');
}
return new Retrofit(this);
} | https://github.com/killetom/ktretrofit | ff643b3ea7557ca0aba8b29f72282ea939a7dd1e | github |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue18.ets.audit.ets | arkts | name | HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 15 : issue18.ets | name(): void {
this.y = 'jj';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left name AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS... | name(): void {
this.y = 'jj';
} | https://gitee.com/openharmony-sig/earth.git | e68bbe37d5f5dcda0ae5be0db4e2f4a087c65232 | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpBackgroundService.ets | arkts | isServiceRunning | Check if service is running | static isServiceRunning(): boolean {
return isRunning;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isServiceRunning 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 ... | static isServiceRunning(): boolean {
return isRunning;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 3223865a13d999fb92456fab43fb047ad3215ad2 | github |
openharmony/applications_call | entry/src/main/ets/common/components/DtmfBtn.ets | arkts | onBtnTouchStart | Call and press the DTMF interface
@param {Object} obj - Object | onBtnTouchStart(obj) {
this.mCallServiceProxy.startDTMF(this.callData.callId, String(obj.value));
LogUtils.i(TAG, 'onBtnTouchStart :');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBtnTouchStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left obj AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expr... | onBtnTouchStart(obj) {
this.mCallServiceProxy.startDTMF(this.callData.callId, String(obj.value));
LogUtils.i(TAG, 'onBtnTouchStart :');
} | https://gitee.com/openharmony/applications_call.git | e1dfbd03e8c28cf9b79c4e46a71e80f74d1e025b | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/06.conversions_and_contexts/02.assignment_contexts/boxing.ets | arkts | main | ---
desc: Assignment contexts allow the use of a boxing conversion
params: Conversion from '{{c.src_type}}' to '{{c.dst_type}}'
--- | function main(): int {
{% for v in c['values'] %}
let src_{{loop.index}}: {{c.src_type}} = {{v|safe}};
let dst_{{loop.index}}: {{c.dst_type}} = src_{{loop.index}}; // boxing in this assignment | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left i... | function main(): int {
{% for v in c['values'] %}
let src_{{loop.index}}: {{c.src_type}} = {{v|safe}};
let dst_{{loop.index}}: {{c.dst_type}} = src_{{loop.index}}; // boxing in this assignment | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8062a2cab482b69fe0f8e84856ca06022ec8119b | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets | arkts | setRuleEnabled | 设置规则启用状态 | async setRuleEnabled(id: string, enabled: boolean): Promise<boolean> {
return this.updateRule(id, { enabled });
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setRuleEnabled AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async setRuleEnabled(id: string, enabled: boolean): Promise<boolean> {
return this.updateRule(id, { enabled });
} | https://github.com/DaLongZhuaZi/manxia | 749b07faf5905aea5656865948d3977705d5ff11 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectProxy.ets | arkts | create | Creates a new proxy instance that implements the specified interfaces and uses the provided handler.
@param { RuntimeLinker } linker - The `RuntimeLinker` used to generate the proxy class at runtime.
@param { FixedArray<Class> } interfaces - An array of `Class` objects representing the interfaces to implement.
@param {... | public static create(linker: RuntimeLinker, interfaces: FixedArray<Class>, handler: InvocationHandler): Proxy {
let proxyClass = Proxy.createClass(linker, interfaces)
// NOTE(kurnevichstanislav): Must be replaced by Type API call: #30649
let ctor = Proxy.findConstructor(proxyClass, Proxy.con... | 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 create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left linker AST#identifier#Right AST#:#Left : AST#:#R... | public static create(linker: RuntimeLinker, interfaces: FixedArray<Class>, handler: InvocationHandler): Proxy {
let proxyClass = Proxy.createClass(linker, interfaces)
// NOTE(kurnevichstanislav): Must be replaced by Type API call: #30649
let ctor = Proxy.findConstructor(proxyClass, Proxy.con... | https://gitcode.com/iop123123/arkts-static-skills | f11bb1d76e3a9867e55df375608d40b5ff8b7758 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/storage/WrongQuestionStorageService.ets | arkts | resetAllQuestions | 重置所有错题(用于测试) | static async resetAllQuestions(): Promise<void> {
try {
await dataStorage.clear(WrongQuestionStorageService.STORE_NAME);
console.log('[WrongQuestionStorage] All wrong questions reset');
} catch (error) {
console.error('[WrongQuestionStorage] Failed to reset:', error);
throw error;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left resetAllQuestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | static async resetAllQuestions(): Promise<void> {
try {
await dataStorage.clear(WrongQuestionStorageService.STORE_NAME);
console.log('[WrongQuestionStorage] All wrong questions reset');
} catch (error) {
console.error('[WrongQuestionStorage] Failed to reset:', error);
throw error;
... | https://github.com/the-wwyang/kids-learning-app | d274aac4d15a8347cc651d63df4687e7f66e14ca | github |
offlinecat-dev/OCNetORM | src/main/ets/errors/MappingError.ets | arkts | constructor | 构造函数
@param expected 期望的类型
@param actual 实际的类型 | constructor(expected: string, actual: string) {
const context = new ErrorContext()
context.operation = '类型检查'
context.details = `期望类型: ${expected},实际类型: ${actual}`
super(`类型不匹配: 期望 '${expected}',实际 '${actual}'`, ERROR_TYPE_MISMATCH, context)
this.name = 'TypeMismatchError'
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left expected AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,... | constructor(expected: string, actual: string) {
const context = new ErrorContext()
context.operation = '类型检查'
context.details = `期望类型: ${expected},实际类型: ${actual}`
super(`类型不匹配: 期望 '${expected}',实际 '${actual}'`, ERROR_TYPE_MISMATCH, context)
this.name = 'TypeMismatchError'
} | https://github.com/offlinecat-dev/OCNetORM | 7b82149ad42eaf35a875f3811bf2c8ef834d6efe | github |
tdcare/tdwebrtc | example/MediaStreamAdvancedExample.ets | arkts | initVideoReceiver | 初始化视频接收端 | public async initVideoReceiver(surfaceId: string): Promise<boolean> {
if (!this.mediaStream) {
return false;
}
this.mediaStream.setRemoteVideoSurface(surfaceId);
return await this.mediaStream.initializeVideoReceiver();
} | 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 initVideoReceiver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#L... | public async initVideoReceiver(surfaceId: string): Promise<boolean> {
if (!this.mediaStream) {
return false;
}
this.mediaStream.setRemoteVideoSurface(surfaceId);
return await this.mediaStream.initializeVideoReceiver();
} | https://github.com/tdcare/tdwebrtc | 3bceeec2d95f749c181d734c1ebe8d6f1ab97327 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Network/ProxyManager.ets | arkts | testProxyBatch | 批量测试代理 | async testProxyBatch(): Promise<ProxyTestResult[]> {
const testUrls = [
'https://www.google.com',
'https://x.com',
'https://www.youtube.com',
'https://github.com'
];
const results: ProxyTestResult[] = [];
for (const url of testUrls) {
const result = await this.testProxy... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left testProxyBatch 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#gener... | async testProxyBatch(): Promise<ProxyTestResult[]> {
const testUrls = [
'https://www.google.com',
'https://x.com',
'https://www.youtube.com',
'https://github.com'
];
const results: ProxyTestResult[] = [];
for (const url of testUrls) {
const result = await this.testProxy... | https://github.com/DaLongZhuaZi/manxia | 09e29141467ca37f086f7d03d16132358dc11702 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getDefaultValueFormatter | Returns the default IValueFormatter that has been determined by the chart
considering the provided minimum and maximum values.
@return | public getDefaultValueFormatter(): IValueFormatter {
return this.mDefaultValueFormatter;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDefaultValueFormatter 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#Le... | public getDefaultValueFormatter(): IValueFormatter {
return this.mDefaultValueFormatter;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 9c8afd5e774eafdb486e9679b27eed7d6b2af1ca | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | readableLength | Size of the data that can be read, in bytes or objects. | get readableLength(): int {
return this.readableLengthInner;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left readableLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifi... | get readableLength(): int {
return this.readableLengthInner;
} | https://gitcode.com/iop123123/arkts-static-skills | edd838d259958925f0db1a2bc4507e99c4e059b0 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleConfiguration.ets | arkts | fetchFromServer | -- Fetch + persistence -- | private async fetchFromServer(): Promise<void> {
const base: Record<string, string> = this.core.requestBuilder.baseParams();
base['method'] = 'sc';
const qs: string = Utils.buildQueryString(base);
this.config.logger.d('[ModuleConfiguration] fetchFromServer, sending /o/sdk?method=sc');
try {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left fetchFromServer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async fetchFromServer(): Promise<void> {
const base: Record<string, string> = this.core.requestBuilder.baseParams();
base['method'] = 'sc';
const qs: string = Utils.buildQueryString(base);
this.config.logger.d('[ModuleConfiguration] fetchFromServer, sending /o/sdk?method=sc');
try {
... | https://github.com/Countly/countly-sdk-hos | fe16a0c13c368b1f0ce49810b0c7e267e987dd29 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | removeByIndex | Removes the element at the specified index.
@param index The index of the element to remove.
@returns The removed element, or undefined if the index is out of range.
@throws BusinessError if the index is out of range. | public removeByIndex(index: int): T | undefined {
this.checkIndexType(index);
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
let removedNode: ListNode<T> | undefined;
if (index == 0) {
removedNode = this.head!;
this.head = this.h... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie... | public removeByIndex(index: int): T | undefined {
this.checkIndexType(index);
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
let removedNode: ListNode<T> | undefined;
if (index == 0) {
removedNode = this.head!;
this.head = this.h... | https://gitcode.com/iop123123/arkts-static-skills | 8701b79bebc5d723b3c19fb38acd878a7e34c341 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | off | Cancel event message.
@param { string } event - Registering Events.
@param { Function } callback - Event callback.
@throws { BusinessError } 401 - Parameter error. Possible causes:
1.Mandatory parameters are left unspecified;
2.Incorrect parameter types. | off(event: string, callback?: Function): void {
if (callback !== undefined) {
if (this.callbacks.has(event)) {
const callbackList = this.callbacks.get(event);
callbackList!.forEach((callbackFunc: Function) => {
if (callb... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left off AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Righ... | off(event: string, callback?: Function): void {
if (callback !== undefined) {
if (this.callbacks.has(event)) {
const callbackList = this.callbacks.get(event);
callbackList!.forEach((callbackFunc: Function) => {
if (callb... | https://gitcode.com/iop123123/arkts-static-skills | 5ca40124e039a7b5bf62facd09ef4aead90018ac | gitcode |
Vsolon0401/MallShopping | features/home/src/main/ets/components/Home.ets | arkts | routerWithParamsToSearch | 点击品牌带参数进入搜索页 | routerWithParamsToSearch(searchKey: string) {
router.pushUrl({
url: 'pages/SearchCommodityPage',
params: { searchKey: searchKey }
}).catch((err: Error) => {
Logger.error(JSON.stringify(err));
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left routerWithParamsToSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERR... | routerWithParamsToSearch(searchKey: string) {
router.pushUrl({
url: 'pages/SearchCommodityPage',
params: { searchKey: searchKey }
}).catch((err: Error) => {
Logger.error(JSON.stringify(err));
});
} | https://github.com/Vsolon0401/MallShopping | 375324e0a1a77bd58a7ef30a84eaa4ac4b8b79bd | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/SearchHistoryManager.ets | arkts | getRecentKeywords | 获取最近搜索的关键词 | static async getRecentKeywords(limit: number = 10): Promise<string[]> {
try {
const records = await SearchHistoryManager.getSearchHistory()
const recentKeywords: string[] = []
for (let i = 0; i < records.length && recentKeywords.length < limit; i++) {
const keyword = records[i].keyword
... | 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 getRecentKeywords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left ... | static async getRecentKeywords(limit: number = 10): Promise<string[]> {
try {
const records = await SearchHistoryManager.getSearchHistory()
const recentKeywords: string[] = []
for (let i = 0; i < records.length && recentKeywords.length < limit; i++) {
const keyword = records[i].keyword
... | https://github.com/cpdd5201314/harmonyOS-music-app | dea926cae5cd106b76f3fecb4885a17210984e3c | github |
offlinecat-dev/OCNetORM | src/main/ets/query/DataTransformTask.ets | arkts | addProperty | 添加属性
@param name 属性名
@param value 属性值
@param type 属性类型 | addProperty(name: string, value: string | number | null, type: string): void {
this.propertyNames.push(name)
this.propertyValues.push(value)
this.propertyTypes.push(type)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | addProperty(name: string, value: string | number | null, type: string): void {
this.propertyNames.push(name)
this.propertyValues.push(value)
this.propertyTypes.push(type)
} | https://github.com/offlinecat-dev/OCNetORM | f7dde8efee62b034bc12d27c2b75299a30a09c99 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets | arkts | splitByAt | 使用 @ 分割规则链 | private splitByAt(rule: string): string[] {
const rules: string[] = [];
let current = '';
let inQuote = false;
let quoteChar = '';
let depth = 0;
for (let i = 0; i < rule.length; i++) {
const c = rule[i];
if ((c === '"' || c === "'") && (i === 0 || rule[i - 1] !== '\\')) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitByAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | private splitByAt(rule: string): string[] {
const rules: string[] = [];
let current = '';
let inQuote = false;
let quoteChar = '';
let depth = 0;
for (let i = 0; i < rule.length; i++) {
const c = rule[i];
if ((c === '"' || c === "'") && (i === 0 || rule[i - 1] !== '\\')) {
... | https://github.com/DaLongZhuaZi/manxia | 64a087844bd1f569370bffb36cc340712cf3a9b6 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | decompressRLE | RLE解压缩 | private async decompressRLE(data: ArrayBuffer): Promise<ArrayBuffer> {
const input = new Uint8Array(data)
const output: number[] = []
let i = 0
while (i < input.length) {
if (input[i] === 0xFF && i + 2 < input.length) {
// RLE编码的数据
const count = input[i + 1]
const va... | 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 decompressRLE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : ... | private async decompressRLE(data: ArrayBuffer): Promise<ArrayBuffer> {
const input = new Uint8Array(data)
const output: number[] = []
let i = 0
while (i < input.length) {
if (input[i] === 0xFF && i + 2 < input.length) {
// RLE编码的数据
const count = input[i + 1]
const va... | https://github.com/AetheriumSimulator/qemu-hmos | 91eabe2f8b1a69ace85cb6f7aa8f96c46fcc7153 | github |
Joker-x-dev/CoolMallArkTS | core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets | arkts | addSearchHistory | 添加搜索历史记录
@param {SearchHistory} searchHistory 搜索历史记录
@returns {Promise<void>} Promise<void> | async addSearchHistory(searchHistory: SearchHistory): Promise<void> {
const keyword: string = searchHistory.keyword.trim();
if (!keyword) {
return;
}
this.orm.table(SearchHistoryLocalDataSourceImpl.TABLE_NAME).where("keyword", keyword).delete();
this.orm.table(SearchHistoryLocalDataSourceIm... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addSearchHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left searchHistory AST#identifier#Right AST#type_annotation#Left AS... | async addSearchHistory(searchHistory: SearchHistory): Promise<void> {
const keyword: string = searchHistory.keyword.trim();
if (!keyword) {
return;
}
this.orm.table(SearchHistoryLocalDataSourceImpl.TABLE_NAME).where("keyword", keyword).delete();
this.orm.table(SearchHistoryLocalDataSourceIm... | https://github.com/Joker-x-dev/CoolMallArkTS | ac3771a6e3d407582830de0995271f8e07c6a436 | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | getCurrentFPS | 获取当前 FPS
对齐 Android EmulatorViewModel.currentFps
@returns 当前帧率 | static getCurrentFPS(): number {
return MelonDSNative.native.getCurrentFPS();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentFPS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#n... | static getCurrentFPS(): number {
return MelonDSNative.native.getCurrentFPS();
} | https://github.com/richshaw2015/nds | 4a4fe903cd1be2b5a02291dc6baf631983be858a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | normalizeUrl | 规范化URL - 确保URL是完整的绝对URL
如果传入的是相对路径,则拼接baseUrl
如果已经是完整URL,则直接返回 | private normalizeUrl(url: string): string {
if (!url) {
return url;
}
// 如果已经是完整URL(以http://或https://开头),直接返回
if (url.startsWith('http://') || url.startsWith('https://')) {
return url;
}
// 获取baseUrl
const baseUrl = this.config?.metadata?.baseUrl || '';
if (!baseU... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | private normalizeUrl(url: string): string {
if (!url) {
return url;
}
// 如果已经是完整URL(以http://或https://开头),直接返回
if (url.startsWith('http://') || url.startsWith('https://')) {
return url;
}
// 获取baseUrl
const baseUrl = this.config?.metadata?.baseUrl || '';
if (!baseU... | https://github.com/DaLongZhuaZi/manxia | 2fbfdef3e1a3fe040c8aa739c05696b49cba1add | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Fills the Uint8ClampedArray with specified value
@param value new valuy
@returns modified Uint8ClampedArray
public | /* public */ internal fill(value: number, start: int, end: int): Uint8ClampedArray {
throw new Error("not implemented")
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST... | /* public */ internal fill(value: number, start: int, end: int): Uint8ClampedArray {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fddf3be34abe36f59dbf6a5df04953b94c4e3e50 | gitee |
openharmony/applications_app_samples | code/BasicFeature/Media/Camera/entry/src/main/ets/views/ModeSwitchPage.ets | arkts | countTakeVideoFn | Countdown capture and video | countTakeVideoFn() {
if (this.countdownNum) {
// Clear Countdown
if (this.countTimerOut) {
clearTimeout(this.countTimerOut);
}
if (this.countTimerInt) {
clearInterval(this.countTimerInt);
}
// Turn on timer
this.countTimerOut = setTimeout(() => {
/... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left countTakeVideoFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | countTakeVideoFn() {
if (this.countdownNum) {
// Clear Countdown
if (this.countTimerOut) {
clearTimeout(this.countTimerOut);
}
if (this.countTimerInt) {
clearInterval(this.countTimerInt);
}
// Turn on timer
this.countTimerOut = setTimeout(() => {
/... | https://github.com/openharmony/applications_app_samples | e47985d9d9c22526f386286c85fb1c67c989b31b | github |
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets | arkts | nativeDebuggerDialogClosed | DebuggerDialog closed or not. | public static nativeDebuggerDialogClosed(): void {
tuanjie.nativeDebuggerDialogClosed();
} | 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 nativeDebuggerDialogClosed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressio... | public static nativeDebuggerDialogClosed(): void {
tuanjie.nativeDebuggerDialogClosed();
} | https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | 29d4669fa72561f877c538cc6fd69587346e2d49 | github |
honjow/Next2V | shared/src/main/ets/storage/LocalDataStore.ets | arkts | rebuildWithoutNotNull | Generic create-new -> copy -> drop-old -> rename rebuild that strips column constraints (here NOT NULL).
The temp table reuses the (no-NOT-NULL) CREATE with the table name suffixed _v7; SELECT * copies by
matching column order (identical columns, only constraints differ). Indexes are recreated after rename. | private static async rebuildWithoutNotNull(
store: relationalStore.RdbStore,
createSql: string,
tableName: string,
indexSqls: string[],
): Promise<void> {
const tmpTable: string = tableName + '_v7'
await store.execute(createSql.replace('IF NOT EXISTS ' + tableName, 'IF NOT EXISTS ' + tmpTabl... | 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 rebuildWithoutNotNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifie... | private static async rebuildWithoutNotNull(
store: relationalStore.RdbStore,
createSql: string,
tableName: string,
indexSqls: string[],
): Promise<void> {
const tmpTable: string = tableName + '_v7'
await store.execute(createSql.replace('IF NOT EXISTS ' + tableName, 'IF NOT EXISTS ' + tmpTabl... | https://github.com/honjow/Next2V | 5888bf142dc4291b3f7facb20d8791d38a2b7f78 | github |
electronicminer/Harmony-Markdown-Editor | entry/src/main/ets/components/AIChatPanel.ets | arkts | stepIcon | 操作类型对应的图标 | stepIcon(action: string): string {
switch (action) {
case 'replace':
case 'replace_content':
return '✏️';
case 'insert_after':
case 'insert_before':
case 'insert_content':
return '➕';
case 'append':
case 'append_content':
return '⬇️';
case 'p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stepIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#... | stepIcon(action: string): string {
switch (action) {
case 'replace':
case 'replace_content':
return '✏️';
case 'insert_after':
case 'insert_before':
case 'insert_content':
return '➕';
case 'append':
case 'append_content':
return '⬇️';
case 'p... | https://github.com/electronicminer/Harmony-Markdown-Editor | 4b30dc5fe1ff682cfea4b51df20cea07317ef718 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | hasNoDragOffset | Returns true if both drag offsets (x and y) are zero or smaller.
@return | public hasNoDragOffset(): boolean {
return this.mViewPortHandler.hasNoDragOffset();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasNoDragOffset 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 hasNoDragOffset(): boolean {
return this.mViewPortHandler.hasNoDragOffset();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f79a9ae4ffeb9a2d4f44c84b73a63ab8aaf81b9d | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/Rect.ets | arkts | setEmpty | Set the rectangle to (0,0,0,0) | public setEmpty() {
this.left = this.right = this.top = this.bottom = 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setEmpty 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#... | public setEmpty() {
this.left = this.right = this.top = this.bottom = 0;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 31d106e61a6aa8c6b0162555614849c552d8375b | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/components/ImageLoadStateManager.ets | arkts | getPixelMap | 获取PixelMap | getPixelMap(pageId: string): image.PixelMap | null {
return this.pixelMaps.get(pageId) || null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | getPixelMap(pageId: string): image.PixelMap | null {
return this.pixelMaps.get(pageId) || null;
} | https://github.com/DaLongZhuaZi/manxia | 541d8835f8ea688ab42eba2e6f8fb074cfdbfc99 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Reader.ets | arkts | fixed64 | Read fixed64 little-endian | fixed64(): bigint { const dv = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 8); const lo = BigInt(dv.getUint32(0, true)); const hi = BigInt(dv.getUint32(4, true)); this.pos += 8; return (hi << 32n) | lo } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fixed64 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 bigint AST#identifier#Right AST#ERROR#Right AST#statem... | fixed64(): bigint { const dv = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 8); const lo = BigInt(dv.getUint32(0, true)); const hi = BigInt(dv.getUint32(4, true)); this.pos += 8; return (hi << 32n) | lo } | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 65703ac4dede0741f9eb80e07e58fcb69aed12ce | gitcode |
openharmony/arkui_advanced_ui_component | atomicservicenavigation/source/atomicservicenavigation.ets | arkts | updateCommonLayout | 更新除LG外窗口模式的布局 | private updateCommonLayout(layout: sideBarAttributeSet): void {
layout.sideBarWidth = SIDE_BAR_OVERLAY_WIDTH;
layout.minContentWidthOfSideBar = '100%';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateCommonLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left layout AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private updateCommonLayout(layout: sideBarAttributeSet): void {
layout.sideBarWidth = SIDE_BAR_OVERLAY_WIDTH;
layout.minContentWidthOfSideBar = '100%';
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | a6885f81893598a89bd0c6ab1c2c3065cb793d7d | gitee |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | nickContact | Save the contact nickname information to the database.
@param {Object} addParams Contact Information
@param {string} DAHelper Database path
@param {number} result Contact ID
@param {string} uri Database address | nickContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
if (addParams.nickname != undefined && addParams.nickname.length > 0) {
let nickContact: Record<string, string | number> = {
'raw_contact_id': result,
'detail_info': addParams.nickname,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left nickContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#identifi... | nickContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
if (addParams.nickname != undefined && addParams.nickname.length > 0) {
let nickContact: Record<string, string | number> = {
'raw_contact_id': result,
'detail_info': addParams.nickname,
... | https://gitee.com/openharmony/applications_contacts.git | d183600045dafa8369d1cd628ab11dcb29306b19 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | detectFoldableDevice | 检测是否是折叠屏设备 | private detectFoldableDevice(): void {
try {
this.isFoldableDevice = display.isFoldable();
if (this.isFoldableDevice) {
this.currentFoldStatus = this.convertFoldStatus(display.getFoldStatus());
logger.info(TAG, `✅ 检测到折叠屏设备,当前状态: ${this.getFoldStatusName(this.currentFoldStatus)}`);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectFoldableDevice 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 AS... | private detectFoldableDevice(): void {
try {
this.isFoldableDevice = display.isFoldable();
if (this.isFoldableDevice) {
this.currentFoldStatus = this.convertFoldStatus(display.getFoldStatus());
logger.info(TAG, `✅ 检测到折叠屏设备,当前状态: ${this.getFoldStatusName(this.currentFoldStatus)}`);
... | https://github.com/DaLongZhuaZi/manxia | 44147a918d34be22663993846d3bf455a4789079 | github |
apap6628114/nga_oh | entry/src/main/ets/common/managers/ThreadPaginationManager.ets | arkts | setPrefetchedPage | 缓存一页预取帖子。将 PostInfo[] 暂存进基类预取 Map。
@param page - 页码
@param posts - 该页帖子
@param totalPages - 总页数 | setPrefetchedPage(page: number, posts: PostInfo[], totalPages: number): void {
const items: object[] = []
for (let i = 0; i < posts.length; i++) {
items.push(posts[i])
}
this.setPrefetchedRaw(page, items, totalPages)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPrefetchedPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left... | setPrefetchedPage(page: number, posts: PostInfo[], totalPages: number): void {
const items: object[] = []
for (let i = 0; i < posts.length; i++) {
items.push(posts[i])
}
this.setPrefetchedRaw(page, items, totalPages)
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L153-L159 | 57d1ec8b3bcad179916e9d9cb2775e47bd8b2a66 | github |
openharmony/applications_filepicker | audiopicker/src/main/ets/pages/viewmodel/AudioPickerViewModel.ets | arkts | getDataSource | 获取lazyforeach的数据源
@returns | public getDataSource(): AudioPickerViewData {
return this.audioPickerViewData
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataSource 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 AudioPic... | public getDataSource(): AudioPickerViewData {
return this.audioPickerViewData
} | https://gitee.com/openharmony/applications_filepicker.git | 56866d9c5cd90a38e2840de0afa8cb4a528e8c32 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Editor/FileEditorService.ets | arkts | createSaveTarget | 创建保存目标 | public createSaveTarget(type: FileEditorSaveTargetType, id: string = '', name: string = '', path: string = '',
pkg: string = '', originalUri: string = '', shouldApplyToApp: boolean = false): FileEditorSaveTarget {
const target: FileEditorSaveTarget = {
type: type,
id: id,
name: name,
p... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createSaveTarget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public createSaveTarget(type: FileEditorSaveTargetType, id: string = '', name: string = '', path: string = '',
pkg: string = '', originalUri: string = '', shouldApplyToApp: boolean = false): FileEditorSaveTarget {
const target: FileEditorSaveTarget = {
type: type,
id: id,
name: name,
p... | https://github.com/DaLongZhuaZi/manxia | 8a73ea55c9e774b49e340276c010790323acc5ae | github |
honjow/Next2V | shared/src/main/ets/settings/RecentStickerSettings.ets | arkts | record | Move `item` to the front of the recent list (dedup by name), cap it, mirror to the holder immediately,
and persist in the background. Called on every sticker pick; safe to call before load() set the context
(it still updates the in-memory holder, just skips the disk write). | static record(item: StickerItem): void {
const name = (item.name || '').trim()
const url = (item.url || '').trim()
if (!name || !url) {
return
}
const head: StickerItem = { name: name, url: url }
const next: StickerItem[] = [head]
for (const existing of connectRecentStickers().items)... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left record AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left StickerIt... | static record(item: StickerItem): void {
const name = (item.name || '').trim()
const url = (item.url || '').trim()
if (!name || !url) {
return
}
const head: StickerItem = { name: name, url: url }
const next: StickerItem[] = [head]
for (const existing of connectRecentStickers().items)... | https://github.com/honjow/Next2V | 4bfe89101a8a5abe2c174e3e49f9aee32f83897d | github |
CPF-ApplicationTPC/imageknifepro | entry/src/main/ets/pages/TestDesiredSizeDecode.ets | arkts | layoutFallbackPx | 无 decodeImages 时仅用于预览布局
DEFAULT 用原图尺寸;DESIRED 取目标框与原图各维度较大值(objectFit.None 下保证缓存图完整可见) | public static layoutFallbackPx(
strategyIndex: number,
snapshot: ImageInfo,
frameW: number,
frameH: number
): DesiredSizeLayoutPx | null {
if (strategyIndex === DesiredSizeDemoDownSampling.DEFAULT_STRATEGY_INDEX) {
if (snapshot.imageWidth > 0 && snapshot.imageHeight > 0) {
return {... | 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 layoutFallbackPx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left strategyIndex AST#identifier#Right AST#ERROR#Left AST... | public static layoutFallbackPx(
strategyIndex: number,
snapshot: ImageInfo,
frameW: number,
frameH: number
): DesiredSizeLayoutPx | null {
if (strategyIndex === DesiredSizeDemoDownSampling.DEFAULT_STRATEGY_INDEX) {
if (snapshot.imageWidth > 0 && snapshot.imageHeight > 0) {
return {... | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/entry/src/main/ets/pages/TestDesiredSizeDecode.ets#L480-L500 | 6c56f03c551cfa19b1c21782ee4a9b931468fed1 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets | arkts | constructor | Create EAWorker instance with specified name and supportInterop and whether it is a taskpool worker
Internal usage only
@param { string } name The name of the worker
@param { Object } task The initial task to execute
@param { boolean } supportInterop true if need to create JS runtime
@param { boolean } isTaskpool true ... | protected constructor(task: Object, name: string, supportInterop: boolean = false, isTaskpool: boolean = false) {
this.isTaskpool = isTaskpool;
this.initialTask = task as Task;
this.worker = supportInterop ? new InteropWorker(name) : new StaticWorker(name);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | protected constructor(task: Object, name: string, supportInterop: boolean = false, isTaskpool: boolean = false) {
this.isTaskpool = isTaskpool;
this.initialTask = task as Task;
this.worker = supportInterop ? new InteropWorker(name) : new StaticWorker(name);
} | https://gitcode.com/iop123123/arkts-static-skills | 37758d2418c2d013000f72764d7d3b95de49771f | gitcode |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/DefaultProcessor.ets | arkts | addObserver | 增加一个观察者 | addObserver(observer: Observer) {
this.mObserverList.add(observer);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addObserver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left observer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Observer AST#identifier#R... | addObserver(observer: Observer) {
this.mObserverList.add(observer);
} | https://gitee.com/openharmony/applications_calendar_data.git | dd5ee2f3484c3607041174df3505b742c61c68b5 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | clear | Removes all elements from the list. | public clear(): void {
this.head = undefined;
this.tail = undefined;
this.elementNum = 0;
} | 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.head = undefined;
this.tail = undefined;
this.elementNum = 0;
} | https://gitcode.com/iop123123/arkts-static-skills | 3bd878515219db9ef161ed8614ce48c81449d703 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/settings/MainMenuSettingsSubPage.ets | arkts | getEBookDetailPageType | 获取电子书场景的详情页类型 | static getEBookDetailPageType(): DetailPageType {
// 强制模式下直接返回 UNIFIED
if (PageSettingsHelper.isForceUnifiedEnabled()) {
return DetailPageType.UNIFIED;
}
const type = PageSettingsHelper.settingsManager.getString(PageSettingKeys.EBOOK_DETAIL_PAGE_TYPE, DetailPageType.DEFAULT);
return type as ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getEBookDetailPageType 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... | static getEBookDetailPageType(): DetailPageType {
// 强制模式下直接返回 UNIFIED
if (PageSettingsHelper.isForceUnifiedEnabled()) {
return DetailPageType.UNIFIED;
}
const type = PageSettingsHelper.settingsManager.getString(PageSettingKeys.EBOOK_DETAIL_PAGE_TYPE, DetailPageType.DEFAULT);
return type as ... | https://github.com/DaLongZhuaZi/manxia | a7b5a0f8338c6ce278a4863f495887e016ff92da | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/CheatManager.ets | arkts | importLocalCheatsXml | 导入 cheats.xml 文件到本地
@param sourceUri 文件选择器返回的 URI | importLocalCheatsXml(sourceUri: string): boolean {
if (!this.ensureCheatsDir()) return false;
const destPath = this.getLocalCheatsXmlPath();
try {
const srcFile = fileIo.openSync(sourceUri, fileIo.OpenMode.READ_ONLY);
try {
const stat = fileIo.statSync(srcFile.fd);
const buf = ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left importLocalCheatsXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceUri AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left... | importLocalCheatsXml(sourceUri: string): boolean {
if (!this.ensureCheatsDir()) return false;
const destPath = this.getLocalCheatsXmlPath();
try {
const srcFile = fileIo.openSync(sourceUri, fileIo.OpenMode.READ_ONLY);
try {
const stat = fileIo.statSync(srcFile.fd);
const buf = ... | https://github.com/richshaw2015/nds | dbd97b4af08d879dd8861a8dfb646ee93c24079e | github |
PollenWang6/HiXD | entry/src/main/ets/pages/sport/SportPage.ets | arkts | build | ===== 主构建 ===== | build() {
NavDestination() {
Column() {
// 标题栏
Column() {
this.buildWhiteTitle('体育信息')
}
.width('100%')
.backgroundColor(this.accentColor)
// Tab 栏(单条滑动指示器)
Stack({ alignContent: Alignment.BottomStart }) {
Row() {
Column() {
Text... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
NavDestination() {
Column() {
// 标题栏
Column() {
this.buildWhiteTitle('体育信息')
}
.width('100%')
.backgroundColor(this.accentColor)
// Tab 栏(单条滑动指示器)
Stack({ alignContent: Alignment.BottomStart }) {
Row() {
Column() {
Text... | https://github.com/PollenWang6/HiXD | 8370616a014d7e857799c2fb1852c2730efda5a7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets | arkts | drawFrame | 绘制当前帧 | private drawFrame(): void {
if (!this.renderingContext) {
return;
}
const ctx = this.renderingContext;
// 清空画布
ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
// 绘制所有快照
this.animatingSnapshots.forEach(snapshot => {
if (!snapshot.pixelMap) {
retu... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawFrame 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#R... | private drawFrame(): void {
if (!this.renderingContext) {
return;
}
const ctx = this.renderingContext;
// 清空画布
ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
// 绘制所有快照
this.animatingSnapshots.forEach(snapshot => {
if (!snapshot.pixelMap) {
retu... | https://github.com/DaLongZhuaZi/manxia | 3765bdf45235d18f30b30f95674d9037dc4026ca | github |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/AVPlayer/entry/src/main/ets/model/DataModel.ets | arkts | addData | Change a single piece of data. | public addData(index: number, data: VideoData): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData 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 ... | public addData(index: number, data: VideoData): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 4130567d09836a35e07a14feb4880fc9d7c61a4b | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | setSleepTimer | 设置睡眠定时器 | setSleepTimer(minutes: number): void {
console.info(`[PlayerService] Sleep timer set: ${minutes}min`);
// 清除之前的定时器
if (this.sleepTimerId !== -1) {
clearTimeout(this.sleepTimerId);
this.sleepTimerId = -1;
}
this.sleepTimerMinutes = minutes;
this.sleepTimerStartTime = minutes >... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSleepTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minutes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#... | setSleepTimer(minutes: number): void {
console.info(`[PlayerService] Sleep timer set: ${minutes}min`);
// 清除之前的定时器
if (this.sleepTimerId !== -1) {
clearTimeout(this.sleepTimerId);
this.sleepTimerId = -1;
}
this.sleepTimerMinutes = minutes;
this.sleepTimerStartTime = minutes >... | https://github.com/pangpang20/antennaPodHM | 2071fd296c7348cc96174bcdb23f2cd89b881d01 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/DeviceSensorService.ets | arkts | setAccelState | 启用/禁用加速度计 | private setAccelState(reportRateHz: number): void {
// 先取消已有订阅
if (this.accelEnabled) {
try {
sensor.off(sensor.SensorId.ACCELEROMETER);
} catch (err) {
console.warn(`[DeviceSensor] 取消加速度计订阅失败: ${err}`);
}
this.accelEnabled = false;
}
this.accelReportRateHz = r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setAccelState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reportRateHz AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | private setAccelState(reportRateHz: number): void {
// 先取消已有订阅
if (this.accelEnabled) {
try {
sensor.off(sensor.SensorId.ACCELEROMETER);
} catch (err) {
console.warn(`[DeviceSensor] 取消加速度计订阅失败: ${err}`);
}
this.accelEnabled = false;
}
this.accelReportRateHz = r... | https://github.com/AlkaidLab/moonlight-harmony | 8125dfb191780c071be3def195f02f881d548aad | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/ReminderService.ets | arkts | calculateNextReminderDate | 计算下次提醒时间(修复月度日期溢出问题) | static calculateNextReminderDate(currentDate: string, frequency: string): string {
const date: Date = new Date(currentDate);
const originalDay: number = date.getDate();
switch (frequency) {
case 'once':
return currentDate;
case 'daily':
date.setDate(date.getDate() + 1);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateNextReminderDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentDate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left str... | static calculateNextReminderDate(currentDate: string, frequency: string): string {
const date: Date = new Date(currentDate);
const originalDay: number = date.getDate();
switch (frequency) {
case 'once':
return currentDate;
case 'daily':
date.setDate(date.getDate() + 1);
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | c0e7c690abd5c6898764e944e4f9be1b5c8d1bb4 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.