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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/CandleDataSet.ets | arkts | setDecreasingColor | Sets the one and ONLY color that should be used for this DataSet when
open > close.
@param color | public setDecreasingColor(color: number): void {
this.mDecreasingColor = color;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDecreasingColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public setDecreasingColor(color: number): void {
this.mDecreasingColor = color;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ed2d559b6e351dd17de5d7304a531ffb5f156c87 | gitee |
darcycui/DarcyHarmonyNext | entry/src/main/ets/pages/entry/http/HttpsCertPinPage.ets | arkts | doHttpRequest | 发起http请求 | doHttpRequest() {
//http请求对象
let httpRequest = http.createHttp();
let opt: http.HttpRequestOptions = {
method: http.RequestMethod.GET,
expectDataType: http.HttpDataType.STRING,
connectTimeout: 5000,
}
// TODO 证书路径
Log.warn(`caPath=${this.filePath}`);
opt.caPath = this.fi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doHttpRequest 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... | doHttpRequest() {
//http请求对象
let httpRequest = http.createHttp();
let opt: http.HttpRequestOptions = {
method: http.RequestMethod.GET,
expectDataType: http.HttpDataType.STRING,
connectTimeout: 5000,
}
// TODO 证书路径
Log.warn(`caPath=${this.filePath}`);
opt.caPath = this.fi... | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/http/HttpsCertPinPage.ets#L160-L187 | 7b2b07d3621497298c34217a6a15cc835252d892 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/ShopExportImportManager.ets | arkts | exportShopsToJson | 导出指定店铺和饮品数据为JSON字符串 | async exportShopsToJson(shopIds: number[]): Promise<string> {
const shareData: ShopShareData = {
version: 1,
exportedAt: Date.now(),
shops: []
};
for (let i = 0; i < shopIds.length; i++) {
const shopId = shopIds[i];
const shop = await this.queryShopById(shopId);
if (sh... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left exportShopsToJson AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left shopIds AST#identifier#Right AST#type_annotation#Left AST#:#L... | async exportShopsToJson(shopIds: number[]): Promise<string> {
const shareData: ShopShareData = {
version: 1,
exportedAt: Date.now(),
shops: []
};
for (let i = 0; i < shopIds.length; i++) {
const shopId = shopIds[i];
const shop = await this.queryShopById(shopId);
if (sh... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 1db0d7f94ac05cf01fef2eecf0752867eeb3f63f | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/location/PermissionManager.ets | arkts | openSettings | 打开系统设置页面 | openSettings(context: common.UIAbilityContext) {
this.openSystemSettings(context, "application_info_entry")
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Lef... | openSettings(context: common.UIAbilityContext) {
this.openSystemSettings(context, "application_info_entry")
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | dabfffcc4e28a307edd85f065f6d598788e29f86 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | toReversed | Creates a reversed copy
@returns { Uint32Array } - a reversed copy
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toReversed(): Uint32Array {
let newArray = new Uint32Array(this.lengthInt)
if (this.lengthInt > 0) {
Uint32Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed 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 Uint32Array... | public toReversed(): Uint32Array {
let newArray = new Uint32Array(this.lengthInt)
if (this.lengthInt > 0) {
Uint32Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | https://gitcode.com/iop123123/arkts-static-skills | 3323b2d728849fa129acca2825010756cdd63e33 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets | arkts | login | 执行登录操作
@returns {void} 无返回值 | login(): void {
if (!ValidationUtil.isValidPhone(this.account)) {
ToastUtils.showError($r("app.string.invalid_phone_number"));
return;
}
if (!ValidationUtil.isValidPassword(this.password)) {
ToastUtils.showError($r("app.string.invalid_password"));
return;
}
const params: Pa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left login 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#{#Left { AST#{#Right AST#method_defini... | login(): void {
if (!ValidationUtil.isValidPhone(this.account)) {
ToastUtils.showError($r("app.string.invalid_phone_number"));
return;
}
if (!ValidationUtil.isValidPassword(this.password)) {
ToastUtils.showError($r("app.string.invalid_password"));
return;
}
const params: Pa... | https://github.com/Joker-x-dev/CoolMallArkTS | e0bbd03a14199b939cd50aa27fe716f734d3d8e0 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | set | Copies all elements of arr to the current Float32Array.
@param arr array to copy data from | public set(arr: float[]): void {
this.set(arr, 0)
} | 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 arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: float[]): void {
this.set(arr, 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d5a583de100f645f7f563d00d8f8ac2d66bd5bb8 | gitee |
openharmony-sig/ohos_subsampling_scale_image_view | library/src/main/ets/components/MainPage/SubsamplingScaleImageView.ets | arkts | isReady | Call to find whether the view is initialised, has dimensions, and will display an image on
the next draw. If a preview has been provided, it may be the preview that will be displayed
and the full size image may still be loading. If no preview was provided, this is called once
the base layer tiles of the full size image... | public isReady(): boolean {
return this.readySent;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boole... | public isReady(): boolean {
return this.readySent;
} | https://gitee.com/openharmony-sig/ohos_subsampling_scale_image_view.git | 839fdef4b26fc27a93dcac218bf6c230fd48dab6 | gitee |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | processImportV1 | 处理V1版本数据导入
注意:不再检查应用级版本号。增量同步应该在词条级别按 updatedAt 时间戳做 upsert 合并,
而不是用版本号拦截数据。这是主流应用(如 Anki、墨墨背单词)的标准做法。 | private processImportV1(
importData: ExportData,
currentVersion: VersionControl,
result: SyncResult
): ImportResult {
// 移除版本號檢查邏輯,直接放行所有數據
// 由上層(DataSyncManager.importIncremental 等方法)按詞條粒度做 upsert
return { data: importData, result };
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processImportV1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left importData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private processImportV1(
importData: ExportData,
currentVersion: VersionControl,
result: SyncResult
): ImportResult {
// 移除版本號檢查邏輯,直接放行所有數據
// 由上層(DataSyncManager.importIncremental 等方法)按詞條粒度做 upsert
return { data: importData, result };
} | https://github.com/CLMC2025/Vignette | b0239395572f942bf1a3193ad763fe048d7a8b72 | github |
daugf2527/harmonyos-libretro-emulator | entry/src/main/ets/common/PerformanceTracker.ets | arkts | getElapsed | 获取当前耗时(不结束计时)
@param label 计时器标签
@returns 当前耗时(毫秒),如果计时器不存在返回 -1 | static getElapsed(label: string): number {
const startTime = this.timers.get(label);
if (startTime === undefined) {
return -1;
}
return Date.now() - startTime;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getElapsed 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... | static getElapsed(label: string): number {
const startTime = this.timers.get(label);
if (startTime === undefined) {
return -1;
}
return Date.now() - startTime;
} | https://github.com/daugf2527/harmonyos-libretro-emulator | cf6c2dd03c3d473cda10b460f7c5a5b5f3e6fb37 | github |
ibestservices/ibest-ui | library/src/main/ets/components/picker/index.ets | arkts | getColumns | 获取列数据 | getColumns(){
return this.columnType == "cascade" ? this.columns : this.options as IBestPickerOption[][]
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getColumns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | getColumns(){
return this.columnType == "cascade" ? this.columns : this.options as IBestPickerOption[][]
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L459-L461 | 39ade3ab00d00ebf33a2e54ed5ca91302c9edb8e | github |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | common/sample_common/src/main/ets/model/ScanAccessibility.ets | arkts | sendAccessibilityEvent | Sends an accessibility event.
@param eventInfo - Information about the accessibility event. | static sendAccessibilityEvent(eventInfo: accessibility.EventInfo): void {
accessibility.sendAccessibilityEvent(eventInfo).then(() => {
Logger.info(TAG, 'sendAccessibilityEvent end');
}).catch((error: BusinessError) => {
Logger.error(TAG, `Failed to sendAccessibilityEvent. Code: ${error.code}`);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendAccessibilityEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#memb... | static sendAccessibilityEvent(eventInfo: accessibility.EventInfo): void {
accessibility.sendAccessibilityEvent(eventInfo).then(() => {
Logger.info(TAG, 'sendAccessibilityEvent end');
}).catch((error: BusinessError) => {
Logger.error(TAG, `Failed to sendAccessibilityEvent. Code: ${error.code}`);
... | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | 7589fd5a65c1ef5af7d590cf6a41f5a63c0d34bb | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/entrybackupability/EntryBackupAbility.ets | arkts | onBackup | 当系统请求备份应用数据时调用
由于此扩展运行在独立进程,主应用的数据管理器均未初始化,
因此不执行实际备份操作,仅安全返回。 | async onBackup() {
hilog.info(DOMAIN, TAG, '系统触发应用数据备份(扩展进程)');
hilog.info(DOMAIN, TAG, '实际备份由用户在应用内手动触发,此处安全返回');
// 不调用任何依赖主应用初始化的管理器,直接返回
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expression_... | async onBackup() {
hilog.info(DOMAIN, TAG, '系统触发应用数据备份(扩展进程)');
hilog.info(DOMAIN, TAG, '实际备份由用户在应用内手动触发,此处安全返回');
// 不调用任何依赖主应用初始化的管理器,直接返回
} | https://github.com/DaLongZhuaZi/manxia | d040611ebad6cbc19ced62525aba005a6e2209bd | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/IndexManager.ets | arkts | createAnomalyDetectionIndexes | 创建异常检测表的索引 | private static async createAnomalyDetectionIndexes(): Promise<void> {
const store = DatabaseManager.getDatabase();
try {
// 异常记录表 - 用户未确认异常查询索引
await store.executeSql(`
CREATE INDEX IF NOT EXISTS idx_anomaly_records_user_ack
ON anomaly_records(user_id, is_acknowledged, created_at ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left createAnomalyDetectionIndexes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#R... | private static async createAnomalyDetectionIndexes(): Promise<void> {
const store = DatabaseManager.getDatabase();
try {
// 异常记录表 - 用户未确认异常查询索引
await store.executeSql(`
CREATE INDEX IF NOT EXISTS idx_anomaly_records_user_ack
ON anomaly_records(user_id, is_acknowledged, created_at ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | fa8391a7cc93da3fff48769c0a598236de294297 | github |
openharmony-sig/ohos_highlightguide | library/src/main/ets/highlightguide/core/Controller.ets | arkts | createPreferences | 创建存储显示次数的实例
@param context 上下文 | private createPreferences(context: Context): void {
try {
preferences.getPreferences(context, 'HighLightGuide')
.then((object) => {
this.preferences = object;
hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'Succeeded in getting preference');
})
.catch((... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createPreferences 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#identifi... | private createPreferences(context: Context): void {
try {
preferences.getPreferences(context, 'HighLightGuide')
.then((object) => {
this.preferences = object;
hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'Succeeded in getting preference');
})
.catch((... | https://gitee.com/openharmony-sig/ohos_highlightguide.git | 1752fc6d85769b937ea24d787edf79d65d21b5cc | gitee |
openharmony-sig/flutter_sqflite | sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/SqflitePlugin.ets | arkts | handleDatabaseExistsCall | /检查数据库是否存在 | async handleDatabaseExistsCall(call: MethodCall, result: MethodResult): Promise<void> {
let dbPath: string = call.argument(Constant.PARAM_PATH);
let isExist: boolean = await DatabaseHelper.checkDatabaseExisted(dbPath);
result.success(isExist);
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left handleDatabaseExistsCall AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left call AST#identifier#Right AST#type_annotation... | async handleDatabaseExistsCall(call: MethodCall, result: MethodResult): Promise<void> {
let dbPath: string = call.argument(Constant.PARAM_PATH);
let isExist: boolean = await DatabaseHelper.checkDatabaseExisted(dbPath);
result.success(isExist);
} | https://gitee.com/openharmony-sig/flutter_sqflite.git | cb59b8bf6a4583cfa842658343f220143eabefa2 | gitee |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/TaskRepository.ets | arkts | insertTask | 插入任务
@param task 任务模型
@returns Promise<boolean> 是否成功,成功后 task.id 会被设置为新 ID | async insertTask(task: TaskListData): Promise<boolean> {
try {
const valueBucket = this.toValueBucket(task);
const rowId = await this.dao.insert(valueBucket);
if (rowId > 0) {
task.id = rowId;
Logger.info(this.LOG_TAG, `Task inserted with ID: ${rowId}`);
return true;
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insertTask AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left task AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async insertTask(task: TaskListData): Promise<boolean> {
try {
const valueBucket = this.toValueBucket(task);
const rowId = await this.dao.insert(valueBucket);
if (rowId > 0) {
task.id = rowId;
Logger.info(this.LOG_TAG, `Task inserted with ID: ${rowId}`);
return true;
... | https://github.com/Kira-Yagami-Light/Kira-Projects | 6232b9acbde3bc8416f45d100b5239f4c0bd5238 | github |
openharmony/codelabs | Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getToDaySteps | Get today's steps.
@param {DataRdb.RdbStore} rdbStore RDB database.
@param {number} dimensionFlag Card Specifications.
@param {string} formId Form ID. | function getToDaySteps(rdbStore: DataRdb.RdbStore, dimensionFlag: number, formId: string) {
let getSensorData: Promise<SensorData> = DatabaseUtils.getSensorData(rdbStore, DateUtils.getDate(0));
getSensorData.then((sensorData: SensorData) => {
let stepValue: number = 0;
if (sensorData) {
stepValue = se... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getToDaySteps AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function getToDaySteps(rdbStore: DataRdb.RdbStore, dimensionFlag: number, formId: string) {
let getSensorData: Promise<SensorData> = DatabaseUtils.getSensorData(rdbStore, DateUtils.getDate(0));
getSensorData.then((sensorData: SensorData) => {
let stepValue: number = 0;
if (sensorData) {
stepValue = se... | https://gitee.com/openharmony/codelabs.git | 181ca77fe6be1c8b5d19e3bc766167203046e2a1 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets | arkts | isEmpty | Check if the TreeMap is empty
@returns true if the TreeMap is empty | isEmpty(): boolean {
return (this.rootEntry === undefined && this.elementNum === 0);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b... | isEmpty(): boolean {
return (this.rootEntry === undefined && this.elementNum === 0);
} | https://gitcode.com/iop123123/arkts-static-skills | de50827f0b864aec44a88bd48c8dbb308012b771 | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets | arkts | notifyLowMemoryWarning | Notify the Dart VM of a low memory event, or that the application is in a state such that now
is an appropriate time to free resources, such as going to the background.
<p>This does not notify a Flutter application about memory pressure. For that, use the {@link
io.flutter.embedding.engine.systemchannels.SystemChannel#... | notifyLowMemoryWarning(): void {
if (this.flutterNapi.isAttached()) {
this.flutterNapi.notifyLowMemoryWarning();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyLowMemoryWarning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_exp... | notifyLowMemoryWarning(): void {
if (this.flutterNapi.isAttached()) {
this.flutterNapi.notifyLowMemoryWarning();
}
} | https://gitee.com/openharmony-sig/flutter_engine.git | 3e1ae877754a1faf3b8ddc259f1347b3ff5043a7 | gitee |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets | arkts | getOrderInfo | 获取订单详情
@param {number} id - 订单 ID
@returns {Promise<NetworkResponse<Order>>} 订单详情 | async getOrderInfo(id: number): Promise<NetworkResponse<Order>> {
const resp: AxiosResponse<NetworkResponse<Order>> =
await NetworkClient.http.get("order/info/info", { params: { id } });
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOrderInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async getOrderInfo(id: number): Promise<NetworkResponse<Order>> {
const resp: AxiosResponse<NetworkResponse<Order>> =
await NetworkClient.http.get("order/info/info", { params: { id } });
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | f8d777deb7a1aa8222a62b17b5fdd807be18876f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | toPrecision | toPrecision() returns std.core.String representing the underlying double in exponential notation
basically, if toPrecision called with no argument it's just toString according to spec
@returns { String } the result of conversion
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toPrecision(): String {
return this.toString();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toPrecision 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 AST... | public toPrecision(): String {
return this.toString();
} | https://gitcode.com/iop123123/arkts-static-skills | d9c358b144e9d1a5ea9d6b77326ce757b7e2fbb4 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | decode | Asynchronously decodes a Base64 encoded string into a byte array.
@param src The Base64 encoded string or a Uint8Array containing the Base64 encoded string.
@param options The decoding options (Base64 type).
@returns A Promise that resolves to a Uint8Array with the decoded bytes. | decode(src: Uint8Array | string, options?: Type): Promise<Uint8Array> {
if (options === undefined) {
options = Type.BASIC;
}
if (src instanceof Uint8Array) {
return this.decodeUint8Array(src, options);
} else {
retur... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#L... | decode(src: Uint8Array | string, options?: Type): Promise<Uint8Array> {
if (options === undefined) {
options = Type.BASIC;
}
if (src instanceof Uint8Array) {
return this.decodeUint8Array(src, options);
} else {
retur... | https://gitcode.com/iop123123/arkts-static-skills | 46b8506fc44287be7f60b916003f9af2547f8ba6 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Authentication/LoginManager.ets | arkts | saveCookiesToDatabase | 保存Cookie到数据库 | private async saveCookiesToDatabase(sourceId: number, cookies: Record<string, string>): Promise<void> {
try {
// 转换为CookieEntry数组
const entries: Array<{ name: string; value: string; expires: number }> = [];
const keys = Object.keys(cookies);
const defaultExpires = Date.now() + (7 * 24 * 60... | 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 saveCookiesToDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left A... | private async saveCookiesToDatabase(sourceId: number, cookies: Record<string, string>): Promise<void> {
try {
// 转换为CookieEntry数组
const entries: Array<{ name: string; value: string; expires: number }> = [];
const keys = Object.keys(cookies);
const defaultExpires = Date.now() + (7 * 24 * 60... | https://github.com/DaLongZhuaZi/manxia | 3074e78df4cfe4a9d10803a55e15adc09f0ef3a8 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | buildModelsUrl | 构建模型列表 API URL | private buildModelsUrl(config: AIApiConfig): string {
// 如果提供了自定义 apiPath,推导 models 端点
if (config.apiPath && config.apiPath.trim() !== '') {
// 将 /chat/completions 替换为 /models
const modelsPath = config.apiPath.replace('/chat/completions', '/models').replace('/completions', '/models')
return ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildModelsUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private buildModelsUrl(config: AIApiConfig): string {
// 如果提供了自定义 apiPath,推导 models 端点
if (config.apiPath && config.apiPath.trim() !== '') {
// 将 /chat/completions 替换为 /models
const modelsPath = config.apiPath.replace('/chat/completions', '/models').replace('/completions', '/models')
return ... | https://github.com/LongLiveY96/chatcube | f8b7af94c97d0e0c08e4441d6e0b159cc91979fb | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosEngineHost.ets | arkts | notifySurfaceDestroyed | Called by CocosBattlePage's XComponent onDestroy handler. Marks the
surface gone so updateVisibility cannot resume the render loop until
the next surface's onLoad. The patched engine releases the swapchain's
EGL surface on this destroy and rebinds when a new surface is created,
so re-entry is safe (no retirement needed... | notifySurfaceDestroyed(): void {
this.surfaceAlive = false;
this.updateVisibility();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifySurfaceDestroyed 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#state... | notifySurfaceDestroyed(): void {
this.surfaceAlive = false;
this.updateVisibility();
} | https://github.com/terryma2024/happyword | 3af0a3c562d5df8dbb78b4a731f6e67a724a321a | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | saveLastCategory | 保存上次选择的分类 | async saveLastCategory(type: BillType, category: string): Promise<void> {
if (!this.preferences) {
console.error('PreferencesUtil: 未初始化');
return;
}
try {
const key = type === BillType.EXPENSE ? this.KEY_LAST_EXPENSE_CATEGORY : this.KEY_LAST_INCOME_CATEGO... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveLastCategory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left type AST#identifier#Right AS... | async saveLastCategory(type: BillType, category: string): Promise<void> {
if (!this.preferences) {
console.error('PreferencesUtil: 未初始化');
return;
}
try {
const key = type === BillType.EXPENSE ? this.KEY_LAST_EXPENSE_CATEGORY : this.KEY_LAST_INCOME_CATEGO... | https://github.com/qiuhaotc/HarmonyOSPlayground | 6577125d9af7e4192d655ce110b440b241c39aab | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/ExternalFileOpener.ets | arkts | editFile | 在默认编辑器中打开(降级为 view) | private static async editFile(filePath: string): Promise<OpenResult> {
// HarmonyOS 暂不支持 editData action,降级为 view
return this.viewFile(filePath);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left editFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifi... | private static async editFile(filePath: string): Promise<OpenResult> {
// HarmonyOS 暂不支持 editData action,降级为 view
return this.viewFile(filePath);
} | https://github.com/XJTUWYD/ArkDiff | 774d2e7a2ba047b67e790eafeb01d722f61b6c85 | github |
ZestBox-18/kitebook-frontend | commons/base/src/main/ets/entities/BillBean.ets | arkts | formatAmount | 格式化金额显示 | formatAmount(): string {
if (this.type === BillTypeEnum.TRANSFER) {
return `¥${this.amount.toFixed(2)}`;
}
const prefix = this.type === BillTypeEnum.EXPENSE ? '-' : '+';
return `${prefix}${this.amount.toFixed(2)}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatAmount 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... | formatAmount(): string {
if (this.type === BillTypeEnum.TRANSFER) {
return `¥${this.amount.toFixed(2)}`;
}
const prefix = this.type === BillTypeEnum.EXPENSE ? '-' : '+';
return `${prefix}${this.amount.toFixed(2)}`;
} | https://github.com/ZestBox-18/kitebook-frontend | 11eeb783dc1512a6473065cfda4e36de3f44ada8 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/FillLetterGenerator.ets | arkts | generateMedium | Generate a medium fill-letter question (two missing letters, two steps).
Returns undefined for words shorter than 4 alphabetic characters so the
caller can degrade to beginner fill-letter or choice. | generateMedium(word: WordEntry, _lastWordId?: string): Question | undefined {
const tokens: PhraseToken[] = phraseTokens(word.word);
const letters: string[] = allLetters(tokens);
const fillable: PhraseToken[] = fillableTokens(tokens);
if (fillable.length < MIN_WORD_LETTERS_MEDIUM) {
return undef... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left generateMedium 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#identifier#Left... | generateMedium(word: WordEntry, _lastWordId?: string): Question | undefined {
const tokens: PhraseToken[] = phraseTokens(word.word);
const letters: string[] = allLetters(tokens);
const fillable: PhraseToken[] = fillableTokens(tokens);
if (fillable.length < MIN_WORD_LETTERS_MEDIUM) {
return undef... | https://github.com/terryma2024/happyword | 409f232a95f71937cbf3945ab725bb1382292928 | github |
openharmony/codelabs | ETSUI/LifeBalance/entry/src/main/ets/common/database/ExerciseRecordDao.ets | arkts | getWeeklyTimeStats | --- 获取过去7天的每日总时间 --- | async getWeeklyTimeStats(): Promise<GeneratedTypeLiteralInterface_1[]> {
const store = RdbManager.getInstance().getRdbStore();
if (!store) {
return [];
}
const result: GeneratedTypeLiteralInterface_2[] = [];
// 循环获取过去 7 天的日期字符串
for (let i = 6; i >= 0; i--) {
const d = new Date();... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getWeeklyTimeStats AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g... | async getWeeklyTimeStats(): Promise<GeneratedTypeLiteralInterface_1[]> {
const store = RdbManager.getInstance().getRdbStore();
if (!store) {
return [];
}
const result: GeneratedTypeLiteralInterface_2[] = [];
// 循环获取过去 7 天的日期字符串
for (let i = 6; i >= 0; i--) {
const d = new Date();... | https://gitcode.com/openharmony/codelabs | e87b805c3197149bf32553279334325dacf9a858 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/Utils.ets | arkts | buildQueryString | URL-encoded form body for POST: key=value&key=value with proper encoding.
Also used to build GET query strings. | public static buildQueryString(params: Record<string, string>): string {
const parts: string[] = [];
const keys: string[] = Object.keys(params);
for (let i = 0; i < keys.length; i++) {
const k: string = keys[i];
const v: string = params[k];
parts.push(`${encodeURIComponent(k)}=${encodeUR... | 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 buildQueryString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left... | public static buildQueryString(params: Record<string, string>): string {
const parts: string[] = [];
const keys: string[] = Object.keys(params);
for (let i = 0; i < keys.length; i++) {
const k: string = keys[i];
const v: string = params[k];
parts.push(`${encodeURIComponent(k)}=${encodeUR... | https://github.com/Countly/countly-sdk-hos | 371ee4663383d7a462dff894271cec938c8313bc | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | resultSetToWord | Convert ResultSet row to WordItem | private resultSetToWord(resultSet: relationalStore.ResultSet): WordItem {
const id = resultSet.getLong(resultSet.getColumnIndex(WordColumns.ID));
const wordStr = resultSet.getString(resultSet.getColumnIndex(WordColumns.WORD));
const statusRaw = resultSet.getString(resultSet.getColumnIndex(WordColumns.STAT... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resultSetToWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_e... | private resultSetToWord(resultSet: relationalStore.ResultSet): WordItem {
const id = resultSet.getLong(resultSet.getColumnIndex(WordColumns.ID));
const wordStr = resultSet.getString(resultSet.getColumnIndex(WordColumns.WORD));
const statusRaw = resultSet.getString(resultSet.getColumnIndex(WordColumns.STAT... | https://github.com/CLMC2025/Vignette | 7d35880a236a251fa62952083831a2f1688ba202 | github |
richshaw2015/nds | ohos/entry/src/test/NativeSync.test.ets | arkts | getLastError | 获取最后一次错误 | getLastError(): string | null {
return this.lastError;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLastError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#L... | getLastError(): string | null {
return this.lastError;
} | https://github.com/richshaw2015/nds | 956f04196d93a479f6cd40e704c7c305f895ac71 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getCenterOfView | Returns a recyclable MPPointF instance.
@return | public getCenterOfView(): MPPointF {
return this.getCenter();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCenterOfView 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 MPPoin... | public getCenterOfView(): MPPointF {
return this.getCenter();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 51698bd667f6410f50e440fee60c6461e291a08d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportEBookLibrary | 导出电子书库
[修复] 从ebook_reading_progress表获取阅读进度 | private async exportEBookLibrary(): Promise<EBookBackupItem[]> {
try {
const sql = 'SELECT * FROM ebook_info WHERE title != ?';
const results = await this.dbManager.querySql(sql, ['漫匣使用手册']);
const backupItems: EBookBackupItem[] = [];
for (const record of results) {
const ebook = ... | 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 exportEBookLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async exportEBookLibrary(): Promise<EBookBackupItem[]> {
try {
const sql = 'SELECT * FROM ebook_info WHERE title != ?';
const results = await this.dbManager.querySql(sql, ['漫匣使用手册']);
const backupItems: EBookBackupItem[] = [];
for (const record of results) {
const ebook = ... | https://github.com/DaLongZhuaZi/manxia | 7f4a8b1bd562a5104e92c5237dbbe5bf8a9e9d27 | github |
mybricks/comlib-harmony-normal | packages/rt-arkts/comlib/src/main/ets/AiMusic/model/AppMusicMediaPlayer.ets | arkts | setAudioListIndex | 设置当前歌曲索引 | static setAudioListIndex(audioListIndex: number) {
MediaPlayer.audioListIndex = audioListIndex
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setAudioListIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left audioListIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | static setAudioListIndex(audioListIndex: number) {
MediaPlayer.audioListIndex = audioListIndex
} | https://github.com/mybricks/comlib-harmony-normal | 064767c99f78d3cb5c6a8a6b663fc4a96a24bf7f | github |
harmonyos/codelabs | CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets | arkts | isEmptyStr | Check str is empty.
@param {string} str
@return {boolean} true(empty) | isEmptyStr(str: string) {
return str.trim().length === 0;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isEmptyStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST... | isEmptyStr(str: string) {
return str.trim().length === 0;
} | https://gitee.com/harmonyos/codelabs.git | df82d6a6be22fb706d15d874372c52f69bef937b | gitee |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/viewmodel/InitialData.ets | arkts | getFormattedDate | 获取浏览日期的格式化字符串 | getFormattedDate(): string {
const date = new Date(this.browsedTime);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}年${month}月${day}日`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormattedDate 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#state... | getFormattedDate(): string {
const date = new Date(this.browsedTime);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}年${month}月${day}日`;
} | https://github.com/ChangJing01/HarmonyOS-FinalProject | 718be16bc87f0d64ab32d906302864dc40a4c2cc | github |
openharmony/applications_app_samples | code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets | arkts | setVideoStabilizationMode | 设置视频防抖。 | function setVideoStabilizationMode(session: camera.VideoSession): boolean {
let mode: camera.VideoStabilizationMode = camera.VideoStabilizationMode.AUTO;
// 查询是否支持视频防抖
let isSupported: boolean = isVideoStabilizationModeSupported(session, mode);
if (isSupported) {
Logger.info(TAG, `setVideoStabilizationMode:... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left setVideoStabilizationMode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left session AST#identifier#Right AST#type_annotation#Left AST#:#... | function setVideoStabilizationMode(session: camera.VideoSession): boolean {
let mode: camera.VideoStabilizationMode = camera.VideoStabilizationMode.AUTO;
// 查询是否支持视频防抖
let isSupported: boolean = isVideoStabilizationModeSupported(session, mode);
if (isSupported) {
Logger.info(TAG, `setVideoStabilizationMode:... | https://github.com/openharmony/applications_app_samples | 12eb3c332c03b87cabdba7288b694a57b4d2332f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_and/bitwise_and_uint.ets | arkts | main | ---
desc: check bitwise AND operation for unsigned int operands
--- | function main(): void {
const a: uint = {{v.left}}
const b: uint = {{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: uint = {{v.left}}
const b: uint = {{v.right}}
assert (a & b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a1fbea99a6a94b99cb54aeffa76235e6cff9ce78 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getScaledFontSize | 获取缩放后的字号 | public getScaledFontSize(baseFontSize: number): number {
return Math.round(baseFontSize * this.fontScale);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getScaledFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseFontSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | public getScaledFontSize(baseFontSize: number): number {
return Math.round(baseFontSize * this.fontScale);
} | https://github.com/DaLongZhuaZi/manxia | 1807558e08034a26db3837a6fb393e9ccf0b25c0 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/line/LineChartRenderer.ets | arkts | getDataPointAt | 获取数据点位置(用于交互) | public getDataPointAt(x: number, y: number): { series: LineChartSeries; point: TimeSeriesDataPoint } | null {
const threshold = 10; // 点击阈值
for (const s of this.series) {
if (!s.show) continue;
for (const point of s.data) {
const px = this.mapX(point.timestamp);
const p... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataPointAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | public getDataPointAt(x: number, y: number): { series: LineChartSeries; point: TimeSeriesDataPoint } | null {
const threshold = 10; // 点击阈值
for (const s of this.series) {
if (!s.show) continue;
for (const point of s.data) {
const px = this.mapX(point.timestamp);
const p... | https://github.com/LJ666-ui/harmony-health-care | f53f640423264d815b0987fa15725c8753314a4f | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/DistributedKVService.ets | arkts | sync | 手动触发同步
@param mode 同步模式,默认 PUSH_PULL | public static sync(mode: distributedKVStore.SyncMode = distributedKVStore.SyncMode.PUSH_PULL): void {
try {
if (!DistributedKVService.kvStore) {
hilog.warn(DOMAIN, TAG, 'KVStore is not initialized, cannot sync');
return;
}
const deviceIds = DistributedKVService.getConnectedDevice... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left sync AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#id... | public static sync(mode: distributedKVStore.SyncMode = distributedKVStore.SyncMode.PUSH_PULL): void {
try {
if (!DistributedKVService.kvStore) {
hilog.warn(DOMAIN, TAG, 'KVStore is not initialized, cannot sync');
return;
}
const deviceIds = DistributedKVService.getConnectedDevice... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L189-L205 | f329fe16206edde46a8f1abd2959a2443ea406c8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVNativeClient.ets | arkts | getQuota | 获取磁盘配额信息 | async getQuota(): Promise<WebDAVNativeQuotaResult> {
if (!this.initialized) {
await this.initialize();
}
try {
logger.info(TAG, '获取磁盘配额');
const result: WebDAVNativeQuotaResult = getNativeModule().getQuota();
return result;
} catch (error) {
logger.error(TAG, `获取配额失败... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getQuota 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 getQuota(): Promise<WebDAVNativeQuotaResult> {
if (!this.initialized) {
await this.initialize();
}
try {
logger.info(TAG, '获取磁盘配额');
const result: WebDAVNativeQuotaResult = getNativeModule().getQuota();
return result;
} catch (error) {
logger.error(TAG, `获取配额失败... | https://github.com/DaLongZhuaZi/manxia | 97fcc536ee030308eedf6859e3e15f8c25132116 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets | arkts | onTouchEvent | Dispatch Touch Event | onTouchEvent(strings: Array<string>): void {
if (this.isAttached()) {
TouchEventProcessor.getInstance().postTouchEvent(strings);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTouchEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left strings AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AST#identifier#R... | onTouchEvent(strings: Array<string>): void {
if (this.isAttached()) {
TouchEventProcessor.getInstance().postTouchEvent(strings);
}
} | https://gitee.com/openharmony-sig/flutter_engine.git | 74d0712b3b5a820685bef5ee64e6245340671040 | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | resetPodcastFetchStatus | 重置播客获取失败状态(允许重新刷新) | async resetPodcastFetchStatus(podcastId: string): Promise<void> {
await this.dbService.updatePodcastFetchStatus(podcastId, false);
console.info(`[PodcastService] Reset fetch status for podcast: ${podcastId}`);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resetPodcastFetchStatus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_pa... | async resetPodcastFetchStatus(podcastId: string): Promise<void> {
await this.dbService.updatePodcastFetchStatus(podcastId, false);
console.info(`[PodcastService] Reset fetch status for podcast: ${podcastId}`);
} | https://github.com/pangpang20/antennaPodHM | ab83cd2ad6ba4a6b3539ee29692994380b366121 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseTypes.ets | arkts | createUserSettingsRecord | 创建用户设置数据库记录 | static createUserSettingsRecord(): UserSettingsDatabaseRecord {
return {
id: '',
userId: '',
settingKey: '', // 使用settingKey字段
settingValue: '', // 使用settingValue字段
settingType: 'string', // 使用settingType字段
description: '',
createTime: 0,
updateTime: 0
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createUserSettingsRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Le... | static createUserSettingsRecord(): UserSettingsDatabaseRecord {
return {
id: '',
userId: '',
settingKey: '', // 使用settingKey字段
settingValue: '', // 使用settingValue字段
settingType: 'string', // 使用settingType字段
description: '',
createTime: 0,
updateTime: 0
... | https://github.com/DaLongZhuaZi/manxia | d342f94b2113fe61f3878805273e606da02938f6 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/uploadanddownload/RequestDownload.ets | arkts | downloadFile | 失败回调
下载文件 | async downloadFile(folder: string, url: string,
callback: (progress: number, isSuccess: boolean, localPath: string) => void) {
logger.info(TAG, 'downloadFile,url:' + url);
// Found an ongoing download task, prompted and returned.
let tasks = await request.agent.search({
state: request.agent.Stat... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left downloadFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left folder AST#identifier#Right AST#type_annotation#Left AST#... | async downloadFile(folder: string, url: string,
callback: (progress: number, isSuccess: boolean, localPath: string) => void) {
logger.info(TAG, 'downloadFile,url:' + url);
// Found an ongoing download task, prompted and returned.
let tasks = await request.agent.search({
state: request.agent.Stat... | https://github.com/openharmony/applications_app_samples | 4a222bc8512d3c00ee3003d23e259b1ebc1c523a | github |
HarmonyOS_Samples/BestPracticeSnippets | DealStrideSolution/entry/src/main/ets/utils/CameraServiceThree.ets | arkts | onImageArrival | [Start onImageArrival_start] | onImageArrival(receiver: image.ImageReceiver): void {
receiver.on('imageArrival', () => {
receiver.readNextImage((err: BusinessError, nextImage: image.Image) => {
if (err || nextImage === undefined) {
Logger.error(TAG, `requestPermissionsFromUser call Failed! error: ${err.code}`);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onImageArrival AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left receiver AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left image AST#identifier#Right... | onImageArrival(receiver: image.ImageReceiver): void {
receiver.on('imageArrival', () => {
receiver.readNextImage((err: BusinessError, nextImage: image.Image) => {
if (err || nextImage === undefined) {
Logger.error(TAG, `requestPermissionsFromUser call Failed! error: ${err.code}`);
... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | e7f0d8d07453ba7d177195b59f14715512cfee44 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistorian.ets | arkts | historyChunkName | Helpers
Gets the history chunk name of a given chunk.
@param timestamp The timestamp.
@returns The chunk name. | private historyChunkName(timestamp: number) {
const date = new Date(timestamp);
return `history_${date.getUTCFullYear()}_${(date.getUTCMonth() + 1).toString().padStart(2, '0')}.txt`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left historyChunkName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | private historyChunkName(timestamp: number) {
const date = new Date(timestamp);
return `history_${date.getUTCFullYear()}_${(date.getUTCMonth() + 1).toString().padStart(2, '0')}.txt`;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 8185c7d090d3e1e66e5e46f7206fff5a059bce92 | github |
HarmonyOS_Samples/BestPracticeSnippets | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | getInstance | Get the singleton of LRUCacheUtil | public static getInstance(): LRUCacheUtil {
if (!LRUCacheUtil.instance) {
LRUCacheUtil.instance = new LRUCacheUtil();
}
return LRUCacheUtil.instance;
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): LRUCacheUtil {
if (!LRUCacheUtil.instance) {
LRUCacheUtil.instance = new LRUCacheUtil();
}
return LRUCacheUtil.instance;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 1557b6c77198d0f512bb00bb0bda249b47365c45 | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/Logger.ets | arkts | warn | Writes a warn line to hilog; joins all parts with " | ".
@param args Text segments to log. | public static warn(...args: Object[]): void {
hilog.warn(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left warn AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#.... | public static warn(...args: Object[]): void {
hilog.warn(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 959cea681f84126416fd2930e649ca45c360a59f | gitcode |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets | arkts | decelerate | 减速插值器
动画开始快,然后减速 | static decelerate(factor: number = 1.0): curves.ICurve {
return AnimationInterpolator.cubicBezier(0, 0, (1 - factor) * 0.6, 1);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left decelerate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left factor AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi... | static decelerate(factor: number = 1.0): curves.ICurve {
return AnimationInterpolator.cubicBezier(0, 0, (1 - factor) * 0.6, 1);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 1da53970ac86635411a9cb579f2064e38a17e183 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new InvalidStoreAccessError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super("InvalidStoreAccessError", message, options)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super("InvalidStoreAccessError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 3b656a69056cf4138901d2b7ab9c8f60370c09d5 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/mindsphere/MindSporeLiteEngine.ets | arkts | checkModelFile | ==================== 私有方法 ==================== | private async checkModelFile(path: string): Promise<boolean> {
try {
// 实际项目中应该检查文件是否存在
// 这里默认返回false,表示使用规则引擎
return false;
} catch (e) {
return false;
}
} | 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 checkModelFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left :... | private async checkModelFile(path: string): Promise<boolean> {
try {
// 实际项目中应该检查文件是否存在
// 这里默认返回false,表示使用规则引擎
return false;
} catch (e) {
return false;
}
} | https://github.com/LJ666-ui/harmony-health-care | 11adfc3a7a2175c245b4e81655eb0cb9f6c30f27 | github |
openharmony-sig/applications_compass | feature/compass/src/main/ets/controller/CompassController.ets | arkts | scalPosition | Latitude and latitude numerical conversion. | public scalPosition(postion: number) {
let str = Math.abs(postion);
let degree = parseInt(str.toString());
let minute = parseInt(((str % 1) * this.minute).toString());
let second = Math.round(((((str % 1) * this.minute) % 1) * this.minute));
return `${degree}°${minute}′${second}″`;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left scalPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left postion AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | public scalPosition(postion: number) {
let str = Math.abs(postion);
let degree = parseInt(str.toString());
let minute = parseInt(((str % 1) * this.minute).toString());
let second = Math.round(((((str % 1) * this.minute) % 1) * this.minute));
return `${degree}°${minute}′${second}″`;
} | https://gitee.com/openharmony-sig/applications_compass.git | 3bf1b2afee1bda0ff7dd34314858713a0b913069 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setCenterTextTypeface | sets the typeface for the center-text paint
@param t | public setCenterTextTypeface(t: FontFamily): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCenterTextTypeface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setCenterTextTypeface(t: FontFamily): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 11d265452c576f9f95db71bdf5475cdac4f9bcd3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Network/ProxyManager.ets | arkts | isEnabled | 检查代理是否启用 | isEnabled(): boolean {
return this.config.enabled;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | isEnabled(): boolean {
return this.config.enabled;
} | https://github.com/DaLongZhuaZi/manxia | 6f30738b0376dd6e80c5c848d89291f237bc9e4f | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets | arkts | aboutToAppear | 初始化示例数据 | aboutToAppear() {
this.initializeSampleEvents()
// 从数据库加载事件数据
this.loadEventsFromDatabase();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.initializeSampleEvents()
// 从数据库加载事件数据
this.loadEventsFromDatabase();
} | https://gitcode.com/openharmony/codelabs | 7ef3320b75d50efa139ed83b053afb6ad7bf25f7 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | loadDeadzoneSetting | ==================== 摇杆/扳机死区处理 ====================
加载死区设置 | private async loadDeadzoneSetting(): Promise<void> {
const percentage = await PreferencesUtil.get<number>(SettingsKeys.DEADZONE, 7);
this.stickDeadzone = Math.max(1, percentage) / 100.0;
console.info(`[GAMEPAD] 摇杆死区: ${percentage}% (radius=${this.stickDeadzone})`);
} | 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 loadDeadzoneSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async loadDeadzoneSetting(): Promise<void> {
const percentage = await PreferencesUtil.get<number>(SettingsKeys.DEADZONE, 7);
this.stickDeadzone = Math.max(1, percentage) / 100.0;
console.info(`[GAMEPAD] 摇杆死区: ${percentage}% (radius=${this.stickDeadzone})`);
} | https://github.com/AlkaidLab/moonlight-harmony | 9391919d7fe2ce01a5649541a854304d8ae8c335 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | setCryptoParams | 存储密码学参数 (使用 insertSync 以触发云同步) | setCryptoParams(salt: string, verifier: string): void {
if (!this.store) { return; }
try {
const vb1: relationalStore.ValuesBucket = { 'id': 'salt', 'key': 'crypto_salt', 'value': salt };
const vb2: relationalStore.ValuesBucket = { 'id': 'verif', 'key': 'crypto_verifier', 'value': verifier };
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCryptoParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left salt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,... | setCryptoParams(salt: string, verifier: string): void {
if (!this.store) { return; }
try {
const vb1: relationalStore.ValuesBucket = { 'id': 'salt', 'key': 'crypto_salt', 'value': salt };
const vb2: relationalStore.ValuesBucket = { 'id': 'verif', 'key': 'crypto_verifier', 'value': verifier };
... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | ae13513f5abea3bb4f0c855d5a8d9138b13ae463 | github |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | resetXY | 初始化 X Y | resetXY(): void {
this.positionY = -this.circleRadius
this.positionX = this.getAutoPositionX(0)
this.oldPositionX = 0
this.oldPositionY = 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetXY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | resetXY(): void {
this.positionY = -this.circleRadius
this.positionX = this.getAutoPositionX(0)
this.oldPositionX = 0
this.oldPositionY = 0
} | https://gitcode.com/arkui-x/samples | 7f113f304d4fb3923da8fd1446ac4bde39dffce3 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Errors.ets | arkts | constructor | The AggregateError() constructor creates AggregateError
object.
@param errors An iterable of errors, may not actually be Error
instances.
@param s An human-readable description of the aggregate error.
@param cause A property indicating the specific cause of the
error. When catching and re-throwing an error with a
more-... | constructor(errors: Error[], s: String, cause: Object) {
super(s, cause);
this.errors = errors;
this.name = "AggregateError";
} | 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 errors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Le... | constructor(errors: Error[], s: String, cause: Object) {
super(s, cause);
this.errors = errors;
this.name = "AggregateError";
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2c42f649db66d67ac3fd1a683812b34704c2c427 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | setHeaders | 设置请求头 | setHeaders(headers: Record<string, string>): ImageRequestBuilder {
this.headers = headers;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left headers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record A... | setHeaders(headers: Record<string, string>): ImageRequestBuilder {
this.headers = headers;
return this;
} | https://github.com/DaLongZhuaZi/manxia | 50fd61f8bd2c247f5e63f8b5cda2a9c381fa82bb | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t5_depthLimit | T5: Depth limit | t5_depthLimit(): void {
const opts: ParseOptions = { depth: 2 };
const r: Record<string, Object> = parse('a[b][c][d][e]=v', opts);
const expected: string = '{"a":{"b":{"c[d][e]":"v"}}}';
const actual: string = JSON.stringify(r);
this.record('T5 Depth limit (2)', expected === actual, expected, actu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t5_depthLimit 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... | t5_depthLimit(): void {
const opts: ParseOptions = { depth: 2 };
const r: Record<string, Object> = parse('a[b][c][d][e]=v', opts);
const expected: string = '{"a":{"b":{"c[d][e]":"v"}}}';
const actual: string = JSON.stringify(r);
this.record('T5 Depth limit (2)', expected === actual, expected, actu... | https://github.com/wgli-collab/qs-arkts | 22bf0a1209a56390888533d1aa3c60538ed68cfa | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/model/Recording.ets | arkts | getFileSizeText | 获取文件大小的格式化显示 | getFileSizeText(): string {
if (this.fileSize < 1024) {
return `${this.fileSize} B`
} else if (this.fileSize < 1024 * 1024) {
return `${(this.fileSize / 1024).toFixed(1)} KB`
} else {
return `${(this.fileSize / 1024 / 1024).toFixed(1)} MB`
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFileSizeText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem... | getFileSizeText(): string {
if (this.fileSize < 1024) {
return `${this.fileSize} B`
} else if (this.fileSize < 1024 * 1024) {
return `${(this.fileSize / 1024).toFixed(1)} KB`
} else {
return `${(this.fileSize / 1024 / 1024).toFixed(1)} MB`
}
} | https://gitcode.com/openharmony/codelabs | 6ef7b56c41f5250aaf8e13086b658293759d5644 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/mapping/TypeConverter.ets | arkts | intToBoolean | 整数转换为 boolean
@param value 整数值
@returns true 如果值不为 0,否则 false | static intToBoolean(value: number): boolean {
return value !== 0
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left intToBoolean 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 nu... | static intToBoolean(value: number): boolean {
return value !== 0
} | https://github.com/offlinecat-dev/OCNetORM | 06e6dd51549f16b2ad3e6b2bb92b67f201ea8853 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | getFavoriteBooksSorted | 获取收藏书籍(支持排序) | async getFavoriteBooksSorted(sortType: string = 'lastRead', ascending: boolean = false): Promise<NovelBook[]> {
const store = this.getStore();
let orderBy = 'lastReadTime DESC';
switch (sortType) {
case 'lastRead':
orderBy = ascending ? 'lastReadTime ASC' : 'lastReadTime DESC';
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFavoriteBooksSorted AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sortType AST#identifier#Right AST#type_annotation#Left A... | async getFavoriteBooksSorted(sortType: string = 'lastRead', ascending: boolean = false): Promise<NovelBook[]> {
const store = this.getStore();
let orderBy = 'lastReadTime DESC';
switch (sortType) {
case 'lastRead':
orderBy = ascending ? 'lastReadTime ASC' : 'lastReadTime DESC';
... | https://github.com/DaLongZhuaZi/manxia | fcd2c106ec1cfe35f6d62a754347c0fbba39ef08 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test25_original_index.ets | arkts | testNestedMap | --- Nested Map with string values --- | function testNestedMap(): string {
let m: Map<string, Map<string, number>> = new Map<string, Map<string, number>>();
let inner: Map<string, number> = new Map<string, number>();
inner.set('x', 100);
inner.set('y', 200);
m.set('point', inner);
let retrieved: Map<string, number> | undefined = m.get('point');
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedMap 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_ty... | function testNestedMap(): string {
let m: Map<string, Map<string, number>> = new Map<string, Map<string, number>>();
let inner: Map<string, number> = new Map<string, number>();
inner.set('x', 100);
inner.set('y', 200);
m.set('point', inner);
let retrieved: Map<string, number> | undefined = m.get('point');
... | https://github.com/miaochiahao/ark-ghidra | 2349a10042a6ae893df1b88a3c52506e4b1241bf | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | includes | The includes() method performs a case-sensitive search to determine whether one string may
be found within another string, returning true or false as appropriate. | public includes(str: String): boolean {
return this.indexOf(str) == -1 ? false : true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String A... | public includes(str: String): boolean {
return this.indexOf(str) == -1 ? false : true;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 799b6c2364877ab469d55a15a12c5655f72ccfd0 | gitee |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | setCurrentSong | 设置当前播放歌曲 | setCurrentSong(song: SongInfo): void {
this.audioManager.setCurrentSong(song);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCurrentSong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SongInfo AST#identifier#Right AST#)#Left ... | setCurrentSong(song: SongInfo): void {
this.audioManager.setCurrentSong(song);
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 3f8dc7c9b2c3da9f0e544af1f8c2d467fa8f99d3 | github |
Countly/countly-sdk-hos | library/src/ohosTest/ets/test/TestHelpers.ets | arkts | fakeContext | A non-null fake context placeholder, the in-memory storage ignores it. | function fakeContext(): common.Context {
return {} as common.Context;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fakeContext 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#nested_type_ide... | function fakeContext(): common.Context {
return {} as common.Context;
} | https://github.com/Countly/countly-sdk-hos | 817078a44cde32ff27a6e71818e757605c4bc5c0 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AdviceFeedback.ets | arkts | fromJSON | 从JSON反序列化 | static fromJSON(data: AdviceFeedbackJSON): AdviceFeedback {
return new AdviceFeedback(
data.feedbackId,
data.userId,
data.adviceId,
data.adviceType,
data.categoryId,
data.categoryName,
data.suggestedBudget,
data.originalBudget,
data.feedbackStatus,
data.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AdviceF... | static fromJSON(data: AdviceFeedbackJSON): AdviceFeedback {
return new AdviceFeedback(
data.feedbackId,
data.userId,
data.adviceId,
data.adviceType,
data.categoryId,
data.categoryName,
data.suggestedBudget,
data.originalBudget,
data.feedbackStatus,
data.... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 176303fe0beac4bd3fcb7863e1af6e6cb916418c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | getLoginFormData | 获取保存的登录表单数据
@param sourceId 书源ID
@returns 保存的表单数据,如果没有则返回空对象 | getLoginFormData(sourceId: string): Record<string, string> {
return this.loginFormDataStore.get(sourceId) || {};
} | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLoginFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | getLoginFormData(sourceId: string): Record<string, string> {
return this.loginFormDataStore.get(sourceId) || {};
} | https://github.com/DaLongZhuaZi/manxia | 893bd10709698d75cbdc5fade90caef1b80bcb5c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | setDisplayMode | 根据显示模式枚举设置显示模式
@param mode 显示模式
@param uiContext 可选的UIContext,推荐在组件中传入 | static setDisplayMode(mode: DisplayMode, uiContext?: UIContext): void {
switch (mode) {
case DisplayMode.FULL_IMMERSIVE:
WindowManager.setFullImmersive(uiContext);
break;
case DisplayMode.HIDE_STATUS_BAR:
WindowManager.hideStatusBar(uiContext);
break;
case Display... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDisplayMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left D... | static setDisplayMode(mode: DisplayMode, uiContext?: UIContext): void {
switch (mode) {
case DisplayMode.FULL_IMMERSIVE:
WindowManager.setFullImmersive(uiContext);
break;
case DisplayMode.HIDE_STATUS_BAR:
WindowManager.hideStatusBar(uiContext);
break;
case Display... | https://github.com/DaLongZhuaZi/manxia | 9153ad5fd244d3d28a587a4105b266e39ebfe524 | github |
PollenWang6/HiXD | entry/src/main/ets/services/VersionService.ets | arkts | getCurrentVersion | 获取当前版本号 | static async getCurrentVersion(): Promise<string> {
try {
const info = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT);
return info.versionName;
} catch (_) {
return '0.0.0';
}
} | 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 getCurrentVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | static async getCurrentVersion(): Promise<string> {
try {
const info = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT);
return info.versionName;
} catch (_) {
return '0.0.0';
}
} | https://github.com/PollenWang6/HiXD | f1c5fb458acd5a234c089ec198d578bf4b8e3e40 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | setClientDecoding | Set client decoding (for background mode)
When disabled, stops receiving graphics updates but keeps audio | static setClientDecoding(inst: number, enable: boolean): number {
if (!LibFreeRDP.ensureNativeReady()) {
return 0;
}
return freerdpNative!.freerdpSetClientDecoding(inst, enable);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setClientDecoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static setClientDecoding(inst: number, enable: boolean): number {
if (!LibFreeRDP.ensureNativeReady()) {
return 0;
}
return freerdpNative!.freerdpSetClientDecoding(inst, enable);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 65fefb9941dfefa6c7d1c2d10e98f998141ad807 | github |
ibestservices/ibest-ui | library/src/main/ets/components/cascader/index.ets | arkts | selectItem | 选中item | selectItem(index1: number, index2: number, item: IBestCascaderOptionInstance) {
// 如果选中索引小于当前tab数量,清空tab在索引后的所有项
if (index1 < this.optionsInstance.length - 1) {
this.tabList.splice(index1 + 1)
this.optionsInstance.splice(index1 + 1)
}
// 设置当前列表项为选中状态
this.optionsInstance[index1].forEach((item: IBestCas... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ... | selectItem(index1: number, index2: number, item: IBestCascaderOptionInstance) {
// 如果选中索引小于当前tab数量,清空tab在索引后的所有项
if (index1 < this.optionsInstance.length - 1) {
this.tabList.splice(index1 + 1)
this.optionsInstance.splice(index1 + 1)
}
// 设置当前列表项为选中状态
this.optionsInstance[index1].forEach((item: IBestCas... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/cascader/index.ets#L156-L182 | 03db2bca20b9aea1134008038397b27aba8b8fe9 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets | arkts | onAttachedToNAPI | Invoked when the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@link
DartExecutor} attaches to JNI.
<p>When attached to JNI, this {@link DartExecutor} begins handling 2-way communication to/from
the Dart execution context. This communication is facilitate via 2 APIs:
<ul>
<li>{@link BinaryMessenger}... | onAttachedToNAPI(): void {
Log.d(TAG, "Attached to NAPI. Registering the platform message handler for this Dart execution context.");
this.flutterNapi.setPlatformMessageHandler(this.dartMessenger);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onAttachedToNAPI 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... | onAttachedToNAPI(): void {
Log.d(TAG, "Attached to NAPI. Registering the platform message handler for this Dart execution context.");
this.flutterNapi.setPlatformMessageHandler(this.dartMessenger);
} | https://gitee.com/openharmony-sig/flutter_engine.git | 841c1b5c4da46dc1717e6652a2769e07fbbc4f36 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | flat | Creates a new Array with all sub-array elements concatenated
@returns a flattened Array | public flat(): Array<Object | null> {
return this.flat(1)
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left flat AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right ... | public flat(): Array<Object | null> {
return this.flat(1)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cc33e8d9095632bc9c9bca3d53b64b7aa881ab18 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | asUintN | Clamps a BigInt to an unsigned integer with the specified number of bits.
@param { long } bits The number of bits for the unsigned integer representation.
@param { BigInt } num The BigInt value to clamp.
@returns { BigInt } A BigInt value clamped to the specified number of bits as an unsigned integer.
@throws { RangeEr... | public static asUintN(bits: long, num: BigInt): BigInt {
if (bits == 0 || num.isZero()) {
return 0n
}
if (bits < 0 || bits > Double.MAX_SAFE_INTEGER) {
throw new RangeError('bits < 0 or bits > Double.MAX_SAFE_INTEGER')
}
if (bits >= num.length() * BigI... | 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 asUintN AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bits AST#identifier#Right AST#:#Left : AST#:#Ri... | public static asUintN(bits: long, num: BigInt): BigInt {
if (bits == 0 || num.isZero()) {
return 0n
}
if (bits < 0 || bits > Double.MAX_SAFE_INTEGER) {
throw new RangeError('bits < 0 or bits > Double.MAX_SAFE_INTEGER')
}
if (bits >= num.length() * BigI... | https://gitcode.com/iop123123/arkts-static-skills | 8d06daa25444d6d56e332ee2bcd8b1c368b6e835 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | set | Copies all elements of arr to the current BigInt64Array.
@param arr array to copy data from | public set(arr: BigInt[]): void {
this.set(arr, 0)
} | 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 arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: BigInt[]): void {
this.set(arr, 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | db4f52efaf8f4ab42a004377fa9991fdfcfeb01f | gitee |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/MemberOrdering/ets/MemberOrdering.ets | arkts | aTest | -> method | public static aTest(): void {
console.info('static method');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left aTest AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right ... | public static aTest(): void {
console.info('static method');
} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | abd2cb0abb8316c6d1e0d30b298614a18f2fd76d | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/PerformanceMonitor.ets | arkts | printStats | 打印性能统计报告 | static printStats(): void {
console.log('\n========== 性能统计报告 ==========');
if (PerformanceMonitor.stats.size === 0) {
console.log('暂无性能数据');
return;
}
PerformanceMonitor.stats.forEach((stats: PerformanceStats, methodName: string) => {
console.log(`\n方法: ${methodName}`);
c... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left printStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static printStats(): void {
console.log('\n========== 性能统计报告 ==========');
if (PerformanceMonitor.stats.size === 0) {
console.log('暂无性能数据');
return;
}
PerformanceMonitor.stats.forEach((stats: PerformanceStats, methodName: string) => {
console.log(`\n方法: ${methodName}`);
c... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ef5cb12c46fee99fd5184584e5ca565f4eb76779 | github |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | trim | 去除字符串两端的空格
@param str
@returns | static trim(str: string): string {
return str.trim();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left trim AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | static trim(str: string): string {
return str.trim();
} | https://github.com/tdcare/tdwebrtc | 196c34619d05c9f490bbbec0609eb6e359fcdb33 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/DataCrypto.ets | arkts | base64Decode | Base64 解码 | private base64Decode(encoded: string): Uint8Array {
const helper = new util.Base64Helper();
return helper.decodeSync(encoded);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left base64Decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encoded AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | private base64Decode(encoded: string): Uint8Array {
const helper = new util.Base64Helper();
return helper.decodeSync(encoded);
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | e6e2f108456b1c806df8564bb2999cfe3c5295ec | github |
HarmonyOS_Samples/BestPracticeSnippets | TaskPoolPractice/entry/src/main/ets/pages/sample4/Sample4.ets | arkts | correctConcurrentFunc | [End sample_6]
[Start sample_4]
Sample4.ets | @Concurrent
function correctConcurrentFunc() {
let count: number = 0;
let id = setInterval(() => {
count++;
if (count == 10) {
hilog.info(0xFF00, 'sampleTag', "the value has reached the threshold");
clearInterval(id);
}
}, 1000);
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left correctConcurrentFunc AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri... | @Concurrent
function correctConcurrentFunc() {
let count: number = 0;
let id = setInterval(() => {
count++;
if (count == 10) {
hilog.info(0xFF00, 'sampleTag', "the value has reached the threshold");
clearInterval(id);
}
}, 1000);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | b6a9b99d0a7754a9a852cdae1bb814dbbe934d81 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/UIContextManager.ets | arkts | showToast | 显示Toast | public showToast(config: ToastConfig): void {
if (!this.uiContext) {
logger.warn(TAG, 'UI上下文未设置,无法显示Toast');
return;
}
try {
// 注意:实际的Toast实现可能需要根据HarmonyOS的具体API调整
logger.info(TAG, `显示Toast: ${config.message}`);
// 这里应该调用实际的Toast API
} catch (error) {
logger.error... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Toas... | public showToast(config: ToastConfig): void {
if (!this.uiContext) {
logger.warn(TAG, 'UI上下文未设置,无法显示Toast');
return;
}
try {
// 注意:实际的Toast实现可能需要根据HarmonyOS的具体API调整
logger.info(TAG, `显示Toast: ${config.message}`);
// 这里应该调用实际的Toast API
} catch (error) {
logger.error... | https://github.com/DaLongZhuaZi/manxia | d3d2745b2d99f1486957f3750eda4fb73f7b60e3 | github |
huaweicloud/huaweicloud-iot-device-sdk-arkts | huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets | arkts | onWrite | 写属性。收到平台下发的写属性操作时此接口被自动调用。
如果用户希望在写属性时增加额外处理,可以重写此接口
@param properties 平台期望属性的值
@return 操作结果 | onWrite(properties: object): IotResult {
let changeProps: string[] = [];
let result = IotResult.SUCCESS;
Object.keys(properties).every((propertyName: string) => {
const field = this.writeableFields.get(propertyName);
if (field === null || field === undefined) {
LogUtil.error(`field not... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWrite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left properties AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#object#Left object AST#object#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig... | onWrite(properties: object): IotResult {
let changeProps: string[] = [];
let result = IotResult.SUCCESS;
Object.keys(properties).every((propertyName: string) => {
const field = this.writeableFields.get(propertyName);
if (field === null || field === undefined) {
LogUtil.error(`field not... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts | 08ceb319ac0a9e103cf32bbe0c98e47774a56cb9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | $_invoke | Creates a new instance of BigInt from string
@param { string } value string value
@returns { BigInt } A new BigInt instance from string
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: string): BigInt {
return new BigInt(value)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke 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... | static $_invoke(value: string): BigInt {
return new BigInt(value)
} | https://gitcode.com/iop123123/arkts-static-skills | d5f957503ff1ba092626aa971ffec26cff78d351 | gitcode |
cduestc-course/ArkLearn | entry/src/main/ets/pages/02/basic.ets | arkts | fn | // 6 函数 | function fn () {
console.log('五角星', '☆')
console.log('五角星', '☆☆')
console.log('五角星', '☆☆☆')
console.log('五角星', '☆☆☆☆')
console.log('五角星', '☆☆☆☆☆')
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fn 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#expression_statement#Lef... | function fn () {
console.log('五角星', '☆')
console.log('五角星', '☆☆')
console.log('五角星', '☆☆☆')
console.log('五角星', '☆☆☆☆')
console.log('五角星', '☆☆☆☆☆')
} | https://github.com/cduestc-course/ArkLearn | b840d2620ddb135d79dede33493b1f5fd32a3400 | github |
openharmony/codelabs | ETSUI/LifeBalance/entry/src/main/ets/common/database/RdbManager.ets | arkts | init | 初始化数据库 (通常在 UIAbility 或页面加载时调用) | async init(context: common.Context): Promise<void> {
if (this.rdbStore) {
return;
}
const config: relationalStore.StoreConfig = {
name: 'LifeBalance.db', // 数据库文件名
securityLevel: relationalStore.SecurityLevel.S1
};
try {
this.rdbStore = await relationalStore.getRdbStore(c... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_an... | async init(context: common.Context): Promise<void> {
if (this.rdbStore) {
return;
}
const config: relationalStore.StoreConfig = {
name: 'LifeBalance.db', // 数据库文件名
securityLevel: relationalStore.SecurityLevel.S1
};
try {
this.rdbStore = await relationalStore.getRdbStore(c... | https://gitcode.com/openharmony/codelabs | 14fbc97c7a3c92f992d4d386fda77a28ed8a9896 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | setMaterialType | 设置材质类型 | async setMaterialType(materialType: number): Promise<void> {
await this.setNumber(PreferenceKeys.MATERIAL_TYPE, materialType)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setMaterialType AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left materialType AST#identifier#Right AST#type_annotation#Left AST#... | async setMaterialType(materialType: number): Promise<void> {
await this.setNumber(PreferenceKeys.MATERIAL_TYPE, materialType)
} | https://github.com/LongLiveY96/chatcube | 057fd90dd4af03052125286d84735f37a06bf887 | github |
genjishare/snake-game | entry/src/main/ets/common/service/EventBus.ets | arkts | on | 订阅事件
@param event 事件名称
@param callback 回调函数 | public on<T extends Object | null = null>(event: string, callback: (data: T) => void): void {
if (!this.listeners.has(event)) {
this.listeners.set(event, []);
}
// 类型转换确保类型兼容性
this.listeners.get(event)?.push(callback as (data: Object | null) => void);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left on AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#type_identifier#Left Object AST#type_ide... | public on<T extends Object | null = null>(event: string, callback: (data: T) => void): void {
if (!this.listeners.has(event)) {
this.listeners.set(event, []);
}
// 类型转换确保类型兼容性
this.listeners.get(event)?.push(callback as (data: Object | null) => void);
} | https://github.com/genjishare/snake-game | 0cc9c62e80410a783bd1ae4426d60bc0460edf92 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/DataStorageManager.ets | arkts | remove | 删除数据
@param storeName 存储文件名
@param key 键名 | async remove(storeName: string, key: string): Promise<void> {
try {
const prefs = await this.getPreferences(storeName);
await prefs.delete(key);
await prefs.flush();
console.log(`[DataStorageManager] Removed: ${storeName}/${key}`);
} catch (error) {
console.error(`[DataStorageMan... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left remove AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left storeName AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async remove(storeName: string, key: string): Promise<void> {
try {
const prefs = await this.getPreferences(storeName);
await prefs.delete(key);
await prefs.flush();
console.log(`[DataStorageManager] Removed: ${storeName}/${key}`);
} catch (error) {
console.error(`[DataStorageMan... | https://github.com/the-wwyang/kids-learning-app | 2809e6a952fcc96982e74a30851dd7790320fa74 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | getRdbStore | 通过accountTable执行RS中的getRS,获取RS对象 | getRdbStore(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier... | getRdbStore(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback)
} | https://gitee.com/openharmony/vendor_unionman.git | 794df8081f6456b88a1da455c7da3c33495f160c | gitee |
CLMC2025/Vignette | entry/src/main/ets/utils/SecureStorage.ets | arkts | injectContext | Inject ability context for secure storage
@param context The UI ability context to use | injectContext(context: common.UIAbilityContext): void {
this.abilityContext = context;
console.log('[SecureStorage] injectContext: Context injected successfully');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left injectContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common AST#i... | injectContext(context: common.UIAbilityContext): void {
this.abilityContext = context;
console.log('[SecureStorage] injectContext: Context injected successfully');
} | https://github.com/CLMC2025/Vignette | db635c7ee5cbbb4e7bfd07b735a61d611a6277e9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | println | Prints an object followed by a newline to stdout
@param {Any | string | boolean | byte | short | char | int | long | float | double} i - The value to print
@returns {void}
@public
@deprecated Will be removed in future. Please use log instead | public println(i: boolean): void {
this.print(i)
this.println()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST... | public println(i: boolean): void {
this.print(i)
this.println()
} | https://gitcode.com/iop123123/arkts-static-skills | b560ed95a9bdfaeea3d96232c33a64561e8137f6 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/components/SessionView.ets | arkts | zoomIn | Zoom in | zoomIn(): void {
this.setViewScale(this.viewScale * 1.25);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left zoomIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left ... | zoomIn(): void {
this.setViewScale(this.viewScale * 1.25);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 173839b84a009957b7eae68b6eb4a998bab24db9 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.