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 |
|---|---|---|---|---|---|---|---|---|---|---|
webabcd/HarmonyDemo | entry/src/main/ets/pages/ui/DisplayWindowDemo.ets | arkts | aboutToAppear | windowClass.getWindowProperties() - 获取当前窗口的相关信息(一个 WindowProperties 对象)
windowRect - 窗口的矩形区域
brightness - 屏幕亮度(0 - 1 之间,如果是 -1 则代表跟随系统的亮度)
isKeepScreenOn - 屏幕是否常亮
windowClass.setWindowKeepScreenOn() - 设置当前屏幕是否常亮
windowClass.setWindowBrightness() - 设置当前屏幕的亮度(0 - 1 之间,如果是 -1 则代表跟随系统的亮度)
windowClass.on('windowSizeChange',... | aboutToAppear(): void {
let windowProperties = this.windowClass.getWindowProperties();
this.message += `width:${windowProperties.windowRect.width}, height:${windowProperties.windowRect.height}\n`
this.message += `brightness:${windowProperties.brightness}\n`
this.message += `isKeepScreenOn:${windowProp... | 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 {
let windowProperties = this.windowClass.getWindowProperties();
this.message += `width:${windowProperties.windowRect.width}, height:${windowProperties.windowRect.height}\n`
this.message += `brightness:${windowProperties.brightness}\n`
this.message += `isKeepScreenOn:${windowProp... | https://github.com/webabcd/HarmonyDemo | 8c037007a8635d17635e53423e06e13d99a46775 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | stopPerformanceMonitoring | 停止性能监控 | stopPerformanceMonitoring(): void {
if (this.performanceMonitorInterval !== null) {
clearInterval(this.performanceMonitorInterval)
this.performanceMonitorInterval = null
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopPerformanceMonitoring 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#st... | stopPerformanceMonitoring(): void {
if (this.performanceMonitorInterval !== null) {
clearInterval(this.performanceMonitorInterval)
this.performanceMonitorInterval = null
}
} | https://github.com/AetheriumSimulator/qemu-hmos | 5aa0e2752e258ed475e784ecc68945c8524706db | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/component/GoodsCommentsCard.ets | arkts | build | 构建商品评论卡片
@returns {void} 无返回值 | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
Card({
widthValue: P100,
radiusValue: $r("app.float.radius_medium")
}) {
C... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
Card({
widthValue: P100,
radiusValue: $r("app.float.radius_medium")
}) {
C... | https://github.com/Joker-x-dev/CoolMallArkTS | 093ba3d5345d6f665a3bf6a3cd6dae1ea6347736 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BasePopup.ets | arkts | handlePopupRadius | 处理圆角
@param isBottom 是否处理底部 | protected handlePopupRadius(isBottom: boolean) {
let typeStr = typeof this.popupConfig.borderRadius
if (typeStr == "object") {
try {
let radius = this.popupConfig.borderRadius as BorderRadiuses
if (isBottom) {
radius.bottomLeft = 0
radius.bottomRight = 0
} els... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handlePopupRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isBottom AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left bool... | protected handlePopupRadius(isBottom: boolean) {
let typeStr = typeof this.popupConfig.borderRadius
if (typeStr == "object") {
try {
let radius = this.popupConfig.borderRadius as BorderRadiuses
if (isBottom) {
radius.bottomLeft = 0
radius.bottomRight = 0
} els... | https://github.com/wuba/omni-ui | 5c050f455051fc6427139df45ab802b9ff6a3ba5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | copyWithin | Makes a copy of internal elements to targetPos from begin to end of Int32Array.
See rules of parameters normalization on
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin | MDN}
@param { int } target - insert index to place copied elements
@returns { Int32Array }
@... | public copyWithin(target: int): Int32Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public copyWithin(target: int): Int32Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | a931ee8f56ea150ffea7a8f0d71428506b540dad | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Description.ets | arkts | getTextAlign | Returns the text alignment of the description.
@return | public getTextAlign(): CanvasTextAlign {
return this.mTextAlign;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTextAlign 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 CanvasTex... | public getTextAlign(): CanvasTextAlign {
return this.mTextAlign;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | bbb40f92e3aea686bc8086d25a3c5be78f807cb3 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/AdminAuthService.ets | arkts | getAdminInfo | 获取管理员信息
@returns 管理员信息 | static async getAdminInfo(): Promise<BaseResponse<AdminInfo>> {
return await HttpUtil.get<AdminInfo>(`${AdminAuthService.BASE_URL}/info`, undefined, { isAdmin: true });
} | 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 getAdminInfo 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 getAdminInfo(): Promise<BaseResponse<AdminInfo>> {
return await HttpUtil.get<AdminInfo>(`${AdminAuthService.BASE_URL}/info`, undefined, { isAdmin: true });
} | https://github.com/LJ666-ui/harmony-health-care | e3a3cd8addf05574b1613de1658d4baae95205d4 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnTagViewModel.ets | arkts | resetCloseableTags | 重置所有可关闭标签的可见状态 | resetCloseableTags(): void {
this.closeable1Visible = true;
this.closeable2Visible = true;
this.closeable3Visible = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetCloseableTags 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... | resetCloseableTags(): void {
this.closeable1Visible = true;
this.closeable2Visible = true;
this.closeable3Visible = true;
} | https://github.com/codelably/tuniao-ui | da95ca7de4244b9fb131f814b6dd2fe5ebfd0139 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/files_manager/class_files_manager.ets | arkts | constructor | 构造 // | constructor(import_global_config: class_global_config) {
// 导入类 //
this.global_config = import_global_config
// 初始化类 //
this.download_manager = new class_download_manager(this.global_config)
this.external_manager = new class_external_manager(this.global_config)
// 检查工作目录 //
try {fs.stat... | 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 import_global_config AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left class_global_config AST#ident... | constructor(import_global_config: class_global_config) {
// 导入类 //
this.global_config = import_global_config
// 初始化类 //
this.download_manager = new class_download_manager(this.global_config)
this.external_manager = new class_external_manager(this.global_config)
// 检查工作目录 //
try {fs.stat... | https://github.com/Nekofox-POT/LinMusic | f66c5163cca9aaf530ed8f16ce46e0ec06501cfa | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | getTrueIndex | getTrueIndex
如果是在特殊表达式中间需要插入到(后面 | public static getTrueIndex(index:number,displayExpression:string): number {
let trueIndex: number = index;
if (displayExpression!== '' && displayExpression !== null && trueIndex > 0) {
if (['a', 'c', 'o', 'n', 'l', 's', 'g', 't', 'i', '\u207B',
'\u00B9'].includes(displayExpression[trueIndex - 1]... | 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 getTrueIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AS... | public static getTrueIndex(index:number,displayExpression:string): number {
let trueIndex: number = index;
if (displayExpression!== '' && displayExpression !== null && trueIndex > 0) {
if (['a', 'c', 'o', 'n', 'l', 's', 'g', 't', 'i', '\u207B',
'\u00B9'].includes(displayExpression[trueIndex - 1]... | https://gitee.com/openharmony-sig/applications_calculator.git | 608be69572268c338f8df2e7a7f846627b0b46bd | gitee |
openharmony/arkui_ace_engine | examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets | arkts | encodeBinary | Returns a QR Code representing the given binary data at the given error correction level.
This function always encodes using the binary segment mode, not any text mode. The maximum number of
bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
The ECC level of the result ... | public static encodeBinary(data: Readonly<Array<byte>>, ecl: QrCode.Ecc): QrCode {
const seg: QrSegment = qrcodegen.QrSegment.makeBytes(data);
return QrCode.encodeSegments([seg], ecl);
} | 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 encodeBinary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST... | public static encodeBinary(data: Readonly<Array<byte>>, ecl: QrCode.Ecc): QrCode {
const seg: QrSegment = qrcodegen.QrSegment.makeBytes(data);
return QrCode.encodeSegments([seg], ecl);
} | https://gitee.com/openharmony/arkui_ace_engine.git | adb773b0916de3cbde6344ae3ada5585cc05d00e | gitee |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/ContactListPresenter.ets | arkts | onShareDialogConfirm | Share confirmation button | onShareDialogConfirm() {
HiLog.i(TAG, 'onShareDialogConfirm !!! ');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onShareDialogConfirm 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_blo... | onShareDialogConfirm() {
HiLog.i(TAG, 'onShareDialogConfirm !!! ');
} | https://gitee.com/openharmony/applications_contacts.git | 6fbb2bac9d358602fa0072f4a35253cb5d4aafa5 | gitee |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Battery/BatteryIndexPage.ets | arkts | getBatteryInfo | 计算剩余可用时间(剩余电量乘以消耗速率) | getBatteryInfo() {
this.batterySOC = batteryInfo.batterySOC
// 计算剩余可用时间(剩余电量乘以消耗速率)
const tempHours = this.batterySOC * this.consumptionRate
// 格式化剩余时间
this.remainingHours = Math.floor(tempHours)
this.remainingMinutes = Math.round((tempHours - this.remainingHours) * 60)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBatteryInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | getBatteryInfo() {
this.batterySOC = batteryInfo.batterySOC
// 计算剩余可用时间(剩余电量乘以消耗速率)
const tempHours = this.batterySOC * this.consumptionRate
// 格式化剩余时间
this.remainingHours = Math.floor(tempHours)
this.remainingMinutes = Math.round((tempHours - this.remainingHours) * 60)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 433576322064a98e3dec18187d6413a3da322051 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Distributed/DistributedDataSyncManager.ets | arkts | leaveSession | 离开会话并清理资源 | public leaveSession(): void {
if (this.syncObj) {
try {
this.syncObj.setSessionId(() => {
logger.info(TAG, 'Successfully left distributed data session');
});
this.syncObj = null;
this.sessionId = '';
this.dataChangedCallbacks.clear();
this.statusChan... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left leaveSession 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#expressio... | public leaveSession(): void {
if (this.syncObj) {
try {
this.syncObj.setSessionId(() => {
logger.info(TAG, 'Successfully left distributed data session');
});
this.syncObj = null;
this.sessionId = '';
this.dataChangedCallbacks.clear();
this.statusChan... | https://github.com/DaLongZhuaZi/manxia | c6b3c26c3bd6eb62be7e281c3893f490b183f206 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/DownloadManager.ets | arkts | registerProgressCallback | 注册下载进度回调
@param listenerId 监听器ID(用于取消注册)
@param callback 进度回调函数 | public registerProgressCallback(listenerId: string, callback: DownloadProgressCallback): void {
this.progressCallbacks.set(listenerId, callback);
logger.debug(TAG, `注册进度回调: ${listenerId}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerProgressCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left listenerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | public registerProgressCallback(listenerId: string, callback: DownloadProgressCallback): void {
this.progressCallbacks.set(listenerId, callback);
logger.debug(TAG, `注册进度回调: ${listenerId}`);
} | https://github.com/DaLongZhuaZi/manxia | d3c41b023985a722a81845f3ef395ccd31db22ab | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/HttpUtil.ets | arkts | getErrorMessage | 获取友好的错误信息
@param errorMessage 原始错误信息 | private static getErrorMessage(errorMessage: string): string {
if (errorMessage.includes('Network Error')) {
return '网络连接失败,请检查网络设置';
} else if (errorMessage.includes('timeout')) {
return '请求超时,请稍后重试';
} else if (errorMessage.includes('401')) {
return '登录已过期,请重新登录';
} else if (errorM... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getErrorMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorMessage AST#identifier#Right AST#ERROR#Left AS... | private static getErrorMessage(errorMessage: string): string {
if (errorMessage.includes('Network Error')) {
return '网络连接失败,请检查网络设置';
} else if (errorMessage.includes('timeout')) {
return '请求超时,请稍后重试';
} else if (errorMessage.includes('401')) {
return '登录已过期,请重新登录';
} else if (errorM... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 0260577c29c35e799bbe7da5bf97871ae0f0721b | github |
HarmonyOS_Samples/MultiFinancialManagement | commons/financialbase/src/main/ets/utils/WindowUtil.ets | arkts | setFullScreen | User the window interface to set up window immersion. | setFullScreen(isFullScreen: boolean): void {
if (canIUse('SystemCapability.Window.SessionManager.Extension')) {
this.mainWindow.setWindowLayoutFullScreen(isFullScreen)
.then(() => {
Logger.info('testLog', `Succeeded in setting full-screen mode.`);
// Update window isFullScreen.
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFullScreen AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ... | setFullScreen(isFullScreen: boolean): void {
if (canIUse('SystemCapability.Window.SessionManager.Extension')) {
this.mainWindow.setWindowLayoutFullScreen(isFullScreen)
.then(() => {
Logger.info('testLog', `Succeeded in setting full-screen mode.`);
// Update window isFullScreen.
... | https://gitcode.com/HarmonyOS_Samples/MultiFinancialManagement | 4a3e341c5a50e13e6c9346e703c795e14bc80f42 | gitcode |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/common/utils/PreferencesUtil.ets | arkts | saveWidgetData | 保存卡片数据到Preferences(供卡片进程读取) | saveWidgetData(preferences: preferences.Preferences, formId: string, data: Record<string, string>): void {
try {
const key = WIDGET_DATA_PREFIX + formId;
const jsonData = JSON.stringify(data);
this.preferencesPut(preferences, key, jsonData);
hilog.info(0x0000, TAG, `[PreferencesUtil] saveW... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left saveWidgetData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left preferences AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left prefere... | saveWidgetData(preferences: preferences.Preferences, formId: string, data: Record<string, string>): void {
try {
const key = WIDGET_DATA_PREFIX + formId;
const jsonData = JSON.stringify(data);
this.preferencesPut(preferences, key, jsonData);
hilog.info(0x0000, TAG, `[PreferencesUtil] saveW... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 092cba88afcfd2b53a85d91e284e23ae97933f88 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | getMessages | ============ 消息管理 ============
获取消息列表
@param conversationId 会话ID
@param params 查询参数 | async getMessages(conversationId: string, params?: {
before?: number
after?: number
limit?: number
}): Promise<ApiResponse<{ messages: Message[]; hasMore: boolean }>> {
return this.client.get<{ messages: Message[]; hasMore: boolean }>(`/api/v1/im/conversations/${conversationId}/messages`, params as ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMessages AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AST#:#... | async getMessages(conversationId: string, params?: {
before?: number
after?: number
limit?: number
}): Promise<ApiResponse<{ messages: Message[]; hasMore: boolean }>> {
return this.client.get<{ messages: Message[]; hasMore: boolean }>(`/api/v1/im/conversations/${conversationId}/messages`, params as ... | https://github.com/David8Idira/AI-OA | ecc10fe1d09f1465008cc0adab505155f1d7f94c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | getBookCacheDir | 获取书籍缓存目录路径
格式: Download/novel/{safeBookId}/ 或 /files/novels/{safeBookId}/ | private getBookCacheDir(bookId: string): string {
// 将bookId转换为安全的目录名(移除特殊字符)
const safeBookId = this.sanitizeFileName(bookId);
return `${this.novelsCacheDir}/${safeBookId}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getBookCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private getBookCacheDir(bookId: string): string {
// 将bookId转换为安全的目录名(移除特殊字符)
const safeBookId = this.sanitizeFileName(bookId);
return `${this.novelsCacheDir}/${safeBookId}`;
} | https://github.com/DaLongZhuaZi/manxia | bbb5b1d5ec855ae2da2957bbf2eaa5512dac4f5d | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/DefaultParser.ets | arkts | isArgument | Tests if the token is a valid argument.
@param token | private isArgument(token: string): boolean {
return!this.isOption(token) || this.isNegativeNumber(token);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isArgument AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | private isArgument(token: string): boolean {
return!this.isOption(token) || this.isNegativeNumber(token);
} | https://gitee.com/openharmony-sig/commons-cli.git | 2c3bcd251047e82c98577e3103f4017a57a1eb47 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | clearHistory | 清空历史记录 | public clearHistory(): void {
this.history = {
timestamps: [],
memoryUsage: [],
cpuUsage: [],
gcCount: [],
heapSize: []
};
logger.info(HIDEBUG_COLLECTOR_TAG, '历史记录已清空');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearHistory 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#expressio... | public clearHistory(): void {
this.history = {
timestamps: [],
memoryUsage: [],
cpuUsage: [],
gcCount: [],
heapSize: []
};
logger.info(HIDEBUG_COLLECTOR_TAG, '历史记录已清空');
} | https://github.com/DaLongZhuaZi/manxia | 592d21a60ba62bfb37374e8b7ea4ca91c30125b8 | github |
openharmony/codelabs | ETSUI/ContactManager/entry/src/main/ets/pages/ContactListPage.ets | arkts | getFirstLetter | 获取首字母:英文字母返回大写,其他字符统一返回 # | getFirstLetter(name: string): string {
if (!name || name.length === 0) {
return '#'
}
const firstChar = name.charAt(0)
// 判断是否为英文字母
if (/^[A-Za-z]$/.test(firstChar)) {
return firstChar.toUpperCase()
}
// 其他字符(包括中文)统一返回 #
return '#'
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFirstLetter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ... | getFirstLetter(name: string): string {
if (!name || name.length === 0) {
return '#'
}
const firstChar = name.charAt(0)
// 判断是否为英文字母
if (/^[A-Za-z]$/.test(firstChar)) {
return firstChar.toUpperCase()
}
// 其他字符(包括中文)统一返回 #
return '#'
} | https://gitcode.com/openharmony/codelabs | 9f82d63a910b7b4a78e7363b3e233e93d026d061 | gitcode |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/GestureUtils.ets | arkts | calculateElasticity | 计算弹性效果
@param progress - 进度(0-1)
@param elasticity - 弹性系数
@returns 弹性效果值 | static calculateElasticity(progress: number, elasticity: number = 0.3): number {
if (progress <= 1) {
return progress;
}
const overshoot: number = progress - 1;
return 1 + overshoot * elasticity;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateElasticity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left progress AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | static calculateElasticity(progress: number, elasticity: number = 0.3): number {
if (progress <= 1) {
return progress;
}
const overshoot: number = progress - 1;
return 1 + overshoot * elasticity;
} | https://github.com/kumaleap/ArkSwipeDeck | 42bb135c1875ee7093a2194e927cd9ac7026bcdd | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/common/utils/Logger.ets | arkts | error | 打印错误日志 | static error(tag: string, format: string, ...args: string[]): void {
hilog.error(Logger.domain, Logger.prefix, `[${tag}] ${format}`, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | static error(tag: string, format: string, ...args: string[]): void {
hilog.error(Logger.domain, Logger.prefix, `[${tag}] ${format}`, args);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | dff6beddc28715fe7540c216a56fc27c261cd0d5 | github |
arkui-x/samples | CodeLab/Cases/feature/componentstack/src/main/ets/model/DataSource.ets | arkts | totalCount | 获取懒加载数据源的数据长度 | totalCount(): number {
return this.ProductList.length;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left totalCount 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_b... | totalCount(): number {
return this.ProductList.length;
} | https://gitcode.com/arkui-x/samples | 1bccb61ec4114f6d616c88c676f7c235d016c7ca | gitcode |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的图书管理系统_刘鑫/code/entry/src/main/ets/MainAbility/pages/libraryManage.ets | arkts | setController | 设置弹窗
@param titleText
@param text | setController(titleText:string,text:string){
this.controller = new CustomDialogController({
builder: myCustomDialog({
text:text,
titleText:titleText,
}),
cancel: () => {
// 点击蒙层的回调
},
autoCancel: true, // 允许点击蒙层关闭弹窗
customStyle: true ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left titleText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS... | setController(titleText:string,text:string){
this.controller = new CustomDialogController({
builder: myCustomDialog({
text:text,
titleText:titleText,
}),
cancel: () => {
// 点击蒙层的回调
},
autoCancel: true, // 允许点击蒙层关闭弹窗
customStyle: true ... | https://gitee.com/openharmony-sig/online_event.git | 78f752c1505b1d336bdfec8bd584bd825da96e7e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceTester.ets | arkts | extractComicId | 从测试详情中提取漫画ID | private extractComicId(details: string): string | null {
try {
const data: ESObject = SafeUtils.parseObj(details) as ESObject;
return data.firstId as string || null;
} catch {
return null;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractComicId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left details AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | private extractComicId(details: string): string | null {
try {
const data: ESObject = SafeUtils.parseObj(details) as ESObject;
return data.firstId as string || null;
} catch {
return null;
}
} | https://github.com/DaLongZhuaZi/manxia | e5fcc98ca717e1bcdc9aeed18a2c740f25d07b9c | github |
xiebyapps/ClipLink | entry/src/main/ets/services/SyncClipboardService.ets | arkts | getProfile | Get current clipboard profile from /SyncClipboard.json | async getProfile(): Promise<ProfileDto> {
return await this.httpClient.get<ProfileDto>('/SyncClipboard.json');
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getProfile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t... | async getProfile(): Promise<ProfileDto> {
return await this.httpClient.get<ProfileDto>('/SyncClipboard.json');
} | https://github.com/xiebyapps/ClipLink | 8f4a8dbf5143709db3085002354bacf54ad79c38 | github |
codelably/HCompass | core/module/src/main/ets/ModuleRegistry.ets | arkts | bootstrap | 启动所有模块
按依赖顺序初始化 | async bootstrap(): Promise<void> {
if (this.bootstrapped) {
this.log('Modules already bootstrapped');
return;
}
this.log('Starting module bootstrap...');
// 获取拓扑排序后的模块列表
const sortedModules = this.topologicalSort();
// 依次初始化模块
for (const moduleId of sortedModules) {
aw... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left bootstrap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:... | async bootstrap(): Promise<void> {
if (this.bootstrapped) {
this.log('Modules already bootstrapped');
return;
}
this.log('Starting module bootstrap...');
// 获取拓扑排序后的模块列表
const sortedModules = this.topologicalSort();
// 依次初始化模块
for (const moduleId of sortedModules) {
aw... | https://github.com/codelably/HCompass | 380dbd1b4907722b22e278ac4eaa771bb15ea965 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | createDouble | Creates a new JSON element containing a double value.
@param {double} value - The double value to store
@returns {JsonElement} A new JsonElement containing the double value | static createDouble(value: double): JsonElement {
const element = new JsonElement()
element.maybeDoubleValue = value
return element
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left do... | static createDouble(value: double): JsonElement {
const element = new JsonElement()
element.maybeDoubleValue = value
return element
} | https://gitcode.com/iop123123/arkts-static-skills | 178f0e00e7ea725a84089cd2b6e2efedd233a887 | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FollowManager.ets | arkts | getFollowerCount | Get follower count (number of people following this user)
优先从服务器获取 | static async getFollowerCount(username: string, userId?: number): Promise<number> {
try {
// 服务器模式下优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await FollowApi.getStats(userId);
console.info(`FollowManager: getStats response code=${response.code}`);
if (r... | 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 getFollowerCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static async getFollowerCount(username: string, userId?: number): Promise<number> {
try {
// 服务器模式下优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await FollowApi.getStats(userId);
console.info(`FollowManager: getStats response code=${response.code}`);
if (r... | https://github.com/Harrisonls2004/WaterFlow | 1f096176f8cb3ff6d326d237504b0b2779f5bc1e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | ensureInitialized | 确保缓存目录已初始化 | private async ensureInitialized(): Promise<void> {
if (this.isInitialized) return;
if (this.initPromise) {
await this.initPromise;
} else {
await this.initCacheDir();
}
} | 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 ensureInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async ensureInitialized(): Promise<void> {
if (this.isInitialized) return;
if (this.initPromise) {
await this.initPromise;
} else {
await this.initCacheDir();
}
} | https://github.com/DaLongZhuaZi/manxia | f9e861dd2e4f42d898aaaaa40c72432358bf6fe1 | github |
qiaomu8559968/FlipClock | clock_component/src/main/ets/components/FlipDigit.ets | arkts | startBottomAnimation | 第二阶段动画:顶层下部向下翻转 (-90 -> 0)
视觉效果:新数字的下半部分从折叠状态翻出,覆盖底层的“旧数字下半部分” | startBottomAnimation() {
Logger.debug(`FlipDigit-startBottomAnimation angleBottom: ${this.angleBottom}`)
animateTo({
duration: 400, // 保持与 MyFlipClock 一致
onFinish: () => {
// 动画结束,重置状态
this.angleTop = 0
this.angleBottom = 90 // 初始状态也要对应调整,稍后在定义处修改
this.oldData = thi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startBottomAnimation 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_blo... | startBottomAnimation() {
Logger.debug(`FlipDigit-startBottomAnimation angleBottom: ${this.angleBottom}`)
animateTo({
duration: 400, // 保持与 MyFlipClock 一致
onFinish: () => {
// 动画结束,重置状态
this.angleTop = 0
this.angleBottom = 90 // 初始状态也要对应调整,稍后在定义处修改
this.oldData = thi... | https://gitcode.com/qiaomu8559968/FlipClock | afe1ceaee9cf43e3f5690110c6b1cb0bb046a9fc | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | checkPluginUpdates | 检查插件更新 | public async checkPluginUpdates(): Promise<PluginUpdateInfo[]> {
try {
const updateInfos: PluginUpdateInfo[] = [];
// 使用显式属性访问替代解构
const registryEntries = Array.from(this.pluginRegistry.entries());
for (let i = 0; i < registryEntries.length; i++) {
const pluginId = registryE... | 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 checkPluginUpdates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public async checkPluginUpdates(): Promise<PluginUpdateInfo[]> {
try {
const updateInfos: PluginUpdateInfo[] = [];
// 使用显式属性访问替代解构
const registryEntries = Array.from(this.pluginRegistry.entries());
for (let i = 0; i < registryEntries.length; i++) {
const pluginId = registryE... | https://github.com/DaLongZhuaZi/manxia | 6e5b8751556ba2ea4e2e685fc254862ff0b379b1 | github |
harmonyos/codelabs | HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Utils.ets | arkts | updateSlider | Update time slider.
@param time
@param index
@returns time | static updateSlider(time: number, index: number): string {
let result = time + index - Const.NUMBER_2;
if (result < 0) {
return '';
}
if (result % Const.TIME_60 < Const.TIME_10) {
return Const.STRING_0 + Math.floor(result / Const.TIME_60) + Const.STRING_COLON_0 + (result % Const.TIME_60);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left updateSlider AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static updateSlider(time: number, index: number): string {
let result = time + index - Const.NUMBER_2;
if (result < 0) {
return '';
}
if (result % Const.TIME_60 < Const.TIME_10) {
return Const.STRING_0 + Math.floor(result / Const.TIME_60) + Const.STRING_COLON_0 + (result % Const.TIME_60);
... | https://gitee.com/harmonyos/codelabs.git | 4fd9077253bbbd2550f6a2f5c53d9b49de450251 | gitee |
HarmonyOS_Samples/guide-snippets | ArkData/DataObject/CrossDeviceCollaboration/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets | arkts | callRemote | 1. 调用端调用startAbilityByCall接口拉起对端Ability | callRemote() {
if (caller) {
hilog.error(DOMAIN, TAG, 'call remote already');
return;
}
// 1.1 调用genSessionId接口创建一个sessionId,通过分布式设备管理接口获取对端设备networkId
sessionId = distributedDataObject.genSessionId();
hilog.info(DOMAIN, TAG, `gen sessionId: ${sessionId}`);
let deviceId = getRemot... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left callRemote 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... | callRemote() {
if (caller) {
hilog.error(DOMAIN, TAG, 'call remote already');
return;
}
// 1.1 调用genSessionId接口创建一个sessionId,通过分布式设备管理接口获取对端设备networkId
sessionId = distributedDataObject.genSessionId();
hilog.info(DOMAIN, TAG, `gen sessionId: ${sessionId}`);
let deviceId = getRemot... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 86404d2665ccaffb592c8de8e2701f6a9dd2dce2 | gitcode |
openharmony-sig/arkcompiler_ets_frontend | arkoala-arkts/shopping/user/src/ets/pages/detailPage/detail.ets | arkts | build | async onPortrait(mediaQueryResult:mediaquery.MediaQueryResult) {
let result = mediaQueryResult.matches
if (result) {
this.width1 = 45
} else {
this.width1 = 100
}
} | build() {
NavDestination() {
Scroll() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Row() {
Image('/resources/icon/back.png')
.objectFit(ImageFit.Contain)
.width(25 * this.ratio)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
NavDestination() {
Scroll() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Row() {
Image('/resources/icon/back.png')
.objectFit(ImageFit.Contain)
.width(25 * this.ratio)
... | https://gitee.com/openharmony-sig/arkcompiler_ets_frontend.git | eeb0890bb7bd834674c3377667e96589f44f07d8 | gitee |
hhtczengjing/ohos_quickjs | quickjs/src/main/ets/JSValue.ets | arkts | valueAtIndex | ==================== Array Elements ==================== | valueAtIndex(index: number): JSValue {
const handle = qjs.getElement(this.ctxHandle.engineHandle, this.handle, index);
return new JSValue(this.ctxHandle, handle);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left valueAtIndex 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#Right AST#)#Left ) A... | valueAtIndex(index: number): JSValue {
const handle = qjs.getElement(this.ctxHandle.engineHandle, this.handle, index);
return new JSValue(this.ctxHandle, handle);
} | https://github.com/hhtczengjing/ohos_quickjs | 864e649457e7c521b29a0ca44cce10ccd80a5962 | github |
wodekouwei/qlog | qloglib/src/main/ets/qlog/xlog/AppUtils.ets | arkts | getBundleName | 获取当前应用的BundleName | public static getBundleName(): string {
return AppUtils.getBundleInfo()?.name ?? ''
} | 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 getBundleName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public static getBundleName(): string {
return AppUtils.getBundleInfo()?.name ?? ''
} | https://gitcode.com/wodekouwei/qlog | 443e5122e132e75e53e15ede37c396e40883f5b4 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | getFileExtension | 获取文件扩展名
@param filePath 文件路径
@returns 文件扩展名(包含点号) | private getFileExtension(filePath: string): string {
const lastDot = filePath.lastIndexOf('.');
return lastDot > 0 ? filePath.substring(lastDot).toLowerCase() : '';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private getFileExtension(filePath: string): string {
const lastDot = filePath.lastIndexOf('.');
return lastDot > 0 ? filePath.substring(lastDot).toLowerCase() : '';
} | https://github.com/DaLongZhuaZi/manxia | 43841c8a038d34a9e74f42056e3aecee85a8f38c | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets | arkts | getReminderOptions | 获取提醒选项(代理给ReminderService) | getReminderOptions() {
return this.reminderService.getReminderOptions();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getReminderOptions 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... | getReminderOptions() {
return this.reminderService.getReminderOptions();
} | https://gitcode.com/openharmony/codelabs | 92edc46c1475afaac48c983fdda8efcb36d33db8 | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/pages/SettingsPage.ets | arkts | confirmEnableNewEpisodeNotification | 确认启用新单集通知 | confirmEnableNewEpisodeNotification(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('允许', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'新单集通知',
'开启后,当订阅的播客发布新单集时,将会收到通知提醒。\n\n是否允许新单集通知?',
buttons
)).then((index: nu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmEnableNewEpisodeNotification 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#Ri... | confirmEnableNewEpisodeNotification(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('允许', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'新单集通知',
'开启后,当订阅的播客发布新单集时,将会收到通知提醒。\n\n是否允许新单集通知?',
buttons
)).then((index: nu... | https://github.com/pangpang20/antennaPodHM | 4d627b97c2621b6f1f64990ce0e6edc50c1dedb9 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/HttpService.ets | arkts | extractErrorCode | 从 HarmonyOS http kit 抛出的 error 对象提取 code 字段, 提取失败返回 0 | private extractErrorCode(error: object): number {
try {
const errorStr = JSON.stringify(error)
const parsed = JSON.parse(errorStr) as Record<string, Object>
if (parsed.code !== undefined) {
return parsed.code as number
}
} catch (_e) {}
return 0
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractErrorCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private extractErrorCode(error: object): number {
try {
const errorStr = JSON.stringify(error)
const parsed = JSON.parse(errorStr) as Record<string, Object>
if (parsed.code !== undefined) {
return parsed.code as number
}
} catch (_e) {}
return 0
} | https://github.com/LongLiveY96/chatcube | ae42a918b9e6d3ba6613e670112862f6853666ef | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/NativeHidController.ets | arkts | setForceProtocolType | 设置强制协议类型
用于手柄有多种模式(如 DS4 模拟模式)时强制使用特定协议
@param protocolType 协议类型 (0=自动, 1=Xbox, 2=DS4, 3=Switch, 4=Generic, 5=DualSense) | setForceProtocolType(protocolType: number): void {
this.forceProtocolType = protocolType;
console.info(`${TAG} 设置强制协议类型: ${protocolType}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setForceProtocolType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left protocolType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#L... | setForceProtocolType(protocolType: number): void {
this.forceProtocolType = protocolType;
console.info(`${TAG} 设置强制协议类型: ${protocolType}`);
} | https://github.com/AlkaidLab/moonlight-harmony | 8fae8a857e2df213e2583a1c319b24871f42562a | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/GameManager.ets | arkts | extractFileName | 从路径提取文件名 | private extractFileName(path: string): string {
const parts = path.split('/');
return parts[parts.length - 1] || path;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private extractFileName(path: string): string {
const parts = path.split('/');
return parts[parts.length - 1] || path;
} | https://github.com/richshaw2015/nds | 2b1b067bb09ae4054e1f2ced7d5d8c129337a664 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets | arkts | constructor | The WeakMap() constructor creates WeakMap objects
@param { Iterable<[K, V]> } entries - Iterable of key-value pairs to initialize the WeakMap
@syscap SystemCapability.Utils.Lang | constructor(entries: Iterable<[K, V]>) {
this(null)
iteratorForEach<[K, V]>(entries.$_iterator(), (entry: [K, V]) => {
this.set(entry[0] as K, entry[1] as V)
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifi... | constructor(entries: Iterable<[K, V]>) {
this(null)
iteratorForEach<[K, V]>(entries.$_iterator(), (entry: [K, V]) => {
this.set(entry[0] as K, entry[1] as V)
})
} | https://gitcode.com/iop123123/arkts-static-skills | 561e2b92c04af4570cd848671f9993c01c075626 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets | arkts | hsv2rgb | HSV格式转换为RGB格式,公式可参考resources/base/media/hsv_to_rgb.png
@param color HSV像素值
@returns RGB像素值 | public static hsv2rgb(color: ColorHsv): ColorRgb {
// hue取值范围是0~360°,每60°为一个区间,每个区间中RGB计算方式不同
const h60: number = color.hue / 60;
// 向下取整
const h60f: number = Math.floor(h60);
const hi: number = h60f % 6;
const f: number = h60 - h60f;
// 计算不同hue区间里面的RGB值
const p: number = color.value *... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left hsv2rgb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#R... | public static hsv2rgb(color: ColorHsv): ColorRgb {
// hue取值范围是0~360°,每60°为一个区间,每个区间中RGB计算方式不同
const h60: number = color.hue / 60;
// 向下取整
const h60f: number = Math.floor(h60);
const hi: number = h60f % 6;
const f: number = h60 - h60f;
// 计算不同hue区间里面的RGB值
const p: number = color.value *... | https://gitcode.com/arkui-x/samples | 7bb6dbfa77a9fd206902f2a6e134a19df5dbe5ae | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | textPrimary | 快捷方法:获取主要文字颜色 | public static get textPrimary(): string {
return AppColors.textPrimary;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left textPrimary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS... | public static get textPrimary(): string {
return AppColors.textPrimary;
} | https://github.com/DaLongZhuaZi/manxia | ff7e1782ce8e0c7b7cd68be095570831bff80600 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toString | Converts this object to a string
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toString(): String {
return StringBuilder.toString(this.value);
} | 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 toString 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 toString(): String {
return StringBuilder.toString(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | 2fb5fef1c866504a350a93d4fa1d06eab66d9f96 | gitcode |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的家庭医生终端系统_韩乐/Harmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onPageShow | http://43.142.133.176/ii.jpg
https://img1.baidu.com/it/u=724179003,4096104503&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1661792400&t=21c8c46ffa1553dad69abfe152039ef1 | onPageShow(){
send_once("a70000");
AlertDialog.show({
message: '服务器已连接',
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow 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... | onPageShow(){
send_once("a70000");
AlertDialog.show({
message: '服务器已连接',
})
} | https://gitee.com/openharmony-sig/online_event.git | f2ff0483ea4b59c5090115d413163a218ee74ff5 | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/ExportPage.ets | arkts | getFileDescription | 获取文件描述 | getFileDescription(fileName: string): string {
if (fileName.includes('AllData')) {
return '全部数据';
} else if (fileName.includes('HealthRecords')) {
return '健康记录';
} else if (fileName.includes('HealthGoals')) {
return '健康目标';
} else if (fileName.includes('Reminders')) {
return '提... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFileDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) ... | getFileDescription(fileName: string): string {
if (fileName.includes('AllData')) {
return '全部数据';
} else if (fileName.includes('HealthRecords')) {
return '健康记录';
} else if (fileName.includes('HealthGoals')) {
return '健康目标';
} else if (fileName.includes('Reminders')) {
return '提... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | a9c7d3fc72f3716989c35d88abe982e7796eae41 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | search | Sets the search portion of the URL.
@param { string } query - The search portion of the URL. | set search(query: string) {
this.urlInner.setEncodeSearch(fixIllegalString(query));
this.cSearch = this.urlInner.getEncodeSearch();
let p = this.cParamsLazy;
if (p != null) {
p.updateParams(this.cSearch);
}
this.setHref();
... | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identi... | set search(query: string) {
this.urlInner.setEncodeSearch(fixIllegalString(query));
this.cSearch = this.urlInner.getEncodeSearch();
let p = this.cParamsLazy;
if (p != null) {
p.updateParams(this.cSearch);
}
this.setHref();
... | https://gitcode.com/iop123123/arkts-static-skills | 7993fa01dd64212188370c60e4ea491f9b013c25 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | findLast | Finds the last element in the Float32Array that satisfies the condition
@param fn condition
@returns the last element that satisfies fn | public findLast(fn: (val: float) => boolean): float {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.findLast(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public findLast(fn: (val: float) => boolean): float {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.findLast(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 11204b8b45d00931dad54bbc7b437c0ae86a8016 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | getRecentToolEvents | 获取最近的工具事件(按时间倒序) | async getRecentToolEvents(limit: number = 20): Promise<ToolEventData[]> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return []
}
const events: ToolEventData[] = []
const predicates = new relationalStore.RdbPredicates(TableNames.TOOL_EVENTS)
predicates.orderByDesc('... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecentToolEvents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left limit AST#identifier#Right AST#type_annotation#Left AST#:#L... | async getRecentToolEvents(limit: number = 20): Promise<ToolEventData[]> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return []
}
const events: ToolEventData[] = []
const predicates = new relationalStore.RdbPredicates(TableNames.TOOL_EVENTS)
predicates.orderByDesc('... | https://github.com/LongLiveY96/chatcube | 6e36a37cea0ea87cc9cdc31bfb12d2829e326f7f | github |
YANGZX22/Voot | entry/src/main/ets/services/SherpaWhisperMicService.ets | arkts | switchModel | 重新初始化为不同的模型
@param modelType 新的模型类型 | async switchModel(modelType: AsrModelType): Promise<void> {
if (!this.ctx) {
throw new Error('SherpaWhisperMicService.switchModel: ctx is undefined, call init first');
}
// 如果正在录音,先停止
if (this.capturing) {
this.stop();
// 等待停止完成
await new Promise<void>(resolve => setTimeout(re... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left switchModel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modelType AST#identifier#Right AS... | async switchModel(modelType: AsrModelType): Promise<void> {
if (!this.ctx) {
throw new Error('SherpaWhisperMicService.switchModel: ctx is undefined, call init first');
}
// 如果正在录音,先停止
if (this.capturing) {
this.stop();
// 等待停止完成
await new Promise<void>(resolve => setTimeout(re... | https://github.com/YANGZX22/Voot | c367190ee10f595a1c934851a3d758960849a61f | github |
HarmonyOS_Samples/component-collection | entry/src/main/ets/pages/universal/properties/componentIDSample/ComponentIDSample.ets | arkts | getComponentRect | Get the coordinates of the rectangular area occupied by the component | static getComponentRect(key: string) {
// This interface is only used for testing your application. It is not recommended due to its long time.
let strJson = getInspectorByKey(key);
let obj: Record<string, Object> = JSON.parse(strJson);
let rectInfo: Record<string, Object> = JSON.parse('[' + obj.$rect... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getComponentRect 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 ... | static getComponentRect(key: string) {
// This interface is only used for testing your application. It is not recommended due to its long time.
let strJson = getInspectorByKey(key);
let obj: Record<string, Object> = JSON.parse(strJson);
let rectInfo: Record<string, Object> = JSON.parse('[' + obj.$rect... | https://gitcode.com/HarmonyOS_Samples/component-collection | f56a36e7419c1e19be098abdf17e540fa2d7eb55 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | UTC | Returns the number of milliseconds elapsed since the epoch,
which is defined as the midnight at the beginning of January 1, 1970, UTC.
@param { int } year to be converted to milliseconds.
@returns { long } get new date value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static UTC(year: int): long {
return ecmaMakeDate(ecmaMakeDay(ecmaMakeFullYear(year), 0.0, 1.0), ecmaMakeTime(0.0, 0.0, 0.0, 0.0));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left UTC AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left year AST#identifier#Right A... | public static UTC(year: int): long {
return ecmaMakeDate(ecmaMakeDay(ecmaMakeFullYear(year), 0.0, 1.0), ecmaMakeTime(0.0, 0.0, 0.0, 0.0));
} | https://gitcode.com/iop123123/arkts-static-skills | f810b6418f0233f916b7124780433f97f0298f9b | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Char.ets | arkts | hashCode | hashCode() returns a hashcode of the underlying char.
@returns the hash code. | public override hashCode(): int {
return Char.hashCode(this.value);
} | 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 {
return Char.hashCode(this.value);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bc7ef950b6c1dd239e7f437c922b206ac06b54e1 | gitee |
PollenWang6/HiXD | entry/src/main/ets/services/EhallService.ets | arkts | preloadAllData | ===== 登录后预加载 ===== | async preloadAllData(): Promise<void> {
console.info(TAG, 'preloadAllData: start');
if (AppStorage.get('preload_status') === 'loading') {
console.info(TAG, 'preloadAllData: already running, skip');
return;
}
AppStorage.setOrCreate('preload_status', 'loading');
AppStorage.setOrCreate('p... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left preloadAllData 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 ... | async preloadAllData(): Promise<void> {
console.info(TAG, 'preloadAllData: start');
if (AppStorage.get('preload_status') === 'loading') {
console.info(TAG, 'preloadAllData: already running, skip');
return;
}
AppStorage.setOrCreate('preload_status', 'loading');
AppStorage.setOrCreate('p... | https://github.com/PollenWang6/HiXD | 8a50af2fb113efc9c958bf4c2f9dcf29382ffd8b | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnDateTimePickerViewModel.ets | arkts | toggleDatetimePicker | 切换日期时间组合选择器弹出层显示状态 | toggleDatetimePicker(): void {
this.datetimePickerOpen = !this.datetimePickerOpen;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleDatetimePicker 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#stateme... | toggleDatetimePicker(): void {
this.datetimePickerOpen = !this.datetimePickerOpen;
} | https://github.com/codelably/tuniao-ui | fba1369703444cdcb12ea47b0439165e2b0cbacd | github |
wuba/omni-ui | omni_component/src/main/ets/components/toast/OmniToast.ets | arkts | showWarning | 警告提示
@param options | public static showWarning(options?: ToastOptions) {
if (options) {
const op = options
op.icon = $r('app.media.warning')
OmniToast.handleShowToast(op)
} else {
OmniToast.handleShowToast({ icon: $r('app.media.warning') })
}
} | 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 showWarning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#?#Left ? A... | public static showWarning(options?: ToastOptions) {
if (options) {
const op = options
op.icon = $r('app.media.warning')
OmniToast.handleShowToast(op)
} else {
OmniToast.handleShowToast({ icon: $r('app.media.warning') })
}
} | https://github.com/wuba/omni-ui | b8579a29eb1530014275e184bebd3c847e2a1a0f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | setValueTextColor | Sets the color of the value-text (color in which the value-labels are
drawn) for all DataSets this data object contains.
@param color | public setValueTextColor(color: number): void {
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
data.setValueTextColor(color);
}
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValueTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setValueTextColor(color: number): void {
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
data.setValueTextColor(color);
}
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 02ee627433346e703358d8691d44428fcf498063 | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/PhotoPickerService.ets | arkts | invokeGalleryPicker | Each underlying SDK call is wrapped in its own try/catch + re-throw
helper so ArkTS strict mode's "function may throw" diagnostic is
satisfied at every call site. The outer `invokeGalleryPicker` then
swallows errors and returns `null` (treated identically to user-
cancel by the caller). | private static async invokeGalleryPicker(): Promise<string | null> {
try {
const opts: photoAccessHelper.PhotoSelectOptions =
RealPhotoPickerAdapter.makeGalleryOpts();
const photoPicker: photoAccessHelper.PhotoViewPicker =
RealPhotoPickerAdapter.newPhotoViewPicker();
const res: p... | 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 invokeGalleryPicker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#a... | private static async invokeGalleryPicker(): Promise<string | null> {
try {
const opts: photoAccessHelper.PhotoSelectOptions =
RealPhotoPickerAdapter.makeGalleryOpts();
const photoPicker: photoAccessHelper.PhotoViewPicker =
RealPhotoPickerAdapter.newPhotoViewPicker();
const res: p... | https://github.com/terryma2024/happyword | 3c6c0e3952aeaff77f185c4da3cd0e05b4754a6e | github |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | init | 初始化信令连接
@param url 信令服务器 URL(不含 MAC 后缀)
@param mac 本机设备标识
@param jsonStr 扩展信息 JSON
@param callback 信令回调 | public init(url: string, mac: string, jsonStr: string, callback: SignalingCallback): void {
this.mac = mac;
this.jsonStr = jsonStr;
this.socketUrl = url + mac;
this.callback = callback;
LogUtil.info(`${TAG} 初始化, url=${this.socketUrl}`);
this.connect();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | public init(url: string, mac: string, jsonStr: string, callback: SignalingCallback): void {
this.mac = mac;
this.jsonStr = jsonStr;
this.socketUrl = url + mac;
this.callback = callback;
LogUtil.info(`${TAG} 初始化, url=${this.socketUrl}`);
this.connect();
} | https://github.com/tdcare/tdwebrtc | 257622334ecbf040b464aa6e2ad9d88edb64b61b | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | userPendingInvites | 获取待使用邀请列表 | static userPendingInvites(username: string): string {
return `/u/${username}/invited/pending.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left userPendingInvites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | static userPendingInvites(username: string): string {
return `/u/${username}/invited/pending.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 86b238b71ca998ece4d94bf3164c8bd0588a7421 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/AdbKeyManager.ets | arkts | getCommonKeyInfo | 获取公共密钥信息 | getCommonKeyInfo(): KeyGenerationInfo {
return new KeyGenerationInfo(this.keyGeneration, !!this.cachedKeyPair);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCommonKeyInfo 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 KeyGenerationInfo AST#identifier#Right AST#ER... | getCommonKeyInfo(): KeyGenerationInfo {
return new KeyGenerationInfo(this.keyGeneration, !!this.cachedKeyPair);
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | a9acf2d194032e5285746f9003828d13efc3cc9b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorDecrement | Decrements the BigInt value by 1.
@returns { BigInt } The decremented value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorDecrement(): BigInt {
return this - new BigInt("1")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorDecrement 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 BigI... | public operatorDecrement(): BigInt {
return this - new BigInt("1")
} | https://gitcode.com/iop123123/arkts-static-skills | 6fb8c1fc3cc27ffd09040d60213a69766c549a38 | gitcode |
openharmony/codelabs | Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets | arkts | dealDeviceId | Indicates the ID of the processing device.
@param deviceId Device ID.
@returns Indicates the ID of the device after processing. | dealDeviceId(deviceId: string) {
return (deviceId.substring(0, CommonConstants.DEVICE_ID_LENGTH) + CommonConstants.DEVICE_ID_ELLIPSIS);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left dealDeviceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#... | dealDeviceId(deviceId: string) {
return (deviceId.substring(0, CommonConstants.DEVICE_ID_LENGTH) + CommonConstants.DEVICE_ID_ELLIPSIS);
} | https://gitee.com/openharmony/codelabs.git | 80ab78da47d88ec66b4aa0f83decacca6d81db09 | gitee |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/shiningability/ShiningAbility.ets | arkts | saveWindowState | 保存窗口状态(大小、位置、最大化状态) | private async saveWindowState(): Promise<void> {
try {
if (this.windowSizePrefs && this.mainWindow) {
// 获取窗口属性
const properties = await this.mainWindow.getWindowProperties();
// 保存窗口状态
await this.windowSizePrefs.pu... | 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 saveWindowState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async saveWindowState(): Promise<void> {
try {
if (this.windowSizePrefs && this.mainWindow) {
// 获取窗口属性
const properties = await this.mainWindow.getWindowProperties();
// 保存窗口状态
await this.windowSizePrefs.pu... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 434e635618b702c43c05812d7b14f002d22d840d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/StringUtil.ets | arkts | uint8ArrayToString | 将 Uint8Array 转换为字符串
@param array Uint8Array
@returns UTF-8 字符串 | static uint8ArrayToString(array: Uint8Array): string {
return StringUtil.getTextDecoder().decodeToString(array);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left uint8ArrayToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static uint8ArrayToString(array: Uint8Array): string {
return StringUtil.getTextDecoder().decodeToString(array);
} | https://github.com/AlkaidLab/moonlight-harmony | 7c8f8539596538dd598bb6755eaaaf106fe120b4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | some | / === with element lambda functions ===
Checks that at least one element of Float64Array satisfies the passed function
@param fn check function
@returns true if some element satisfies fn | public some(fn: (element: double, index: int, array: Float64Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (fn(this.at(i), i, this)) {
return true
}
}
return false
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public some(fn: (element: double, index: int, array: Float64Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (fn(this.at(i), i, this)) {
return true
}
}
return false
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3f679173a05b74e02e6892271dd0058f23f45462 | gitee |
XHXYT/Pixark | entry/src/main/ets/viewmodel/DownloadsViewModel.ets | arkts | clearAllCompletedTasks | 清空所有已完成的任务 | async clearAllCompletedTasks() {
// 筛选已完成任务
const completedTasks = this.tasks.filter(d => d.status === request.agent.State.COMPLETED);
if (completedTasks.length === 0) {
logger.warn("clearAllCompletedTasks: 没有已完成的任务需要清理");
return;
}
// 提取 ID
const ids = completedTasks.map(task => t... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAllCompletedTasks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left... | async clearAllCompletedTasks() {
// 筛选已完成任务
const completedTasks = this.tasks.filter(d => d.status === request.agent.State.COMPLETED);
if (completedTasks.length === 0) {
logger.warn("clearAllCompletedTasks: 没有已完成的任务需要清理");
return;
}
// 提取 ID
const ids = completedTasks.map(task => t... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L306-L317 | d4dea75cf57657e46594a865a19459673f77984f | github |
openharmony-tpc/openharmony_tpc_samples | LibphoneNumber/entry/src/main/ets/util/Log.ets | arkts | showInfo | print info level log
@param {string} log - Log needs to be printed | static showInfo(log: string, ...ms: string[]) {
console.info(log, ms);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | static showInfo(log: string, ...ms: string[]) {
console.info(log, ms);
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 6aa21e8e6f19747e905dd41b8f20a98adf8e9a2c | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | calculateExpenseStabilityScore | 计算支出稳定性评分 | static calculateExpenseStabilityScore(monthlyExpenses: number[]): DimensionScore {
if (monthlyExpenses.length < 3) {
const result: DimensionScore = {
name: '支出稳定性',
score: 50,
weight: 0.10,
weightedScore: 5,
grade: GRADE_FAIR,
actualValue: 0,
targetVal... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateExpenseStabilityScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left monthlyExpenses AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number... | static calculateExpenseStabilityScore(monthlyExpenses: number[]): DimensionScore {
if (monthlyExpenses.length < 3) {
const result: DimensionScore = {
name: '支出稳定性',
score: 50,
weight: 0.10,
weightedScore: 5,
grade: GRADE_FAIR,
actualValue: 0,
targetVal... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | d0c8d8cce4477a6aff1e3bbd9375ca6b59902e16 | github |
OHPG/FinVideo | entry/src/main/ets/data/Repository.ets | arkts | getEpisodes | 获取剧集分集列表
@param seriesId
@param seasonId
@returns | public getEpisodes(seriesId: string, seasonId?: string): Promise<Array<FinItem>> {
return this.requireApi().getEpisodes(seriesId, seasonId)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEpisodes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seriesId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | public getEpisodes(seriesId: string, seasonId?: string): Promise<Array<FinItem>> {
return this.requireApi().getEpisodes(seriesId, seasonId)
} | https://github.com/OHPG/FinVideo | 8a303077e816df3ff6d5b842b6ca73fd620f6d34 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AutomationEngine.ets | arkts | isInCooldown | 检查规则是否在冷却期 | private isInCooldown(rule: AutomationRule): boolean {
const cooldownSeconds = rule.triggerCondition.cooldownSeconds || 60;
const lastTriggered = this.cooldownMap.get(rule.ruleId);
if (!lastTriggered) {
return false;
}
const elapsed = Date.now() - lastTriggered;
return elapsed < cooldow... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isInCooldown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private isInCooldown(rule: AutomationRule): boolean {
const cooldownSeconds = rule.triggerCondition.cooldownSeconds || 60;
const lastTriggered = this.cooldownMap.get(rule.ruleId);
if (!lastTriggered) {
return false;
}
const elapsed = Date.now() - lastTriggered;
return elapsed < cooldow... | https://github.com/LJ666-ui/harmony-health-care | f0b331a5dbc9ad655aaa9b7164911eb9df384bf8 | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | setVideoSize | Sets the playback page size based on the video size. | setVideoSize() {
if (this.avPlayer === null) {
return;
}
if (this.avPlayer.height > this.avPlayer.width) {
this.playerModel.videoWidth = PlayConstants.PLAY_PLAYER_HEIGHT_FULL;
this.playerModel.videoHeight = PlayConstants.PLAY_PLAYER_HEIGHT_FULL;
this.playerModel.videoPosition = Fle... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setVideoSize 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 ... | setVideoSize() {
if (this.avPlayer === null) {
return;
}
if (this.avPlayer.height > this.avPlayer.width) {
this.playerModel.videoWidth = PlayConstants.PLAY_PLAYER_HEIGHT_FULL;
this.playerModel.videoHeight = PlayConstants.PLAY_PLAYER_HEIGHT_FULL;
this.playerModel.videoPosition = Fle... | https://gitee.com/openharmony/codelabs.git | cfc2586de0d0882e156101032bc419e1e877b041 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | cos | Return a new Decimal whose value is the cosine of `n`, rounded to `precision` significant
digits using rounding mode `rounding`
@param { Value } n {double | string | Decimal} A value in radians.
@returns { Decimal } the Decimal type | static cos(n: Value): Decimal {
return new Decimal(n).cos();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left cos AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static cos(n: Value): Decimal {
return new Decimal(n).cos();
} | https://gitcode.com/iop123123/arkts-static-skills | fe9adfcb39605e16d21e667c88dec27b1f45ba14 | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets | arkts | showAddEventDialog | 显示添加事件对话框 | showAddEventDialog() {
// 获取下一个可用时间
const nextStartTime = CalendarUtils.getNextAvailableTime(
this.selectedDate,
this.events
);
// 默认持续1小时
const nextEndTime = nextStartTime + 60 * 60 * 1000;
const newEvent: CalendarEvent = {
id: '0',
title: '新事件',
description: '... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showAddEventDialog 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... | showAddEventDialog() {
// 获取下一个可用时间
const nextStartTime = CalendarUtils.getNextAvailableTime(
this.selectedDate,
this.events
);
// 默认持续1小时
const nextEndTime = nextStartTime + 60 * 60 * 1000;
const newEvent: CalendarEvent = {
id: '0',
title: '新事件',
description: '... | https://gitcode.com/openharmony/codelabs | f8f4e982326d8053a3ea5473ce93125b82b75727 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelTxtTocRuleManager.ets | arkts | parseChaptersByRuleId | 使用指定规则解析章节
@param content 文本内容
@param ruleId 规则ID,空字符串表示使用所有启用规则 | parseChaptersByRuleId(content: string, ruleId: string): TxtChapter[] {
let pattern: RegExp | null = null;
if (ruleId && ruleId.length > 0) {
// 使用指定规则 - rules是Map类型,使用get方法
const rule: TxtTocRule | undefined = this.rules.get(ruleId);
if (rule) {
try {
pattern = new Reg... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parseChaptersByRuleId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Ri... | parseChaptersByRuleId(content: string, ruleId: string): TxtChapter[] {
let pattern: RegExp | null = null;
if (ruleId && ruleId.length > 0) {
// 使用指定规则 - rules是Map类型,使用get方法
const rule: TxtTocRule | undefined = this.rules.get(ruleId);
if (rule) {
try {
pattern = new Reg... | https://github.com/DaLongZhuaZi/manxia | 28d8e32b2225d4325a7ba69cff05710a5f2e077e | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | postUpdatedMedia | @summary Reports that new movies have been added by an external source.
@param {LibraryApiPostUpdatedMediaRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public postUpdatedMedia(requestParameters: LibraryApiPostUpdatedMediaRequest): Promise<void> {
return this.apiClient.post({path: `/Library/Media/Updated`, data: requestParameters.mediaUpdateInfoDto})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left postUpdatedMedia AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | public postUpdatedMedia(requestParameters: LibraryApiPostUpdatedMediaRequest): Promise<void> {
return this.apiClient.post({path: `/Library/Media/Updated`, data: requestParameters.mediaUpdateInfoDto})
} | https://github.com/OHPG/FinSdk | 3a8df47021f8909d4d8de3227b044be6beea2f58 | github |
midori52000/ArkPilot | Agent/entry/src/main/ets/backend/ProviderConfigStore.ets | arkts | escapeTomlString | ── TOML serializer ── | function escapeTomlString(value: string): string {
let escaped: string = '';
for (let i = 0; i < value.length; i++) {
const ch: string = value.charAt(i);
if (ch === '"') {
escaped += '\\"';
} else if (ch === '\\') {
escaped += '\\\\';
} else {
escaped += ch;
}
}
return `"${... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left escapeTomlString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function escapeTomlString(value: string): string {
let escaped: string = '';
for (let i = 0; i < value.length; i++) {
const ch: string = value.charAt(i);
if (ch === '"') {
escaped += '\\"';
} else if (ch === '\\') {
escaped += '\\\\';
} else {
escaped += ch;
}
}
return `"${... | https://github.com/midori52000/ArkPilot | 4d51d1b7e22d72f9526f20b363e76e9133e3ea1a | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getLastYearMonth | 获取上个月的年份和月份
@param year 年
@param month 月
@returns 返回上个月的年份和月份 | static getLastYearMonth(year: number, month: number): string {
year = (month - 1 < 1) ? year - 1 : year;
month = (month - 1 < 1) ? 12 : month - 1;
return year + '-' + month;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLastYearMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static getLastYearMonth(year: number, month: number): string {
year = (month - 1 < 1) ? year - 1 : year;
month = (month - 1 < 1) ? 12 : month - 1;
return year + '-' + month;
} | https://gitcode.com/arkui-x/samples | 0255ace21d5e47093a49ee600b8db721f4b94454 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/common/SecurityUtils.ets | arkts | simpleHash | 简单的hash算法实现 | private static simpleHash(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
// 转为正数并转16进制
const result = (hash >>> 0).toString(16);
// 补齐到8位
return '0'.repe... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left simpleHash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST... | private static simpleHash(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
// 转为正数并转16进制
const result = (hash >>> 0).toString(16);
// 补齐到8位
return '0'.repe... | https://github.com/the-wwyang/kids-learning-app | c34079fa6650743ac43cec3c3d3f7ad6fb66d710 | github |
lidaixian999/Smart_Car | entry/src/main/ets/model/SmartCommandExecutor.ets | arkts | executeCommand | 执行单个指令
@param command 要执行的指令
@returns 执行是否成功 | private async executeCommand(command: CommandAction): Promise<boolean> {
try {
// 验证指令参数
if (command.position === undefined || command.digit === undefined) {
console.error(`SmartCommandExecutor: 指令参数无效 ${command.type}-${command.action}`);
return false;
}
// 验证位置范围
if... | 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 executeCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left command AST#identifier#Right AST#:#Lef... | private async executeCommand(command: CommandAction): Promise<boolean> {
try {
// 验证指令参数
if (command.position === undefined || command.digit === undefined) {
console.error(`SmartCommandExecutor: 指令参数无效 ${command.type}-${command.action}`);
return false;
}
// 验证位置范围
if... | https://github.com/lidaixian999/Smart_Car | 505ef00d435effa80eea098e4fd3d8ab272f0286 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/beans/LocationParam.ets | arkts | ofSelect | 选择模式
@param onLocation 选择回调
@return LocationParam | public static ofSelect(fileSuffix?: Array<string>, onLocation?: (param: LocationInfo) => void): LocationParam {
LocationParam.instance = new LocationParam(LocationMode.SELECT, fileSuffix, undefined, onLocation);
return LocationParam.instance;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ofSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left A... | public static ofSelect(fileSuffix?: Array<string>, onLocation?: (param: LocationInfo) => void): LocationParam {
LocationParam.instance = new LocationParam(LocationMode.SELECT, fileSuffix, undefined, onLocation);
return LocationParam.instance;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/beans/LocationParam.ets#L99-L102 | eac3107781fde96e4153d263bee6eab78756e5d6 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/EventSourcingDAO.ets | arkts | getByAggregateType | 按聚合类型查询事件 | static async getByAggregateType(aggregateType: string, limit: number = 1000): Promise<DomainEvent[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(DomainEvent.tableName);
predi... | 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 getByAggregateType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left AS... | static async getByAggregateType(aggregateType: string, limit: number = 1000): Promise<DomainEvent[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(DomainEvent.tableName);
predi... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8e51f7a44dcaae817bc59d0a5cf3121d2b43d2b5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | getEnabledPlugins | 获取已启用的插件 | public getEnabledPlugins(): PluginInfo[] {
return Array.from(this.pluginRegistry.values()).filter(plugin => plugin.isEnabled);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEnabledPlugins 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 Plug... | public getEnabledPlugins(): PluginInfo[] {
return Array.from(this.pluginRegistry.values()).filter(plugin => plugin.isEnabled);
} | https://github.com/DaLongZhuaZi/manxia | 020e917d0ea8a93cbc2ea876e2da802118da7eaa | github |
harmonyos/codelabs | HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Utils.ets | arkts | timestamp2Time | Convert timestamp to time.
@param timestamp
@returns time | static timestamp2Time(timestamp: number): string {
let date = new Date(timestamp * Const.TIME_1000);
let year = date.getFullYear() + Const.STRING_SLASH;
let month = (date.getMonth() + 1 < Const.TIME_10
? Const.STRING_0 + (date.getMonth() + 1) : date.getMonth() + 1) + Const.STRING_SLASH;
let day ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left timestamp2Time AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | static timestamp2Time(timestamp: number): string {
let date = new Date(timestamp * Const.TIME_1000);
let year = date.getFullYear() + Const.STRING_SLASH;
let month = (date.getMonth() + 1 < Const.TIME_10
? Const.STRING_0 + (date.getMonth() + 1) : date.getMonth() + 1) + Const.STRING_SLASH;
let day ... | https://gitee.com/harmonyos/codelabs.git | 9d74ea4eba533bd4b9f07b020177fee3aea2ba7b | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnDateTimePickerViewModel.ets | arkts | onYearMonthConfirm | 年月选择确认回调
@param value 选中的年月 | onYearMonthConfirm(value: string): void {
this.selectedYearMonth = value;
this.yearMonthPickerOpen = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onYearMonthConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Le... | onYearMonthConfirm(value: string): void {
this.selectedYearMonth = value;
this.yearMonthPickerOpen = false;
} | https://github.com/codelably/tuniao-ui | 3498b56ce898fcc445b1aa9339cac30138f0e4e6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | saveImageToGallery | 保存背景图到相册
@param imageUrl 图片 URL
@param context 应用上下文
@returns 是否保存成功 | async saveImageToGallery(imageUrl: string, context: common.UIAbilityContext): Promise<boolean> {
if (!imageUrl || imageUrl.length === 0) {
ToastQueue.show({ message: '没有可保存的图片' });
return false;
}
try {
ToastQueue.show({ message: '正在保存图片...' });
let imageData: ArrayBuffer |... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveImageToGallery AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageUrl AST#identifier#Ri... | async saveImageToGallery(imageUrl: string, context: common.UIAbilityContext): Promise<boolean> {
if (!imageUrl || imageUrl.length === 0) {
ToastQueue.show({ message: '没有可保存的图片' });
return false;
}
try {
ToastQueue.show({ message: '正在保存图片...' });
let imageData: ArrayBuffer |... | https://github.com/AlkaidLab/moonlight-harmony | c9fb692df905ab9b52b3efe4347b965dcd9361b8 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | setActivationKey | 设置激活键
@param key GYRO_ACTIVATION_ALWAYS / GYRO_ACTIVATION_LT / GYRO_ACTIVATION_RT | setActivationKey(key: number): void {
this._activationKey = key;
// 更新 hold 状态
if (key === GYRO_ACTIVATION_ALWAYS) {
this.holdActive = true;
} else {
this.holdActive = false;
// 切换激活键时清零当前陀螺仪数据
this.gyroStickX = 0;
this.gyroStickY = 0;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setActivationKey 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 number AST#identifier#Right AST#)#Left )... | setActivationKey(key: number): void {
this._activationKey = key;
// 更新 hold 状态
if (key === GYRO_ACTIVATION_ALWAYS) {
this.holdActive = true;
} else {
this.holdActive = false;
// 切换激活键时清零当前陀螺仪数据
this.gyroStickX = 0;
this.gyroStickY = 0;
}
} | https://github.com/AlkaidLab/moonlight-harmony | f40ce7f7c3b74b5754291df8a1d3f6af1484c7d8 | github |
awaLiny2333/Renameow | honk/src/main/ets/hosts/meowHonk.ets | arkts | getUniqueByResultName | 示例输入: [{resultName:'a'},{resultName:'b'},{resultName:'a'},{resultName:'b'}]
返回: [[0,2], [1,3]]
根据 folderPath 去重,返回新的不重复数组
@param arr - meowFile 对象数组
@returns 去重后的新数组
@author DeepSeek Web @ Feb 23 2026 | function getUniqueByResultName(arr: meowFile[]): string[] {
const seen = new Set<string>();
const unique: string[] = [];
for (const item of arr) {
if (!seen.has(item.folderPath)) {
seen.add(item.folderPath);
unique.push(item.folderPath);
}
}
return unique;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getUniqueByResultName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function getUniqueByResultName(arr: meowFile[]): string[] {
const seen = new Set<string>();
const unique: string[] = [];
for (const item of arr) {
if (!seen.has(item.folderPath)) {
seen.add(item.folderPath);
unique.push(item.folderPath);
}
}
return unique;
} | https://github.com/awaLiny2333/Renameow/blob/34617cc8dc8596061456d226ee717517ff41d25a/honk/src/main/ets/hosts/meowHonk.ets#L287-L299 | f4cd755b5d317694296302807ff240a45d71938e | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/stores/AppStore.ets | arkts | initialize | 初始化全部全局状态 | static initialize(): void {
ThemeStore.initialize()
AuthStore.initialize()
AppStore.initBreakpoint()
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static initialize(): void {
ThemeStore.initialize()
AuthStore.initialize()
AppStore.initBreakpoint()
} | https://github.com/encorexin/WordPressCMS | eab3ad350dfce140852cc813e97168e3be0a76f1 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | eventLoopTick | 事件循环单次执行
v27: 网络 I/O 已移至 Rust 后台线程,此处仅轮询事件队列
v28: RTP 包直接轮询,不再依赖事件通知(避免事件队列洪泛) | public eventLoopTick(): void {
if (!this.client) return;
// v27: handle_timeout 和 sendOutgoingPackets 已由 Rust 后台线程处理
// ArkTS 仅轮询事件队列(状态变化、ICE 候选等)
this.pollEvents();
// 轮询完整媒体帧(Rust 层 RTP 解包 + 帧重组)
if (this.onMediaFrameReceived) {
const frames: NapiMediaFrame[] = this.receiveMediaFram... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left eventLoopTick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#... | public eventLoopTick(): void {
if (!this.client) return;
// v27: handle_timeout 和 sendOutgoingPackets 已由 Rust 后台线程处理
// ArkTS 仅轮询事件队列(状态变化、ICE 候选等)
this.pollEvents();
// 轮询完整媒体帧(Rust 层 RTP 解包 + 帧重组)
if (this.onMediaFrameReceived) {
const frames: NapiMediaFrame[] = this.receiveMediaFram... | https://github.com/tdcare/tdwebrtc | d2a69742e8538e1fb99f4426883344f659864231 | github |
arkui-x/samples | CodeLab/Cases/feature/chatwithexpression/src/main/ets/view/ChatWithExpression.ets | arkts | aboutToAppear | 聊天信息最大宽度 | aboutToAppear() {
const displayData: display.Display = display.getDefaultDisplaySync();
this.screenWidth = px2vp(displayData.width);
// 根据设计稿及屏幕宽度计算fontsize及行间距
this.msgFontSize = this.screenWidth * 100 / DESIGN_WIDTH; // 100,百分比
logger.info(TAG, 'FontSize:' + this.msgFontSize.toString());
//... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
const displayData: display.Display = display.getDefaultDisplaySync();
this.screenWidth = px2vp(displayData.width);
// 根据设计稿及屏幕宽度计算fontsize及行间距
this.msgFontSize = this.screenWidth * 100 / DESIGN_WIDTH; // 100,百分比
logger.info(TAG, 'FontSize:' + this.msgFontSize.toString());
//... | https://gitcode.com/arkui-x/samples | c4cb2df0f5f3710c88b9bcacde86c545e3a60b0e | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CloudSyncRecordDAO.ets | arkts | insert | 插入同步记录 | static async insert(record: CloudSyncRecord): Promise<number> {
if (!record.validate()) {
throw new Error('[CloudSyncRecordDAO] 插入失败,数据验证不通过');
}
const now: string = DAOHelper.now();
record.createdAt = now;
record.updatedAt = now;
const store: relationalStore.RdbStore = DatabaseManager... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Ri... | static async insert(record: CloudSyncRecord): Promise<number> {
if (!record.validate()) {
throw new Error('[CloudSyncRecordDAO] 插入失败,数据验证不通过');
}
const now: string = DAOHelper.now();
record.createdAt = now;
record.updatedAt = now;
const store: relationalStore.RdbStore = DatabaseManager... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3e4cf6ef49b7e638bb0aa344a0d2b748ce30bcf0 | github |
HarmonyCandies/extended_text | extended_text/src/main/ets/builder/SpecialTextSpanBuilder.ets | arkts | isStart | 检查字符串是否以 startFlag 开头 | isStart(value: string, startFlag: string): boolean {
return value.endsWith(startFlag);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#... | isStart(value: string, startFlag: string): boolean {
return value.endsWith(startFlag);
} | https://github.com/HarmonyCandies/extended_text | 19e42d6cda92803b22ac44155b6b2aa447614f19 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/PaginationHandler.ets | arkts | resetPagination | 重置分页状态 | resetPagination(sourceId: string, config?: PaginationConfig): void {
if (config) {
this.initializePagination(sourceId, config);
} else {
this.paginationStates.delete(sourceId);
}
logger.debug(TAG, `重置分页状态: ${sourceId}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetPagination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST... | resetPagination(sourceId: string, config?: PaginationConfig): void {
if (config) {
this.initializePagination(sourceId, config);
} else {
this.paginationStates.delete(sourceId);
}
logger.debug(TAG, `重置分页状态: ${sourceId}`);
} | https://github.com/DaLongZhuaZi/manxia | d9580d425c38dbd9179f9feab071f8ee0b7a2b45 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.