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 |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | negate | Returns the negation of the BigInt.
@returns { BigInt } The negated value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public negate(): BigInt {
return new BigInt(this.bytes, this.sign * -1)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left negate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left BigInt AST#iden... | public negate(): BigInt {
return new BigInt(this.bytes, this.sign * -1)
} | https://gitcode.com/iop123123/arkts-static-skills | d02bb7752da67ba5733e5be8559f4683b9b28e77 | gitcode |
openharmony/update_update_app | feature/ota/src/main/ets/dialog/DialogHelper.ets | arkts | showDialog | 弹框
@param title 标题
@param message 内容
@param confirmText 确认按钮显示内容
@param operator 回调 | function showDialog(title: string | Resource, message: string | Resource, confirmText?: string | Resource,
operator ?: DialogOperator): void {
AlertDialog.show(
{
title: title,
message: message,
confirm: {
value: confirmText,
action: () => {
logInf... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left showDialog AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function showDialog(title: string | Resource, message: string | Resource, confirmText?: string | Resource,
operator ?: DialogOperator): void {
AlertDialog.show(
{
title: title,
message: message,
confirm: {
value: confirmText,
action: () => {
logInf... | https://gitee.com/openharmony/update_update_app.git | bc1bda509f0ada26568cb8ad58f3293a7fde6b14 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | doBoundaryCheck | Performs boundary check due to `data` array possibly shrinking down
@param pos index to be checked before accessing the underlying buffer | private final doBoundaryCheck(pos: int): void {
if (pos < 0 || pos >= this._byteLength) {
throw new IndexOutOfBoundsError("ArrayBuffer position " + pos + " is out of bounds")
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left final AST#identifier#Right AST#call_expression#Left AST#identifier#Left doBoundaryCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AST#:#Left :... | private final doBoundaryCheck(pos: int): void {
if (pos < 0 || pos >= this._byteLength) {
throw new IndexOutOfBoundsError("ArrayBuffer position " + pos + " is out of bounds")
}
} | https://gitcode.com/iop123123/arkts-static-skills | 11eddb353e9ea915ba366f7b4e4457da7f6025bd | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | equals | Return true if the value of this Decimal is equal to the value of `n`, otherwise return false.
@param { Value } n {double | string | Decimal}
@returns { boolean } the boolean type | public equals(n: Value): boolean {
return this.comparedTo(n) === 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Value AST#id... | public equals(n: Value): boolean {
return this.comparedTo(n) === 0;
} | https://gitcode.com/iop123123/arkts-static-skills | aa3551d4db0911d58ec86ab8b1d2015d992a6ec4 | gitcode |
openharmony/update_update_app | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getUpdateState | 取升级状态缓存数据
@return 升级状态 | getUpdateState(): number {
return this._updateStatus;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUpdateState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getUpdateState(): number {
return this._updateStatus;
} | https://gitee.com/openharmony/update_update_app.git | f71ce5c3efc8ab76743927cfa291d7a412a35551 | gitee |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | init | 初始化偏好设置 | async init(context: Context): Promise<void> {
try {
this.preferences = await preferences.getPreferences(context, this.PREFERENCES_NAME);
console.info('PreferencesUtil: 初始化成功');
} catch (err) {
console.error('PreferencesUtil: 初始化失败', JSON.stringify(err));
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async init(context: Context): Promise<void> {
try {
this.preferences = await preferences.getPreferences(context, this.PREFERENCES_NAME);
console.info('PreferencesUtil: 初始化成功');
} catch (err) {
console.error('PreferencesUtil: 初始化失败', JSON.stringify(err));
... | https://github.com/qiuhaotc/HarmonyOSPlayground | f45998a9a2a7baef9ded9d4522fa88c713939cb6 | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/ai/KeywordFetcherService.ets | arkts | fetchKeywordsFromTrends | 从 Google Trends 获取关键词建议 | static async fetchKeywordsFromTrends(topic: string): Promise<FetchKeywordsResult> {
const result = new FetchKeywordsResult()
try {
const encodedTopic = encodeURIComponent(topic)
const googleUrl = `https://suggestqueries.google.com/complete/search?client=firefox&q=${encodedTopic}`
const prox... | 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 fetchKeywordsFromTrends AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left topic AST#identifier#Right AST#:... | static async fetchKeywordsFromTrends(topic: string): Promise<FetchKeywordsResult> {
const result = new FetchKeywordsResult()
try {
const encodedTopic = encodeURIComponent(topic)
const googleUrl = `https://suggestqueries.google.com/complete/search?client=firefox&q=${encodedTopic}`
const prox... | https://github.com/encorexin/WordPressCMS | 226b5c6749d7bef5c42ad01acf4244ec14ce7603 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ThemeService.ets | arkts | getCurrentColors | 获取当前颜色配置 | getCurrentColors(): ThemeColorConfig {
return getThemeColors(this.currentTheme, this.currentIsDarkMode)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentColors 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 ThemeColorConfig AST#identifier#Right AST#ERR... | getCurrentColors(): ThemeColorConfig {
return getThemeColors(this.currentTheme, this.currentIsDarkMode)
} | https://github.com/LongLiveY96/chatcube | 37c0e2c4bbfba4ad600781085b5cf901cb5cf25a | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPInputHandler.ets | arkts | switchLayout | 切换键盘布局 | switchLayout(layout: 'qwerty' | 'numeric' | 'symbols') {
this.currentLayout = layout
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switchLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left layout AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expressi... | switchLayout(layout: 'qwerty' | 'numeric' | 'symbols') {
this.currentLayout = layout
} | https://github.com/AetheriumSimulator/qemu-hmos | 2de1cf386e888f16b88b5c90d9a187a4922887a2 | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | getSimpleAlternative | 获取简单替代词 | private getSimpleAlternative(word: string): string {
// 简化实现:返回单词本身
// 实际应用中应该维护一个同义词库
return word;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSimpleAlternative AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private getSimpleAlternative(word: string): string {
// 简化实现:返回单词本身
// 实际应用中应该维护一个同义词库
return word;
} | https://github.com/CLMC2025/Vignette | 7b01438e8dea41c99b9e2b5db050a745cfc1e103 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoWebViewComponent.ets | arkts | isWebViewAvailable | 检查WebView是否可用 | isWebViewAvailable(): boolean {
const executor = getWebViewExecutor();
return executor.isWebViewReady();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isWebViewAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#... | isWebViewAvailable(): boolean {
const executor = getWebViewExecutor();
return executor.isWebViewReady();
} | https://github.com/DaLongZhuaZi/manxia | a539618c169fb21df81824670f8d8c4b95ba0d9a | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setUnbindEnabled | Set this to true to enable "unbinding" of drawables. When a View is detached
from a window. This helps avoid memory leaks.
Default: false
@param enabled | public setUnbindEnabled(enabled: boolean) {
this.mUnbind = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUnbindEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public setUnbindEnabled(enabled: boolean) {
this.mUnbind = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 9ec0e5f79d9b446af37102919cd2f226f2a34618 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setBorderColor | 边框颜色
@param borderColor
@returns | setBorderColor(borderColor: number): Builder {
this.popupConfig.borderColor = borderColor
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBorderColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left borderColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A... | setBorderColor(borderColor: number): Builder {
this.popupConfig.borderColor = borderColor
return this
} | https://github.com/wuba/omni-ui | 3a95bdcc8b2d5bc6563ce5f6b9ae6c954def2617 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets | arkts | packToDataPixelMap | PixelMap转为data
@param context
@param buffer 调用data创建ImageSource方法, 需接收buffer参数 | packToDataPixelMap(context: Context, buffer: ArrayBuffer) {
try {
const packFilePath: string = context.filesDir + '/' + this.getTimeStr() + '_3.jpg'
const result: number = ndkTest.packToDataPixelMap(buffer, packFilePath)
logger.info(TAG, 'packToDataPixelMap result ' + result);
} catch (error... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left packToDataPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identif... | packToDataPixelMap(context: Context, buffer: ArrayBuffer) {
try {
const packFilePath: string = context.filesDir + '/' + this.getTimeStr() + '_3.jpg'
const result: number = ndkTest.packToDataPixelMap(buffer, packFilePath)
logger.info(TAG, 'packToDataPixelMap result ' + result);
} catch (error... | https://github.com/openharmony/applications_app_samples | afbae565e4d76e24546288c7e574e64e9d428c43 | github |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | copyToTemp | 将受权限限制的文件复制到应用临时目录
解决从相册选择图片权限有限的问题
@param srcFileUri 源文件 URI(如相册图片的 file:// URI)
@param targetDir 目标目录(可选,默认为 luban)
@returns 复制后的文件路径 | static async copyToTemp(srcFileUri: string, targetDir: string = "luban"): Promise<string> {
try {
LogUtil.debug('📋 开始复制文件到临时目录...');
LogUtil.debug(`🔗 源文件URI: ${srcFileUri}`);
// 生成目标文件路径
const fileName = LubanUtils.generateTempFileName(srcFileUri);
const tempFilePath = LubanUtils.... | 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 copyToTemp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left srcFileUri AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async copyToTemp(srcFileUri: string, targetDir: string = "luban"): Promise<string> {
try {
LogUtil.debug('📋 开始复制文件到临时目录...');
LogUtil.debug(`🔗 源文件URI: ${srcFileUri}`);
// 生成目标文件路径
const fileName = LubanUtils.generateTempFileName(srcFileUri);
const tempFilePath = LubanUtils.... | https://github.com/kumaleap/ArkLuban | 340fb0ef68682b470737b897325d76d6e2639465 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | setFontScale | 设置全局字号缩放倍率 | public static setFontScale(scale: number): void {
FontAwareHelper.globalState.fontScale = Math.max(0.5, Math.min(2.0, scale));
FontAwareHelper.notifyAllCallbacks();
logger.info(TAG, `字号缩放倍率设置为: ${FontAwareHelper.globalState.fontScale}`);
} | 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 setFontScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scale AST#identifier#Right AST#:#Left : AS... | public static setFontScale(scale: number): void {
FontAwareHelper.globalState.fontScale = Math.max(0.5, Math.min(2.0, scale));
FontAwareHelper.notifyAllCallbacks();
logger.info(TAG, `字号缩放倍率设置为: ${FontAwareHelper.globalState.fontScale}`);
} | https://github.com/DaLongZhuaZi/manxia | 2056b4d017141dfeb97727004469bcd36b6947f6 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/UserSettingsStorageService.ets | arkts | updateFontSize | 更新字体大小
@param size 字体大小 | static async updateFontSize(size: 'small' | 'medium' | 'large'): Promise<void> {
try {
const settings = await UserSettingsStorageService.loadSettings();
settings.fontSize = size;
await UserSettingsStorageService.saveSettings(settings);
console.log(`[UserSettingsStorage] Font size updated: ... | 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 updateFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AS... | static async updateFontSize(size: 'small' | 'medium' | 'large'): Promise<void> {
try {
const settings = await UserSettingsStorageService.loadSettings();
settings.fontSize = size;
await UserSettingsStorageService.saveSettings(settings);
console.log(`[UserSettingsStorage] Font size updated: ... | https://github.com/the-wwyang/kids-learning-app | 4ee95600a481c07eb560af8b8f7364fd4207efee | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_int.ets | arkts | main | ---
desc: check prefix decrement for integer operand
--- | function main(): void {
let value: int = {{v.value}}
let result: int = --value
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: int = {{v.value}}
let result: int = --value
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 824f0fd088cac679085225598ba9032d47521560 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setTouchEnabled | Set this to false to disable all gestures and touches on the chart,
default: true
@param enabled | public setTouchEnabled(enabled: boolean) {
this.mTouchEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTouchEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setTouchEnabled(enabled: boolean) {
this.mTouchEnabled = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f9232386f9e9eb95a2fd6b8faac3fdd32c8a1dff | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets | arkts | getAttendanceRule | ============ 考勤规则 ============
获取考勤规则 | async getAttendanceRule(): Promise<ApiResponse<AttendanceRule>> {
return this.client.get<AttendanceRule>('/api/v1/attendance/rule')
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAttendanceRule 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#ge... | async getAttendanceRule(): Promise<ApiResponse<AttendanceRule>> {
return this.client.get<AttendanceRule>('/api/v1/attendance/rule')
} | https://github.com/David8Idira/AI-OA | 79a82fc3369b2b9b96f82d6f711f06f8add503e5 | github |
erosTeam/NextE | shared/src/main/ets/settings/ListModeSettings.ets | arkts | setFixedHeight | Single writer of the fixed/adaptive list-row height axis (eros_fe fixedHeightOfListItems). | static async setFixedHeight(
context: common.UIAbilityContext,
fixedHeight: boolean,
): Promise<void> {
connectListMode().fixedHeight = fixedHeight
try {
const store: preferences.Preferences = await preferences.getPreferences(
context,
StorageKeys.STORE_SETTINGS,
)
... | 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 setFixedHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :... | static async setFixedHeight(
context: common.UIAbilityContext,
fixedHeight: boolean,
): Promise<void> {
connectListMode().fixedHeight = fixedHeight
try {
const store: preferences.Preferences = await preferences.getPreferences(
context,
StorageKeys.STORE_SETTINGS,
)
... | https://github.com/erosTeam/NextE | 9fd4afdcb576c4b41d574c5c8c3dd9100d4ba728 | github |
ibestservices/ibest-ui | library/src/main/ets/components/price/index.ets | arkts | formatInteger | 格式化整数部分 | formatInteger() {
let value = this.value
if(isNaN(Number(value)) || Number(value) == 0) {
value = 0
}
if(this.isHasPoint()) {
value = Number(value).toFixed(this.decimal)
value = value.split('.')[0]
}else {
value = value.toString... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left formatInteger 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... | formatInteger() {
let value = this.value
if(isNaN(Number(value)) || Number(value) == 0) {
value = 0
}
if(this.isHasPoint()) {
value = Number(value).toFixed(this.decimal)
value = value.split('.')[0]
}else {
value = value.toString... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/price/index.ets#L65-L81 | 395fec825b6c77f34713b37d304828426cb47edf | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test54_original_index.ets | arkts | maxSubarraySum | --- Sliding window max sum --- | function maxSubarraySum(arr: number[], k: number): number {
if (arr.length < k) {
return 0;
}
let maxSum: number = 0;
let windowSum: number = 0;
for (let i = 0; i < k; i++) {
windowSum += arr[i];
}
maxSum = windowSum;
for (let i = k; i < arr.length; i++) {
windowSum = windowSum - arr[i - k] ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left maxSubarraySum AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function maxSubarraySum(arr: number[], k: number): number {
if (arr.length < k) {
return 0;
}
let maxSum: number = 0;
let windowSum: number = 0;
for (let i = 0; i < k; i++) {
windowSum += arr[i];
}
maxSum = windowSum;
for (let i = k; i < arr.length; i++) {
windowSum = windowSum - arr[i - k] ... | https://github.com/miaochiahao/ark-ghidra | 786a29104df05db4ca34e3b837fe40a7429108c8 | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | getAVPlayer | 获取AVPlayer实例
@returns media.AVPlayer | getAVPlayer() {
return this.avPlayer
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAVPlayer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | getAVPlayer() {
return this.avPlayer
} | https://github.com/yangyongzhen/hmmovie | cfe7f8107040d129f35a756f545e2581e946107c | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/ClipboardBridgeService.ets | arkts | setSystemText | 写系统剪贴板纯文本 (来自远端) — 同时标记防回环窗口 | setSystemText(text: string): void {
if (text.length === 0) {
return;
}
try {
const pd: pasteboard.PasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
pasteboard.getSystemPasteboard().setData(pd);
this.remoteSetAt = Date.now();
this.remoteSetHash = this.ha... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSystemText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | setSystemText(text: string): void {
if (text.length === 0) {
return;
}
try {
const pd: pasteboard.PasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
pasteboard.getSystemPasteboard().setData(pd);
this.remoteSetAt = Date.now();
this.remoteSetHash = this.ha... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 2183f9114809139654765a1b3ebf23d268135d7d | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/UrlUtils.ets | arkts | encode | 编码URL
@param urlPath URL地址
@returns 编码后的URL | public static encode(urlPath: string): string {
return encodeURIComponent(urlPath);
} | 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 encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left urlPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public static encode(urlPath: string): string {
return encodeURIComponent(urlPath);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/UrlUtils.ets#L50-L52 | 8ceffc1facec3033fba960b24dca2d7b15d4b988 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | constructor | ---------------------------------------------------------------------------
构造函数
--------------------------------------------------------------------------- | constructor() {
this.nativeModule = nativeLib as NativeModule;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.nativeModule = nativeLib as NativeModule;
} | https://github.com/AlkaidLab/moonlight-harmony | 548cef63aaab2cfd1480d328467e061823260dcf | github |
CLMC2025/Vignette | entry/src/main/ets/ui/Animations.ets | arkts | getOrCreateState | 获取或创建动画状态 | private getOrCreateState(key: string): AnimationState {
let state = this.animationStates.get(key);
if (state === undefined) {
state = new AnimationState();
this.animationStates.set(key, state);
}
return state;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getOrCreateState 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#Le... | private getOrCreateState(key: string): AnimationState {
let state = this.animationStates.get(key);
if (state === undefined) {
state = new AnimationState();
this.animationStates.set(key, state);
}
return state;
} | https://github.com/CLMC2025/Vignette | c656b4ec39565c16a2125233f9e73ef6b3fd84f4 | github |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/AnimationUtils.ets | arkts | calculateStackAnimation | 计算卡片堆叠动画参数
@param index - 卡片索引(0为顶层卡片)
@param scaleRatio - 缩放比例
@param cardSpacing - 卡片间距
@returns 堆叠动画参数 | static calculateStackAnimation(
index: number,
scaleRatio: number,
cardSpacing: number
): AnimationParams {
const scale: number = Math.pow(scaleRatio, index);
const translateY: number = index * cardSpacing;
return {
translateX: 0,
translateY: translateY,
rotation: 0,
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateStackAnimation 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#identif... | static calculateStackAnimation(
index: number,
scaleRatio: number,
cardSpacing: number
): AnimationParams {
const scale: number = Math.pow(scaleRatio, index);
const translateY: number = index * cardSpacing;
return {
translateX: 0,
translateY: translateY,
rotation: 0,
... | https://github.com/kumaleap/ArkSwipeDeck | cd966be13278c5c3474630fed70ffec371af2aed | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/SnoozeManager.ets | arkts | saveSnoozedAlarmData | Save Next Nap Timestamp
@param alarmId alarm id
@param nextAlertTime next Nap Timestamp | async saveSnoozedAlarmData(alarmId: string, nextAlertTime: number): Promise<void> {
const preferences = await this.getPreferences();
const snoozeIds = await preferences.get(SNOOZE_ID, '');
let snoozeArray: string[] = [];
if (snoozeIds) {
snoozeArray = snoozeIds.toString().split(SNOOZE_SEPARATOR)... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveSnoozedAlarmData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmId AST#identifier#Right AST#type_annotation#Left AST#... | async saveSnoozedAlarmData(alarmId: string, nextAlertTime: number): Promise<void> {
const preferences = await this.getPreferences();
const snoozeIds = await preferences.get(SNOOZE_ID, '');
let snoozeArray: string[] = [];
if (snoozeIds) {
snoozeArray = snoozeIds.toString().split(SNOOZE_SEPARATOR)... | https://gitee.com/openharmony-sig/applications_clock.git | 00be7a88f8a1ed6ce2ceacb54787df562bc704f9 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NativeJsEngine.ets | arkts | getNativeModuleError | 获取Native模块加载错误信息 | static getNativeModuleError(): string {
return nativeModuleLoadError;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNativeModuleError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left strin... | static getNativeModuleError(): string {
return nativeModuleLoadError;
} | https://github.com/DaLongZhuaZi/manxia | 44b57ecc120d004f9721fa77323dc819a81e12d2 | github |
honjow/Next2V | shared/src/main/ets/settings/CloudSyncSettings.ets | arkts | enabledTables | The local tables to mark/sync given the current feature selection (plus the always-on catch-all). | static enabledTables(): string[] {
return cloudSyncTablesForFeatures(CloudSyncSettings.enabledFeatureKeys())
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left enabledTables 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 string A... | static enabledTables(): string[] {
return cloudSyncTablesForFeatures(CloudSyncSettings.enabledFeatureKeys())
} | https://github.com/honjow/Next2V | 7aaf81360fbefc53c36840eb609b5ef97c067399 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/NotificationService.ets | arkts | getEmergencyNotifications | 获取紧急通知列表 | getEmergencyNotifications(): EmergencyNotification[] {
return Array.from(this.emergencyNotifications.values())
.sort((a: EmergencyNotification, b: EmergencyNotification) => b.timestamp - a.timestamp);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getEmergencyNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argu... | getEmergencyNotifications(): EmergencyNotification[] {
return Array.from(this.emergencyNotifications.values())
.sort((a: EmergencyNotification, b: EmergencyNotification) => b.timestamp - a.timestamp);
} | https://github.com/LJ666-ui/harmony-health-care | 0faf5af149b633075c0a4a943446d2bc310aedf3 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/SessionPlanner.ets | arkts | generateSessionSummary | 生成会话摘要 | generateSessionSummary(tasks: TaskItem[]): string {
const totalTasks = tasks.length;
const reinforcementTasks = tasks.filter((t: TaskItem): boolean => t.isReinforcement).length;
const estimatedTime = this.estimateSessionTime(tasks);
const distribution = this.getTaskDistribution(tasks);
let summar... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateSessionSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tasks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Ta... | generateSessionSummary(tasks: TaskItem[]): string {
const totalTasks = tasks.length;
const reinforcementTasks = tasks.filter((t: TaskItem): boolean => t.isReinforcement).length;
const estimatedTime = this.estimateSessionTime(tasks);
const distribution = this.getTaskDistribution(tasks);
let summar... | https://github.com/CLMC2025/Vignette | f29d69fdb9c73a45a0de6c3e1c5088cce3ca79b7 | github |
HarmonyOS_Codelabs/readerkit_codelab_arkts | entry/src/main/ets/pages/Reader.ets | arkts | registerScreenDensityChange | Register the screen density change callback. | registerScreenDensityChange() {
this.screenDensityCallBack = () => {
try {
let displaySync = display.getDefaultDisplaySync();
let scaledDensity = displaySync.scaledDensity;
if (scaledDensity !== this.readerSetting.scaledDensity) {
AppStorage.setOrCreate('isDensityChange', t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerScreenDensityChange 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#statem... | registerScreenDensityChange() {
this.screenDensityCallBack = () => {
try {
let displaySync = display.getDefaultDisplaySync();
let scaledDensity = displaySync.scaledDensity;
if (scaledDensity !== this.readerSetting.scaledDensity) {
AppStorage.setOrCreate('isDensityChange', t... | https://gitcode.com/HarmonyOS_Codelabs/readerkit_codelab_arkts | c36c9745e12cb15381e20eff3a869520061db8fe | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/store/AppStore.ets | arkts | toggleReminder | Action: 切换提醒状态 | public toggleReminder(id: string): void {
const updatedReminders: Reminder[] = [];
for (let i = 0; i < this.state.reminders.length; i++) {
const reminder = this.state.reminders[i];
if (reminder.id === id) {
const updatedReminder: Reminder = {
title: reminder.title,
time... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toggleReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | public toggleReminder(id: string): void {
const updatedReminders: Reminder[] = [];
for (let i = 0; i < this.state.reminders.length; i++) {
const reminder = this.state.reminders[i];
if (reminder.id === id) {
const updatedReminder: Reminder = {
title: reminder.title,
time... | https://github.com/LJ666-ui/harmony-health-care | 8ce38b6f3fad6ac9c6ef3f53d3fcc2e0fefb6f2c | github |
daugf2527/harmonyos-libretro-emulator | entry/src/main/ets/common/ErrorCodes.ets | arkts | findByNumericCode | 根据数值错误码查找错误定义 | static findByNumericCode(numericCode: number): ErrorCodeDefinition | undefined {
for (const definition of ALL_ERROR_CODE_DEFINITIONS) {
if (definition.numericCode === numericCode) {
return definition;
}
}
return undefined;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left findByNumericCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left numericCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | static findByNumericCode(numericCode: number): ErrorCodeDefinition | undefined {
for (const definition of ALL_ERROR_CODE_DEFINITIONS) {
if (definition.numericCode === numericCode) {
return definition;
}
}
return undefined;
} | https://github.com/daugf2527/harmonyos-libretro-emulator | 1f88eedb0c07d944f9c6e7fa5121a8e54ffb9c5e | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/common/ScheduleData.ets | arkts | deleteCourse | 删除指定位置的课程
@param dayIndex 周几
@param periodIndex 第几节 | static async deleteCourse(dayIndex: number, periodIndex: number): Promise<boolean> {
if (!ScheduleManager.context) return false;
try {
let allCourses = await ScheduleManager.getAllCourses();
const initialLength = allCourses.length;
// 过滤掉目标课程
allCourses = allCourses.filter(c =>
... | 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 deleteCourse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dayIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async deleteCourse(dayIndex: number, periodIndex: number): Promise<boolean> {
if (!ScheduleManager.context) return false;
try {
let allCourses = await ScheduleManager.getAllCourses();
const initialLength = allCourses.length;
// 过滤掉目标课程
allCourses = allCourses.filter(c =>
... | https://gitcode.com/openharmony/codelabs | c6e68db9bc95d9f2870e773cc24c89a1b8a2f3f5 | gitcode |
Joker-x-dev/HarmonyKit | core/data/src/main/ets/repository/AccountStoreRepository.ets | arkts | constructor | 构造函数
@param {common.Context} [context] UIAbility 上下文
@param {AccountStoreDataSource} [dataSource] 可选自定义数据源 | constructor(context?: common.Context, dataSource?: AccountStoreDataSource) {
this.dataSource = dataSource ?? new AccountStoreDataSourceImpl(context);
} | 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 context AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression... | constructor(context?: common.Context, dataSource?: AccountStoreDataSource) {
this.dataSource = dataSource ?? new AccountStoreDataSourceImpl(context);
} | https://github.com/Joker-x-dev/HarmonyKit | 8c7b6f60801cbc5b1c49d867222142ab6004408c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | sortEBookList | 对电子书列表进行排序 | private sortEBookList(list: EBook[]): EBook[] {
const sorted = list.slice();
switch (this.customShelfSortType) {
case 'name_asc':
return sorted.sort((a, b) => a.metadata.title.localeCompare(b.metadata.title, 'zh-CN'));
case 'name_desc':
return sorted.sort((a, b) => b.metadata.title... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sortEBookList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre... | private sortEBookList(list: EBook[]): EBook[] {
const sorted = list.slice();
switch (this.customShelfSortType) {
case 'name_asc':
return sorted.sort((a, b) => a.metadata.title.localeCompare(b.metadata.title, 'zh-CN'));
case 'name_desc':
return sorted.sort((a, b) => b.metadata.title... | https://github.com/DaLongZhuaZi/manxia | 2b40efb503d40966783daf62264a8d1cf868e2c2 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test48_original_index.ets | arkts | testSliceNegative | --- Slice with negative index --- | function testSliceNegative(): string {
let s: string = 'Hello, World!';
let last5: string = s.slice(-5);
let mid: string = s.slice(7, 12);
return last5 + ',' + mid;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSliceNegative AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testSliceNegative(): string {
let s: string = 'Hello, World!';
let last5: string = s.slice(-5);
let mid: string = s.slice(7, 12);
return last5 + ',' + mid;
} | https://github.com/miaochiahao/ark-ghidra | 1d1bf5258a883d1640a84b29a7e410d0243f25db | github |
openharmony-tpc/openharmony_tpc_samples | RxJS/entry/src/ohosTest/ets/test/spec/Subscriber-spec.test.ets | arkts | next | In here, we access instance state and alter it. | next(value: string) {
if (value === 'reset') {
this.valuesProcessed = [];
} else {
this.valuesProcessed.push(value);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left next 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#)#L... | next(value: string) {
if (value === 'reset') {
this.valuesProcessed = [];
} else {
this.valuesProcessed.push(value);
}
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 27c6157496571d4bea98361905a0c4d7574694bb | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | equals | Checks if two `Array` instances have the same content.
@param other `Array` instance to be compared with.
@returns `true` if `other` is `Array` instance, both `this` and `other` have
same `length()` and all elements are `equals()`, `false` otherwise. | public override equals(other: Object|null): boolean {
if (!(other instanceof Array)) {
return false;
}
let a = other as Array<Object>;
if (this.data.length != a.data.length) {
return false;
}
for (let i = 0; i < this.data.length; i++) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#... | public override equals(other: Object|null): boolean {
if (!(other instanceof Array)) {
return false;
}
let a = other as Array<Object>;
if (this.data.length != a.data.length) {
return false;
}
for (let i = 0; i < this.data.length; i++) {
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 48f2b4dbc881d81f55f2df66ae7ba17d21ebefde | gitee |
codelably/HCompass | core/network/src/main/ets/AxiosHttpClient.ets | arkts | put | PUT 请求
@param url 请求地址
@param data 请求体
@param options 请求选项
@returns 响应数据 | async put<T>(url: string, data?: Unknown, options?: RequestOptions): Promise<T> {
this.logRequest('PUT', url, options, data);
const response: AxiosResponse<T> = await this.axiosInstance.put<T>(url, data, {
headers: options?.headers,
timeout: options?.timeout,
params: options?.params
});
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left put AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_iden... | async put<T>(url: string, data?: Unknown, options?: RequestOptions): Promise<T> {
this.logRequest('PUT', url, options, data);
const response: AxiosResponse<T> = await this.axiosInstance.put<T>(url, data, {
headers: options?.headers,
timeout: options?.timeout,
params: options?.params
});
... | https://github.com/codelably/HCompass | 1dfeb1da880cbf2c6585220686f5b824fd07ab6b | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/SecurityToolkit.ets | arkts | aesEncrypt | AES-GCM 加密
@param plainText 明文
@param keyBase64 Base64 编码的 AES 密钥 (16 字节)
@param ivBase64 Base64 编码的 12 字节 IV;为空时自动生成
@returns Base64 编码的 (IV + 密文 + authTag) | async aesEncrypt(plainText: string, keyBase64: string, ivBase64: string): Promise<NGFEncryptResult> {
try {
const ivBytes: Uint8Array = ivBase64.length > 0
? this.base64ToUint8Array(ivBase64)
: this.generateRandomBytes(12);
const keyBlob: cryptoFramework.DataBlob = { data: this.base64T... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left aesEncrypt AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left plainText AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async aesEncrypt(plainText: string, keyBase64: string, ivBase64: string): Promise<NGFEncryptResult> {
try {
const ivBytes: Uint8Array = ivBase64.length > 0
? this.base64ToUint8Array(ivBase64)
: this.generateRandomBytes(12);
const keyBlob: cryptoFramework.DataBlob = { data: this.base64T... | https://github.com/DaLongZhuaZi/NGF | ff985bd9930500ed5243377d22be5f1528fe79ba | github |
arkui-x/xts | commonlibrary/crossplatform/codeparsingtest/entry/src/ohosTest/ets/test/weaktest/weaktest.test.ets | arkts | constructor | 1. 先在类中声明字段 | constructor(description: string) { // 2. 构造函数参数不加修饰符
this.description = description; // 3. 在构造函数体内赋值
} | 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 description AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS... | constructor(description: string) { // 2. 构造函数参数不加修饰符
this.description = description; // 3. 在构造函数体内赋值
} | https://gitcode.com/arkui-x/xts | 6209546259475e935a5e1656139a41bb3e9a29c1 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | requestLogout | 触发退出登录弹窗
@returns {void} 无返回值 | requestLogout(): void {
this.showLogoutDialog = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left requestLogout 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... | requestLogout(): void {
this.showLogoutDialog = true;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 004f6540924137bc7cc96000601c621c155d158d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | getAvailableNovelSources | 获取可用的小说书源列表 | getAvailableNovelSources(): NovelSourceInfo[] {
try {
return this.novelSourceManager.getEnabledSources().filter((source: NovelSourceInfo): boolean => {
return source.searchable && source.bookSourceType !== LegadoBookSourceType.IMAGE;
});
} catch (error) {
logger.error(TAG, `获取小说书源失败:... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAvailableNovelSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#L... | getAvailableNovelSources(): NovelSourceInfo[] {
try {
return this.novelSourceManager.getEnabledSources().filter((source: NovelSourceInfo): boolean => {
return source.searchable && source.bookSourceType !== LegadoBookSourceType.IMAGE;
});
} catch (error) {
logger.error(TAG, `获取小说书源失败:... | https://github.com/DaLongZhuaZi/manxia | 123c89d9950c4a297ff3a44a6254013b186578c0 | github |
PollenWang6/HiXD | entry/src/main/ets/services/AttendanceService.ets | arkts | getAttendanceRecords | ===== 主方法:获取考勤数据 ===== | async getAttendanceRecords(): Promise<ClassAttendance[]> {
try {
await this.ensureLogin();
console.info(TAG, 'getAttendanceRecords: fetching course list');
const infoResp: HttpResponse = await this.http.get(COURSE_INFO_URL);
console.info(TAG, 'getAttendanceRecords: infoResp status=' + Str... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAttendanceRecords 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... | async getAttendanceRecords(): Promise<ClassAttendance[]> {
try {
await this.ensureLogin();
console.info(TAG, 'getAttendanceRecords: fetching course list');
const infoResp: HttpResponse = await this.http.get(COURSE_INFO_URL);
console.info(TAG, 'getAttendanceRecords: infoResp status=' + Str... | https://github.com/PollenWang6/HiXD | 598273683ee05fb3106f62e50f22ddebcb1948c8 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | prepare | 加载本地沙箱内的rawfile资源
@param fileName 本地沙箱内的rawfile资源文件名
@param finishTask prepare完成时的任务,例如:prepare完成后直接启动播放
@returns {Promise<void>} | async prepare(fileName: string, finishTask?: Function): Promise<void> {
if (!this.avPlayer) {
logger.error('avPlayer no create.');
return;
}
// 通过UIAbilityContext的resourceManager成员的getRawFd接口获取媒体资源播放地址
const context = getContext(this) as common.UIAbilityContext;
// 返回类型为{fd,offset,len... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left prepare AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileName AST#identifier#Right AST#typ... | async prepare(fileName: string, finishTask?: Function): Promise<void> {
if (!this.avPlayer) {
logger.error('avPlayer no create.');
return;
}
// 通过UIAbilityContext的resourceManager成员的getRawFd接口获取媒体资源播放地址
const context = getContext(this) as common.UIAbilityContext;
// 返回类型为{fd,offset,len... | https://gitcode.com/arkui-x/samples | 08072707bc7f97a7bcdbfc7edef761d4e9c88afc | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceVerifier.ets | arkts | chunkArray | ─── 私有工具方法 ─────────────────────────────────────────────────────────── | private static chunkArray<T>(arr: T[], size: number): T[][] {
const chunks: T[][] = [];
for (let i = 0; i < arr.length; i += size) {
chunks.push(arr.slice(i, i + size));
}
return chunks;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left chunkArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Rig... | private static chunkArray<T>(arr: T[], size: number): T[][] {
const chunks: T[][] = [];
for (let i = 0; i < arr.length; i += size) {
chunks.push(arr.slice(i, i + size));
}
return chunks;
} | https://github.com/DaLongZhuaZi/manxia | 2b765de12281dd7b28e559fe2443c92d5b679516 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | installPluginPackage | 安装插件包 | private async installPluginPackage(pluginId: string, packageData: ArrayBuffer): Promise<void> {
// 模拟安装插件包的逻辑
// 实际实现需要解压HSP包并安装到系统中
logger.debug(TAG, `安装插件包: ${pluginId}`);
} | 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 installPluginPackage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pluginId AST#identifier#Right AST#ERROR#Left AS... | private async installPluginPackage(pluginId: string, packageData: ArrayBuffer): Promise<void> {
// 模拟安装插件包的逻辑
// 实际实现需要解压HSP包并安装到系统中
logger.debug(TAG, `安装插件包: ${pluginId}`);
} | https://github.com/DaLongZhuaZi/manxia | bb57f028052bd5d370a25d1997b207082afd67d9 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/components/RemoteModifierPanel.ets | arkts | build | ============================================================
构建 — 主面板 (紧凑)
============================================================ | build() {
Column() {
// 主面板
if (this.visible) {
Column() {
// 标题栏
Row() {
this.PanelDragArea('修饰键', false)
Text('✕')
.fontSize(13)
.fontColor('rgba(255,255,255,0.4)')
.padding({ left: 10, right: 2, top: 2, bottom: 2 })
... | 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#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
// 主面板
if (this.visible) {
Column() {
// 标题栏
Row() {
this.PanelDragArea('修饰键', false)
Text('✕')
.fontSize(13)
.fontColor('rgba(255,255,255,0.4)')
.padding({ left: 10, right: 2, top: 2, bottom: 2 })
... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 923aae96caeb593ec7b44b877a0c0f9d2aa89697 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/TerminalManager.ets | arkts | mapUserTypeToRole | 映射用户类型到角色
@param userType 用户类型(数字) | private mapUserTypeToRole(userType: number): UserRole {
switch (userType) {
case 0:
return UserRole.PATIENT;
case 1:
return UserRole.DOCTOR;
case 2:
return UserRole.NURSE;
case 3:
return UserRole.FAMILY;
case 4:
return UserRole.ADMIN;
def... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapUserTypeToRole AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | private mapUserTypeToRole(userType: number): UserRole {
switch (userType) {
case 0:
return UserRole.PATIENT;
case 1:
return UserRole.DOCTOR;
case 2:
return UserRole.NURSE;
case 3:
return UserRole.FAMILY;
case 4:
return UserRole.ADMIN;
def... | https://github.com/LJ666-ui/harmony-health-care | 77f0389cafd1a16d361400003204ebc2b3fb3713 | github |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/CustomCalendar.ets | arkts | initDay | 显示的日历列表
初始化时间, 需要显示初始化日历的年月,格式:y-M | initDay(day:Date){
this.today = this.formatDate(new Date(),'y-M-d');
if(!day){
day = this.today;
}
console.log('传入的当前年月:'+day)
console.log('获取今天的时间:'+this.today)
this.getCld(day);
this.isSelectDay=this.today;
console.log(this.isSelectDay)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left day AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date AST#identifier#Right AST#)#Le... | initDay(day:Date){
this.today = this.formatDate(new Date(),'y-M-d');
if(!day){
day = this.today;
}
console.log('传入的当前年月:'+day)
console.log('获取今天的时间:'+this.today)
this.getCld(day);
this.isSelectDay=this.today;
console.log(this.isSelectDay)
} | https://gitee.com/openharmony-sig/ohos_easyui.git | a589a1ac566a905d58321553c3a6ed9c58d438f3 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets | arkts | tickServer | 服务端模式:上报指标,执行服务端指令 | private async tickServer(stats: StreamStats): Promise<void> {
const now = Date.now();
const systemQos = this.getFreshSystemQos();
const systemScene = this.getFreshSystemScene();
const feedback: NetworkFeedback = {
packetLoss: stats.packetLoss,
rttMs: stats.networkLatency > 0 ? stats.networ... | 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 tickServer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stats AST#identifier#Right AST#:#Left : AS... | private async tickServer(stats: StreamStats): Promise<void> {
const now = Date.now();
const systemQos = this.getFreshSystemQos();
const systemScene = this.getFreshSystemScene();
const feedback: NetworkFeedback = {
packetLoss: stats.packetLoss,
rttMs: stats.networkLatency > 0 ? stats.networ... | https://github.com/AlkaidLab/moonlight-harmony | 2916d245bd12f7398d4bd8cc7cd50e7a5cb3cf3d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | setButtonFlag | 设置按钮状态标志
@param buttonFlag 按钮标志位
@param data 如果非零则设置,否则清除 | protected setButtonFlag(buttonFlag: number, data: number): void {
if (data !== 0) {
this.buttonFlags |= buttonFlag;
} else {
this.buttonFlags &= ~buttonFlag;
}
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left setButtonFlag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buttonFlag AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | protected setButtonFlag(buttonFlag: number, data: number): void {
if (data !== 0) {
this.buttonFlags |= buttonFlag;
} else {
this.buttonFlags &= ~buttonFlag;
}
} | https://github.com/AlkaidLab/moonlight-harmony | 0f12f2b31163895f784979c86948ecd64854d739 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Atomics.ets | arkts | notify | Operates exactly like Atomics.notify(Int32Array, int) but specifies the maximum number of threads to notify using 'count'. | public static notify(typedArray: Int32Array, offset: int, count: int): int {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int32Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let buffer = typedArray.buffer
if (buffer instanceof ArrayBuffer) {
retu... | 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 notify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typedArray AST#identifier#Right AST#:#Left : AST... | public static notify(typedArray: Int32Array, offset: int, count: int): int {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int32Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let buffer = typedArray.buffer
if (buffer instanceof ArrayBuffer) {
retu... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 878f3aaf1ac224cbd0a354041fbea477aaac4eb0 | gitee |
OHPG/FinMusic | entry/src/main/ets/prefer/AppPrefer.ets | arkts | isLyricCacheEnabled | ─── 歌词缓存相关 ───────────────────────────────────────────────────────── | public isLyricCacheEnabled(): boolean {
return this.preference.getSync(AppPrefer.KEY_LYRIC_CACHE_ENABLED, true) as boolean
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLyricCacheEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boole... | public isLyricCacheEnabled(): boolean {
return this.preference.getSync(AppPrefer.KEY_LYRIC_CACHE_ENABLED, true) as boolean
} | https://github.com/OHPG/FinMusic | a05ebe61e3a9df201f351164c3a330301214fefe | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | PrepareWriteLock | Computes the new state when a writer attempts to acquire the lock.
Increments the writer count and, if there is no read lock, sets WRITE_LOCKED.
@param { long } state Current lock state
@returns { long } Updated state with writer count and lock state encoded
@throws { RangeError } If the writer count would overflow the... | public static PrepareWriteLock(state: long): long {
return State.IncWriters(state) | (State.HasReadLock(state) ? 0 : State.WRITE_LOCKED);
} | 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 PrepareWriteLock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public static PrepareWriteLock(state: long): long {
return State.IncWriters(state) | (State.HasReadLock(state) ? 0 : State.WRITE_LOCKED);
} | https://gitcode.com/iop123123/arkts-static-skills | e285f08ca22abf02a05efeb0835179e4b461b231 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | setFontSize | 设置字体大小 | setFontSize(size: PanelFontSize): void {
this.fontSize = size;
this.notifyCallback();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PanelFontSize AST#identifier#Right AST#)#Lef... | setFontSize(size: PanelFontSize): void {
this.fontSize = size;
this.notifyCallback();
} | https://github.com/DaLongZhuaZi/manxia | e49f093c468d854f22893f22d6ebb2ff6fbfa04b | github |
HarmonyOS_Codelabs/arkts-basic-syntax-demo | entry/src/main/ets/pages/BasicPage.ets | arkts | showWhileStatements | while语句 | function showWhileStatements() {
let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi'];
let index = 0; // 初始化索引
// 循环条件:index小于数组长度
while (index < students.length) {
console.log(students[index]); // 打印学生信息
index++; // 索引自增(关键! 否则会无限循环)
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left showWhileStatements AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical... | function showWhileStatements() {
let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi'];
let index = 0; // 初始化索引
// 循环条件:index小于数组长度
while (index < students.length) {
console.log(students[index]); // 打印学生信息
index++; // 索引自增(关键! 否则会无限循环)
}
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo | e46e11e879186b01eb61ee7629b2c172c36fb908 | gitcode |
Joker-x-dev/CoolMallArkTS | core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets | arkts | onRequestError | 请求失败回调
@returns {void} 无返回值 | protected onRequestError(): void {
this.setErrorState();
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left onRequestError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | protected onRequestError(): void {
this.setErrorState();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 401d12e39ca3b50ff0751480c680505b34526ed8 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | getMonthlyRecognitionCount | 统计按月识别次数 | static async getMonthlyRecognitionCount(
userId: number,
year: number,
month: number
): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
// 构造月份的开始和结束日期
const monthStr = month < 10 ? '0' + month.toString() : month.toString();
const startDate = `${year}-${... | 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 getMonthlyRecognitionCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right A... | static async getMonthlyRecognitionCount(
userId: number,
year: number,
month: number
): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
// 构造月份的开始和结束日期
const monthStr = month < 10 ? '0' + month.toString() : month.toString();
const startDate = `${year}-${... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7eb7fd8b3b7319be75ab070fbc4c893c2febfa5c | github |
arkui-x/samples | CodeLab/Cases/feature/diggingholescreen/src/main/ets/components/mainpage/DiggingHoleScreen.ets | arkts | getBoundingRectPosition | TODO 知识点:通过获取到的屏幕属性和屏幕不可用区域来判断不可用区域位置
1.getCutoutInfo接口获取到不可用区域的左边界、上边界、宽度、高度。
2.不可用区域左边宽度即为左边界的值。
3.不可用区域右边界宽度等于屏幕宽度减去不可用区域宽度和左边界。
4.获取到不可用区域到左右屏幕边缘的宽度进行对比判断出不可用区域位置。
5.不可用区域位于中间时,不同设备左右距离可能存在小于10的差值,判断是否在中间取去左右距离差值的绝对值进行判断。
@returns left:左偏移量 right:右偏移量 | getBoundingRectPosition(): TextMargin {
if (this.boundingRect !== null && this.displayClass !== null && this.boundingRect[0] !== undefined) {
// 不可用区域右侧到屏幕右边界的距离:屏幕宽度减去左侧宽度和不可用区域宽度
const boundingRectRight: number = this.displayClass.width - (this.boundingRect[0].left + this.boundingRect[0].width);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBoundingRectPosition 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 TextMargin AST#identifier#Right AST#ER... | getBoundingRectPosition(): TextMargin {
if (this.boundingRect !== null && this.displayClass !== null && this.boundingRect[0] !== undefined) {
// 不可用区域右侧到屏幕右边界的距离:屏幕宽度减去左侧宽度和不可用区域宽度
const boundingRectRight: number = this.displayClass.width - (this.boundingRect[0].left + this.boundingRect[0].width);
... | https://gitcode.com/arkui-x/samples | 6e1d925ac42698473d778254cd2f7aa04ec0d89f | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | getCookieString | 获取Cookie字符串 | getCookieString(sourceId: string): string {
// 调试:输出所有已保存的Cookie keys
const allKeys: string[] = [];
this.cookies.forEach((_, key) => allKeys.push(key));
logger.debug(TAG, `getCookieString: 查找=${sourceId}, 已保存的keys=[${allKeys.join(', ')}], initialized=${this.initialized}`);
const candidateIds = th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCookieString 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... | getCookieString(sourceId: string): string {
// 调试:输出所有已保存的Cookie keys
const allKeys: string[] = [];
this.cookies.forEach((_, key) => allKeys.push(key));
logger.debug(TAG, `getCookieString: 查找=${sourceId}, 已保存的keys=[${allKeys.join(', ')}], initialized=${this.initialized}`);
const candidateIds = th... | https://github.com/DaLongZhuaZi/manxia | c26538ca6f587a5b7aa7a8b43058e80c45b22631 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | listDir | 获取目录内容
@param path 路径
@returns 文件信息列表
@throws 如果获取失败则抛出异常 | public listDir(path: string): Promise<FileInfo[]> {
return this.decoratedStorage.listDir(path);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left listDir 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#Left string A... | public listDir(path: string): Promise<FileInfo[]> {
return this.decoratedStorage.listDir(path);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L191-L193 | 4064875b6a5e53f48f53eb2e0a12829386067af7 | github |
openharmony/codelabs | ETSUI/ChatAppDemo/entry/src/main/ets/utils/DatabaseManager.ets | arkts | prePopulateChatData | 这里的 mock 数据逻辑需要适配 owner 字段,根据当前用户填充 | private async prePopulateChatData() {
if (!this.chat) {
return;
}
// 此时不知道 owner 是谁,由业务层根据登录用户调用填充
} | 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 prePopulateChatData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async prePopulateChatData() {
if (!this.chat) {
return;
}
// 此时不知道 owner 是谁,由业务层根据登录用户调用填充
} | https://gitcode.com/openharmony/codelabs | 9308b46de64a069dbbf699de1645882ecca6c58e | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/ListDemo6.ets | arkts | notifyDataReload | 通知 LazyForEach 组件,需要重载所有 item | notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDatasetChange([{type: DataOperationType.RELOAD}]);
// 上面的相当于下面的,但是在一个 IDataSource 内,onDatasetChange 和 onDataXXX 不能混用,否则可能会报错 Error: onDatasetChange cannot be used with other interface
// listener.onDataReloaded();
})
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataReload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDatasetChange([{type: DataOperationType.RELOAD}]);
// 上面的相当于下面的,但是在一个 IDataSource 内,onDatasetChange 和 onDataXXX 不能混用,否则可能会报错 Error: onDatasetChange cannot be used with other interface
// listener.onDataReloaded();
})
... | https://github.com/webabcd/HarmonyDemo | 784aecca7f5babbac2bbdf7933c30a194616de19 | github |
xblLab/HarmonyProjectTemplate | commons/lib_api/src/main/ets/services/MineService.ets | arkts | cancelMark | 取消收藏
@param label | public cancelMark(label: string) {
const mineUserInfo = this.queryAuthorRaw() as MyAuthor;
const index = mineUserInfo?.myMarks.findIndex(id => id === label);
if (index !== -1) {
mineUserInfo?.myMarks.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cancelMark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | public cancelMark(label: string) {
const mineUserInfo = this.queryAuthorRaw() as MyAuthor;
const index = mineUserInfo?.myMarks.findIndex(id => id === label);
if (index !== -1) {
mineUserInfo?.myMarks.splice(index, 1);
}
} | https://github.com/xblLab/HarmonyProjectTemplate | b37f024252c1f3fb6f8060a9162b48851faa5b76 | github |
erosTeam/NextE | feature/user/src/main/ets/viewmodel/FavoritesViewModel.ets | arkts | toggleOrder | Toggle favorited-time ↔ posted-time order and reload from page 1. | async toggleOrder(): Promise<void> {
if (this.isLoading || this.isLocalFavcat()) {
return
}
this.favOrder =
this.favOrder === EhConstants.FAV_ORDER_FAV
? EhConstants.FAV_ORDER_POSTED
: EhConstants.FAV_ORDER_FAV
await this.load()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left toggleOrder 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 toggleOrder(): Promise<void> {
if (this.isLoading || this.isLocalFavcat()) {
return
}
this.favOrder =
this.favOrder === EhConstants.FAV_ORDER_FAV
? EhConstants.FAV_ORDER_POSTED
: EhConstants.FAV_ORDER_FAV
await this.load()
} | https://github.com/erosTeam/NextE | 487b3fc1166c0e7aa6b4634d8a94381637efbcac | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ViewModelMapper.ets | arkts | toViewModelArray | 批量转换 EntityData 数组为 ViewModel 数组
@param entityDataArray EntityData 数组
@param factory ViewModel 工厂函数
@param mapper 属性映射回调
@returns ViewModel 数组 | static toViewModelArray<T>(
entityDataArray: Array<EntityData>,
factory: ViewModelFactory<T>,
mapper: PropertyMapper<T>
): Array<T> {
const result: Array<T> = []
for (let i = 0; i < entityDataArray.length; i++) {
result.push(ViewModelMapper.toViewModel(entityDataArray[i], factory, mapper))... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left toViewModelArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AS... | static toViewModelArray<T>(
entityDataArray: Array<EntityData>,
factory: ViewModelFactory<T>,
mapper: PropertyMapper<T>
): Array<T> {
const result: Array<T> = []
for (let i = 0; i < entityDataArray.length; i++) {
result.push(ViewModelMapper.toViewModel(entityDataArray[i], factory, mapper))... | https://github.com/offlinecat-dev/OCNetORM | 77de4704c339cdb745d4521f425029b9d6c4c791 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets | arkts | getSourceIconPath | 获取图源图标路径
@param pkg 图源包名
@returns 图标文件路径,如果不存在返回 null | getSourceIconPath(pkg: string): string | null {
const ngfIconPath = ngfSourceLoaderFacade.loadIconPath(pkg);
if (ngfIconPath.length > 0) {
return ngfIconPath;
}
// 检查 repositoryDir 是否已初始化
if (!this.repositoryDir || this.repositoryDir.trim() === '') {
logger.warn(TAG, `getSourceIconPat... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSourceIconPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pkg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | getSourceIconPath(pkg: string): string | null {
const ngfIconPath = ngfSourceLoaderFacade.loadIconPath(pkg);
if (ngfIconPath.length > 0) {
return ngfIconPath;
}
// 检查 repositoryDir 是否已初始化
if (!this.repositoryDir || this.repositoryDir.trim() === '') {
logger.warn(TAG, `getSourceIconPat... | https://github.com/DaLongZhuaZi/manxia | 73bfd0e38a4a31256f34edd16e69fefe21539c1d | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | onBLEDeviceFind | 订阅查找蓝牙设备 | private onBLEDeviceFind() {
try {
ble.on('BLEDeviceFind', (arr: Array<ble.ScanResult>) => {
Log.showInfo(TAG, `onBLEDeviceFind: BLEDeviceFind arr.length = ${arr.length}, arr = ${JSON.stringify(arr)}`);
let deviceId: string = arr[0].deviceId;
let device = this.mAvailableDevices.find(... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onBLEDeviceFind AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#L... | private onBLEDeviceFind() {
try {
ble.on('BLEDeviceFind', (arr: Array<ble.ScanResult>) => {
Log.showInfo(TAG, `onBLEDeviceFind: BLEDeviceFind arr.length = ${arr.length}, arr = ${JSON.stringify(arr)}`);
let deviceId: string = arr[0].deviceId;
let device = this.mAvailableDevices.find(... | https://gitcode.com/arkui-x/samples | 0f901d2b74d5dd0fad10fa694dfd872cb81e3c59 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets | arkts | getLeaveDetail | 获取请假详情
@param leaveId 请假ID | async getLeaveDetail(leaveId: string): Promise<ApiResponse<LeaveRecord>> {
return this.client.get<LeaveRecord>(`/api/v1/attendance/leave/${leaveId}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLeaveDetail AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left leaveId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getLeaveDetail(leaveId: string): Promise<ApiResponse<LeaveRecord>> {
return this.client.get<LeaveRecord>(`/api/v1/attendance/leave/${leaveId}`)
} | https://github.com/David8Idira/AI-OA | 855d48fb9ebf3c43bb2bdffc4193b0e3c011af37 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | stopAlarm | 停止提醒,并根据重复模式更新闹钟状态
@param alarmInfo 闹钟对象 | async stopAlarm(alarmInfo: AlarmInfo): Promise<void> {
alarmInfo.enabled = (alarmInfo.daysOfWeek || []).length !== 0 || alarmInfo.daysOfWakeType === 4;
// 重复模式为“不重复时”,同时关闭闹钟
await this.updateAlarm(alarmInfo)
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left stopAlarm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#type_annotation#Left AST#... | async stopAlarm(alarmInfo: AlarmInfo): Promise<void> {
alarmInfo.enabled = (alarmInfo.daysOfWeek || []).length !== 0 || alarmInfo.daysOfWakeType === 4;
// 重复模式为“不重复时”,同时关闭闹钟
await this.updateAlarm(alarmInfo)
} | https://gitee.com/openharmony-sig/applications_clock.git | 10c2e7b2edc9c0bbf5921a56d8aaa2d569b9557b | gitee |
openharmony/codelabs | ETSUI/LifeBalance/entry/src/main/ets/pages/MainPage.ets | arkts | getBMIStatus | --- 辅助显示 --- | getBMIStatus(): string {
if (this.bmi < 18.5) {
return '偏瘦'
}
if (this.bmi < 24) {
return '正常'
}
if (this.bmi < 28) {
return '超重'
}
return '肥胖'
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBMIStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement... | getBMIStatus(): string {
if (this.bmi < 18.5) {
return '偏瘦'
}
if (this.bmi < 24) {
return '正常'
}
if (this.bmi < 28) {
return '超重'
}
return '肥胖'
} | https://gitcode.com/openharmony/codelabs | 64ac5bac4634d0f8cb13a6a80d5b52eb6325ea6f | gitcode |
openharmony-sig/FastBle | library/src/main/ets/BleManager.ets | arkts | write | write
@param bleDevice
@param uuid_service
@param uuid_write
@param data
@param split
@param sendNextWhenLastSuccess
@param intervalBetweenTwoPackage
@param callback | public write(bleDevice: BleDevice, uuid_service: string, uuid_write: string, data: Uint8Array | null, split: boolean = true, sendNextWhenLastSuccess: boolean = true, intervalBetweenTwoPackage: number = 0, callback: BleWriteCallback) {
if (callback == null) {
throw new Error("BleWriteCallback can not be Null... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left write AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bleDevice AST#identifier#Right AST#:#Left :... | public write(bleDevice: BleDevice, uuid_service: string, uuid_write: string, data: Uint8Array | null, split: boolean = true, sendNextWhenLastSuccess: boolean = true, intervalBetweenTwoPackage: number = 0, callback: BleWriteCallback) {
if (callback == null) {
throw new Error("BleWriteCallback can not be Null... | https://gitee.com/openharmony-sig/FastBle.git | ee427d38cea743b42dc00df2155838a85e9643ce | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/MdnsDiscovery.ets | arkts | setOnComputerFoundListener | 设置计算机发现回调 | setOnComputerFoundListener(callback: (computer: DiscoveredComputer) => void): void {
this.onComputerFound = callback;
} | AST#program#Left AST#ERROR#Left AST#identifier#Left setOnComputerFoundListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#i... | setOnComputerFoundListener(callback: (computer: DiscoveredComputer) => void): void {
this.onComputerFound = callback;
} | https://github.com/AlkaidLab/moonlight-harmony | b5135148944218dc81f93625fc8e1a6b1782e72f | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/TimeUtil.ets | arkts | getDaysToNextAlarm | Gets the number of days until the next alarm
@param daysOfWeek Days-of-week information for repetition
@param nearWeekDay The nearest day of week that the alarm may ring
@return The number of days until the next alarm | static getDaysToNextAlarm(daysOfWeek: number[], nearWeekDay: number): number {
let dayCount = 0;
for (; dayCount < DAYS_OF_WEEK_COUNT; dayCount++) {
const day = (nearWeekDay + dayCount) % DAYS_OF_WEEK_COUNT;
if (daysOfWeek.some(item => item === day)) {
break;
}
}
return dayCo... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDaysToNextAlarm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left daysOfWeek AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | static getDaysToNextAlarm(daysOfWeek: number[], nearWeekDay: number): number {
let dayCount = 0;
for (; dayCount < DAYS_OF_WEEK_COUNT; dayCount++) {
const day = (nearWeekDay + dayCount) % DAYS_OF_WEEK_COUNT;
if (daysOfWeek.some(item => item === day)) {
break;
}
}
return dayCo... | https://gitee.com/openharmony-sig/applications_clock.git | 0800cff61ecfa93fa8d4793832cedf52ad7fd828 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/addition/addition_char.ets | arkts | main | ---
desc: check addition of two chars
--- | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a + b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a + b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e120db2d272ee72fe77f62184d91f1daf656e91b | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamLifecycleManager.ets | arkts | showLatencyToastIfEnabled | ==================== 延迟统计 ====================
串流结束后显示延迟统计 Toast
对齐 Android: Game.connectionTerminated() 中 enableLatencyToast 逻辑 | showLatencyToastIfEnabled(): void {
console.info(`[StreamPage] showLatencyToast: enabled=${this.latencyToastEnabled}`);
if (!this.latencyToastEnabled) {
return;
}
// 使用 getSummaryStats 获取有效数据(断连后 native 数据可能已清零)
const session = this.viewModel?.getSession();
const stats = session ? sessi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showLatencyToastIfEnabled 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... | showLatencyToastIfEnabled(): void {
console.info(`[StreamPage] showLatencyToast: enabled=${this.latencyToastEnabled}`);
if (!this.latencyToastEnabled) {
return;
}
// 使用 getSummaryStats 获取有效数据(断连后 native 数据可能已清零)
const session = this.viewModel?.getSession();
const stats = session ? sessi... | https://github.com/AlkaidLab/moonlight-harmony | 3832ebaac2872654d1839058498e7c2160751133 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | createNovelTables | 创建小说相关表 | private async createNovelTables(): Promise<void> {
const store = this.getStore();
const tables: TableInfo[] = [
{ name: 'novel_source', sql: NOVEL_CREATE_TABLE_SQL.NOVEL_SOURCE } as TableInfo,
{ name: 'novel_book', sql: NOVEL_CREATE_TABLE_SQL.NOVEL_BOOK } as TableInfo,
{ name: 'novel_chapter... | 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 createNovelTables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async createNovelTables(): Promise<void> {
const store = this.getStore();
const tables: TableInfo[] = [
{ name: 'novel_source', sql: NOVEL_CREATE_TABLE_SQL.NOVEL_SOURCE } as TableInfo,
{ name: 'novel_book', sql: NOVEL_CREATE_TABLE_SQL.NOVEL_BOOK } as TableInfo,
{ name: 'novel_chapter... | https://github.com/DaLongZhuaZi/manxia | a357df1e8666da18ade3d44ae81a4ac3474dceb1 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test37_original_index.ets | arkts | testNumberFormat | --- Number formatting chain --- | function testNumberFormat(): string {
let n: number = 3.14159265;
let fixed2: string = n.toFixed(2);
let fixed4: string = n.toFixed(4);
let precision: string = n.toPrecision(4);
let hex: string = (255).toString(16);
let bin: string = (8).toString(2);
return fixed2 + ',' + fixed4 + ',' + precision + ',' + ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNumberFormat AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testNumberFormat(): string {
let n: number = 3.14159265;
let fixed2: string = n.toFixed(2);
let fixed4: string = n.toFixed(4);
let precision: string = n.toPrecision(4);
let hex: string = (255).toString(16);
let bin: string = (8).toString(2);
return fixed2 + ',' + fixed4 + ',' + precision + ',' + ... | https://github.com/miaochiahao/ark-ghidra | 69f5a53c0ba9676e96bcf5aee7bc180b21729ea1 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SeasonalityDetectionService.ets | arkts | evaluateCV | 评估变异系数得分 | private static evaluateCV(cv: number, threshold: number): number {
if (cv < threshold) {
return 0; // 变异太小,无季节性
}
// CV越大,季节性越明显
// 使用sigmoid函数映射到0-1
const normalized = cv / threshold;
const score = 1 / (1 + Math.exp(-5 * (normalized - 1)));
return Math.min(score, 1);
} | 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 evaluateCV AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cv AST#identifier#Right AST#:#Left : AST#... | private static evaluateCV(cv: number, threshold: number): number {
if (cv < threshold) {
return 0; // 变异太小,无季节性
}
// CV越大,季节性越明显
// 使用sigmoid函数映射到0-1
const normalized = cv / threshold;
const score = 1 / (1 + Math.exp(-5 * (normalized - 1)));
return Math.min(score, 1);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b430e631981cb01f78a1b21ef81c16deeb16af6d | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | sendMessage | 发送消息并获取 AI 回复 | async sendMessage(
content: string,
providerId: string,
providerType: ProviderType,
apiStyle: ApiStyle,
apiKey: string,
baseUrl: string,
modelId: string,
modelName: string,
messages: ChatMessage[],
onUserMessageAdded: (message: ChatMessage) => void,
onAIMessageAdded: (messa... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async sendMessage(
content: string,
providerId: string,
providerType: ProviderType,
apiStyle: ApiStyle,
apiKey: string,
baseUrl: string,
modelId: string,
modelName: string,
messages: ChatMessage[],
onUserMessageAdded: (message: ChatMessage) => void,
onAIMessageAdded: (messa... | https://github.com/LongLiveY96/chatcube | e5e5e84068336ab35371943a96bf4eeb47ac2db5 | github |
webabcd/HarmonyDemo | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageWillDestroy | UIAbility 的窗口销毁之前 | onWindowStageWillDestroy(windowStage: window.WindowStage) {
MyLog.d('ability onWindowStageWillDestroy');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageWillDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Lef... | onWindowStageWillDestroy(windowStage: window.WindowStage) {
MyLog.d('ability onWindowStageWillDestroy');
} | https://github.com/webabcd/HarmonyDemo | b5ca51153b36f6ac2cca67d9614d551acae5cdb6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | set | Sets the short value wrapped in this ShortBox.
@param { short } value - The new short value to set
@returns { short } The newly set short value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(value: short): short {
return (this.value = value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(value: short): short {
return (this.value = value);
} | https://gitcode.com/iop123123/arkts-static-skills | a9f01f453ea4c52adc2c0502535ff9c6c125ee8b | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test11_original_index.ets | arkts | testArrayFromMap | --- Array.from with mapping --- | function testArrayFromMap(): string {
let nums: number[] = [1, 2, 3];
let strs: string[] = [];
for (let i: number = 0; i < nums.length; i++) {
strs.push('n' + String(nums[i]));
}
return strs.join(',');
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayFromMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testArrayFromMap(): string {
let nums: number[] = [1, 2, 3];
let strs: string[] = [];
for (let i: number = 0; i < nums.length; i++) {
strs.push('n' + String(nums[i]));
}
return strs.join(',');
} | https://github.com/miaochiahao/ark-ghidra | b230b87b56c0103e0981e6f9653ee6ab8a654348 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | getLastNavDestinationId | 获取当前路由栈的栈顶页面DestinationId
@returns | public static getLastNavDestinationId(): string | undefined {
return ZRouter.getRouterMgr().getLastNavDestinationId()
} | 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 getLastNavDestinationId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | public static getLastNavDestinationId(): string | undefined {
return ZRouter.getRouterMgr().getLastNavDestinationId()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L269-L271 | 83d3b3b5c0b0084229793565dd7f4d112b67ca18 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | parseData | 解析数据为按键列表(兼容 v3 管道格式、v2 JSON、v1 JSON) | private static parseData(data: string): [string, CustomKeyDef[]] | null {
// v3 管道格式:首行为 "3"
if (data.startsWith('3\n')) {
return deserializeV3(data);
}
// v1/v2 JSON 格式
try {
const raw = JSON.parse(data) as Record<string, Object>;
const version = raw['v'] as number ?? 1;
c... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left parseData AST#identifier#Right AST#arguments#Left... | private static parseData(data: string): [string, CustomKeyDef[]] | null {
// v3 管道格式:首行为 "3"
if (data.startsWith('3\n')) {
return deserializeV3(data);
}
// v1/v2 JSON 格式
try {
const raw = JSON.parse(data) as Record<string, Object>;
const version = raw['v'] as number ?? 1;
c... | https://github.com/AlkaidLab/moonlight-harmony | fd894411bacd351b749e4e028716a58221eafd46 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLast | Finds the last element in the Float64Array that satisfies the condition
@param { function } fn - condition
@returns { double } - the last element that satisfies fn
@throws { Error } - If the element cannot be found, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number, index: int, array: Float64Array) => boolean): double {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn((val).toDouble(), i, this)) {
return val
}
}
throw new Error("Float6... | 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: number, index: int, array: Float64Array) => boolean): double {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn((val).toDouble(), i, this)) {
return val
}
}
throw new Error("Float6... | https://gitcode.com/iop123123/arkts-static-skills | 7cdfa8d409047a948b7d229558ef3e2da80e11ac | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/core/EntityMetadata.ets | arkts | getHooks | 获取实体钩子
@returns 实体钩子,如果未设置返回 null | getHooks(): EntityHooks | null {
return this.hooks
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHooks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifier#Left EntityHooks AST#identifier... | getHooks(): EntityHooks | null {
return this.hooks
} | https://github.com/offlinecat-dev/OCNetORM | 3e15729b33d4cf81ac667550be654b027e535c20 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | subarray | Creates a Uint8Array with the same underlying ArrayBuffer
@param begin start index, inclusive
@param end last index, exclusive
@returns new Uint8Array with the same underlying ArrayBuffer | public subarray(begin: number, end: number): Uint8Array {
return this.subarray(begin as int, end as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public subarray(begin: number, end: number): Uint8Array {
return this.subarray(begin as int, end as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fb7abbad2d72c05bec7a8a7bf8348b4746771cdf | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateBuilder.ets | arkts | withCustomField | 添加自定义字段 | withCustomField(field: ITemplateField): TemplateBuilder {
if (field.isProtected) {
this.entry.fields.set(field.key, ProtectedValue.fromString(field.value));
} else {
this.entry.fields.set(field.key, field.value);
}
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withCustomField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ITemplateField AST#identifier#Right AST... | withCustomField(field: ITemplateField): TemplateBuilder {
if (field.isProtected) {
this.entry.fields.set(field.key, ProtectedValue.fromString(field.value));
} else {
this.entry.fields.set(field.key, field.value);
}
return this;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L128-L135 | bb08e93462929d4c8dde1a04d438f586a0a3fbd4 | github |
YANGZX22/Voot | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageRestore | 流转恢复时恢复窗口(官方推荐方式)
当应用通过流转启动时,系统会调用此方法恢复窗口状态 | onWindowStageRestore(windowStage: window.WindowStage): void {
console.info('[EntryAbility] onWindowStageRestore - Restoring from continuation');
// 保存 windowStage
AppStorage.setOrCreate('windowStage', windowStage);
// 使用 restoreWindowStage 恢复页面
// 注意:此方法必须在同步接口中调用
windowStage.loadContent('pa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageRestore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identi... | onWindowStageRestore(windowStage: window.WindowStage): void {
console.info('[EntryAbility] onWindowStageRestore - Restoring from continuation');
// 保存 windowStage
AppStorage.setOrCreate('windowStage', windowStage);
// 使用 restoreWindowStage 恢复页面
// 注意:此方法必须在同步接口中调用
windowStage.loadContent('pa... | https://github.com/YANGZX22/Voot | 44a35a0d327d986bd854a38e5a660f6d52123ff5 | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | checkPastePressed | isPastePressed
globalExpression是否是空 | public static checkPastePressed( isPastePressed: boolean) :boolean {
if (AppStorage.get<string>('globalExpression') === '') {
CommonUtil.updateCopyResult('');
AppStorage.set<string>('globalResult','');
return false;
}
return isPastePressed;
} | 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 checkPastePressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isPastePressed AST#identifier#Right AST#ERROR#Left A... | public static checkPastePressed( isPastePressed: boolean) :boolean {
if (AppStorage.get<string>('globalExpression') === '') {
CommonUtil.updateCopyResult('');
AppStorage.set<string>('globalResult','');
return false;
}
return isPastePressed;
} | https://gitee.com/openharmony-sig/applications_calculator.git | 178a2f1fa147fea3a9c4000df475cf60488e8656 | gitee |
chenchl/GMLogger-HarmonyOS | gmlogger/src/main/ets/components/security/logger/LoggerCryptoUtil.ets | arkts | genIvParamsSpec | 生成一个用于加密的初始化向量参数规范(IvParamsSpec)。
该函数创建了一个包含固定初始化向量(IV)的IvParamsSpec对象,用于加密算法中。
@returns {cryptoFramework.IvParamsSpec} 返回一个包含初始化向量参数的IvParamsSpec对象。 | private static genIvParamsSpec() {
// 创建一个固定的16字节初始化向量(IV)数组
let ivBlob = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5]);
// 构建IvParamsSpec对象,包含算法名称和初始化向量
let ivParamsSpec: cryptoFramework.IvParamsSpec = {
algName: "IvParamsSpec",
iv: { data: ivBlob }
};
return ... | 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 genIvParamsSpec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private static genIvParamsSpec() {
// 创建一个固定的16字节初始化向量(IV)数组
let ivBlob = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5]);
// 构建IvParamsSpec对象,包含算法名称和初始化向量
let ivParamsSpec: cryptoFramework.IvParamsSpec = {
algName: "IvParamsSpec",
iv: { data: ivBlob }
};
return ... | https://github.com/chenchl/GMLogger-HarmonyOS | 858a5055bf07bfee238451045addab9178e5db24 | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V21.ets | arkts | parseItems | Parses lines other than the first "BEGIN:VCARD". Takes care of "END:VCARD"n and
"BEGIN:VCARD" in nested vCard.
items = *CRLF item / item
Note: BEGIN/END aren't include in the original spec while this method handles them. | protected parseItems(): void {
let ended = false;
try {
ended = this.parseItem();
} catch (e) {
Log.w(this.LOG_TAG, "Invalid line which looks like some comment was found. Ignored." + e);
}
while (!ended) {
try {
ended = th... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left parseItems 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... | protected parseItems(): void {
let ended = false;
try {
ended = this.parseItem();
} catch (e) {
Log.w(this.LOG_TAG, "Invalid line which looks like some comment was found. Ignored." + e);
}
while (!ended) {
try {
ended = th... | https://gitee.com/openharmony-tpc/VCard.git | 2abec82c307b1523ff340a3951d8092d37f4d54c | gitee |
openharmony-tpc/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | removeAllFileCache | 清除所有文件缓存
@returns | async removeAllFileCache(): Promise<void> {
if (this.fileCache !== undefined) {
await this.fileCache.removeAll()
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left removeAllFileCache AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#L... | async removeAllFileCache(): Promise<void> {
if (this.fileCache !== undefined) {
await this.fileCache.removeAll()
}
} | https://gitee.com/openharmony-tpc/ImageKnife.git | e43c046e66adc669a2129a2dad4b0b94bd8e233d | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.