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 |
|---|---|---|---|---|---|---|---|---|---|---|
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/database/Config.ets | arkts | getCreateTableSql | 获取建表SQL语句 | getCreateTableSql(): Record<string, string>|undefined {
return initConfig.dbSql
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getCreateTableSql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Lef... | getCreateTableSql(): Record<string, string>|undefined {
return initConfig.dbSql
} | https://github.com/ZestBox-18/kitebook-frontend | 0686fb200541bb2c6c77b6b66a1600c3ad2ff300 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/AppStorageManager.ets | arkts | getLearningProgress | 获取学习进度 | public async getLearningProgress(moduleName: string): Promise<LearningProgress | null> {
if (this.dataPreferences === null || this.currentUserData === null) {
return null;
}
try {
const username = this.currentUserData.username;
const key = `${AppStorageManager.LEARNING_PROGRESS_KEY}_${u... | 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 getLearningProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#... | public async getLearningProgress(moduleName: string): Promise<LearningProgress | null> {
if (this.dataPreferences === null || this.currentUserData === null) {
return null;
}
try {
const username = this.currentUserData.username;
const key = `${AppStorageManager.LEARNING_PROGRESS_KEY}_${u... | https://github.com/the-wwyang/kids-learning-app | 2258e88887cf70b733c9416cbf459e0a198c3d2c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectProxy.ets | arkts | constructor | Protected constructor that initializes the proxy with a specific invocation handler.
@param handler - The `InvocationHandler` to handle method and property operations. | protected constructor(handler: InvocationHandler) {
this.handler = handler
} | 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 handler AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | protected constructor(handler: InvocationHandler) {
this.handler = handler
} | https://gitcode.com/iop123123/arkts-static-skills | 38cb5a8020884449dfef2cc70cfc22300ad0401c | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/common/VNCConnection.ets | arkts | sendData | 发送数据到VNC服务器
@param data 要发送的数据 | async sendData(data: ArrayBuffer): Promise<void> {
if (this.connectionState !== VNCConnectionState.CONNECTED || !this.tcpSocket) {
throw new Error('Not connected to VNC server');
}
try {
await this.tcpSocket.send({ data: data });
} catch (error) {
const errorMsg = `Failed to send da... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sendData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_a... | async sendData(data: ArrayBuffer): Promise<void> {
if (this.connectionState !== VNCConnectionState.CONNECTED || !this.tcpSocket) {
throw new Error('Not connected to VNC server');
}
try {
await this.tcpSocket.send({ data: data });
} catch (error) {
const errorMsg = `Failed to send da... | https://github.com/AetheriumSimulator/qemu-hmos | 857e49c504123507cf9bd8d94009974a66f4436c | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/common/database/ContactsDataBase.ets | arkts | getEntries | Obtains all key-value pairs that match the specified key prefix.
@param key Indicates the key prefix to be matched.
@param callback Callback function. | getEntries(key: string, callback: AsyncCallback<distributedKVStore.Entry[]>): void {
try {
this.kvStore?.getEntries(key, callback);
} catch (err) {
Logger.error(TAG, `An unexpected error occurred, error message is ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEntries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,... | getEntries(key: string, callback: AsyncCallback<distributedKVStore.Entry[]>): void {
try {
this.kvStore?.getEntries(key, callback);
} catch (err) {
Logger.error(TAG, `An unexpected error occurred, error message is ${JSON.stringify(err)}`);
}
} | https://gitee.com/harmonyos/codelabs.git | e9ebfae6434a67c3706a8f6ec0aa069d4e4be217 | gitee |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/FileFolderUtil.ets | arkts | createNewFolder | 新建文件夹 | static async createNewFolder(context: Context, folder_name: string) {
const new_folder: FileFolder = {
name: folder_name,
date: systemDateTime.getTime(false).toString(), // 这里不需要使用纳秒
video_list: [],
}
const file_folder_list = Preferences.getFileFolder(context) as FileFolder[]
if (!fi... | 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 createNewFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left ... | static async createNewFolder(context: Context, folder_name: string) {
const new_folder: FileFolder = {
name: folder_name,
date: systemDateTime.getTime(false).toString(), // 这里不需要使用纳秒
video_list: [],
}
const file_folder_list = Preferences.getFileFolder(context) as FileFolder[]
if (!fi... | https://github.com/Yebingiscn/SweetVideo | 5407f268040a621f9c4b214979b6b1d81f124b36 | github |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets | arkts | pushByIndexed | 替换指定位置的数据项 | pushByIndexed(index: number, count: number, items: T[]) {
this.originDataArray.splice(index, count, ...items);
this.notifyDataReload()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pushByIndexed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ... | pushByIndexed(index: number, count: number, items: T[]) {
this.originDataArray.splice(index, count, ...items);
this.notifyDataReload()
} | https://gitee.com/openharmony/arkui_ace_engine.git | f2c48fa79e159867aee6e2c8794fe847ad666ead | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getElementsByXPath | 通过XPath获取元素列表 | private getElementsByXPath(xpath: string): string[] {
return this.getElementsByXPathPath(xpath);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsByXPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xpath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private getElementsByXPath(xpath: string): string[] {
return this.getElementsByXPathPath(xpath);
} | https://github.com/DaLongZhuaZi/manxia | 24cd2a04bcad816c2a8b85989442c8402608ce96 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/AuthService.ets | arkts | isTokenValid | 检查Token是否有效
@returns Token是否有效 | static async isTokenValid(): Promise<boolean> {
try {
const settings = SettingsUtil.getInstance();
const token = await settings.getToken();
return token && token.length > 0;
} catch (error) {
console.error('检查Token失败:', error);
return false;
}
} | 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 isTokenValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async isTokenValid(): Promise<boolean> {
try {
const settings = SettingsUtil.getInstance();
const token = await settings.getToken();
return token && token.length > 0;
} catch (error) {
console.error('检查Token失败:', error);
return false;
}
} | https://github.com/LJ666-ui/harmony-health-care | 5b231aa3b96515641441ec2fa8554e4261e67b03 | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | stop | Stops AVPlayer and clears playing state when prepared. | public async stop() {
Logger.info(TAG, 'stop()');
if (this.isPrepared && this.avPlayer) {
try {
await this.avPlayer.stop();
this.updateIsPlay(false);
this.state = AudioPlayerState.PAUSE;
if (this.abilityContext) {
BackgroundUtil.stopContinuousTask(this.abilityCo... | 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 stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right... | public async stop() {
Logger.info(TAG, 'stop()');
if (this.isPrepared && this.avPlayer) {
try {
await this.avPlayer.stop();
this.updateIsPlay(false);
this.state = AudioPlayerState.PAUSE;
if (this.abilityContext) {
BackgroundUtil.stopContinuousTask(this.abilityCo... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 86490b053f1380fd535245e3d0641bc3e847ca71 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/components/SessionView.ets | arkts | setViewScale | Set zoom level | setViewScale(newScale: number): void {
this.viewScale = Math.max(SessionView.MIN_SCALE, Math.min(newScale, SessionView.MAX_SCALE));
this.constrainOffset();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setViewScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newScale AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#... | setViewScale(newScale: number): void {
this.viewScale = Math.max(SessionView.MIN_SCALE, Math.min(newScale, SessionView.MAX_SCALE));
this.constrainOffset();
} | https://github.com/tangwengang-del/freerdp-harmonyos | 30bf9d372f1fc9ed4fbeecbffa331a2b8eb42d03 | github |
tdcare/tdwebrtc | src/main/ets/CameraCapture.ets | arkts | selectProfile | ============================================================
Profile 选择
============================================================
选择最接近目标分辨率的 Profile | private selectProfile(profiles: camera.Profile[]): camera.Profile {
let bestProfile: camera.Profile = profiles[0];
let bestDiff: number = Number.MAX_VALUE;
for (let i = 0; i < profiles.length; i++) {
const p: camera.Profile = profiles[i];
const diff: number = Math.abs(p.size.width - this.conf... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left selectProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#subscript_expression#Left AST#member_expression#Left AST#identifier#Left profiles AST#identifier#Right AST#ERROR#Left... | private selectProfile(profiles: camera.Profile[]): camera.Profile {
let bestProfile: camera.Profile = profiles[0];
let bestDiff: number = Number.MAX_VALUE;
for (let i = 0; i < profiles.length; i++) {
const p: camera.Profile = profiles[i];
const diff: number = Math.abs(p.size.width - this.conf... | https://github.com/tdcare/tdwebrtc | 9cf75f85d31902113d476b2b22c38bb038272621 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/PersistedUriManager.ets | arkts | getPersistedFiles | 获取所有持久化的文件 | public getPersistedFiles(): PersistedUri[] {
return [...this.fileUris];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPersistedFiles 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 Pers... | public getPersistedFiles(): PersistedUri[] {
return [...this.fileUris];
} | https://github.com/richshaw2015/nds | b45a767c6ba641a1a15705afe6f70572bd957f47 | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/VocabularyTracker.ets | arkts | getStatistics | 获取词汇统计 | getStatistics(): Statistics {
const records = this.getAllRecords();
const total = records.length;
const newCount = records.filter((r: VocabularyRecord) => r.status === WordStatus.NEW).length;
const learningCount = records.filter((r: VocabularyRecord) => r.status === WordStatus.LEARNING).length;
c... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Statistics AST#identifier#Right AST#ERROR#Right ... | getStatistics(): Statistics {
const records = this.getAllRecords();
const total = records.length;
const newCount = records.filter((r: VocabularyRecord) => r.status === WordStatus.NEW).length;
const learningCount = records.filter((r: VocabularyRecord) => r.status === WordStatus.LEARNING).length;
c... | https://github.com/CLMC2025/Vignette | a341e622feb6131b24982d204f03ff7f67f5e40b | github |
XJTUWYD/ArkDiff | entry/src/main/ets/viewmodel/DiffSessionViewModel.ets | arkts | startEdit | ==================== 行内编辑 ==================== | startEdit(lineIndex: number): void {
if (!this.diffResult) return;
const lines = this.diffResult.unifiedLines;
if (lineIndex < 0 || lineIndex >= lines.length) return;
const line = lines[lineIndex];
this.editState = {
lineIndex: lineIndex,
originalContent: line.content,
buffer: li... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startEdit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | startEdit(lineIndex: number): void {
if (!this.diffResult) return;
const lines = this.diffResult.unifiedLines;
if (lineIndex < 0 || lineIndex >= lines.length) return;
const line = lines[lineIndex];
this.editState = {
lineIndex: lineIndex,
originalContent: line.content,
buffer: li... | https://github.com/XJTUWYD/ArkDiff | 67b7892c9c0f60cfed9dc6a0ab9c4e636db0d580 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/model/GlobalUserDBModel.ets | arkts | saveLoginInfo | 保存本地登录信息
@param id
@param loginInfoJson
@param cookie
@param password | async saveLoginInfo(id: number, loginInfoJson: string, cookie: string, password: string) {
//先找到上一个登录的账号 如果有的话
let predicates = new relationalStore.RdbPredicates(this.TABLE_USER)
predicates.equalTo("login_state", 1)
let queryResultSet: relationalStore.ResultSet
//处理账号状态
try {
queryResult... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveLoginInfo AST#identifier#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#:#L... | async saveLoginInfo(id: number, loginInfoJson: string, cookie: string, password: string) {
//先找到上一个登录的账号 如果有的话
let predicates = new relationalStore.RdbPredicates(this.TABLE_USER)
predicates.equalTo("login_state", 1)
let queryResultSet: relationalStore.ResultSet
//处理账号状态
try {
queryResult... | https://github.com/RedRackham-R/WanAndroidHarmoney | c994ff0184906a8ef60aff0fb8013922066149bb | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/AuthService.ets | arkts | logout | 用户登出
清除本地存储的认证信息并跳转到登录页 | static async logout(): Promise<void> {
try {
const settings = SettingsUtil.getInstance();
await settings.clearAll();
AppStorage.delete('userToken');
AppStorage.delete('userInfo');
AppStorage.delete('isLoggedIn');
AppStorage.delete('username');
AppStorage.delete('userId');... | 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 logout 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 logout(): Promise<void> {
try {
const settings = SettingsUtil.getInstance();
await settings.clearAll();
AppStorage.delete('userToken');
AppStorage.delete('userInfo');
AppStorage.delete('isLoggedIn');
AppStorage.delete('username');
AppStorage.delete('userId');... | https://github.com/LJ666-ui/harmony-health-care | c83ae6ffd1bc730f9beba240c7f4856a1fe39351 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | contains | Checks whether a given value is within the current range.
@param { ScopeType } value - A ScopeType value
@returns { boolean } If the value is within the current range return true,otherwise return false. | contains(value: T): boolean {
let lowerRes = value.compareTo(this._lowerLimit)
let upperRes = this._upperLimit.compareTo(value)
return lowerRes && upperRes
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left contains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ... | contains(value: T): boolean {
let lowerRes = value.compareTo(this._lowerLimit)
let upperRes = this._upperLimit.compareTo(value)
return lowerRes && upperRes
} | https://gitcode.com/iop123123/arkts-static-skills | 8c142760ac934e8725ea95b687c3b4faa6ff9d8c | gitcode |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/network-request-template.ets | arkts | put | ==================== PUT 请求 ==================== | async put<T>(path: string, body?: object): Promise<ApiResponse<T>> {
let url = this.buildUrl(path);
return this.request<T>(url, http.RequestMethod.PUT, body);
} | 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#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > A... | async put<T>(path: string, body?: object): Promise<ApiResponse<T>> {
let url = this.buildUrl(path);
return this.request<T>(url, http.RequestMethod.PUT, body);
} | https://github.com/Goway-Hui/harmonyos-next-dev | 220a141ae5c263c233584f336871be5ec617f878 | github |
azhu0001/localsend-harmony | serve/src/main/ets/http/ServerResponse.ets | arkts | setHeaders | 设置响应头
@param headers header整个对象 | public setHeaders(headers: Map<string, string>): ServerResponse {
for (const key of headers.keys()) {
this.setHeader(key.toLowerCase(), headers.get(key) || '');
}
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left headers AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | public setHeaders(headers: Map<string, string>): ServerResponse {
for (const key of headers.keys()) {
this.setHeader(key.toLowerCase(), headers.get(key) || '');
}
return this
} | https://gitcode.com/azhu0001/localsend-harmony | af7385be3ad4fc6676107043f32c2bad7632087f | gitcode |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getLabelTextFontSize | 获取标签字体大小 | static getLabelTextFontSize(): number {
return 14;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLabelTextFontSize 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 numbe... | static getLabelTextFontSize(): number {
return 14;
} | https://github.com/chendi126/harmonyOS-TCP | 7fee357eb43b1515dd66cf7e67cb4f9d71f90708 | github |
the-wwyang/kids-learning-app | src/main/ets/services/AchievementService.ets | arkts | getRecommendedNextAchievement | 获取推荐的下一个成就
@param achievements 用户成就列表
@returns 推荐的成就或undefined | static getRecommendedNextAchievement(achievements: Achievement[]): Achievement | undefined {
// 找到进度最高但未解锁的成就
const locked = achievements.filter(a => !a.isUnlocked);
if (locked.length === 0) return undefined;
locked.sort((a, b) => {
const progressA = (a.currentProgress / a.targetValue) * 100;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRecommendedNextAchievement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left achievements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ... | static getRecommendedNextAchievement(achievements: Achievement[]): Achievement | undefined {
// 找到进度最高但未解锁的成就
const locked = achievements.filter(a => !a.isUnlocked);
if (locked.length === 0) return undefined;
locked.sort((a, b) => {
const progressA = (a.currentProgress / a.targetValue) * 100;
... | https://github.com/the-wwyang/kids-learning-app | 4116e1a716ec6bf34f78260f229a682bc924d2c8 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/FileService.ets | arkts | resetDbFileParam | 重置数据库文件参数
@param kdbx 数据库
@param modifiedTime 修改时间
@returns 结果 | public static resetDbFileParam(kdbx: Kdbx, modifiedTime: number): DbFileParam {
FileService.getDbFileParam().database = kdbx;
FileService.getDbFileParam().modifiedTime = modifiedTime;
return FileService.getDbFileParam();
} | 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 resetDbFileParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kdbx AST#identifier#Right AST#:#Left :... | public static resetDbFileParam(kdbx: Kdbx, modifiedTime: number): DbFileParam {
FileService.getDbFileParam().database = kdbx;
FileService.getDbFileParam().modifiedTime = modifiedTime;
return FileService.getDbFileParam();
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/FileService.ets#L70-L74 | e471417817ca44bdffe02cdb3fd9ebb5fb7fec00 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | floatingBallTransparency | 获取悬浮球透明度 | public get floatingBallTransparency(): number {
return this.currentProfile.transparency.floatingBall;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left floatingBallTransparency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public get floatingBallTransparency(): number {
return this.currentProfile.transparency.floatingBall;
} | https://github.com/DaLongZhuaZi/manxia | 978ad15467f58d6d8905362025ac9e0acb209f89 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/BookTransitionOverlay.ets | arkts | isTransitioning | 是否正在过渡中 | public isTransitioning(): boolean {
return this.currentState.isActive;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isTransitioning 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 isTransitioning(): boolean {
return this.currentState.isActive;
} | https://github.com/DaLongZhuaZi/manxia | 8b0bd28d3d096b032a5729e5b6eab2fa65c2ddef | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/selection/RadioDemo.ets | arkts | buildRadio | 自定义 Radio | @Builder function buildRadio(config: RadioConfiguration) {
/*
* RadioConfiguration - 自定义 Radio 的相关信息
* enabled - 是否可用
* contentModifier - 绑定的 ContentModifier 对象
* value - 单选框的名字
* checked - 是否是选中状态
* triggerChange() - 触发 Radio 的 onChange() 回调
*/
Column({ space: 10 }) {
Circle({ wi... | 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 buildRadio AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requir... | @Builder function buildRadio(config: RadioConfiguration) {
/*
* RadioConfiguration - 自定义 Radio 的相关信息
* enabled - 是否可用
* contentModifier - 绑定的 ContentModifier 对象
* value - 单选框的名字
* checked - 是否是选中状态
* triggerChange() - 触发 Radio 的 onChange() 回调
*/
Column({ space: 10 }) {
Circle({ wi... | https://github.com/webabcd/HarmonyDemo | 77795e5ecfb980d9b9c1fceda4765c56827042d1 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Boolean.ets | arkts | hashCode | Returns a hash code (integer representation) for this instance
@returns representation of this instance | public override hashCode(): int {
if (this.value) {
return 1;
}
return 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left hashCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override hashCode(): int {
if (this.value) {
return 1;
}
return 0;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4c07c5d6d0e2f09d3621de6b01be6da83bf09646 | gitee |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/MainAbility/pages/music2.ets | arkts | onNextMusic | 播放下一首 | onNextMusic() {
CommonLog.info("Play next music")
//下面也是为了防止多次点击
if (this.isSwitching) {
CommonLog.info('onNextMusic ignored, isSwitching');
return;
}
this.isSwitching = true
this.playerManager.playNextMusic()
this.playAnimation() // 播放动画
this.isPlaying = true
this.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onNextMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | onNextMusic() {
CommonLog.info("Play next music")
//下面也是为了防止多次点击
if (this.isSwitching) {
CommonLog.info('onNextMusic ignored, isSwitching');
return;
}
this.isSwitching = true
this.playerManager.playNextMusic()
this.playAnimation() // 播放动画
this.isPlaying = true
this.... | https://gitee.com/openharmony-sig/online_event.git | e2296140da85d92bd3c2fa6cc23b58c8259f7894 | gitee |
fbinba3955/Flymby | smartxplayer/src/main/ets/SXAudioPlayer.ets | arkts | onAudioInterrupt | https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V4/audio-playback-concurrency-0000001630145913-V4#ZH-CN_TOPIC_0000001714627429__%E7%9B%91%E5%90%AC%E9%9F%B3%E9%A2%91%E6%89%93%E6%96%AD%E4%BA%8B%E4%BB%B6 | private onAudioInterrupt(interruptEvent: audio.InterruptEvent) {
// 在发生音频打断事件时,audioRenderer收到interruptEvent回调,此处根据其内容做相应处理
// 先读取interruptEvent.forceType的类型,判断系统是否已强制执行相应操作
// 再读取interruptEvent.hintType的类型,做出相应的处理
if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) {
// 强... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onAudioInterrupt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left interruptEvent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | private onAudioInterrupt(interruptEvent: audio.InterruptEvent) {
// 在发生音频打断事件时,audioRenderer收到interruptEvent回调,此处根据其内容做相应处理
// 先读取interruptEvent.forceType的类型,判断系统是否已强制执行相应操作
// 再读取interruptEvent.hintType的类型,做出相应的处理
if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) {
// 强... | https://github.com/fbinba3955/Flymby | 9d83de1d7a04fc75398065feeec3941e3c04032b | github |
harmonyos/codelabs | HarmonyOS_NEXT/Preferences/entry/src/main/ets/view/ButtonComponent.ets | arkts | getButtonItemValues | Gets the data in the clicked button. | getButtonItemValues() {
let values: Array<ButtonItemData> = [
new ButtonItemData(
$r('app.string.write_data_btn_text'),
() => {
// Write data.
PreferenceModel.writeData(this.fruit);
}
),
new ButtonItemData(
$r('app.string.read_data_btn_text'),
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getButtonItemValues 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_bloc... | getButtonItemValues() {
let values: Array<ButtonItemData> = [
new ButtonItemData(
$r('app.string.write_data_btn_text'),
() => {
// Write data.
PreferenceModel.writeData(this.fruit);
}
),
new ButtonItemData(
$r('app.string.read_data_btn_text'),
... | https://gitee.com/harmonyos/codelabs.git | 2481afa52577ecede6c9123c1539730015499f91 | gitee |
openharmony-sig/applications_clock | feature/timer/src/main/ets/controller/TimerController.ets | arkts | reset | Timer reset | public reset() {
LogUtil.info(`${TAG} timer reset `);
this.beforePauseTime = 0;
this.startTimestamp = 0;
this.timeList = [];
this.lastTimeMs = 0;
this.notifierId = -1;
this.currentTimeMs = 0;
this.state = TimerState.IDLE;
this.notifyTimeChanges();
this.notifyStateChanges();
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#L... | public reset() {
LogUtil.info(`${TAG} timer reset `);
this.beforePauseTime = 0;
this.startTimestamp = 0;
this.timeList = [];
this.lastTimeMs = 0;
this.notifierId = -1;
this.currentTimeMs = 0;
this.state = TimerState.IDLE;
this.notifyTimeChanges();
this.notifyStateChanges();
... | https://gitee.com/openharmony-sig/applications_clock.git | cdc12cb2f3a39006503f4f877437e4f22aa023eb | gitee |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/pages/ShoppingCartPage.ets | arkts | checkout | 结算按钮点击 | checkout() {
const selectedItems = this.cartItems.filter(item => item.selected);
if (selectedItems.length === 0) {
promptAction.showToast({
message: '请选择要结算的商品',
duration: 2000
});
return;
}
// 显示支付对话框
this.showPaymentDialog = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST... | checkout() {
const selectedItems = this.cartItems.filter(item => item.selected);
if (selectedItems.length === 0) {
promptAction.showToast({
message: '请选择要结算的商品',
duration: 2000
});
return;
}
// 显示支付对话框
this.showPaymentDialog = true;
} | https://github.com/ChangJing01/HarmonyOS-FinalProject | c0081a3ec6b725f00b5265018d39739ef6167b75 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | hash | Gets the serialized URL as a string.
@return {string} Returns the serialized URL as a string. | get hash(): string {
return this.cHash;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left hash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ER... | get hash(): string {
return this.cHash;
} | https://gitcode.com/iop123123/arkts-static-skills | 7d64d40abc31e59880623124d90086f254f80189 | gitcode |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/features/mydemo/src/main/ets/Video/components/CommentKeyboard.ets | arkts | addKeyboardHeightListener | 监听键盘高
@param win | addKeyboardHeightListener(win: window.Window) {
win.on('keyboardHeightChange', height => {
console.info('keyboard height has changed', this.getUIContext().px2vp(height))
if (height !== 0) {
this.keyboardHeight = this.getUIContext().px2vp(height)
return
}
if (!this.isEmojiK... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addKeyboardHeightListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left win AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#ident... | addKeyboardHeightListener(win: window.Window) {
win.on('keyboardHeightChange', height => {
console.info('keyboard height has changed', this.getUIContext().px2vp(height))
if (height !== 0) {
this.keyboardHeight = this.getUIContext().px2vp(height)
return
}
if (!this.isEmojiK... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 035e85834d2c788f3c35b7b3f9ad5b7aa0471c41 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/view/OrderPayPage.ets | arkts | build | 构建订单支付页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.order_pay"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset
}
}) {
this.OrderPayContent();... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.order_pay"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset
}
}) {
this.OrderPayContent();... | https://github.com/Joker-x-dev/CoolMallArkTS | dbbce96cb8c40096ec048b2666fe4f330341dcc4 | github |
SMAT-Lab/HapRepair | arkts_files/155.ets | arkts | onActive | Callback when the page is in the foreground | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onActive 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#Lef... | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
} | https://github.com/SMAT-Lab/HapRepair | 6cb8e52504de4f57b0a4fa55fa8a9c53e9240045 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | explore | 获取发现页书籍列表 | async explore(exploreUrl: string, page: number = 1): Promise<LegadoSearchBook[]> {
this.ensureJsLib();
if (!this.source.ruleExplore) {
logger.warn(TAG, '书源没有配置发现规则');
return [];
}
try {
const request = await this.analyzeRequestUrl(exploreUrl, '', page);
const response = await ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left explore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left exploreUrl... | async explore(exploreUrl: string, page: number = 1): Promise<LegadoSearchBook[]> {
this.ensureJsLib();
if (!this.source.ruleExplore) {
logger.warn(TAG, '书源没有配置发现规则');
return [];
}
try {
const request = await this.analyzeRequestUrl(exploreUrl, '', page);
const response = await ... | https://github.com/DaLongZhuaZi/manxia | be4234436c24e34a16a205a8a54d5778abbf45c6 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | updateSessionTitle | 手动更新会话标题 | async updateSessionTitle(title: string): Promise<void> {
const updated = await this.sessionStore.updateCurrentSessionTitle(title)
this.currentSession = this.sessionStore.getCurrentSession()
if (!updated) {
return
}
// 通知标题更新
if (this.titleCallbacks !== null && this.titleCallbacks.onTitl... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateSessionTitle AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async updateSessionTitle(title: string): Promise<void> {
const updated = await this.sessionStore.updateCurrentSessionTitle(title)
this.currentSession = this.sessionStore.getCurrentSession()
if (!updated) {
return
}
// 通知标题更新
if (this.titleCallbacks !== null && this.titleCallbacks.onTitl... | https://github.com/LongLiveY96/chatcube | 0841b3c1b53faf32c7cac3075c1b9aaf466b3d58 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets | arkts | scheduleCleanup | 递归调度清理任务 | private scheduleCleanup(): void {
// 每5分钟清理一次未使用的WebView实例
const scheduleNext = (): void => {
this.cleanupUnusedInstances();
if (this.cleanupTimer !== null) {
this.scheduleCleanup();
}
};
// 使用setTimeout模拟setInterval的递归调度
this.cleanupTimer = setTimeout(scheduleNext, ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleCleanup 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#... | private scheduleCleanup(): void {
// 每5分钟清理一次未使用的WebView实例
const scheduleNext = (): void => {
this.cleanupUnusedInstances();
if (this.cleanupTimer !== null) {
this.scheduleCleanup();
}
};
// 使用setTimeout模拟setInterval的递归调度
this.cleanupTimer = setTimeout(scheduleNext, ... | https://github.com/DaLongZhuaZi/manxia | 8f73954ec6f65d8210fe90fef67466a0a7f67150 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | onCryptoReset | 注册加密重置回调 (供 Service 层使用, 重置时清空内存数据) | onCryptoReset(callback: () => void): void {
this.onCryptoResetCallbacks.push(callback);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left onCryptoReset AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argu... | onCryptoReset(callback: () => void): void {
this.onCryptoResetCallbacks.push(callback);
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 7de3daa4475ae6620015d98d3a23a163a829811d | github |
openharmony-tpc/openharmony_tpc_samples | dialogs/library/src/main/ets/components/progress/base/LVBase.ets | arkts | setIsBack | 设置动画第一次是由start变为end还是end变为start,只有当animRepeatMode为true时才有效
为true时,动画第一次是由start变为end
为end时,动画第一次是由end变为start | setIsBack(isBack:boolean) {
this.isBack = isBack
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setIsBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isBack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right ... | setIsBack(isBack:boolean) {
this.isBack = isBack
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 223b356d5d73c05a174cfcce32fb0d31968108b8 | gitee |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/BreakpointState.ets | arkts | isLG | 是否为大断点
@returns {boolean} 是否大断点 | isLG(): boolean {
return this.current === BreakpointType.LG;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLG 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_bloc... | isLG(): boolean {
return this.current === BreakpointType.LG;
} | https://github.com/Joker-x-dev/CoolMallArkTS | dbe1977cf9dc349c2f9b957d076fdca092bc7f33 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/client/tools/ControlPacket.ets | arkts | createSetClipboard | ============ TYPE_SET_CLIPBOARD (9) ============
格式: type(1) + sequence(8) + paste(1) + length(4) + text(N) = 14+N bytes | static createSetClipboard(text: string, sequence: bigint = 0n, paste: boolean = false): ArrayBuffer {
const textBytes = buffer.from(text, 'utf-8');
const textLen = textBytes.buffer.byteLength;
const buf = new ArrayBuffer(14 + textLen);
const view = new DataView(buf);
view.setUint8(0, ControlM... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createSetClipboard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static createSetClipboard(text: string, sequence: bigint = 0n, paste: boolean = false): ArrayBuffer {
const textBytes = buffer.from(text, 'utf-8');
const textLen = textBytes.buffer.byteLength;
const buf = new ArrayBuffer(14 + textLen);
const view = new DataView(buf);
view.setUint8(0, ControlM... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 1060d5d1ea37757e07e2003def6a8304348ea3d4 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | getSplitDetails | 获取分摊详情 | getSplitDetails(): BillSplitDetail[] {
try {
const parsed = JSON.parse(this.splitDetailsJson) as BillSplitDetail[];
return parsed;
} catch (e) {
return [];
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSplitDetails AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left BillSplitDetail ... | getSplitDetails(): BillSplitDetail[] {
try {
const parsed = JSON.parse(this.splitDetailsJson) as BillSplitDetail[];
return parsed;
} catch (e) {
return [];
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8bb7a73a6f6ba8f8be93f93aaa32694aa8d26859 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | setSensitivity | 设置灵敏度倍率 (0.5 ~ 3.0)
倍率越高,越小的旋转幅度即可让摇杆满偏 | setSensitivity(multiplier: number): void {
this._sensitivityMultiplier = Math.max(0.5, Math.min(10.0, multiplier));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSensitivity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left multiplier AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AS... | setSensitivity(multiplier: number): void {
this._sensitivityMultiplier = Math.max(0.5, Math.min(10.0, multiplier));
} | https://github.com/AlkaidLab/moonlight-harmony | a8ab7ee18ec4836ca8d3cacb0ee055bb306050ce | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BudgetManager.ets | arkts | deleteBudget | 删除预算记录。 | private static async deleteBudget(id: number): Promise<number> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('id', id);
return new Promise<number>((resolve, reject) => {
dbManager.dbStore?.delete(predicates)
.then((num: number) => {
resolve... | 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 deleteBudget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id... | private static async deleteBudget(id: number): Promise<number> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('id', id);
return new Promise<number>((resolve, reject) => {
dbManager.dbStore?.delete(predicates)
.then((num: number) => {
resolve... | https://github.com/ZestBox-18/kitebook-frontend | fe6e5152062e713de511cee1b4c46db4db7bb56c | github |
codelably/HCompass | core/module/src/main/ets/ModuleRegistry.ets | arkts | getModuleIds | 获取所有已注册的模块 ID
@returns 模块 ID 列表 | getModuleIds(): string[] {
return Array.from(this.modules.keys());
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getModuleIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left :... | getModuleIds(): string[] {
return Array.from(this.modules.keys());
} | https://github.com/codelably/HCompass | 5c8e05b0e59a9a67aaab282cd392cf506553a30a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | createSlideInState | 创建滑入动画状态 | public createSlideInState(direction: 'left' | 'right' | 'up' | 'down'): AnimationState {
switch (direction) {
case 'left':
return {
isPlaying: false,
isCompleted: false,
currentIteration: 0,
progress: 0,
translateX: 0
};
case 'right':
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createSlideInState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left direction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_e... | public createSlideInState(direction: 'left' | 'right' | 'up' | 'down'): AnimationState {
switch (direction) {
case 'left':
return {
isPlaying: false,
isCompleted: false,
currentIteration: 0,
progress: 0,
translateX: 0
};
case 'right':
... | https://github.com/DaLongZhuaZi/manxia | 617e3013e925cc4065cdd8f61b1836aded959896 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/LearningRecorder.ets | arkts | getCloudSync | V0.6.4: read-only accessor used by pages that want to peek at the
attached sync service (e.g. ConfigPage's manual-sync button). | getCloudSync(): CloudSyncLike | undefined {
return this.cloudSync;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCloudSync 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 AST#identifier#Left CloudSyncLike AST#iden... | getCloudSync(): CloudSyncLike | undefined {
return this.cloudSync;
} | https://github.com/terryma2024/happyword | e0fcd820de7451a653cdd9c7c52f60f93aded094 | github |
apap6628114/nga_oh | entry/src/main/ets/store/CategoryStore.ets | arkts | reset | 重置缓存(登出时调用) | reset(): void {
this.cachedCategories = []
this.categoriesRefreshing = false
this.categoriesLoaded = false
this.categoriesError = ''
super.reset()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | reset(): void {
this.cachedCategories = []
this.categoriesRefreshing = false
this.categoriesLoaded = false
this.categoriesError = ''
super.reset()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/CategoryStore.ets#L30-L36 | ca0dc827ace1d62aadf4a1b823a5b59fac6fa1f8 | github |
aimilin6688/KeePassHO | entry/src/main/ets/components/loading/PromptActionUtils.ets | arkts | openCustomDialog | 弹出自定义弹窗 | static async openCustomDialog<T extends PromptActionBean>(value: PromptActionOptions<T>): Promise<void> {
try {
if (PromptActionUtils.existsCustomDialog(value.params.dialogId)) {
return;
}
const uiContext = CommonUtils.getUiContext();
const uiPromptAction = uiContext.getPromptActio... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left openCustomDialog AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#typ... | static async openCustomDialog<T extends PromptActionBean>(value: PromptActionOptions<T>): Promise<void> {
try {
if (PromptActionUtils.existsCustomDialog(value.params.dialogId)) {
return;
}
const uiContext = CommonUtils.getUiContext();
const uiPromptAction = uiContext.getPromptActio... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/loading/PromptActionUtils.ets#L45-L93 | 543cfaba2d617b379896dd7896f03d7fcf30d1f9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets | arkts | shrinkTo | Shrinks the Array to the specified length. Elements beyond the new length are removed.
@param { int } arrayLength The length at which to shrink the array.
@throws { RangeError } Throws a RangeError if the array length is negative.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public shrinkTo(arrayLength: int): void {
if(arrayLength < 0){
throw new RangeError("Parameter error.Invalid array length.")
}
if (arrayLength >= this.actualLength) {
return
}
let newLen: int = arrayLength
if (newLen < 0) {
// Conve... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left shrinkTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arrayLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifi... | public shrinkTo(arrayLength: int): void {
if(arrayLength < 0){
throw new RangeError("Parameter error.Invalid array length.")
}
if (arrayLength >= this.actualLength) {
return
}
let newLen: int = arrayLength
if (newLen < 0) {
// Conve... | https://gitcode.com/iop123123/arkts-static-skills | a748357b340c038019a23dfd054c0cda684bc103 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | safeSplit | 安全分割字符串(排除引号内和<js>标签内的分割符) | private safeSplit(str: string, splitter: string): string[] {
const results: string[] = [];
let current = '';
let inQuote = false;
let quoteChar = '';
let inJsTag = false;
for (let i = 0; i < str.length; i++) {
// 检查是否进入或离开<js>标签
if (this.isJsOpenTagAt(str, i)) {
inJsTag = ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left safeSplit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | private safeSplit(str: string, splitter: string): string[] {
const results: string[] = [];
let current = '';
let inQuote = false;
let quoteChar = '';
let inJsTag = false;
for (let i = 0; i < str.length; i++) {
// 检查是否进入或离开<js>标签
if (this.isJsOpenTagAt(str, i)) {
inJsTag = ... | https://github.com/DaLongZhuaZi/manxia | 033327198446303339d58c245aeb16fc4c9e6628 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/06.conversions_and_contexts/06.numeric_contexts/01.unary_numeric_promotion/shift_n.ets | arkts | main | ---
desc: >-
Unary numeric promotion is performed on expressions in the following situation:
Each operand, separately, of a shift operator.
params: "{{op.name}}, {{c.vtype}} or {{c.rtype}} cannot be promoted to primitive integral."
tags: [compile-only, negative]
--- | function main(): int {
let v: {{c.vtype}} = {{c.vval}}; | 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 {
let v: {{c.vtype}} = {{c.vval}}; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5b51c86efda7f5a46498e8e77e6f3fb42451ad45 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | extractChapterNumberFromTitle | 从章节标题中提取章节号
[增强] 支持多种语言、符号格式,提高准确性和兼容性 | private extractChapterNumberFromTitle(title: string): number | null {
if (!title) return null;
// 预处理:去除首尾空格
const cleanTitle = title.trim();
// 中文数字映射(扩展支持)
const chineseNumMap: Record<string, number> = {
'零': 0, '〇': 0,
'一': 1, '壹': 1,
'二': 2, '贰': 2, '两': 2,
'三': 3, '叁... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractChapterNumberFromTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | private extractChapterNumberFromTitle(title: string): number | null {
if (!title) return null;
// 预处理:去除首尾空格
const cleanTitle = title.trim();
// 中文数字映射(扩展支持)
const chineseNumMap: Record<string, number> = {
'零': 0, '〇': 0,
'一': 1, '壹': 1,
'二': 2, '贰': 2, '两': 2,
'三': 3, '叁... | https://github.com/DaLongZhuaZi/manxia | ebbd49d2ff9617193974eff237b53e7c1751b079 | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/utils/lunar.ets | arkts | getLunarYearDays | 获取农历年的总天数
@param lunarYear 农历年
@returns 总天数 | static getLunarYearDays(lunarYear: number): number {
const info: number = LUNAR_INFO[lunarYear - 1900];
let totalDays: number = 0;
for (let i: number = 1; i <= 12; i++) {
const bitPosition: number = 16 - i;
totalDays += (info >> bitPosition) & 0x01 ? 30 : 29;
}
const leapMonth: number ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLunarYearDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lunarYear AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | static getLunarYearDays(lunarYear: number): number {
const info: number = LUNAR_INFO[lunarYear - 1900];
let totalDays: number = 0;
for (let i: number = 1; i <= 12; i++) {
const bitPosition: number = 16 - i;
totalDays += (info >> bitPosition) & 0x01 ? 30 : 29;
}
const leapMonth: number ... | https://github.com/codelably/tuniao-ui | 5000e7c959953269dac8090141b2ab18797f7220 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets | arkts | destroy | 销毁执行器 | destroy(): void {
// 停止状态检查
if (this.statusCheckInterval !== null) {
clearInterval(this.statusCheckInterval);
this.statusCheckInterval = null;
}
// 清理待处理任务
const destroyTaskIds = Array.from(this.pendingTasks.keys());
for (let i = 0; i < destroyTaskIds.length; i++) {
cons... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left destroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | destroy(): void {
// 停止状态检查
if (this.statusCheckInterval !== null) {
clearInterval(this.statusCheckInterval);
this.statusCheckInterval = null;
}
// 清理待处理任务
const destroyTaskIds = Array.from(this.pendingTasks.keys());
for (let i = 0; i < destroyTaskIds.length; i++) {
cons... | https://github.com/DaLongZhuaZi/manxia | e9705e4e1c2eef6d3478731bbae89f7333ab4fa8 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/AccessibilityConfig.ets | arkts | toggleLargeTextMode | 切换大字体模式 | public toggleLargeTextMode(): void {
this.config.isLargeTextMode = !this.config.isLargeTextMode;
AppStorage.setOrCreate<boolean>('isLargeTextMode', this.config.isLargeTextMode);
if (this.config.isLargeTextMode) {
this.setFontScale(1.5);
} else {
this.setFontScale(1.0);
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toggleLargeTextMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ex... | public toggleLargeTextMode(): void {
this.config.isLargeTextMode = !this.config.isLargeTextMode;
AppStorage.setOrCreate<boolean>('isLargeTextMode', this.config.isLargeTextMode);
if (this.config.isLargeTextMode) {
this.setFontScale(1.5);
} else {
this.setFontScale(1.0);
}
... | https://github.com/LJ666-ui/harmony-health-care | 46d4ee6e59d4367a3fe0cbe56c7606629e1114b3 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | getStatisticsByReceiptType | 按票据类型统计 | static async getStatisticsByReceiptType(userId: number): Promise<ReceiptTypeStatistics[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
receipt_type,
COUNT(*) as count,
AVG(confidence_score) as avg_confidence,
SUM(CASE WHEN to... | 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 getStatisticsByReceiptType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right A... | static async getStatisticsByReceiptType(userId: number): Promise<ReceiptTypeStatistics[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
receipt_type,
COUNT(*) as count,
AVG(confidence_score) as avg_confidence,
SUM(CASE WHEN to... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 583272758cc19a9d526a17aaf5f659722b6fd627 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ComicConverter.ets | arkts | loadReadingProgress | 从数据库加载漫画的阅读进度
@param comicId 漫画ID
@param userId 用户ID
@returns Promise<ReadingProgress> 阅读进度 | private static async loadReadingProgress(comicId: string, userId: string): Promise<ReadingProgress> {
const dataManager = DataManager.getInstance();
try {
// 从read_history表获取最新的阅读记录
const historyList = await dataManager.getReadHistoryByComic(comicId, userId, 1);
if (historyList &... | 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 loadReadingProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AS... | private static async loadReadingProgress(comicId: string, userId: string): Promise<ReadingProgress> {
const dataManager = DataManager.getInstance();
try {
// 从read_history表获取最新的阅读记录
const historyList = await dataManager.getReadHistoryByComic(comicId, userId, 1);
if (historyList &... | https://github.com/DaLongZhuaZi/manxia | e765a03138c88f95dfbcda3af4b8daca415c7e8c | github |
darcycui/DarcyHarmonyNext | entry/src/main/ets/pages/entry/basepage/ColumnPage.ets | arkts | aboutToDisappear | 生命周期回调:页面即将消失 所有组件 | aboutToDisappear(): void {
Log.info(TAG + "aboutToDisappear");
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
Log.info(TAG + "aboutToDisappear");
} | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/basepage/ColumnPage.ets#L42-L44 | 63c5c04bdf18a8816bbee1723a5d82c1d75c883d | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | readBigInt64BE | Reads a signed 64-bit integer from the buffer at the specified offset using big-endian format
@param {int} [offset=0] - Number of bytes to skip before reading
@returns {bigint} The read value
@throws { BusinessError } 10200001 - The value of "[offset]" is out of range. It mast be >= 0 and
<= buf.length - 8. Received va... | public readBigInt64BE(offset: int = 0): bigint {
let lengthOffset: int = this.length - 8;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= $... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readBigInt64BE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expr... | public readBigInt64BE(offset: int = 0): bigint {
let lengthOffset: int = this.length - 8;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= $... | https://gitcode.com/iop123123/arkts-static-skills | c9492021940ae4f8a8c165f1b7fb5d0a33dcea38 | gitcode |
LZZLHY/hlib | entry/src/main/ets/utils/Layout.ets | arkts | resolveNavStyle | 决定最终导航样式:
- 用户偏好为 'bottom' / 'side' 时直接遵从(但 sm 强制底栏)
- 'auto':sm/md → bottom,lg/xl → side | static resolveNavStyle(bp: Breakpoint, pref: NavStyle): 'bottom' | 'side' {
if (bp === 'sm') return 'bottom'; // 手机绝不上侧栏
if (pref === 'side') return 'side';
if (pref === 'bottom') return 'bottom';
// auto
if (bp === 'lg' || bp === 'xl') return 'side';
return 'bottom';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resolveNavStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Br... | static resolveNavStyle(bp: Breakpoint, pref: NavStyle): 'bottom' | 'side' {
if (bp === 'sm') return 'bottom'; // 手机绝不上侧栏
if (pref === 'side') return 'side';
if (pref === 'bottom') return 'bottom';
// auto
if (bp === 'lg' || bp === 'xl') return 'side';
return 'bottom';
} | https://github.com/LZZLHY/hlib | 9f6c846b032cba4b008a642905ac626398c302a2 | github |
huaweicloud/huaweicloud-iot-device-sdk-arkts | huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets | arkts | reportDeviceMessage | 上报设备消息
@param deviceMessage 设备消息
@param qos qos
@returns | reportDeviceMessage(deviceMessage: DeviceMessage, qos: IoTMqttQos = 0) : Promise<IoTMqttResponse> {
if (!this.mqttClient) {
return new Promise<IoTMqttResponse>((resolve, reject) => reject("mqtt client is null"));
}
const publishOption: IoTMqttPublishOptions = {
topic: `$oc/devices/${this.clien... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left reportDeviceMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deviceMessage AST#identifier#Right AST#:#Left : AST#:#... | reportDeviceMessage(deviceMessage: DeviceMessage, qos: IoTMqttQos = 0) : Promise<IoTMqttResponse> {
if (!this.mqttClient) {
return new Promise<IoTMqttResponse>((resolve, reject) => reject("mqtt client is null"));
}
const publishOption: IoTMqttPublishOptions = {
topic: `$oc/devices/${this.clien... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts | c90db3b114601af3192321895aa28849b898cb32 | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics2D/TextEngine/ThemeFont/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | [StartExclude arkts_theme_font_entry_ability] | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(DOMAIN, 'testTag', 'onCreate');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(DOMAIN, 'testTag', 'onCreate');
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 680e1bc481310a1abb3ea58530ef39534afbdf11 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | getByReceiptType | 根据票据类型查询 | static async getByReceiptType(
userId: number,
receiptType: string,
limit: number = 30
): Promise<OCRRecognitionRecord[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${OCRRecognitionRecord.tableName}
WHERE user_id = ? AND recei... | 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 getByReceiptType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left ... | static async getByReceiptType(
userId: number,
receiptType: string,
limit: number = 30
): Promise<OCRRecognitionRecord[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${OCRRecognitionRecord.tableName}
WHERE user_id = ? AND recei... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ee40fa4692055397102356cd1910a7891ef2b6e3 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MultiAgentOrchestrator.ets | arkts | saveConversation | 保存对话
@param sessionId 会话ID
@param userId 用户ID
@param question 用户问题
@param answers 智能体回答 | private async saveConversation(
sessionId: string,
userId: string,
question: string,
answers: AgentAnswer[]
): Promise<void> {
// 保存用户消息
const userMessage: ConversationMessage = {
role: 'user',
content: question,
timestamp: Date.now()
};
await this.memory.save(sessi... | 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 saveConversation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:... | private async saveConversation(
sessionId: string,
userId: string,
question: string,
answers: AgentAnswer[]
): Promise<void> {
// 保存用户消息
const userMessage: ConversationMessage = {
role: 'user',
content: question,
timestamp: Date.now()
};
await this.memory.save(sessi... | https://github.com/LJ666-ui/harmony-health-care | cc402a5cdcd8e40936bf3104546798d131d6fe75 | github |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets | arkts | levenshteinDistance | Calculate Levenshtein distance for similarity comparison | private levenshteinDistance(a: string, b: string): number {
if (a.length === 0) return b.length;
if (b.length === 0) return a.length;
const matrix: number[][] = [];
for (let i = 0; i <= b.length; i++) {
matrix[i] = [i];
}
for (let j = 0; j <= a.length; j++) {
matrix[0][j] = j;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left levenshteinDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private levenshteinDistance(a: string, b: string): number {
if (a.length === 0) return b.length;
if (b.length === 0) return a.length;
const matrix: number[][] = [];
for (let i = 0; i <= b.length; i++) {
matrix[i] = [i];
}
for (let j = 0; j <= a.length; j++) {
matrix[0][j] = j;
... | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L73-L102 | df65c32e2b313d649818a953eecbac54598e36ff | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets | arkts | getItemCount | 获取当前物品数量 | getItemCount(): number {
return this.itemCount;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getItemCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement... | getItemCount(): number {
return this.itemCount;
} | https://gitcode.com/openharmony/codelabs | ad2a917efc2fcc866c0ea4bfe0dfe780c6cc77a5 | gitcode |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/AddressList.ets | arkts | showTips | 被选中的地址
展示提示弹窗 | showTips(message: string) {
promptAction.showToast({
message: message,
duration: 1000,
bottom: 400
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showTips AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Lef... | showTips(message: string) {
promptAction.showToast({
message: message,
duration: 1000,
bottom: 400
})
} | https://gitee.com/openharmony-sig/ohos_easyui.git | 5fc60ca3525e11c809118c7ab739c623c9d590ad | gitee |
HarmonyOS_Samples/BestPracticeSnippets | PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/display_sync_example.ets | arkts | build | [End vsync_power_case_1] | build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
// 30FPS 动态文本
Row() {
this.doSomeRenderFirst()
}
.width('80%')
.height('auto')
.justifyContent(FlexAlign.Center)
.margin({ top: 10 })
// 60FPS 动态文本
Row() {
thi... | 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() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
// 30FPS 动态文本
Row() {
this.doSomeRenderFirst()
}
.width('80%')
.height('auto')
.justifyContent(FlexAlign.Center)
.margin({ top: 10 })
// 60FPS 动态文本
Row() {
thi... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 4319c3590cfc293791e8ef276a9a5e6937e0ae63 | gitcode |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BillManager.ets | arkts | deleteBill | 删除账单
@param id 账单ID
@returns 删除的记录数 | static async deleteBill(id: number): Promise<number> {
const existingBill: BillBean | null = await BillManager.getBillById(id);
if (existingBill === null) {
return -1;
}
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('id', id);
return new Promise<nu... | 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 deleteBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Ri... | static async deleteBill(id: number): Promise<number> {
const existingBill: BillBean | null = await BillManager.getBillById(id);
if (existingBill === null) {
return -1;
}
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('id', id);
return new Promise<nu... | https://github.com/ZestBox-18/kitebook-frontend | d9d62919f520d2e7f7528849a47dea2e783bf923 | github |
dingzhilin1990/zhilinclaw | src/skills/SkillRegistry.ets | arkts | getSkillsCount | 获取技能数量 | public getSkillsCount(): number {
return this.skills.size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSkillsCount 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#... | public getSkillsCount(): number {
return this.skills.size;
} | https://github.com/dingzhilin1990/zhilinclaw | c78dcaaa63550c829853d08e96bda91d26eeae63 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_ulong.ets | arkts | main | ---
desc: check bitwise XOR of two unsigned long integers
--- | function main(): void {
const a: ulong = {{v.left}}
const b: ulong = {{v.right}}
assert (a ^ b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ulong = {{v.left}}
const b: ulong = {{v.right}}
assert (a ^ b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1bd3766ef478866bcf75574d01a777ee83b0bb42 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_plus/unary_plus_ubyte.ets | arkts | main | ---
desc: check unary plus operation for unsigned byte operand
--- | function main(): void {
const v: ubyte = {{v.value}}
assert +(v) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const v: ubyte = {{v.value}}
assert +(v) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6db0b5fff3cbc5128faf604e9cbcd4e559b7450a | gitee |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/model/CityModel.ets | arkts | getLongitudeDMS | 获取经度(度分秒格式) | getLongitudeDMS(): string {
return CityModel.decimalToDMS(this.getLongitudeDecimal());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLongitudeDMS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem... | getLongitudeDMS(): string {
return CityModel.decimalToDMS(this.getLongitudeDecimal());
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | e6fdae447661e4672c8657c9ca50697bed33ca77 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _readMisc | 读取杂项:注释、处理指令、空白字符
@see https://www.w3.org/TR/xml/ 2.8节 [27] Misc
@return 是否读取到了杂项信息; | private _readMisc(): boolean{
return this._readComment() || this._readProcessingInstruction() || this._readWhitespace();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readMisc 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#... | private _readMisc(): boolean{
return this._readComment() || this._readProcessingInstruction() || this._readWhitespace();
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | d66e4ec19f649ee0d0bef9879d4e7ee88064506d | gitee |
ASweetBite/HarmonyPulse | entry/src/main/ets/pages/views/LibraryView.ets | arkts | triggerVibration | 触发振动的封装函数 | triggerVibration() {
try {
// 触发马达振动
vibrator.startVibration({
type: 'preset',
effectId: 'haptic.effect.soft',
count: 1,
intensity: 50,
}, {
usage: 'unknown'
}, (error: BusinessError) => {
if (error) {
console.error(`Failed to start... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left triggerVibration 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... | triggerVibration() {
try {
// 触发马达振动
vibrator.startVibration({
type: 'preset',
effectId: 'haptic.effect.soft',
count: 1,
intensity: 50,
}, {
usage: 'unknown'
}, (error: BusinessError) => {
if (error) {
console.error(`Failed to start... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/pages/views/LibraryView.ets#L263-L284 | 0f8de361024d1e2897a724e90d53b409be84a0e2 | github |
dingzhilin1990/zhilinclaw | src/adapters/AIModelAdapter.ets | arkts | create | 创建 AI 模型适配器
@param config 模型配置 | public static create(config: AIModelConfig): AIModelAdapter {
switch (config.provider) {
case 'cloud':
return new CloudAIModelAdapter(config);
case 'local':
return new LocalAIModelAdapter(config);
default:
throw new Error(`不支持的模型提供商:${config.provider}`);
}
} | 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 config AST#identifier#Right AST#:#Left : AST#:#R... | public static create(config: AIModelConfig): AIModelAdapter {
switch (config.provider) {
case 'cloud':
return new CloudAIModelAdapter(config);
case 'local':
return new LocalAIModelAdapter(config);
default:
throw new Error(`不支持的模型提供商:${config.provider}`);
}
} | https://github.com/dingzhilin1990/zhilinclaw | 78a0d2dd21873661c3eb874779a9e1aad65ab785 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets | arkts | goToToday | 切换到今天 | goToToday() {
const today = new Date()
this.currentDate = today
this.selectedDate = today
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left goToToday AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | goToToday() {
const today = new Date()
this.currentDate = today
this.selectedDate = today
} | https://gitcode.com/openharmony/codelabs | 9071faf29f1d85175370baa34de30007df552233 | gitcode |
openharmony/third_party_typescript | tests/arkTSTest/testcase/arkts-sendable-definite-assignment/arkts-sendable-definite-assignment-1-error.ets | arkts | constructor | should report, arkts-sendable-definite-assignment | constructor() {
this.prop1 = ''
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.prop1 = ''
} | https://gitee.com/openharmony/third_party_typescript.git | 38a21396b9b77a8eeb38f44830d5e91ca4870ddd | gitee |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/common/DiskCacheManager.ets | arkts | constructor | 创建磁盘缓存
@param diskCachePath 磁盘缓存路径
@param diskCacheCapacity 磁盘缓存大小 | constructor(diskCachePath: string, diskCacheCapacity: number) {
this.cache = new DiskLruCache(diskCachePath, diskCacheCapacity);
} | 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 diskCachePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right ... | constructor(diskCachePath: string, diskCacheCapacity: number) {
this.cache = new DiskLruCache(diskCachePath, diskCacheCapacity);
} | https://gitcode.com/arkui-x/samples | 29aa764aa8c69f4fe8800de0617371fc25a80af5 | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | getServerUserId | 获取服务器用户ID | static async getServerUserId(): Promise<number | null> {
if (!UserManager.dataPreferences) {
return null;
}
try {
const userId = await UserManager.dataPreferences.get(UserManager.KEY_SERVER_USER_ID, '') as string;
if (userId && userId.length > 0) {
return parseInt(userId);
... | 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 getServerUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | static async getServerUserId(): Promise<number | null> {
if (!UserManager.dataPreferences) {
return null;
}
try {
const userId = await UserManager.dataPreferences.get(UserManager.KEY_SERVER_USER_ID, '') as string;
if (userId && userId.length > 0) {
return parseInt(userId);
... | https://github.com/Harrisonls2004/WaterFlow | 7e0a9c4f919664de83e703bbb28b74469e8d140b | github |
HarmonyOS_Samples/StateStore | entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | [EndExclude todo_list_index] | aboutToAppear(): void {
// The dispatch triggers a GetTodoList event to get the full data and update the status
TodoStore.dispatch(TodoListActions.getTodoList);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
// The dispatch triggers a GetTodoList event to get the full data and update the status
TodoStore.dispatch(TodoListActions.getTodoList);
} | https://gitcode.com/HarmonyOS_Samples/StateStore | 7190401adacbeaa2744ff242f611b5fe15c7435f | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/common/MooStringPairArrayList.ets | arkts | build | Called when the selected index needs to be reset. E.g. when the item selected is deleted. | build() {
Scroll() {
Flex({
wrap: isPreferRightHand() ? FlexWrap.WrapReverse : FlexWrap.Wrap,
space: { main: LengthMetrics.vp(standardSpacing * 0.75), cross: LengthMetrics.vp(standardSpacing * 0.75) },
alignItems: ItemAlign.Center
}) {
// The fixed default item
... | 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() {
Scroll() {
Flex({
wrap: isPreferRightHand() ? FlexWrap.WrapReverse : FlexWrap.Wrap,
space: { main: LengthMetrics.vp(standardSpacing * 0.75), cross: LengthMetrics.vp(standardSpacing * 0.75) },
alignItems: ItemAlign.Center
}) {
// The fixed default item
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 0c4fc1597122104502c0cf896837bbed7e00b854 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/Node.ets | arkts | encodeHtmlEntities | 编码 HTML 实体 | protected encodeHtmlEntities(text: string): string {
return HtmlEntities.encode(text);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left encodeHtmlEntities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | protected encodeHtmlEntities(text: string): string {
return HtmlEntities.encode(text);
} | https://github.com/DaLongZhuaZi/manxia | e4315c1b27d42d0b05a1effc1eb96bc236c49e9d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | setValue | 设置值(内部方法) | private async setValue(key: string, value: string, type: SettingType): Promise<void> {
try {
if (!this.dataManager) {
throw new Error('DataManager未初始化');
}
// 更新缓存
this.settingsCache.set(key, value);
// 保存到数据库
await this.dataManager.saveSetting(key, value, type);
... | 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 setValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#... | private async setValue(key: string, value: string, type: SettingType): Promise<void> {
try {
if (!this.dataManager) {
throw new Error('DataManager未初始化');
}
// 更新缓存
this.settingsCache.set(key, value);
// 保存到数据库
await this.dataManager.saveSetting(key, value, type);
... | https://github.com/DaLongZhuaZi/manxia | 7f0dadd46c056cbf667744c08cb4b75ba0dad8e9 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/XAxis.ets | arkts | setLabelXOffset | 设置标签在 X 轴上的偏移量
@param xOffset - 偏移量 | public setLabelXOffset(xOffset: number): void {
this.mLabelXOffset = xOffset;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLabelXOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public setLabelXOffset(xOffset: number): void {
this.mLabelXOffset = xOffset;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a9f469edf53428e22cb87abb2aa4e93dd074b693 | gitee |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/pages/NewsDetailPage.ets | arkts | setupAudioCallbacks | 设置音频回调 | setupAudioCallbacks() {
if (!this.audioUtils) return;
this.audioUtils.setOnStateChange((state) => {
this.isPlaying = state === 'playing';
});
this.audioUtils.setOnProgress((position, dur) => {
this.currentPosition = position;
this.duration = dur;
});
this.audioUtils.setOnC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setupAudioCallbacks 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_bloc... | setupAudioCallbacks() {
if (!this.audioUtils) return;
this.audioUtils.setOnStateChange((state) => {
this.isPlaying = state === 'playing';
});
this.audioUtils.setOnProgress((position, dur) => {
this.currentPosition = position;
this.duration = dur;
});
this.audioUtils.setOnC... | https://github.com/Coke0807/NewsAPP-HarmonyOS | 80625690532c09b32fc804ac0e513c3a47b6d865 | github |
xblLab/HarmonyProjectTemplate | components/module_search/src/main/ets/components/SearchPage.ets | arkts | searchText | 搜索功能匹配数据源 | searchText() {
let tmp: string[] = [];
this.searchValue = this.searchValue.replace(/^\s+|\s+$/g, '');
this.searchSourceData.forEach((item: string) => {
if (item.indexOf(this.searchValue) !== -1) {
tmp.push(item)
}
})
this.searchResultList = tmp;
if (this.searchValue) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | searchText() {
let tmp: string[] = [];
this.searchValue = this.searchValue.replace(/^\s+|\s+$/g, '');
this.searchSourceData.forEach((item: string) => {
if (item.indexOf(this.searchValue) !== -1) {
tmp.push(item)
}
})
this.searchResultList = tmp;
if (this.searchValue) {
... | https://github.com/xblLab/HarmonyProjectTemplate | bb5aaec59f81e81d3b70cce0ac9efed1c55ccd36 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new NeverError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super("NeverError", message, options)
} | 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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super("NeverError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 860d7b0d1938ddd22aa9c78ad34c735f10f9298b | gitcode |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/GoalEditPage.ets | arkts | getDirectionName | 获取目标方向名称 | getDirectionName(direction: GoalDirection): string {
switch (direction) {
case GoalDirection.DECREASE:
return '减少到';
case GoalDirection.INCREASE:
return '增加到';
case GoalDirection.REACH:
return '达到';
default:
return '达到';
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDirectionName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left direction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GoalDirection AST#identifier#Right... | getDirectionName(direction: GoalDirection): string {
switch (direction) {
case GoalDirection.DECREASE:
return '减少到';
case GoalDirection.INCREASE:
return '增加到';
case GoalDirection.REACH:
return '达到';
default:
return '达到';
}
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 2ab022b35eba87b936941978c77c722e92f027c1 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/ternary/ternary_uint.ets | arkts | main | ---
desc: check ternary if-else operation with condition of unsigned integer operand
--- | function main(): void {
const a: uint = {{v.condition}}
const b: uint = {{v.ifTrue}}
const c: uint = {{v.ifFalse}}
assert (a ? b : c) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: uint = {{v.condition}}
const b: uint = {{v.ifTrue}}
const c: uint = {{v.ifFalse}}
assert (a ? b : c) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 78e327dc6d8e994cd5281b59e8027b314544b7b7 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | calculateExpenseStabilityFromBills | 从账单计算支出稳定性评分
@param bills 账单列表
@param userId 用户ID
@param months 要分析的月份数 | static calculateExpenseStabilityFromBills(
bills: Bill[],
userId: number,
months: number = 6
): DimensionScore {
// 按月统计支出
const monthlyExpenses: Map<string, number> = new Map();
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.userId === userId && bill.i... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateExpenseStabilityFromBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right ... | static calculateExpenseStabilityFromBills(
bills: Bill[],
userId: number,
months: number = 6
): DimensionScore {
// 按月统计支出
const monthlyExpenses: Map<string, number> = new Map();
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.userId === userId && bill.i... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f6eccfc11c3e3d4cfcf21efb786f0c942cfe9e51 | github |
openharmony/codelabs | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | getRandomInt | Get movie a random number.
@return {movieRandom} return a random number | getRandomInt(randomNumber: number): number {
let roundNumber: number = Math.round(Math.random() * CommonConstants.MULTIPLY_TEN);
if (roundNumber === randomNumber) {
roundNumber = this.getRandomInt(randomNumber);
}
return roundNumber;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRandomInt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left randomNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AS... | getRandomInt(randomNumber: number): number {
let roundNumber: number = Math.round(Math.random() * CommonConstants.MULTIPLY_TEN);
if (roundNumber === randomNumber) {
roundNumber = this.getRandomInt(randomNumber);
}
return roundNumber;
} | https://gitee.com/openharmony/codelabs.git | a5b1768fdf666a7b998dedc4323668e897aa2a71 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets | arkts | registerPage | 注册页面管理器 | registerPage(pageId: string, manager: IPageManager): void {
if (this.pageManagers.has(pageId)) {
logger.warn(TAG, `页面已注册: ${pageId}`);
return;
}
this.pageManagers.set(pageId, manager);
this.updateStats();
logger.info(TAG, `页面已注册: ${pageId}, 当前总数: ${this.pageManagers.size}`);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerPage 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#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , ... | registerPage(pageId: string, manager: IPageManager): void {
if (this.pageManagers.has(pageId)) {
logger.warn(TAG, `页面已注册: ${pageId}`);
return;
}
this.pageManagers.set(pageId, manager);
this.updateStats();
logger.info(TAG, `页面已注册: ${pageId}, 当前总数: ${this.pageManagers.size}`);
... | https://github.com/DaLongZhuaZi/manxia | 940fa0144a767a50684ddbdbddc7492935dc3802 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | moveInFreeMode | Moving in free mode.
@param offsetX
@param offsetY | private moveInFreeMode(offsetX: number, offsetY: number) {
let crop = this.getCropRect();
let limit = this.limitRect;
let image = this.getCurrentRotatedImage();
let minLength = this.minSideLength;
let imageLines = this.getCurrentImageLines();
if (this.isLeft) {
if (offsetX < 0 || this.co... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left moveInFreeMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | private moveInFreeMode(offsetX: number, offsetY: number) {
let crop = this.getCropRect();
let limit = this.limitRect;
let image = this.getCurrentRotatedImage();
let minLength = this.minSideLength;
let imageLines = this.getCurrentImageLines();
if (this.isLeft) {
if (offsetX < 0 || this.co... | https://gitee.com/openharmony/codelabs.git | 211873c478753297d8271b41cabbcfa8e23313e6 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets | arkts | validateToken | 验证令牌是否有效
@param token 令牌信息
@return Promise<boolean> 令牌是否有效 | public async validateToken(token: OAuth2Token): Promise<boolean> {
if (!token.accessToken || token.accessToken.trim().length === 0) {
return false;
}
if (token.expiresAt && token.expiresAt < Date.now()) {
return false;
}
try {
await this.getUserInfo(token.accessToken);
re... | 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 validateToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AS... | public async validateToken(token: OAuth2Token): Promise<boolean> {
if (!token.accessToken || token.accessToken.trim().length === 0) {
return false;
}
if (token.expiresAt && token.expiresAt < Date.now()) {
return false;
}
try {
await this.getUserInfo(token.accessToken);
re... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L170-L185 | 3814dea7afdfb592102eb6e9ce42334a8ebc8ff6 | github |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/AudioUtils.ets | arkts | initUrl | 初始化音频URL | async initUrl(audioUrl: string): Promise<void> {
try {
// 释放旧播放器
if (this.player) {
await this.release();
}
// 创建新播放器
this.player = await media.createAVPlayer();
// 注册状态回调
this.player.on('stateChange', (state: string) => {
console.info('Audio... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left audioUrl AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async initUrl(audioUrl: string): Promise<void> {
try {
// 释放旧播放器
if (this.player) {
await this.release();
}
// 创建新播放器
this.player = await media.createAVPlayer();
// 注册状态回调
this.player.on('stateChange', (state: string) => {
console.info('Audio... | https://github.com/Coke0807/NewsAPP-HarmonyOS | 7bface8734e6c5cc22ec36b4ed0fa63641cb9300 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | getId | 获取菜单项ID
@returns 菜单项的唯一标识 | public getId(): string | number {
return this.id;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getId AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#ca... | public getId(): string | number {
return this.id;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 59225a150bf7e9320ab80c184b2a3219fef98886 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.