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 |
|---|---|---|---|---|---|---|---|---|---|---|
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | getVMSharedPath | 获取 VM 的共享目录路径 | public getVMSharedPath(vmName: string): string {
return `${this.config.vmDisksPath}/${vmName}/shared`;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getVMSharedPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public getVMSharedPath(vmName: string): string {
return `${this.config.vmDisksPath}/${vmName}/shared`;
} | https://github.com/AetheriumSimulator/qemu-hmos | f9ffe973841160dee9ba3faf49719302454ddfef | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets | arkts | isInPrivacyMode | 获取当前是否处于隐私模式 | public isInPrivacyMode(): boolean {
return this.isPrivacyMode;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isInPrivacyMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | public isInPrivacyMode(): boolean {
return this.isPrivacyMode;
} | https://github.com/DaLongZhuaZi/manxia | af88a66c068489c8df39575adfec06dbfd30421f | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | dealSpecialPhoneNumber | Handle invalid phone numbers that contain #, *, and dots in redirection from other applications.
Replace them with spaces. | dealSpecialPhoneNumber() {
if (!this.isPhoneNumber(this.strContactsNumber)) {
this.strContactsNumber = this.replaceCode(this.strContactsNumber);
this.strContactsNumberFormat = this.replaceCode(this.strContactsNumberFormat);
if (this.strContactsName != common.string.EMPTY_STR) {
this.strC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left dealSpecialPhoneNumber 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_b... | dealSpecialPhoneNumber() {
if (!this.isPhoneNumber(this.strContactsNumber)) {
this.strContactsNumber = this.replaceCode(this.strContactsNumber);
this.strContactsNumberFormat = this.replaceCode(this.strContactsNumberFormat);
if (this.strContactsName != common.string.EMPTY_STR) {
this.strC... | https://gitee.com/openharmony/applications_mms.git | a61231ce89c79642b7aa6242efa0deb4bbf6ee24 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/AITaskService.ets | arkts | cleanTitle | 清理标题(去引号、换行、前缀、思考标签) | private cleanTitle(rawTitle: string): string {
let title = rawTitle.trim()
// 去除模型思考标签(Qwen3 等模型的 <think>...</think>)
title = title.replace(/<think>[\s\S]*?<\/think>/g, '').trim()
// 去除首尾引号
title = title.replace(/^["'""'']+|["'""'']+$/g, '')
// 去除换行,只取第一行有效内容
const lines = title.split(/... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left cleanTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rawTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | private cleanTitle(rawTitle: string): string {
let title = rawTitle.trim()
// 去除模型思考标签(Qwen3 等模型的 <think>...</think>)
title = title.replace(/<think>[\s\S]*?<\/think>/g, '').trim()
// 去除首尾引号
title = title.replace(/^["'""'']+|["'""'']+$/g, '')
// 去除换行,只取第一行有效内容
const lines = title.split(/... | https://github.com/LongLiveY96/chatcube | 82cbb361a8aaf1e858838e52d869a893b2718abe | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | restore | 恢复已删除标签 - 保留自定义实现(需要检查 user_id)
@param userId 用户ID
@param tagId 标签ID | static async restore(userId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `UPDATE tags SET is_deleted = 0, updated_at = ? WHERE tag_id = ? AND user_id = ?`;
try {
await store.executeSql(sql, [now, tagId, us... | 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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#R... | static async restore(userId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `UPDATE tags SET is_deleted = 0, updated_at = ? WHERE tag_id = ? AND user_id = ?`;
try {
await store.executeSql(sql, [now, tagId, us... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | c3112230464476d4237422a890e3ca6ebccbdafa | github |
erosTeam/NextE | shared/src/main/ets/parser/EhUconfigParser.ets | arkts | parseLanguages | The Excluded Languages section is a table: each <tr> has the language name in its first <td>, then
checkboxes for original (id < 1024) / translated (1024..2047) / rewrite (>= 2048). Build one toggle
per present checkbox carrying the language name + variant column. | private static parseLanguages(html: string): EhUconfigToggleItem[] {
const out: EhUconfigToggleItem[] = []
const start: number = html.indexOf('Excluded Languages')
if (start < 0) {
return out
}
const end: number = html.indexOf('</table>', start)
const region: string = end > start ? html.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseLanguages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left ... | private static parseLanguages(html: string): EhUconfigToggleItem[] {
const out: EhUconfigToggleItem[] = []
const start: number = html.indexOf('Excluded Languages')
if (start < 0) {
return out
}
const end: number = html.indexOf('</table>', start)
const region: string = end > start ? html.... | https://github.com/erosTeam/NextE | 366ff93bb0225039cec5a71deb85c96264a27df0 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnRadioViewModel.ets | arkts | setRadioValue2 | 设置单选框组2的选中值
@param value 新的选中值 | setRadioValue2(value: string): void {
this.radioValue2 = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRadioValue2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )... | setRadioValue2(value: string): void {
this.radioValue2 = value;
} | https://github.com/codelably/tuniao-ui | 14edd18240a461fc78c088b9cc51b2d89b89e0f2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/PaginationHandler.ets | arkts | extractField | 从对象中提取字段值(支持嵌套路径) | private extractField(obj: any, path: string): any {
if (!obj || !path) {
return undefined;
}
const keys = path.split('.');
let current = obj;
for (const key of keys) {
if (current && typeof current === 'object' && key in current) {
current = current[key];
} else {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left a... | private extractField(obj: any, path: string): any {
if (!obj || !path) {
return undefined;
}
const keys = path.split('.');
let current = obj;
for (const key of keys) {
if (current && typeof current === 'object' && key in current) {
current = current[key];
} else {
... | https://github.com/DaLongZhuaZi/manxia | 520e201b6ba4722da067b73d9edcb243fe1c82fc | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/ListPageViewModel.ets | arkts | redirectAddPage | Button for redirecting to the add page. | redirectAddPage(): void {
router.pushUrl({
url: CommonConstants.ADD_EDIT_URL,
params: {
isEdit: false
}
}).catch((err: BusinessError) => {
Logger.error(`pushUrl failed, code message is ${JSON.stringify(err)}`);
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left redirectAddPage 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_bl... | redirectAddPage(): void {
router.pushUrl({
url: CommonConstants.ADD_EDIT_URL,
params: {
isEdit: false
}
}).catch((err: BusinessError) => {
Logger.error(`pushUrl failed, code message is ${JSON.stringify(err)}`);
});
} | https://gitee.com/harmonyos/codelabs.git | ecd45a8d4ed3be9642324def1b8dc8599352633f | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/JSONPathParser.ets | arkts | parse | 解析JSONPath表达式
@param data JSON数据
@param path JSONPath表达式
@returns 解析结果 | static parse(data: Record<string, Object>, path: string): JSONPathResult {
try {
// 移除开头的$
let normalizedPath = path.trim();
if (normalizedPath.startsWith('$')) {
normalizedPath = normalizedPath.substring(1);
}
if (normalizedPath.startsWith('.')) {
normalizedPath = no... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | static parse(data: Record<string, Object>, path: string): JSONPathResult {
try {
// 移除开头的$
let normalizedPath = path.trim();
if (normalizedPath.startsWith('$')) {
normalizedPath = normalizedPath.substring(1);
}
if (normalizedPath.startsWith('.')) {
normalizedPath = no... | https://github.com/DaLongZhuaZi/manxia | a5e871ee4dd59c3e91f6a85e0dafc240debf625c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | executeUrlLogin | 执行URL登录 | private async executeUrlLogin(source: LegadoBookSource, formData: Record<string, string>): Promise<LoginResult> {
const inputKeys = Object.keys(formData);
logger.warn(
TAG,
`URL登录需要页面级WebView表单提交链路,当前NovelLoginManager无可绑定WebView: source=${source.bookSourceName}, fields=${inputKeys.join(',')}`
... | 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 executeUrlLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Lef... | private async executeUrlLogin(source: LegadoBookSource, formData: Record<string, string>): Promise<LoginResult> {
const inputKeys = Object.keys(formData);
logger.warn(
TAG,
`URL登录需要页面级WebView表单提交链路,当前NovelLoginManager无可绑定WebView: source=${source.bookSourceName}, fields=${inputKeys.join(',')}`
... | https://github.com/DaLongZhuaZi/manxia | 653d1bcf10dc3b2d13d4bc662857858ffbeaf03c | github |
silence17/harmonydemo | common_lib/src/main/ets/common/components/BuiText.ets | arkts | textStyle | 这2个 是一样的,只是不能同时设置Text和Span ,后续修改也要保持一致 | @Extend(Text)
function textStyle(structObject: TextStruct) {
.fontFamily(structObject.fontFamily as string)
.fontSize(structObject.fontSize)
.fontColor(structObject.color)
.fontWeight(structObject.bold ? 500 : 450)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function textStyle(structObject: TextStruct) {
.fontFamily(structObject.fontFamily as string)
.fontSize(structObject.fontSize)
.fontColor(structObject.color)
.fontWeight(structObject.bold ? 500 : 450)
} | https://github.com/silence17/harmonydemo | 2291271e01d8f1ea3206bfc86002f5377b5d7e5c | github |
Joker-x-dev/HarmonyKit | core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets | arkts | createItem | 新增一条 Demo 记录
@param {string} title - 标题
@param {string} description - 描述
@returns {Promise<number>} 新建记录主键 | async createItem(title: string, description: string = ""): Promise<number> {
const entity: DemoEntity = new DemoEntity();
entity.title = title;
entity.description = description;
return this.orm.insert(entity);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createItem AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async createItem(title: string, description: string = ""): Promise<number> {
const entity: DemoEntity = new DemoEntity();
entity.title = title;
entity.description = description;
return this.orm.insert(entity);
} | https://github.com/Joker-x-dev/HarmonyKit | 954823797e576fe5266f98aa82b25408b7171820 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | writableObjectMode | Returns boolean indicating whether it is in ObjectMode. | get writableObjectMode(): boolean {
return this.writableObjectModeInner;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left writableObjectMode 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#boo... | get writableObjectMode(): boolean {
return this.writableObjectModeInner;
} | https://gitcode.com/iop123123/arkts-static-skills | 68c3641d2c6ac767657019a97098d5a617396416 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | loadUsbDriverSetting | 加载 USB 驱动设置并决定输入模式
三种模式:
1. 纯 GCK 模式(默认):仅使用 Game Controller Kit,支持 USB + 蓝牙手柄
2. 混合模式(USB_DRIVER_ENABLED=true):GCK 处理输入 + USB 驱动提供震动/LED
3. 强制 USB 模式(FORCE_USB_DRIVER_ONLY=true):禁用 GCK,USB 驱动接管全部功能
优先级:FORCE_USB_DRIVER_ONLY > USB_DRIVER_ENABLED > 默认 GCK | private loadUsbDriverSetting(): void {
Promise.all([
PreferencesUtil.get<boolean>(SettingsKeys.USB_DRIVER_ENABLED, false),
PreferencesUtil.get<boolean>(SettingsKeys.FORCE_USB_DRIVER_ONLY, false)
]).then((results: boolean[]) => {
const usbEnabled = results[0];
const forceUsbOnly = resul... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadUsbDriverSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | private loadUsbDriverSetting(): void {
Promise.all([
PreferencesUtil.get<boolean>(SettingsKeys.USB_DRIVER_ENABLED, false),
PreferencesUtil.get<boolean>(SettingsKeys.FORCE_USB_DRIVER_ONLY, false)
]).then((results: boolean[]) => {
const usbEnabled = results[0];
const forceUsbOnly = resul... | https://github.com/AlkaidLab/moonlight-harmony | 36dc5c3e648ac2df99f2001fe4bbc1dfe6f6e320 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCommentViewModel.ets | arkts | openImagePreview | 打开图片预览
@param {string[]} images - 图片列表
@param {number} startIndex - 起始索引
@returns {void} 无返回值 | openImagePreview(images: string[], startIndex: number): void {
if (images.length === 0) {
return;
}
IBestImagePreview.show(images, {
startIndex
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openImagePreview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left images AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left string ... | openImagePreview(images: string[], startIndex: number): void {
if (images.length === 0) {
return;
}
IBestImagePreview.show(images, {
startIndex
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | feb46aa61d6f0a461ab6a955d22d680d268c9883 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartCategory.ets | arkts | hasHighConfidence | 是否有高置信度推荐 | hasHighConfidence(threshold: number = 0.8): boolean {
if (this.topRecommendation === null) {
return false;
}
return this.topRecommendation.confidence >= threshold;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasHighConfidence AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left threshold AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left nu... | hasHighConfidence(threshold: number = 0.8): boolean {
if (this.topRecommendation === null) {
return false;
}
return this.topRecommendation.confidence >= threshold;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8ec5268d18d086064b7a9815eac24fa6b56e7909 | github |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets | arkts | getLocationBol | 地理位置持久化,再次进入,确定开关是否开启 | getLocationBol(bol: boolean): void {
let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig;
cameraConfig.locationBol = bol;
GlobalContext.get().setObject('cameraConfig', cameraConfig);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLocationBol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bol AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) ... | getLocationBol(bol: boolean): void {
let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig;
cameraConfig.locationBol = bol;
GlobalContext.get().setObject('cameraConfig', cameraConfig);
} | https://gitee.com/openharmony/multimedia_camera_framework.git | 482e46727d1936e298d0c2527a567208dc63566c | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | isSafeInteger | Checks if double is a safe integer value
@param { double } v the double to test
@returns { boolean } true if the argument is integer ans less than MAX_SAFE_INTEGER
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isSafeInteger(v: double): boolean {
return Double.isInteger(v) && (abs(v) <= Double.MAX_SAFE_INTEGER);
} | 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 isSafeInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:... | public static isSafeInteger(v: double): boolean {
return Double.isInteger(v) && (abs(v) <= Double.MAX_SAFE_INTEGER);
} | https://gitcode.com/iop123123/arkts-static-skills | b9122c596563f9c0921987460cf0828acf462743 | gitcode |
XHXYT/Pixark | entry/src/main/ets/common/utils/ColorUtils.ets | arkts | getUnableColor | 获取禁用变灰颜色 | public getUnableColor(color: ResourceColor) {
return this.getColorWithAlpha(color, 0x33); // 透明度固定为 0x33
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUnableColor 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#Left ... | public getUnableColor(color: ResourceColor) {
return this.getColorWithAlpha(color, 0x33); // 透明度固定为 0x33
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/ColorUtils.ets#L14-L16 | d889ae3f2ed88747c19347d634227bca8dc06ebe | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | softDelete | 软删除规则 | static async softDelete(ruleId: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.RdbPredicates(SmartCa... | 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 softDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ruleId AST#identifier#Right AST#:#Left : AST#... | static async softDelete(ruleId: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.RdbPredicates(SmartCa... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 00d20d67839d754976ce1d8cb649b42d86c06e45 | github |
PollenWang6/HiXD | entry/src/main/ets/utils/ThemeColors.ets | arkts | init | 初始化(aboutToAppear) | static init(mode: number, ctx: Object): void {
_prefMode = mode;
const appCtx: ESObject = (ctx as ESObject)['getApplicationContext']() as ESObject;
appCtx['setColorMode'](mode);
if (mode === ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET) {
const stored: boolean | undefined = AppStorage.get(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | static init(mode: number, ctx: Object): void {
_prefMode = mode;
const appCtx: ESObject = (ctx as ESObject)['getApplicationContext']() as ESObject;
appCtx['setColorMode'](mode);
if (mode === ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET) {
const stored: boolean | undefined = AppStorage.get(... | https://github.com/PollenWang6/HiXD | f33b8d033e5057074274c40f8712d7867c29603b | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/beans/LocationParam.ets | arkts | ofSave | 保存模式
@param fileName 文件名
@return LocationParam | public static ofSave(fileName: string, onLocation?: (param: LocationInfo) => void): LocationParam {
LocationParam.instance = new LocationParam(LocationMode.SAVE, undefined, fileName, onLocation);
return LocationParam.instance;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ofSave AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#iden... | public static ofSave(fileName: string, onLocation?: (param: LocationInfo) => void): LocationParam {
LocationParam.instance = new LocationParam(LocationMode.SAVE, undefined, fileName, onLocation);
return LocationParam.instance;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/beans/LocationParam.ets#L109-L112 | 7e432bd2fbe69b57fc7e7a4eca5d9891df69b290 | github |
Tianpei-Shi/MusicDash | src/services/UserService.ets | arkts | saveUserInfo | 保存用户信息
@param userInfo 用户信息 | async saveUserInfo(userInfo: UserInfo): Promise<boolean> {
try {
const cloudObject = userInfo.toCloudObject();
return await this.cloudDBService.saveUserInfo(cloudObject);
} catch (error) {
console.error('保存用户信息失败:', error);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveUserInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userInfo AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async saveUserInfo(userInfo: UserInfo): Promise<boolean> {
try {
const cloudObject = userInfo.toCloudObject();
return await this.cloudDBService.saveUserInfo(cloudObject);
} catch (error) {
console.error('保存用户信息失败:', error);
return false;
}
} | https://github.com/Tianpei-Shi/MusicDash | 8e43b9b91a4ce5da5b5a04bed3ba050273fa1bee | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | setAbrMode | 通知服务端启用/关闭智能码率 | async setAbrMode(config: AbrConfig): Promise<boolean> {
try {
const baseUrl = await this.getHttpsBaseUrl();
const url = `${baseUrl}/api/abr`;
if (!this.certFilePath || !this.keyFilePath) return false;
const response = await HttpClient.postWithClientCert(
url,
JSON.stringi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setAbrMode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async setAbrMode(config: AbrConfig): Promise<boolean> {
try {
const baseUrl = await this.getHttpsBaseUrl();
const url = `${baseUrl}/api/abr`;
if (!this.certFilePath || !this.keyFilePath) return false;
const response = await HttpClient.postWithClientCert(
url,
JSON.stringi... | https://github.com/AlkaidLab/moonlight-harmony | fe9664f24988ab223f06e46998e5036712114ca6 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | calculateEdgeCost | 计算边代价
@param from 起点节点
@param to 终点节点
@param options 规划选项 | private calculateEdgeCost(
from: GraphNode,
to: GraphNode,
options: PathPlanningOptions
): number {
let cost = this.getDistance(from.position, to.position);
// 应用节点权重
cost *= to.weight;
// 转弯惩罚
if (this.isTurn(from, to)) {
cost += 2; // 额外2米代价
}
// 拥挤区域惩罚(简化实现:随机模拟)
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateEdgeCost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private calculateEdgeCost(
from: GraphNode,
to: GraphNode,
options: PathPlanningOptions
): number {
let cost = this.getDistance(from.position, to.position);
// 应用节点权重
cost *= to.weight;
// 转弯惩罚
if (this.isTurn(from, to)) {
cost += 2; // 额外2米代价
}
// 拥挤区域惩罚(简化实现:随机模拟)
... | https://github.com/LJ666-ui/harmony-health-care | 021e0aa8d21231ded774fbce7701a2e8179c6a15 | github |
the-wwyang/kids-learning-app | src/main/ets/services/AchievementService.ets | arkts | getAchievementById | 根据ID获取成就配置
@param achievementId 成就ID
@returns 成就配置或undefined | static getAchievementById(achievementId: string): AchievementConfig | undefined {
return AchievementService.ACHIEVEMENT_CONFIGS.find(config => config.id === achievementId);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAchievementById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left achievementId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A... | static getAchievementById(achievementId: string): AchievementConfig | undefined {
return AchievementService.ACHIEVEMENT_CONFIGS.find(config => config.id === achievementId);
} | https://github.com/the-wwyang/kids-learning-app | e2180fa59c572ad16f5fcc8bba1649c9f0a7251d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | with | Creates a copy with replaced value on index
@param index
@param value
@returns an Int16Array with replaced value on index | public with(index: number, value: number): Int16Array {
return this.with(index as int, value as double as int as short)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | public with(index: number, value: number): Int16Array {
return this.with(index as int, value as double as int as short)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a040c9cb62ecd4cf767ced35eafc03e8d4c34de7 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistorian.ets | arkts | pushHistory | Operations
Pushes a history entry to the Historian.
@param newHistoryEntry The meowHistoryEntry.
@returns Whether the history entry was accepted and successfully added. | async pushHistory(newHistoryEntry: meowHistoryEntry) {
if (this.busy) {
meow(`Busy. Rejected history: ["${newHistoryEntry.url}", "${newHistoryEntry.title}", ${newHistoryEntry.time}]`, 'meowHistorian][pushHistory', meowLevel.WARN);
return false;
}
// Only accept newer history entries.
if (... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left pushHistory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left newHistoryEntry AST#identifier#Ri... | async pushHistory(newHistoryEntry: meowHistoryEntry) {
if (this.busy) {
meow(`Busy. Rejected history: ["${newHistoryEntry.url}", "${newHistoryEntry.title}", ${newHistoryEntry.time}]`, 'meowHistorian][pushHistory', meowLevel.WARN);
return false;
}
// Only accept newer history entries.
if (... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 573c0886266c6bbf6b8b8dd58a90d1ce91107f6c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/SmartCurtainController.ets | arkts | sendCommand | 发送控制命令到窗帘设备 | public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> {
console.log(`SmartCurtainController: Sending command to ${deviceId}`, command);
// 解析命令参数
const params = command.params;
let openLevel: number = 0;
let isOpen: boolean = false;
if ('openLevel' in params) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left sendCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> {
console.log(`SmartCurtainController: Sending command to ${deviceId}`, command);
// 解析命令参数
const params = command.params;
let openLevel: number = 0;
let isOpen: boolean = false;
if ('openLevel' in params) {
... | https://github.com/LJ666-ui/harmony-health-care | e51dbe4a709b26b3edbeae992dad28f7af5f92d3 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateService.ets | arkts | findGroupByUuid | 根据UUID查找分组 | private findGroupByUuid(group: KdbxGroup, uuid: KdbxUuid): KdbxGroup | null {
if (group.uuid.equals(uuid)) {
return group;
}
for (let i = 0; i < group.groups.length; i++) {
const found = this.findGroupByUuid(group.groups[i], uuid);
if (found) {
return found;
}
}
ret... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findGroupByUuid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private findGroupByUuid(group: KdbxGroup, uuid: KdbxUuid): KdbxGroup | null {
if (group.uuid.equals(uuid)) {
return group;
}
for (let i = 0; i < group.groups.length; i++) {
const found = this.findGroupByUuid(group.groups[i], uuid);
if (found) {
return found;
}
}
ret... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L365-L376 | 8aa8525a4acf79894e475db00ce379bc86746a1d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | openMangaReader | 打开漫画阅读器
打开漫画阅读器 | private async openMangaReader(manga: Manga) {
try {
if (this.isRemoteProviderManga(manga)) {
const target = await this.determineResumeTarget(manga);
const remoteParams = await this.buildRemoteProviderReaderParams(manga, target, 'MainMenuPage');
if (remoteParams === null) {
... | 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 openMangaReader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right AST#:#Left... | private async openMangaReader(manga: Manga) {
try {
if (this.isRemoteProviderManga(manga)) {
const target = await this.determineResumeTarget(manga);
const remoteParams = await this.buildRemoteProviderReaderParams(manga, target, 'MainMenuPage');
if (remoteParams === null) {
... | https://github.com/DaLongZhuaZi/manxia | 86861fde5373ccc724f7172c05824c1972bc5dff | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | getMaximumEntryHeight | returns the maximum height in pixels across all legend labels
@param p the paint object used for rendering the text
@return | public getMaximumEntryHeight(p: Paint): number {
let max: number = 0;
for (let entry of this.mEntries) {
let label: string = entry.label;
if (!label) continue;
let length: number = Utils.getLabelTextSize(p, label, this.textSizeCache).height;
if (length > max)
max = length;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMaximumEntryHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public getMaximumEntryHeight(p: Paint): number {
let max: number = 0;
for (let entry of this.mEntries) {
let label: string = entry.label;
if (!label) continue;
let length: number = Utils.getLabelTextSize(p, label, this.textSizeCache).height;
if (length > max)
max = length;
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7a35c9da683d4d673f17aac28d2140acb3e6aecc | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ObjectPool.ets | arkts | getPoolCapacity | Returns the capacity of this object pool. Note : The pool will automatically resize
to contain additional objects if the user tries to add more objects than the pool's
capacity allows, but this comes at a performance cost.
@return The capacity of the pool. | public getPoolCapacity(): number {
return this.objects ? this.objects.length : 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPoolCapacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST... | public getPoolCapacity(): number {
return this.objects ? this.objects.length : 0;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 2ba35e6d9531e71aac7d17363fb7e0d4654c1c00 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new ShortBox instance with the specified initial value.
@param { short } value - The initial short value to be wrapped
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(value: short) {
this.value = value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left sho... | public constructor(value: short) {
this.value = value;
} | https://gitcode.com/iop123123/arkts-static-skills | 8d0f88764ab2614ca423ca8f07a1856a04217c3d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/EBookDataManager.ets | arkts | saveReadingProgress | 保存阅读进度
串行化同一本书的写入,并使用插入或替换避免并发唯一约束冲突
仍然保留完整字段写入,避免依赖更新语句时出现静默失败 | public async saveReadingProgress(progress: EBookReadingProgress): Promise<void> {
const saveKey = `${progress.bookId}|default_user`;
let state = this.readingProgressSaveStates.get(saveKey);
if (!state) {
state = {
latestProgress: null,
runningPromise: null
};
this.reading... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveReadingProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left progress AST#identifier#Right AST#:#... | public async saveReadingProgress(progress: EBookReadingProgress): Promise<void> {
const saveKey = `${progress.bookId}|default_user`;
let state = this.readingProgressSaveStates.get(saveKey);
if (!state) {
state = {
latestProgress: null,
runningPromise: null
};
this.reading... | https://github.com/DaLongZhuaZi/manxia | 1cb032dfb7776bd024c75f05f21e8877ddf2cdd4 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/deviceAwareness/facades/DeviceAdaptationFacade.ets | arkts | isBreakpointGreaterOrEqual | 判断当前断点是否大于等于目标断点 | public isBreakpointGreaterOrEqual(targetBreakpoint: NGFBreakpoint): boolean {
const currentIndex: number = BREAKPOINT_ORDER.indexOf(this.getCurrentBreakpoint());
const targetIndex: number = BREAKPOINT_ORDER.indexOf(targetBreakpoint);
return currentIndex >= targetIndex;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isBreakpointGreaterOrEqual AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetBreakpoint AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifie... | public isBreakpointGreaterOrEqual(targetBreakpoint: NGFBreakpoint): boolean {
const currentIndex: number = BREAKPOINT_ORDER.indexOf(this.getCurrentBreakpoint());
const targetIndex: number = BREAKPOINT_ORDER.indexOf(targetBreakpoint);
return currentIndex >= targetIndex;
} | https://github.com/DaLongZhuaZi/NGF | b64877050cf1754d6a0f2a29bac00706c9db5110 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/SettingsManager.ets | arkts | getChatFontSize | ========== 聊天字体大小相关方法 ========== | getChatFontSize(): number {
return this.chatFontSize
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getChatFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statem... | getChatFontSize(): number {
return this.chatFontSize
} | https://github.com/LongLiveY96/chatcube | 46d05b5071e7bda4de0d1c21a264e2dd4f4cf8b6 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/config/RouteConfigManager.ets | arkts | printAllRoutes | 打印所有路由(调试用) | public printAllRoutes(): void {
console.info('[RouteConfigManager] 所有已注册路由:');
const routeList = Array.from(this.routes).sort();
routeList.forEach((route: string, index: number) => {
console.info(` ${index + 1}. ${route}`);
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left printAllRoutes 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#express... | public printAllRoutes(): void {
console.info('[RouteConfigManager] 所有已注册路由:');
const routeList = Array.from(this.routes).sort();
routeList.forEach((route: string, index: number) => {
console.info(` ${index + 1}. ${route}`);
});
} | https://github.com/LJ666-ui/harmony-health-care | 877efcb18cce9bb56b368f5b81aeacec78731697 | github |
tianlongbaobao/idut-HarmonyOS-Next | entry/src/main/ets/pages/app/selfinformation.ets | arkts | fancy | 按钮公共样式抽取 | @Extend(Text) function fancy () {
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.layoutWeight(12)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text) function fancy () {
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.layoutWeight(12)
} | https://github.com/tianlongbaobao/idut-HarmonyOS-Next | 7a2bd63c4e2c547e325e4624ce9bd3ce8279957c | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/model/DigitPanelModel.ets | arkts | getStandardPanelList | getStandardPanelList
@return Array<Array<SimplePhysicsButtonInfo>> | getStandardPanelList(): Array<Array<SimplePhysicsButtonInfo>> {
let arr: SimplePhysicsButtonInfo[][] =
[
[
{ keyCode: KeyCode.KEYCODE_MEM_CLEAR, keyText: 'MC', accessibilityInfo: new AccessibilityInfo(KeyCode.KEYCODE_MEM_CLEAR) },
{ keyCode: KeyCode.KEYCODE_MEM_ADD, keyText: 'M+'... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getStandardPanelList 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#... | getStandardPanelList(): Array<Array<SimplePhysicsButtonInfo>> {
let arr: SimplePhysicsButtonInfo[][] =
[
[
{ keyCode: KeyCode.KEYCODE_MEM_CLEAR, keyText: 'MC', accessibilityInfo: new AccessibilityInfo(KeyCode.KEYCODE_MEM_CLEAR) },
{ keyCode: KeyCode.KEYCODE_MEM_ADD, keyText: 'M+'... | https://gitee.com/openharmony-sig/applications_calculator.git | c42bed3563181a8663a8f16444be6bd2df86ad73 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | find | Returns the first element in the provided array that satisfies the provided testing function
@param fn testing function
@param thisArg an Array to search
@returns found element or null otherwise | public static find<T>(fn: (elem: T) => boolean, thisArg: Array<T>): T | null {
for (let i = 0; i < thisArg.data.length; i++) {
if (fn(thisArg.data[i])) {
return thisArg.data[i];
}
}
return null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#b... | public static find<T>(fn: (elem: T) => boolean, thisArg: Array<T>): T | null {
for (let i = 0; i < thisArg.data.length; i++) {
if (fn(thisArg.data[i])) {
return thisArg.data[i];
}
}
return null;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5728b3a533b507a7052a02433d43ef7d2e0cd5e1 | gitee |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/aiinsight/AIInsightState.ets | arkts | startSelectedInsight | 精准洞察:只取选中笔记。 | startSelectedInsight(): void {
if (this.isGenerating) {
this.notifyGeneratingLocked();
return;
}
if (!this.aiService.hasUsableConfig()) {
this.notifyConfigRequired();
return;
}
const allIdeas = this.ideaState.ideas;
const selected = allIdeas.filter((idea: Idea) => this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startSelectedInsight 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 AS... | startSelectedInsight(): void {
if (this.isGenerating) {
this.notifyGeneratingLocked();
return;
}
if (!this.aiService.hasUsableConfig()) {
this.notifyConfigRequired();
return;
}
const allIdeas = this.ideaState.ideas;
const selected = allIdeas.filter((idea: Idea) => this.... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/aiinsight/AIInsightState.ets#L268-L285 | d0ede9a9e6df5dcf461d43cfbd7f80a034ebf731 | github |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | initCamera | 初始化相机功能
@param surfaceId - Surface 的 ID
@param cameraDeviceIndex - 相机设备索引
@returns 无返回值 | async initCamera(surfaceId: string, cameraDeviceIndex: number): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
// 获取相机管理器实例
this.cameraManager = this.getCameraManagerFn();
if (this.cameraManager === undefined) ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left surfaceId AST#identifier#Right AST#type_annotation#Left AST... | async initCamera(surfaceId: string, cameraDeviceIndex: number): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
// 获取相机管理器实例
this.cameraManager = this.getCameraManagerFn();
if (this.cameraManager === undefined) ... | https://gitee.com/openharmony/multimedia_camera_framework.git | 86f033e1cdfa393244c96ecc79aa676401508fdf | gitee |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | getCoodXY | Drag position calculation in the editing area | getCoodXY(index: number): PositionXY {
let x: number = 0;
let y: number = 0;
const gridCol: number = this.colNum;
const lastCol: number = Math.trunc(index % gridCol);
if (index >= this.dragContentIndex) {
if (index <= this.insertIndex && index !== this.dragContentIndex) {
// item ne... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCoodXY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#... | getCoodXY(index: number): PositionXY {
let x: number = 0;
let y: number = 0;
const gridCol: number = this.colNum;
const lastCol: number = Math.trunc(index % gridCol);
if (index >= this.dragContentIndex) {
if (index <= this.insertIndex && index !== this.dragContentIndex) {
// item ne... | https://gitcode.com/openharmony/arkui_ace_engine | 3060e0e6df02d88ae7e82955671d4d7b3b876ef8 | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/manager/PageContextManager.ets | arkts | popPage | 关闭页面
@param animated boolean | public popPage(animated: boolean = true): void {
try {
this.pathStack.pop(animated)
} catch (error) {
const businessError: BusinessError = error as BusinessError
Logger.error(TAG, `关闭页面失败, 错误码: ${businessError.code}, 错误信息: ${businessError.message}`)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left popPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left animated AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressio... | public popPage(animated: boolean = true): void {
try {
this.pathStack.pop(animated)
} catch (error) {
const businessError: BusinessError = error as BusinessError
Logger.error(TAG, `关闭页面失败, 错误码: ${businessError.code}, 错误信息: ${businessError.message}`)
}
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | fbd878a0f4daa01753bd7224e9e3462809a012c3 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets | arkts | compareTo | Compares this instance to other Boolean object The result is less than 0 if this instance lesser than provided
object 0 if they are equal and greater than 0 otherwise.
@param { Boolean } other Boolean object to compare with
@returns { int } Negative if this < other,0 if equal, positive if this > other
@syscap SystemCap... | public override compareTo(other: Boolean): int {
let thisInt = this.value ? 1 : 0
let otherInt = other.value ? 1 : 0
return thisInt - otherInt;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST... | public override compareTo(other: Boolean): int {
let thisInt = this.value ? 1 : 0
let otherInt = other.value ? 1 : 0
return thisInt - otherInt;
} | https://gitcode.com/iop123123/arkts-static-skills | 072cb5616750ac1b271c8a11bde9c9085c360075 | gitcode |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/uiTheme/facades/ComponentThemeOverrideFacade.ets | arkts | listOverrideNames | 列出所有已注册的覆盖名称 | listOverrideNames(): Array<string> {
const names: Array<string> = [];
const keys: Array<string> = Array.from(this.overrides.keys());
for (let i: number = 0; i < keys.length; i++) {
names.push(keys[i]);
}
return names;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left listOverrideNames 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#:... | listOverrideNames(): Array<string> {
const names: Array<string> = [];
const keys: Array<string> = Array.from(this.overrides.keys());
for (let i: number = 0; i < keys.length; i++) {
names.push(keys[i]);
}
return names;
} | https://github.com/DaLongZhuaZi/NGF | a8c625460c71e69b6472afaf93074614f3cff79d | github |
erosTeam/NextE | feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets | arkts | loadPreviousFavorites | Favorite-type profiles use page/from for previous pages when EH exposes ptt navigation. | private async loadPreviousFavorites(afterPrepend?: (prependedCount: number) => void): Promise<number> {
DiagnosticLogger.info('home-list-anchor', 'fav_prev_enter', this.debugState())
const requestedPage: number = this.favPrevPage
const requestedPrev: string = this.prevGid
if (requestedPage < 0 && requ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left loadPreviousFavorites AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left afterPrepen... | private async loadPreviousFavorites(afterPrepend?: (prependedCount: number) => void): Promise<number> {
DiagnosticLogger.info('home-list-anchor', 'fav_prev_enter', this.debugState())
const requestedPage: number = this.favPrevPage
const requestedPrev: string = this.prevGid
if (requestedPage < 0 && requ... | https://github.com/erosTeam/NextE | 1874df5108af64d2e55911c70429ceced2a37774 | github |
the-wwyang/kids-learning-app | src/main/ets/services/AchievementService.ets | arkts | shouldUnlock | 检查成就是否应该解锁
@param achievementId 成就ID
@param currentValue 当前进度值
@returns 是否应该解锁 | static shouldUnlock(achievementId: string, currentValue: number): boolean {
const config = AchievementService.getAchievementById(achievementId);
if (!config) return false;
return currentValue >= config.targetValue;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left shouldUnlock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left achievementId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | static shouldUnlock(achievementId: string, currentValue: number): boolean {
const config = AchievementService.getAchievementById(achievementId);
if (!config) return false;
return currentValue >= config.targetValue;
} | https://github.com/the-wwyang/kids-learning-app | 00ca7ebb5e621d0e0c373da818b5cfcfdb1d24fb | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | getCurrentSong | 获取当前播放歌曲 | getCurrentSong(): SongInfo | null {
return this.audioManager.getCurrentSong();
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentSong 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#identi... | getCurrentSong(): SongInfo | null {
return this.audioManager.getCurrentSong();
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 894590c80edb094f2662bd202805187bec1a23ce | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/pages/login.ets | arkts | sendAuthCodeToServer | 发送authCode到服务器 | sendAuthCodeToServer(authCode: string) {
let httpRequest = http.createHttp();
// 读取当前应用的clientId(请替换为自己在 AGC 创建应用后获得的真实 Client ID)
const clientId = 'your_client_id_here';
// 服务器地址(请替换为自己的后端地址,仓库内已移除默认的本地 Node 示例)
const serverUrl = 'http://your-server-host:port';
httpRequest.request(
`${s... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendAuthCodeToServer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left authCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Ri... | sendAuthCodeToServer(authCode: string) {
let httpRequest = http.createHttp();
// 读取当前应用的clientId(请替换为自己在 AGC 创建应用后获得的真实 Client ID)
const clientId = 'your_client_id_here';
// 服务器地址(请替换为自己的后端地址,仓库内已移除默认的本地 Node 示例)
const serverUrl = 'http://your-server-host:port';
httpRequest.request(
`${s... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | b1e33527bec96619da7ca9eafa75fa738cd6cf44 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | readUInt32LE | Reads an unsigned 32-bit integer from the buffer at the specified offset using little-endian format
@param {int} [offset=0] - Number of bytes to skip before reading
@returns {long} The read value | public readUInt32LE(offset: int = 0): long {
let lengthOffset: int = this.length - 4;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= ${len... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readUInt32LE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expres... | public readUInt32LE(offset: int = 0): long {
let lengthOffset: int = this.length - 4;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= ${len... | https://gitcode.com/iop123123/arkts-static-skills | 942bdab3e9d56a911c675d33ffc04c63f5139e0d | gitcode |
JackJiang2011/harmonychat | entry/src/main/ets/pages/model/Message.ets | arkts | createChatMsgEntity_INCOME_TEXT | 构建一条收到的消息对象。
@param senderId 发送者uid
@param nickName 发送者昵称
@param message 消息内容
@param time 消息时间戳,0表示使用当前系统时间戳
@returns 新的消息对象 | static createChatMsgEntity_INCOME_TEXT(senderId: string, nickName: string, message: string, time: number): Message {
return new Message(senderId, nickName, time, message, MsgType.TYPE_TEXT);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createChatMsgEntity_INCOME_TEXT AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left senderId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left ... | static createChatMsgEntity_INCOME_TEXT(senderId: string, nickName: string, message: string, time: number): Message {
return new Message(senderId, nickName, time, message, MsgType.TYPE_TEXT);
} | https://github.com/JackJiang2011/harmonychat | 851767f32f8d0b63f765a81c9de501bb27bb5da1 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | updateAlarmDatabase | Modify Alarm Database Data
isIntentMode 意图框架调用此方法的标识
@param alarmInfo alarm object | private async updateAlarmDatabase(alarmInfo: AlarmInfo, isIntentMode?: boolean): Promise<void> {
const rdbStore = await this.getRdbStore();
try {
rdbStore.beginTransaction();
const predicates = new rdb.RdbPredicates(DATA_TABLE);
if (alarmInfo && alarmInfo.id) {
predicates.equalTo('ID... | 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 updateAlarmDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmInfo AST#identifier#Right AS... | private async updateAlarmDatabase(alarmInfo: AlarmInfo, isIntentMode?: boolean): Promise<void> {
const rdbStore = await this.getRdbStore();
try {
rdbStore.beginTransaction();
const predicates = new rdb.RdbPredicates(DATA_TABLE);
if (alarmInfo && alarmInfo.id) {
predicates.equalTo('ID... | https://gitee.com/openharmony-sig/applications_clock.git | b0ccdcb386c7f59a881baf41d48e66c80c0ade35 | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/ProfileService.ets | arkts | saveAllProfiles | 保存所有档案 | private async saveAllProfiles(profiles: UserProfile[]): Promise<boolean> {
if (this.dataPreferences === null) {
return false;
}
try {
const profilesData: ProfileData[] = profiles.map((profile: UserProfile): ProfileData => ({
id: profile.id,
nickname: profile.nickname,
... | 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 saveAllProfiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left profiles AST#identifier#Right AST#:#L... | private async saveAllProfiles(profiles: UserProfile[]): Promise<boolean> {
if (this.dataPreferences === null) {
return false;
}
try {
const profilesData: ProfileData[] = profiles.map((profile: UserProfile): ProfileData => ({
id: profile.id,
nickname: profile.nickname,
... | https://github.com/the-wwyang/kids-learning-app | 7225d030f407c5b72ccaee1e43bd5b8eb200156f | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | getAssistantByIdAsync | 内存未命中时回源 DB,但不会刷新整个 state(单个 assistant 场景不值得整表同步) | async getAssistantByIdAsync(assistantId: string): Promise<Assistant | null> {
const cached = this.getAssistantById(assistantId)
if (cached !== null) {
return cached
}
return await this.db.getAssistant(assistantId)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAssistantByIdAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left assistantId AST#identifier#Right AST#type_annotation#Left... | async getAssistantByIdAsync(assistantId: string): Promise<Assistant | null> {
const cached = this.getAssistantById(assistantId)
if (cached !== null) {
return cached
}
return await this.db.getAssistant(assistantId)
} | https://github.com/LongLiveY96/chatcube | a90b65f2282e3dfd3984e78445fcfc2ea88c5f54 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets | arkts | isEmpty | Check if the TreeSet is empty
@returns true if the TreeSet is empty | isEmpty(): boolean {
return this.treeMap.isEmpty();
} | 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.treeMap.isEmpty();
} | https://gitcode.com/iop123123/arkts-static-skills | 0cbcfc71016314aa6be1839eb01a710c5031819e | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/ScoreService.ets | arkts | getDailyGoalProgress | 获取每日目标完成度 | public getDailyGoalProgress(currentStars: number, dailyGoal: number = 20): number {
return Math.min(Math.round((currentStars / dailyGoal) * 100), 100);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDailyGoalProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentStars AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | public getDailyGoalProgress(currentStars: number, dailyGoal: number = 20): number {
return Math.min(Math.round((currentStars / dailyGoal) * 100), 100);
} | https://github.com/the-wwyang/kids-learning-app | 6a698efe3bf92bfea8711954b37262089fd07543 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | calculateSavingsRateScore | 计算储蓄率评分 | static calculateSavingsRateScore(income: number, expense: number): DimensionScore {
const actualRate = income > 0 ? ((income - expense) / income) * 100 : 0;
const targetRate = 20;
const benchmarkRate = 15;
let score: number;
if (actualRate >= 30) {
score = 100;
} else if (actualRate >= ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateSavingsRateScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left income AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | static calculateSavingsRateScore(income: number, expense: number): DimensionScore {
const actualRate = income > 0 ? ((income - expense) / income) * 100 : 0;
const targetRate = 20;
const benchmarkRate = 15;
let score: number;
if (actualRate >= 30) {
score = 100;
} else if (actualRate >= ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 51e449f66d786e521d141cd11c4b01e52f13b77c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getDataStats | ==================== 统计信息 ====================
获取数据统计信息 | public async getDataStats(): Promise<DataStats> {
try {
const results = await Promise.all([
this.getTableCount('comic_info'),
this.getTableCount('chapter'),
this.getTableCount('favorite'),
this.getTableCount('download_task'),
this.sandboxManager.getStorageStats(),
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getDataStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async getDataStats(): Promise<DataStats> {
try {
const results = await Promise.all([
this.getTableCount('comic_info'),
this.getTableCount('chapter'),
this.getTableCount('favorite'),
this.getTableCount('download_task'),
this.sandboxManager.getStorageStats(),
... | https://github.com/DaLongZhuaZi/manxia | 7b356db6870a7cd039bbfcf55b03ea3e340d3ae9 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/GuidePage.ets | arkts | setBubbleIndicator | 设置当前引导页的气泡指示器
@param bubbleIndicator
@returns 引导层布局 | public setBubbleIndicator(bubbleIndicator: BubbleIndicator | null): GuidePage {
this.bubbleIndicator = bubbleIndicator;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBubbleIndicator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bubbleIndicator AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#bi... | public setBubbleIndicator(bubbleIndicator: BubbleIndicator | null): GuidePage {
this.bubbleIndicator = bubbleIndicator;
return this;
} | https://github.com/wuba/omni-ui | fbdee6557ecac8e34e825e3f10318383fe16629a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets | arkts | getStatus | 获取自动备份状态 | async getStatus(): Promise<AutoBackupStatus> {
const settings = await this.loadWebDAVSettings();
if (!settings || !settings.autoBackup) {
return {
enabled: false,
interval: 'daily',
lastBackupTime: 0,
nextBackupTime: 0,
isRunning: this.isRunning,
last... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_ty... | async getStatus(): Promise<AutoBackupStatus> {
const settings = await this.loadWebDAVSettings();
if (!settings || !settings.autoBackup) {
return {
enabled: false,
interval: 'daily',
lastBackupTime: 0,
nextBackupTime: 0,
isRunning: this.isRunning,
last... | https://github.com/DaLongZhuaZi/manxia | 1f55d10edf08bcdc2259c088a8f99a59da6f5074 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an object of std.core.Array<int>.
@param { Array<int> } arr - An instance of the std.core.Array type to convert to an array.
@returns { Uint32Array } - A new Uint32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: Array<int>): Uint32Array {
let result = new Uint32Array(arr.length)
result.set(arr)
return result
} | 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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: Array<int>): Uint32Array {
let result = new Uint32Array(arr.length)
result.set(arr)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 2bab8fa6286d4c58a446e81b8a303b915e0be47a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | getFromMemoryCache | 从内存缓存获取图片 | private getFromMemoryCache(cacheKey: string): image.PixelMap | null {
const entry = this.memoryCache.get(cacheKey);
if (entry) {
// 更新访问信息
entry.accessTime = Date.now();
entry.accessCount++;
return entry.pixelMap;
}
return null;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFromMemoryCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private getFromMemoryCache(cacheKey: string): image.PixelMap | null {
const entry = this.memoryCache.get(cacheKey);
if (entry) {
// 更新访问信息
entry.accessTime = Date.now();
entry.accessCount++;
return entry.pixelMap;
}
return null;
} | https://github.com/DaLongZhuaZi/manxia | 0e3afb57fe65947149968ed19844185f74c71ecf | github |
the-wwyang/kids-learning-app | src/main/ets/services/DataBackupService.ets | arkts | saveToFile | 保存到文件 | private async saveToFile(fileName: string, content: string): Promise<string | null> {
if (!this.context) {
console.error('DataBackupService: Context未初始化');
return null;
}
try {
// 获取应用文件目录
const filesDir = this.context.filesDir;
const backupDir = `${filesDir}/backups`;
... | 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 saveToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left :... | private async saveToFile(fileName: string, content: string): Promise<string | null> {
if (!this.context) {
console.error('DataBackupService: Context未初始化');
return null;
}
try {
// 获取应用文件目录
const filesDir = this.context.filesDir;
const backupDir = `${filesDir}/backups`;
... | https://github.com/the-wwyang/kids-learning-app | f1151d0eb21258e57486941f98d1ce96c9c6c8db | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets | arkts | cancel | 取消 Promise
@param reason 取消原因 | cancel(reason: string = '操作已取消'): void {
if (this._isCancelled) {
return;
}
this._isCancelled = true;
this._cancelReason = reason;
this.signal.abort(reason);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left string AST#ident... | cancel(reason: string = '操作已取消'): void {
if (this._isCancelled) {
return;
}
this._isCancelled = true;
this._cancelReason = reason;
this.signal.abort(reason);
} | https://github.com/DaLongZhuaZi/manxia | e0c6d042403161413d7ebfdfce27bf0dbcaaaf59 | github |
the-wwyang/kids-learning-app | src/main/ets/common/UserService.ets | arkts | saveLoginState | 保存登录状态 | public async saveLoginState(username: string, rememberPassword: boolean, password: string, phone: string = ''): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
// 如果记住密码,需要加密后保存
const savedPassword = rememberPassword ? SecurityUtils.encryptPassword(password) : '';
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveLoginState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public async saveLoginState(username: string, rememberPassword: boolean, password: string, phone: string = ''): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
// 如果记住密码,需要加密后保存
const savedPassword = rememberPassword ? SecurityUtils.encryptPassword(password) : '';
... | https://github.com/the-wwyang/kids-learning-app | 595105af14318f1f2274f45d1c3c07a417f46183 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | updateHistory | 更新历史记录 | private updateHistory(data: HidebugPerformanceData): void {
const timestamps = this.history.timestamps;
const memoryUsage = this.history.memoryUsage;
const cpuUsage = this.history.cpuUsage;
const gcCount = this.history.gcCount;
const heapSize = this.history.heapSize;
// 添加新数据
timestam... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateHistory 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... | private updateHistory(data: HidebugPerformanceData): void {
const timestamps = this.history.timestamps;
const memoryUsage = this.history.memoryUsage;
const cpuUsage = this.history.cpuUsage;
const gcCount = this.history.gcCount;
const heapSize = this.history.heapSize;
// 添加新数据
timestam... | https://github.com/DaLongZhuaZi/manxia | 661985165affc35893b8569f05763654d724bb8b | github |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/model/PlaylistSongUiDataSource.ets | arkts | getData | Returns the song UI model at the given index.
@param index Zero-based index into the backing array.
@returns The {@link PlaylistSongUi} at the given index. | public getData(index: number): PlaylistSongUi {
return this.dataArray[index];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | public getData(index: number): PlaylistSongUi {
return this.dataArray[index];
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | f10a578fddafa3777b3a6ca91fd0c23eaead4006 | gitcode |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/AddressRepository.ets | arkts | deleteAddress | 删除地址
@param params 待删除地址ID集合
@returns 删除结果 | async deleteAddress(params: Ids): Promise<NetworkResponse<void>> {
return this.networkDataSource.deleteAddress(params);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteAddress AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async deleteAddress(params: Ids): Promise<NetworkResponse<void>> {
return this.networkDataSource.deleteAddress(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2cbe24873a43b42067372dd8d8193344044e38e6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | toggleOverlay | 切换性能监控覆盖层显示 | toggleOverlay(): void {
this.showOverlay = !this.showOverlay;
console.info(`StreamViewModel: 性能覆盖层 ${this.showOverlay ? '显示' : '隐藏'}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleOverlay 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... | toggleOverlay(): void {
this.showOverlay = !this.showOverlay;
console.info(`StreamViewModel: 性能覆盖层 ${this.showOverlay ? '显示' : '隐藏'}`);
} | https://github.com/AlkaidLab/moonlight-harmony | 1a903b5bf8fef96a2a4487736e51f74a95e21126 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test45_original_index.ets | arkts | testParseIntRadix | --- Number parseInt with radix --- | function testParseIntRadix(): string {
let bin: number = parseInt('1010', 2);
let hex: number = parseInt('FF', 16);
let oct: number = parseInt('77', 8);
return String(bin) + ',' + String(hex) + ',' + String(oct);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testParseIntRadix AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testParseIntRadix(): string {
let bin: number = parseInt('1010', 2);
let hex: number = parseInt('FF', 16);
let oct: number = parseInt('77', 8);
return String(bin) + ',' + String(hex) + ',' + String(oct);
} | https://github.com/miaochiahao/ark-ghidra | cd9499af2cab8785a1d17169e290e7d91b71aeab | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | atan2 | Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
(inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
@param { Value } y {double | string | Decimal} The y-coordinate.
@param { Value } x {double | string | Decimal} The x-coordinate.
@returns ... | static atan2(y: Value, x: Value): Decimal {
y = new Decimal(y);
x = new Decimal(x);
let pr = Decimal.precision;
let rm = Decimal.rounding;
let wpr = pr + 4;
let result: Decimal;
// Either NaN
if (!y.s || !x.s) {
result = new Decimal(NaN);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left atan2 AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left y AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | static atan2(y: Value, x: Value): Decimal {
y = new Decimal(y);
x = new Decimal(x);
let pr = Decimal.precision;
let rm = Decimal.rounding;
let wpr = pr + 4;
let result: Decimal;
// Either NaN
if (!y.s || !x.s) {
result = new Decimal(NaN);
... | https://gitcode.com/iop123123/arkts-static-skills | 0416e2d986a52ef7dcc94250e6fbfb73a00ffe90 | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/MusicDbApi.ets | arkts | getSongList | @returns All songs as {@link SongApiDto} rows. | public getSongList(): SongApiDto[] {
return this.store.songs.map((songRow) => this.rowToSongApiDto(songRow));
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSongList 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... | public getSongList(): SongApiDto[] {
return this.store.songs.map((songRow) => this.rowToSongApiDto(songRow));
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | ec6509cad012697222946e0417d581463ae30841 | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityAndEntryDelegate.ets | arkts | doInitialFlutterViewRun | 加载app.so资源或者snapshot | private doInitialFlutterViewRun(): void {
let initialRoute = this.host?.getInitialRoute();
if (initialRoute == null && this.host != null) {
initialRoute = this.maybeGetInitialRouteFromIntent(this.host.getWant());
}
if (initialRoute == null) {
initialRoute = FlutterAbilityLaunchConfigs.DEF... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left doInitialFlutterViewRun 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 v... | private doInitialFlutterViewRun(): void {
let initialRoute = this.host?.getInitialRoute();
if (initialRoute == null && this.host != null) {
initialRoute = this.maybeGetInitialRouteFromIntent(this.host.getWant());
}
if (initialRoute == null) {
initialRoute = FlutterAbilityLaunchConfigs.DEF... | https://gitee.com/openharmony-sig/flutter_engine.git | c93dcfae49e900e441162167bd3e0fcd353c3d53 | gitee |
codelably/HCompass | core/di/src/main/ets/ServiceContainer.ets | arkts | clear | 清空所有已注册的服务 | clear(): void {
this.services.clear();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | clear(): void {
this.services.clear();
} | https://github.com/codelably/HCompass | 06e1add3869ed22d1b4d5fdf6624d104661714ce | github |
openharmony-sig/ohos_subsampling_scale_image_view | library/src/main/ets/components/MainPage/SubsamplingScaleImageView.ets | arkts | setMinimumDpi | This is a screen density aware alternative to {@link #setMaxScale(float)}; it allows you to express the maximum
allowed scale in terms of the minimum pixel density. This avoids the problem of 1:1 scale still being
too small on a high density screen. A sensible starting point is 160 - the default used by this view.
@par... | public setMinimumDpi(dpi: number): Model {
let screen = display.getDefaultDisplaySync()
let averageDpi: number = (screen.xDPI + screen.yDPI) / 2
this.setMaxScale(averageDpi / dpi);
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinimumDpi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dpi AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | public setMinimumDpi(dpi: number): Model {
let screen = display.getDefaultDisplaySync()
let averageDpi: number = (screen.xDPI + screen.yDPI) / 2
this.setMaxScale(averageDpi / dpi);
return this;
} | https://gitee.com/openharmony-sig/ohos_subsampling_scale_image_view.git | 112d7ab794a37170d86cad849c1ef1f334e755bd | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsService.ets | arkts | getDisplaySettings | 获取显示设置 | async getDisplaySettings(): Promise<DisplaySettings> {
const itemsStr = await this.getString(SettingsKeys.PERF_OVERLAY_ITEMS, 'resolution,decoder,render_fps,packet_loss,bitrate,network_latency,decode_latency');
const items = itemsStr.split(',').filter(item => item.length > 0);
const hdrPeakBrightnessNits ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDisplaySettings 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 getDisplaySettings(): Promise<DisplaySettings> {
const itemsStr = await this.getString(SettingsKeys.PERF_OVERLAY_ITEMS, 'resolution,decoder,render_fps,packet_loss,bitrate,network_latency,decode_latency');
const items = itemsStr.split(',').filter(item => item.length > 0);
const hdrPeakBrightnessNits ... | https://github.com/AlkaidLab/moonlight-harmony | 4c5c8589353f74652856fd923b5c4e2e66dcc310 | github |
PollenWang6/HiXD | entry/src/main/ets/utils/AccentColors.ets | arkts | colorForTheme | 根据当前主题模式获取颜色 | static colorForTheme(isDark: boolean, idx: number): string {
if (idx === -1) return AppStorage.get('accent_color') as string ?? '#5588CC';
if (idx < 0 || idx >= ACCENT_PRESETS.length) idx = 0;
return isDark ? ACCENT_PRESETS[idx][1] : ACCENT_PRESETS[idx][0];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left colorForTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isDark AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static colorForTheme(isDark: boolean, idx: number): string {
if (idx === -1) return AppStorage.get('accent_color') as string ?? '#5588CC';
if (idx < 0 || idx >= ACCENT_PRESETS.length) idx = 0;
return isDark ? ACCENT_PRESETS[idx][1] : ACCENT_PRESETS[idx][0];
} | https://github.com/PollenWang6/HiXD | 4d892986d2abc08ce087374636032d8963ecbeb0 | github |
openharmony-sig/applications_clock | feature/timer/src/main/ets/controller/TimerController.ets | arkts | pause | Timer pause | public async pause() {
LogUtil.info(`${TAG} timer pause `);
clearInterval(this.notifierId);
this.beforePauseTime += new Date().getTime() - this.startTimestamp;
this.currentTimeMs = this.beforePauseTime;
this.notifierId = -1;
this.state = TimerState.PAUSED;
if (this.preferences) {
awa... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left pause AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Righ... | public async pause() {
LogUtil.info(`${TAG} timer pause `);
clearInterval(this.notifierId);
this.beforePauseTime += new Date().getTime() - this.startTimestamp;
this.currentTimeMs = this.beforePauseTime;
this.notifierId = -1;
this.state = TimerState.PAUSED;
if (this.preferences) {
awa... | https://gitee.com/openharmony-sig/applications_clock.git | 5310aaaecf289858f51c2cf05bb9e0804b253f97 | gitee |
ibestservices/ibest-ui | entry/src/main/ets/pages/Index.ets | arkts | checkUpdate | 检查新版本 | checkUpdate(){
updateManager.checkAppUpdate(this.context).then((checkResult: updateManager.CheckUpdateResult) => {
if(checkResult.updateAvailable == 1){
updateManager.showUpdateDialog(this.context)
}
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | checkUpdate(){
updateManager.checkAppUpdate(this.context).then((checkResult: updateManager.CheckUpdateResult) => {
if(checkResult.updateAvailable == 1){
updateManager.showUpdateDialog(this.context)
}
})
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/entry/src/main/ets/pages/Index.ets#L788-L794 | 3631feb4cb930be09d2fb4972faa1303202563df | github |
openharmony/applications_filepicker | audiopicker/src/main/ets/pages/card/AudioPickerView.ets | arkts | isLast | 是否是列表最后一个音频 | isLast(index: number): boolean {
this.requestCounts = Constants.PICKER_PAGE_SIZE * (this.pageNo + 1)
let musicTotal: number = 0
if (this.audioPickerData.totalCount() < this.requestCounts) {
musicTotal = this.audioPickerViewModel.getAudioTotal()
}
if (musicTotal) {
return index >= music... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#R... | isLast(index: number): boolean {
this.requestCounts = Constants.PICKER_PAGE_SIZE * (this.pageNo + 1)
let musicTotal: number = 0
if (this.audioPickerData.totalCount() < this.requestCounts) {
musicTotal = this.audioPickerViewModel.getAudioTotal()
}
if (musicTotal) {
return index >= music... | https://gitee.com/openharmony/applications_filepicker.git | 9c8eac724ccfc450f9f256efee17c8e02e5256bf | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyStore.ets | arkts | exportProfile | ── 导入/导出 ──
导出当前配置为 JSON 字符串 | static async exportProfile(): Promise<string> {
const profile = await CustomKeyStore.getActiveProfile();
const exportData: ExportData = {
version: 1,
profile: profile,
};
return JSON.stringify(exportData);
} | 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 exportProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | static async exportProfile(): Promise<string> {
const profile = await CustomKeyStore.getActiveProfile();
const exportData: ExportData = {
version: 1,
profile: profile,
};
return JSON.stringify(exportData);
} | https://github.com/AlkaidLab/moonlight-harmony | 72c76df1e847f912febd91dffbf8886e34180f55 | github |
YANGZX22/Voot | entry/src/main/ets/services/ContinuityService.ets | arkts | bindDevice | 绑定设备(建立信任关系) | async bindDevice(deviceId: string): Promise<boolean> {
if (!this.dmInstance) {
return false;
}
return new Promise((resolve) => {
try {
const bindParam: Record<string, Object> = {
'bindType': 1,
'targetPkgName': 'com.zixiao.voot',
'appName': 'Voot',
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left bindDevice AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceId AST#identifier#Right AST#... | async bindDevice(deviceId: string): Promise<boolean> {
if (!this.dmInstance) {
return false;
}
return new Promise((resolve) => {
try {
const bindParam: Record<string, Object> = {
'bindType': 1,
'targetPkgName': 'com.zixiao.voot',
'appName': 'Voot',
... | https://github.com/YANGZX22/Voot | 19221dffa612d4231532736fe04d1be0ee9e9a10 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | clearCustomTheme | 清除自定义主题,恢复默认主题 | public async clearCustomTheme(): Promise<void> {
try {
logger.info(TAG, '开始清除自定义主题');
// 1. 清除全局状态
AppStorage.setOrCreate(CUSTOM_THEME_KEYS.BACKGROUND_IMAGE, '');
AppStorage.setOrCreate(CUSTOM_THEME_KEYS.BACKGROUND_IMAGE_LIGHT, '');
AppStorage.setOrCreate(CUSTOM_THEME_KEYS.BAC... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left clearCustomTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public async clearCustomTheme(): Promise<void> {
try {
logger.info(TAG, '开始清除自定义主题');
// 1. 清除全局状态
AppStorage.setOrCreate(CUSTOM_THEME_KEYS.BACKGROUND_IMAGE, '');
AppStorage.setOrCreate(CUSTOM_THEME_KEYS.BACKGROUND_IMAGE_LIGHT, '');
AppStorage.setOrCreate(CUSTOM_THEME_KEYS.BAC... | https://github.com/DaLongZhuaZi/manxia | a817be46fec7a6d15040477eabf380a5dfaa8809 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BubbleComponent.ets | arkts | getBubbleTopPadding | 顶部内边距
@returns | getBubbleTopPadding(): number {
const p = this.mShadowRadius + this.mBubbleBorderSize
const topPadding =
p + (this.mShadowY < 0 ? -this.mShadowY : 0) + (this.mArrowLocation == ArrowLocation.TOP ? this.mArrowHeight : 0)
return topPadding + (this.mBubbleTopPadding == -1 ? this.mBubblePadding : this.mB... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBubbleTopPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#st... | getBubbleTopPadding(): number {
const p = this.mShadowRadius + this.mBubbleBorderSize
const topPadding =
p + (this.mShadowY < 0 ? -this.mShadowY : 0) + (this.mArrowLocation == ArrowLocation.TOP ? this.mArrowHeight : 0)
return topPadding + (this.mBubbleTopPadding == -1 ? this.mBubblePadding : this.mB... | https://github.com/wuba/omni-ui | 585b413750617945226885852817468cf314dca4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | slice | Creates a slice of current BigUint64 with all elements.
@returns a new BigUint64Array with elements of current BigUint64Array | public slice(): BigUint64Array {
return new BigUint64Array(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public slice(): BigUint64Array {
return new BigUint64Array(this)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | aa22448dfa0a7a0149b9f5ae51ca5bcdb6b93d4c | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/xiaoyi/XiaoyiSkillManager.ets | arkts | registerSkill | 注册单个Skill | registerSkill(skill: XiaoyiSkillDefinition): void {
this.skills.set(skill.config.skillId, skill);
console.info(`[Xiaoyi] 注册Skill: ${skill.config.skillName} (${skill.config.skillId})`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerSkill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left skill AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left XiaoyiSkillDefinition AST#identifier#Righ... | registerSkill(skill: XiaoyiSkillDefinition): void {
this.skills.set(skill.config.skillId, skill);
console.info(`[Xiaoyi] 注册Skill: ${skill.config.skillName} (${skill.config.skillId})`);
} | https://github.com/LJ666-ui/harmony-health-care | b96f381865a343d103c6b06efe56eb6cb1fe2065 | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets | arkts | evaluateHeartRate | 评估心率风险 | private static evaluateHeartRate(value: number): RiskFactor {
let score = 0;
let level: 'low' | 'medium' | 'high' | 'very_high' = 'low';
if (value >= 150) { score = 90; level = 'very_high'; }
else if (value >= 100) { score = 60; level = 'high'; }
else if (value < 50) { score = 50; level = 'me... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left evaluateHeartRate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#L... | private static evaluateHeartRate(value: number): RiskFactor {
let score = 0;
let level: 'low' | 'medium' | 'high' | 'very_high' = 'low';
if (value >= 150) { score = 90; level = 'very_high'; }
else if (value >= 100) { score = 60; level = 'high'; }
else if (value < 50) { score = 50; level = 'me... | https://github.com/LJ666-ui/harmony-health-care | 21bfcc5f29f7428bf3135132d7f91f17505b8240 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/CoffeeDao.ets | arkts | queryById | 查询单条记录 | async queryById(id: number): Promise<CoffeeRecord | null> {
const rdbStore = this.getRdbStore()
if (!rdbStore) {
return null;
}
const predicates = new relationalStore.RdbPredicates(this.tableName);
predicates.equalTo('id', id);
try {
const resultSet = await rdbStore.query(predica... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryById 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#:#R... | async queryById(id: number): Promise<CoffeeRecord | null> {
const rdbStore = this.getRdbStore()
if (!rdbStore) {
return null;
}
const predicates = new relationalStore.RdbPredicates(this.tableName);
predicates.equalTo('id', id);
try {
const resultSet = await rdbStore.query(predica... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 6ac33c8616adc2fe52b9cea8cb8e67bfd4040464 | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | unregister | 取消订阅默认网络状态变化的通知。 | static unregister() {
if (NetworkUtil.netConnection) {
NetworkUtil.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtil.error(error);
}
});
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS... | static unregister() {
if (NetworkUtil.netConnection) {
NetworkUtil.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtil.error(error);
}
});
}
} | https://github.com/tdcare/tdwebrtc | 682515ebf7594ab8f0cf7c82415d0ac8af170134 | github |
openharmony/codelabs | ETSUI/SimpleCalculator/entry/src/main/ets/model/CalculateModel.ets | arkts | getResult | Obtaining Results.
@return Whether the result is incorrect. | async getResult() {
let calResult = CalculateUtil.parseExpression(this.deepCopy());
if (calResult === 'NaN') {
this.context.calValue = this.resourceToString($r('app.string.error'));
return false;
}
this.context.calValue = calResult;
return true;
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getResult 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 getResult() {
let calResult = CalculateUtil.parseExpression(this.deepCopy());
if (calResult === 'NaN') {
this.context.calValue = this.resourceToString($r('app.string.error'));
return false;
}
this.context.calValue = calResult;
return true;
} | https://gitee.com/openharmony/codelabs.git | 48065941cc624a6dc89c6ca5ed5a69e3b8adf371 | gitee |
Bistu-OSSDT-2024/16-ArkNotes | memo/entry/src/main/ets/Component/ButtonStyle.ets | arkts | build | @State backgroundImageIndex: number = 0; // 当前选择的壁纸的索引
两种内置的壁纸的路径
backgroundImages: Resource[] = [
$r('app.media.123'),
$r('app.media.background1'),
$r('app.media.background2'),
$r('app.media.background3')
]; | build() {
Column() {
Button('更改壁纸')
.backgroundColor('rgba(255, 255, 255, 0.5)') // 设置背景色为半透明的白色
.borderRadius('50%') // 设置边框半径为50%,使其成为圆形
.width(100)
.height(40)
.fontSize(10)
.fontColor('#000000')
.margin({left:0,bottom:0})
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
Button('更改壁纸')
.backgroundColor('rgba(255, 255, 255, 0.5)') // 设置背景色为半透明的白色
.borderRadius('50%') // 设置边框半径为50%,使其成为圆形
.width(100)
.height(40)
.fontSize(10)
.fontColor('#000000')
.margin({left:0,bottom:0})
... | https://github.com/Bistu-OSSDT-2024/16-ArkNotes | 99a602d9ce596c9e3af89b33add0132de1a7f6a8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | saveToPermanentCache | 保存到永久缓存 | private async saveToPermanentCache(
url: string,
pixelMap: image.PixelMap,
options: LoadOptions
): Promise<void> {
try {
const permanentCache = PermanentImageCacheManager.getInstance();
// 将PixelMap转换为ArrayBuffer
const imageData = await this.pixelMapToArrayBuffer(pixelMap);
... | 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 saveToPermanentCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#L... | private async saveToPermanentCache(
url: string,
pixelMap: image.PixelMap,
options: LoadOptions
): Promise<void> {
try {
const permanentCache = PermanentImageCacheManager.getInstance();
// 将PixelMap转换为ArrayBuffer
const imageData = await this.pixelMapToArrayBuffer(pixelMap);
... | https://github.com/DaLongZhuaZi/manxia | b82b381d427d817072592d8d0677afbe53e2bfc5 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/AchievementStorageService.ets | arkts | unlockAchievements | 批量解锁成就
@param achievementIds 成就ID列表 | static async unlockAchievements(achievementIds: string[]): Promise<void> {
try {
const achievements = await AchievementStorageService.loadAchievements();
let updated = false;
for (let i = 0; i < achievementIds.length; i++) {
const id = achievementIds[i];
const achievement = achi... | 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 unlockAchievements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left achievementIds AST#identifier#Right AST#ERROR#Left A... | static async unlockAchievements(achievementIds: string[]): Promise<void> {
try {
const achievements = await AchievementStorageService.loadAchievements();
let updated = false;
for (let i = 0; i < achievementIds.length; i++) {
const id = achievementIds[i];
const achievement = achi... | https://github.com/the-wwyang/kids-learning-app | c39a7a38baa4d65505cd5aed999ad99c178a6624 | github |
mybricks/comlib-harmony-normal | packages/rt-arkts/comlib/src/main/ets/audio/AudioCapturer.ets | arkts | getDuration | 计算音频时长 | async getDuration(): Promise<number> {
const audioParamsGet = this.audioCapturer?.getStreamInfoSync()
if (!audioParamsGet) return 0;
const bytesPerSample = this.getBytesPerSample(audioParamsGet.sampleFormat);
const duration = this.bufferSize / (
audioParamsGet.samplingRate *
audioParamsGe... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDuration AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getDuration(): Promise<number> {
const audioParamsGet = this.audioCapturer?.getStreamInfoSync()
if (!audioParamsGet) return 0;
const bytesPerSample = this.getBytesPerSample(audioParamsGet.sampleFormat);
const duration = this.bufferSize / (
audioParamsGet.samplingRate *
audioParamsGe... | https://github.com/mybricks/comlib-harmony-normal | e90641164fd3357f8a09b5b391d6b32ec1507f01 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CommentManager.ets | arkts | init | Initialize preferences | static async init(context: Context): Promise<void> {
try {
CommentManager.preferencesInstance = await preferences.getPreferences(context, CommentManager.PREFERENCES_NAME);
console.log('CommentManager initialized successfully');
} catch (err) {
console.error('Failed to initialize CommentManag... | 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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig... | static async init(context: Context): Promise<void> {
try {
CommentManager.preferencesInstance = await preferences.getPreferences(context, CommentManager.PREFERENCES_NAME);
console.log('CommentManager initialized successfully');
} catch (err) {
console.error('Failed to initialize CommentManag... | https://github.com/Harrisonls2004/WaterFlow | c97b2485ce2b4ce9a2b1d9ccd4bb3892dfaca685 | github |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/AddressEdit.ets | arkts | isRightPhone | 验证手机号是否正确 | isRightPhone(phone:string):boolean{
if(phone == "" || phone.length>11){
return false;
}
let reg = /^1[3|4|5|7|8][0-9]{9}/;
if(reg.test(phone)){
return true;//手机号码正确
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRightPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | isRightPhone(phone:string):boolean{
if(phone == "" || phone.length>11){
return false;
}
let reg = /^1[3|4|5|7|8][0-9]{9}/;
if(reg.test(phone)){
return true;//手机号码正确
}
return false;
} | https://gitee.com/openharmony-sig/ohos_easyui.git | b7cdea823b88df629d42e34c9cdc2a74cbb2f851 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | search | Executes a search for a match between a regular expression and this String object.
@param regexp a regular expression object
@returns the index of the first match between the regular expression and the given string,
or -1 if no match was found. | public search(regexp: RegExp) : int {
throw new Error("Not implemented");
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left regexp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RegExp ... | public search(regexp: RegExp) : int {
throw new Error("Not implemented");
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1957a76face4f441f5c73fa4e1ea2ffc1c8f2952 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.