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 |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | addTxtTocRule | 添加TXT目录规则 | async addTxtTocRule(rule: TxtTocRuleInput): Promise<string> {
const id = `rule_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
const newRule: TxtTocRule = {
id: id,
name: rule.name,
pattern: rule.pattern,
enabled: rule.enabled,
priority: rule.priority,
example... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addTxtTocRule AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rule AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async addTxtTocRule(rule: TxtTocRuleInput): Promise<string> {
const id = `rule_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
const newRule: TxtTocRule = {
id: id,
name: rule.name,
pattern: rule.pattern,
enabled: rule.enabled,
priority: rule.priority,
example... | https://github.com/DaLongZhuaZi/manxia | 99d3b42e7c07b352c9124e577a4b62a86466ecdd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current Float64Array using range [begin, this.length).
@param { int } begin - start index to be taken into slice
@returns { Float64Array } - a new Float64Array with elements of current Float64Array[begin, this.length)
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public slice(begin: int): Float64Array {
return this.sliceFromTo(begin, this.lengthInt)
} | 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#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public slice(begin: int): Float64Array {
return this.sliceFromTo(begin, this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | a8cd1913261d27fac5fa2e6318f33855434fae18 | gitcode |
XHXYT/Pixark | entry/src/main/ets/viewmodel/FavoriteViewModel.ets | arkts | loadCollectionData | 加载收藏 (支持全部/公开/隐藏) | async loadCollectionData(isLoadMore: boolean = false) {
if (!isLoadMore && this.hasLoadedCollection && this.lastFilterIndex === this.filterIndex) return;
try {
const userId = PixState.currentUser?.id || 0;
let newData: PixivIllust[] = [];
if (this.filterIndex === 0) {
const results =... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadCollectionData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isLoadMore AST#identifier#... | async loadCollectionData(isLoadMore: boolean = false) {
if (!isLoadMore && this.hasLoadedCollection && this.lastFilterIndex === this.filterIndex) return;
try {
const userId = PixState.currentUser?.id || 0;
let newData: PixivIllust[] = [];
if (this.filterIndex === 0) {
const results =... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/FavoriteViewModel.ets#L191-L228 | 95187402b3383582c3f862f616623289d500ca18 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | deleteByUserId | 批量删除用户的训练记录 | static async deleteByUserId(userId: number): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.RdbPredicates(Smar... | 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 deleteByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ... | static async deleteByUserId(userId: number): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.RdbPredicates(Smar... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ae36bf1debe64e6ac41fc1d237c2e5a6d6248137 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | println | @section Println definitions
Prints a newline
@returns {void}
@public
@deprecated Will be removed in future. Please use log instead | public println(): void {
this.print(c'\n')
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta... | public println(): void {
this.print(c'\n')
} | https://gitcode.com/iop123123/arkts-static-skills | ee1871c4874f1824f35f1ae2961be0fab5969485 | gitcode |
openharmony-sig/ohos_video_trimmer | entry/src/main/ets/pages/FileUtils.ets | arkts | readFilePicAsync | 异步读取路径path的文件 | readFilePicAsync(path: string): Promise<ArrayBuffer> {
return new Promise((resolve,reject)=>{
fs.open(path, fs.OpenMode.READ_ONLY).then((file) => {
let stat = fs.statSync(path)
let fd = file.fd;
let length = stat.size;
let buf = new ArrayBuffer(length);
fs.read(fd,buf... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left readFilePicAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | readFilePicAsync(path: string): Promise<ArrayBuffer> {
return new Promise((resolve,reject)=>{
fs.open(path, fs.OpenMode.READ_ONLY).then((file) => {
let stat = fs.statSync(path)
let fd = file.fd;
let length = stat.size;
let buf = new ArrayBuffer(length);
fs.read(fd,buf... | https://gitee.com/openharmony-sig/ohos_video_trimmer.git | c9e79703365bb043ebe5c99f67d12724026114f0 | gitee |
CLMC2025/Vignette | entry/src/main/ets/utils/TimerManager.ets | arkts | isDestroyed | 检查是否已销毁 | isDestroyed(): boolean {
return this.destroyed;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isDestroyed 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#stateme... | isDestroyed(): boolean {
return this.destroyed;
} | https://github.com/CLMC2025/Vignette | b9ed921d9ea7148107397e1e2d9f03664332f154 | github |
iop123123/arkts-static-skills | linter/linter/examples/declarations/var_banned.fail.ets | arkts | main | expect: fail
expect-code: ESY0297
evidence: ERROR_ARKTS_NO_VAR — 'var' keyword is not supported. Use 'let' instead. | function main(): void {
var x: int = 1;
console.log(x as Object);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
var x: int = 1;
console.log(x as Object);
} | https://gitcode.com/iop123123/arkts-static-skills | 821c03446417007873a7c235a33333741bc46486 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DataValidator.ets | arkts | validateNonEmptyString | 验证字符串是否非空
@param value - 要验证的字符串
@param fieldName - 字段名称(用于错误消息)
@returns 验证结果 | static validateNonEmptyString(value: string | undefined | null, fieldName: string = 'field'): ValidationResult {
const errors: string[] = [];
if (value === null || value === undefined) {
errors.push(`${fieldName} 不能为空`);
} else if (typeof value !== 'string') {
errors.push(`${fieldName} 必须... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateNonEmptyString 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#binary_e... | static validateNonEmptyString(value: string | undefined | null, fieldName: string = 'field'): ValidationResult {
const errors: string[] = [];
if (value === null || value === undefined) {
errors.push(`${fieldName} 不能为空`);
} else if (typeof value !== 'string') {
errors.push(`${fieldName} 必须... | https://github.com/DaLongZhuaZi/manxia | 2f67a77cd9fd0c440d87c101832ffbd602744aaf | github |
chenchl/GMLogger-HarmonyOS | gmlogger/src/main/ets/components/security/logger/LoggerCryptoUtil.ets | arkts | encryptSM4 | 使用SM4算法对明文进行加密。
@param key - 用于加密的密钥,类型为Uint8Array。
@param plainText - 需要加密的明文,类型为字符串。
@returns 返回加密后的数据,类型为Uint8Array。如果加密失败,则返回明文的Uint8Array表示。 | static encryptSM4(key: Uint8Array, plainText: string) {
try {
// 生成对称密钥
let symKey = LoggerCryptoUtil.genSymKeyByData(key);
// 创建SM4加密器,使用CBC模式和PKCS7填充
let cipher = cryptoFramework.createCipher('SM4_128|CBC|PKCS7');
// 初始化加密器为加密模式,并设置密钥和初始化向量
cipher.initSync(cryptoFramework.Cry... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left encryptSM4 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8A... | static encryptSM4(key: Uint8Array, plainText: string) {
try {
// 生成对称密钥
let symKey = LoggerCryptoUtil.genSymKeyByData(key);
// 创建SM4加密器,使用CBC模式和PKCS7填充
let cipher = cryptoFramework.createCipher('SM4_128|CBC|PKCS7');
// 初始化加密器为加密模式,并设置密钥和初始化向量
cipher.initSync(cryptoFramework.Cry... | https://github.com/chenchl/GMLogger-HarmonyOS | c8dbc4f6ecff4b4ec362056889eea955044cae31 | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/CommonUtil.ets | arkts | getDayOfWeekByDateNotHO | Query which day of the week by given the date.
@param date Date
@return The description of the queried day of a week in the corresponding language. | static getDayOfWeekByDateNotHO(date: Date): string {
if (!date) {
return '';
}
const options: Intl.DateTimeFormatOptions = { weekday: 'short' };
return new Date(date.getFullYear(), date.getMonth(),
date.getDate()).toLocaleDateString(i18n.getSystemLanguage(), options);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDayOfWeekByDateNotHO AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | static getDayOfWeekByDateNotHO(date: Date): string {
if (!date) {
return '';
}
const options: Intl.DateTimeFormatOptions = { weekday: 'short' };
return new Date(date.getFullYear(), date.getMonth(),
date.getDate()).toLocaleDateString(i18n.getSystemLanguage(), options);
} | https://gitee.com/openharmony-sig/applications_clock.git | 30b29a381bc9f5c5f04a5b1f3ec1e9bbe577ad8d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | generateMangaMetadataXml | 生成漫画元数据XML文件 | private async generateMangaMetadataXml(manga: MangaBackupItem, targetDir: string): Promise<void> {
try {
const metadata: MangaMetadata = {
title: manga.title,
series: manga.title,
author: manga.author,
artist: manga.artist,
description: manga.description,
genr... | 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 generateMangaMetadataXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right A... | private async generateMangaMetadataXml(manga: MangaBackupItem, targetDir: string): Promise<void> {
try {
const metadata: MangaMetadata = {
title: manga.title,
series: manga.title,
author: manga.author,
artist: manga.artist,
description: manga.description,
genr... | https://github.com/DaLongZhuaZi/manxia | 85d869e27b7a6b6d155bc92f2f9050f5d17e1d78 | github |
codelably/HCompass | core/testing/src/main/ets/TestContainerHelper.ets | arkts | teardown | 清理测试环境,恢复原始全局容器 | teardown(): void {
if (this.originalContainer) {
setContainer(this.originalContainer);
}
this.originalContainer = undefined;
this.testContainer = undefined;
this.isSetup = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left teardown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left A... | teardown(): void {
if (this.originalContainer) {
setContainer(this.originalContainer);
}
this.originalContainer = undefined;
this.testContainer = undefined;
this.isSetup = false;
} | https://github.com/codelably/HCompass | 9c89ec362e7c284ae33e5350572049fca9e909c1 | github |
arkui-x/samples | CodeLab/Cases/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets | arkts | createCommonSettingView | 弹窗可滚动区域最大高度
创建常用设置底部弹窗视图 | @Builder
function createCommonSettingView() {
CommonSettingView()
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left createCommonSettingView AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig... | @Builder
function createCommonSettingView() {
CommonSettingView()
} | https://gitcode.com/arkui-x/samples | 807665ce8d872fe4c0d7d2f90414cfa47e18423e | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/utils/FileHelper.ets | arkts | getExportDirectory | 获取导出目录路径,确保目录存在
@returns 导出目录路径 | static async getExportDirectory(): Promise<string> {
try {
// 获取应用文件目录
const context = getContext();
const filesDir = context.filesDir;
if (!filesDir) {
throw new Error("无法获取 filesDir");
}
const exportDir = `${filesDir}/${FileHelper.EXPORT_DIR}`;
// 检查目录是否存在,不存... | 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 getExportDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | static async getExportDirectory(): Promise<string> {
try {
// 获取应用文件目录
const context = getContext();
const filesDir = context.filesDir;
if (!filesDir) {
throw new Error("无法获取 filesDir");
}
const exportDir = `${filesDir}/${FileHelper.EXPORT_DIR}`;
// 检查目录是否存在,不存... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f05dc859cd8e8ab470b45406c7922a4c36393489 | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/model/ReminderModel.ets | arkts | checkGoalAchievement | 检查是否达成目标并返回达成的目标类型 | checkGoalAchievement(distance: number, duration: number, calories: number): string[] {
const achievedGoals: string[] = [];
const hasDistanceGoal = globalGoal.distance !== undefined;
const hasDurationGoal = globalGoal.duration !== undefined;
const hasCaloriesGoal = globalGoal.calories !== undefined;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkGoalAchievement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left distance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Ri... | checkGoalAchievement(distance: number, duration: number, calories: number): string[] {
const achievedGoals: string[] = [];
const hasDistanceGoal = globalGoal.distance !== undefined;
const hasDurationGoal = globalGoal.duration !== undefined;
const hasCaloriesGoal = globalGoal.calories !== undefined;
... | https://gitcode.com/openharmony/codelabs | 9280d05cb5c5cc3203f51d782e4019dad9c8b334 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | collectMemoryInfoSync | 同步收集内存信息 | private collectMemoryInfoSync(): HidebugMemoryInfo {
const memoryInfo: HidebugMemoryInfo = {
nativeHeapSize: 0,
nativeHeapAllocatedSize: 0,
nativeHeapFreeSize: 0,
pss: 0,
vss: 0,
sharedDirty: 0,
privateDirty: 0,
vmMemoryInfo: null,
appMemoryLimit: 0,
gra... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left collectMemoryInfoSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Le... | private collectMemoryInfoSync(): HidebugMemoryInfo {
const memoryInfo: HidebugMemoryInfo = {
nativeHeapSize: 0,
nativeHeapAllocatedSize: 0,
nativeHeapFreeSize: 0,
pss: 0,
vss: 0,
sharedDirty: 0,
privateDirty: 0,
vmMemoryInfo: null,
appMemoryLimit: 0,
gra... | https://github.com/DaLongZhuaZi/manxia | f3b399cdc487cb2d245071fb5edab5632e6afb21 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | getDistance | Calculates the distance between the two given points.
@param x1
@param y1
@param x2
@param y2
@return | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
//return Math.abs(y1 - y2);
//return Math.abs(x1 - x2);
return Math.hypot(x1 - x2, y1 - y2);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
//return Math.abs(y1 - y2);
//return Math.abs(x1 - x2);
return Math.hypot(x1 - x2, y1 - y2);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1dd899bb5a5935c212ba3ca66a5ff1adbff09ec7 | gitee |
lidaixian999/Smart_Car | entry/src/main/ets/model/SsapManager.ets | arkts | unregisterCallback | 取消注册扫描结果回调 | public unregisterCallback(callback: ScanResultCallback): void {
const deleted = this.callbacks.delete(callback);
if (deleted) {
hilog.info(this.domainId, this.logTag, `Callback unregistered, total: ${this.callbacks.size}`);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregisterCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public unregisterCallback(callback: ScanResultCallback): void {
const deleted = this.callbacks.delete(callback);
if (deleted) {
hilog.info(this.domainId, this.logTag, `Callback unregistered, total: ${this.callbacks.size}`);
}
} | https://github.com/lidaixian999/Smart_Car | 2c3ce5c0115bf42cbfeae369b9bfb5c751c19909 | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/common/utils.ets | arkts | quatMultVec3 | Multiply vector3 by quaternion(rotation) | function quatMultVec3(q: Quaternion, v: Vec3): Vec3 {
let quatvector: Vec3 = { x: q.x, y: q.y, z: q.z };
let uv: Vec3 = cross(quatvector, v);
let uuv: Vec3 = (cross(quatvector, uv));
let ret: Vec3 = {
x: v.x + (uv.x * q.w + uuv.x) * 2,
y: v.y + (uv.y * q.w + uuv.y) * 2, z: v.z + (uv.z * q.w + uuv.z) * ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left quatMultVec3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left q AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function quatMultVec3(q: Quaternion, v: Vec3): Vec3 {
let quatvector: Vec3 = { x: q.x, y: q.y, z: q.z };
let uv: Vec3 = cross(quatvector, v);
let uuv: Vec3 = (cross(quatvector, uv));
let ret: Vec3 = {
x: v.x + (uv.x * q.w + uuv.x) * 2,
y: v.y + (uv.y * q.w + uuv.y) * 2, z: v.z + (uv.z * q.w + uuv.z) * ... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 7a8d6590f851a10a8db508c3d62b3f61b950d4cc | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/base/BaseChart.ets | arkts | notifyConfigChange | 通知配置变更 | protected notifyConfigChange(): void {
const config = this.getConfig();
this.configListeners.forEach(listener => {
try {
listener(config);
} catch (error) {
console.error('[BaseChart] 配置监听器执行失败:', error);
}
});
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left notifyConfigChange 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 ... | protected notifyConfigChange(): void {
const config = this.getConfig();
this.configListeners.forEach(listener => {
try {
listener(config);
} catch (error) {
console.error('[BaseChart] 配置监听器执行失败:', error);
}
});
} | https://github.com/LJ666-ui/harmony-health-care | 51b41b2ea5ecf43151a3d72b07361e5bde3966a4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | setMaxConcurrentSources | 设置最大并发搜索数 | async setMaxConcurrentSources(count: number): Promise<void> {
this.searchSettings.maxConcurrentSources = Math.max(1, Math.min(50, count));
await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.SEARCH_SETTINGS, this.searchSettings);
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setMaxConcurrentSources AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requi... | async setMaxConcurrentSources(count: number): Promise<void> {
this.searchSettings.maxConcurrentSources = Math.max(1, Math.min(50, count));
await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.SEARCH_SETTINGS, this.searchSettings);
} | https://github.com/DaLongZhuaZi/manxia | cf240b5ba2c9a07e7a5dd2fb4c28cc4dd818ed2e | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets | arkts | isValid | Determine whether the current ratio is valid.
@returns | isValid(): boolean {
return (this.w > 0 && this.h > 0);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValid 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... | isValid(): boolean {
return (this.w > 0 && this.h > 0);
} | https://gitee.com/openharmony/codelabs.git | dbc7b3de0de37cd9233cd7845ef0d65eaa888cea | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/06.conversions_and_contexts/02.assignment_contexts/unboxing.ets | arkts | main | ---
desc: Assignment contexts allow the use of an unboxing conversion.
params: Conversion from '{{case.src_type}}' to '{{case.dst_type}}'
--- | function main(): int {
{% for v in case['values'] %}
let src_{{loop.index}}: {{case.src_type}} = new {{case.src_type}}({{v|safe}}); | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left i... | function main(): int {
{% for v in case['values'] %}
let src_{{loop.index}}: {{case.src_type}} = new {{case.src_type}}({{v|safe}}); | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2430dc1ea3c5ae15d232a04906ffb4028e537e69 | gitee |
openharmony-sig/ohos_highlightguide | library/src/main/ets/highlightguide/core/HighLightGuideBuilder.ets | arkts | setShowCounts | 设置引导页的显示次数
@param count 显示次数
@returns 引导页组件的配置项 | public setShowCounts(count: number): HighLightGuideBuilder {
this.showCounts = count;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setShowCounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | public setShowCounts(count: number): HighLightGuideBuilder {
this.showCounts = count;
return this;
} | https://gitee.com/openharmony-sig/ohos_highlightguide.git | 8bc5ff36a349fbee797f3153350a9ad6470c6a64 | gitee |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/AppNav.ets | arkts | clearDetailState | 清理覆盖页内容 builder 与详情状态。 | private clearDetailState(): void {
this.detailModuleName = '';
this.detailRecordId = 0;
this.actionSheetHeight = AppNav.DEFAULT_ACTION_SHEET_HEIGHT;
this.detailCardHeight = AppNav.DEFAULT_DETAIL_CARD_HEIGHT;
this.actionSheetContentBuilder = () => {};
this.detailCardContentBuilder = () => {};
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left clearDetailState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ex... | private clearDetailState(): void {
this.detailModuleName = '';
this.detailRecordId = 0;
this.actionSheetHeight = AppNav.DEFAULT_ACTION_SHEET_HEIGHT;
this.detailCardHeight = AppNav.DEFAULT_DETAIL_CARD_HEIGHT;
this.actionSheetContentBuilder = () => {};
this.detailCardContentBuilder = () => {};
... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L181-L188 | 8d8ac4330c342ad79ff69f8d2e9dd3160665030d | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets | arkts | update_play_list_index | 更新播放列表排序 // | update_play_list_index(list_index: number[]) {} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left update_play_list_index AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left list_index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#[#Le... | update_play_list_index(list_index: number[]) {} | https://github.com/Nekofox-POT/LinMusic | 7dfd745c2b7a5abaf4fee4253e5f768d433c6897 | github |
openharmony-sig/flutter_packages | packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/OhosObjectHostApiImpl.ets | arkts | constructor | Constructs a {@link JavaObjectHostApiImpl}.
@param instanceManager maintains instances stored to communicate with Dart objects | constructor(instanceManager: InstanceManager) {
super()
this.instanceManager = instanceManager;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instanceManager AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InstanceManager AS... | constructor(instanceManager: InstanceManager) {
super()
this.instanceManager = instanceManager;
} | https://gitee.com/openharmony-sig/flutter_packages.git | 1a3159da54556d8e041b607c1bbcc2ed6cd5a70e | gitee |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | loadAll | ============================================================================
加载(DB → normalize → state)
============================================================================
从 DB 拉一遍 providers,更新内存 state;返回同样的数组以兼容原调用方 | async loadAll(): Promise<ModelProvider[]> {
const configs = await this.db.getAllProviders()
const providers: ModelProvider[] = []
for (let i = 0; i < configs.length; i++) {
providers.push(this.configToProvider(configs[i]))
}
this.setProviders(providers)
return providers
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadAll 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_type... | async loadAll(): Promise<ModelProvider[]> {
const configs = await this.db.getAllProviders()
const providers: ModelProvider[] = []
for (let i = 0; i < configs.length; i++) {
providers.push(this.configToProvider(configs[i]))
}
this.setProviders(providers)
return providers
} | https://github.com/LongLiveY96/chatcube | f6d9eb71171dab962741f11d1f44edef1bbd4a0a | github |
openharmony/arkui_ace_engine | examples/Animation/entry/src/main/ets/pages/pageTransition/pageTransition3.ets | arkts | pageTransition | 自定义方式2:使用系统提供的多种默认效果(平移、缩放、透明度等) | pageTransition() {
// 该页面进入动画时长为1200ms,尽量与另一页面的退出动画时长匹配
PageTransitionEnter({ duration: 1200 })
.slide(SlideEffect.Left)
// 该页面退出动画时长为1000ms,尽量与另一页面的进入动画时长匹配
PageTransitionExit({ duration: 1000 })
.translate({ x: 100.0, y: 100.0 })
.opacity(0)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | pageTransition() {
// 该页面进入动画时长为1200ms,尽量与另一页面的退出动画时长匹配
PageTransitionEnter({ duration: 1200 })
.slide(SlideEffect.Left)
// 该页面退出动画时长为1000ms,尽量与另一页面的进入动画时长匹配
PageTransitionExit({ duration: 1000 })
.translate({ x: 100.0, y: 100.0 })
.opacity(0)
} | https://gitcode.com/openharmony/arkui_ace_engine | 7468f0ba27c8a1bdd19ff22b62a92bd21cba0f0f | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/GradientBackgroundViewModel.ets | arkts | getCoolGradientItems | 获取酷炫渐变背景列表
@returns {GradientBackgroundItem[]} 酷炫渐变背景数组 | getCoolGradientItems(): GradientBackgroundItem[] {
return [
new GradientBackgroundItem("Cool 1", "酷炫渐变 1", TnGradientBackground("cool-1"), "cool-1"),
new GradientBackgroundItem("Cool 2", "酷炫渐变 2", TnGradientBackground("cool-2"), "cool-2"),
new GradientBackgroundItem("Cool 3", "酷炫渐变 3", TnGradien... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCoolGradientItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left GradientBackgroundItem AST#identifier#Rig... | getCoolGradientItems(): GradientBackgroundItem[] {
return [
new GradientBackgroundItem("Cool 1", "酷炫渐变 1", TnGradientBackground("cool-1"), "cool-1"),
new GradientBackgroundItem("Cool 2", "酷炫渐变 2", TnGradientBackground("cool-2"), "cool-2"),
new GradientBackgroundItem("Cool 3", "酷炫渐变 3", TnGradien... | https://github.com/codelably/tuniao-ui | 71fa8a917d24787c5475d1dae4a03152c4405773 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isLowerCase | isLowerCase() checks whether the underlying char is a lower case letter.
@returns { boolean }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isLowerCase(): boolean {
return Char.isLowerCase(this.value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLowerCase 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#b... | public isLowerCase(): boolean {
return Char.isLowerCase(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | 77bd9e3b8096f6673c053fe03eda9ad1d97dfbd4 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/model/ScanSize.ets | arkts | constructor | XComponent's Y方向的偏移量 | constructor() {
this.width = 1080;
this.height = 720;
this.offsetX = 0;
this.offsetY = 0;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.width = 1080;
this.height = 720;
this.offsetX = 0;
this.offsetY = 0;
} | https://gitcode.com/arkui-x/samples | c65f2c69e62fa450f5b7bdb4b3a1080ee44dc46d | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setDrawCenterText | set this to true to draw the text that is displayed in the center of the
pie chart
@param enabled | public setDrawCenterText(enabled: boolean): void {
this.mDrawCenterText = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawCenterText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public setDrawCenterText(enabled: boolean): void {
this.mDrawCenterText = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | de80ff4a291c436d0fe9498e12fae4cd9d280c46 | gitee |
fbinba3955/Flymby | common/src/main/ets/utils/VolumeUtil.ets | arkts | setMediaVolume | 设置媒体音量
@param volume 音量值 0.0-1.0 | public static async setMediaVolume(volume: number): Promise<void> {
try {
if (!VolumeUtil.audioManager) {
LogUtil.error('VolumeUtil 音频管理器未初始化');
return;
}
// 将0-1的音量值转换为系统音量值0-15
const systemVolume = Math.round(volume * VolumeUtil.MAX_SYSTEM_VOLUME);
const validVolum... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left setMediaVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vol... | public static async setMediaVolume(volume: number): Promise<void> {
try {
if (!VolumeUtil.audioManager) {
LogUtil.error('VolumeUtil 音频管理器未初始化');
return;
}
// 将0-1的音量值转换为系统音量值0-15
const systemVolume = Math.round(volume * VolumeUtil.MAX_SYSTEM_VOLUME);
const validVolum... | https://github.com/fbinba3955/Flymby | a8168284b07cdce63068868976e721e51fabf1fe | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/AppColors.ets | arkts | buttonPrimary | ==================== 按钮专用 ==================== | static get buttonPrimary(): string { return getColorForCurrentTheme(ColorRole.BUTTON_PRIMARY); } | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left buttonPrimary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | static get buttonPrimary(): string { return getColorForCurrentTheme(ColorRole.BUTTON_PRIMARY); } | https://github.com/DaLongZhuaZi/manxia | 4221c05465623984d009312641aa77b24e6adcf4 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/PermissionManager.ets | arkts | requestPermissions | 动态申请授权(首次弹窗申请)
@param permissions 权限列表
@returns 返回授权结果,授权成功为 Promise.resolve(), 拒绝授权为 Promise.reject() | async requestPermissions(permissions: Permissions[]) {
const context: Context = new UIContext().getHostContext() as Context
// 1. 创建应用权限管理器
const atManager = abilityAccessCtrl.createAtManager()
// 2. 向用户申请 user_grant 权限(温馨提示:首次申请时会弹窗,后续申请则不会再出现弹窗)
const requestResult = await atManager.requestPermi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestPermissions AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left permissions AST#identifier#Right AST#type_annotation#Left AS... | async requestPermissions(permissions: Permissions[]) {
const context: Context = new UIContext().getHostContext() as Context
// 1. 创建应用权限管理器
const atManager = abilityAccessCtrl.createAtManager()
// 2. 向用户申请 user_grant 权限(温馨提示:首次申请时会弹窗,后续申请则不会再出现弹窗)
const requestResult = await atManager.requestPermi... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 420ac62e9592d4f17ee41fcd803a43a8ecca685f | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistoryChunk.ets | arkts | lookUpHistoryEntries | Looks up history entries for a given query. Would load index and entries from disk.
@param query Any query word(s) / string.
@param maxResults The maximum number of results to return.
@returns A promise that resolves to an array of meowHistory objects, in descending order. | async lookUpHistoryEntries(query: string, maxResults: number = 20): Promise<meowHistoryEntry[]> {
// const startTime = Date.now();
// Get index bundles.
await this.loadIndexFromDisk();
if (!this.indexBundle) {
meow(`this.initIndexBundleFromDisk() failed to do its mission! Query of key ${query} ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left lookUpHistoryEntries AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Left AST#:#... | async lookUpHistoryEntries(query: string, maxResults: number = 20): Promise<meowHistoryEntry[]> {
// const startTime = Date.now();
// Get index bundles.
await this.loadIndexFromDisk();
if (!this.indexBundle) {
meow(`this.initIndexBundleFromDisk() failed to do its mission! Query of key ${query} ... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 1a2b1be4788b730fea7c18d093c5d457b322e4e5 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/DataSet.ets | arkts | getValues | /**
* This method is deprecated.
* Use getEntries() instead.
*
* @return
@Deprecated | public getValues(): JArrayList<T> | null {
return this.mEntries;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#i... | public getValues(): JArrayList<T> | null {
return this.mEntries;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | df43fbf665918ef5e9ab9a52c844823482ae827d | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | compareTo | Compares this instance to other Char 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 { Char } other Char object to compare with
@returns { int }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override compareTo(other: Char): int {
if (this.value < other) {
return -1;
}
if (this.value == other) {
return 0;
}
return 1;
} | 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#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | public override compareTo(other: Char): int {
if (this.value < other) {
return -1;
}
if (this.value == other) {
return 0;
}
return 1;
} | https://gitcode.com/iop123123/arkts-static-skills | adf86202daa5a49af66e8e429bba3c49d46a596f | gitcode |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | send_metadata | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
广播函数 //
//////////
7x2 元数据广播 // | private async send_metadata() {
const path = this.play_list[this.play_list_index]
// 获取元数据 //
const tmp = await get_meta(path)
// 获取专辑封面 //
const tmp_image = await get_image(path)
if (tmp[0].length != 0) {
// 广播 //
emitter.emit({ eventId: 712 }, { data: { meta: tmp, image: tmp_... | 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 send_metadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async send_metadata() {
const path = this.play_list[this.play_list_index]
// 获取元数据 //
const tmp = await get_meta(path)
// 获取专辑封面 //
const tmp_image = await get_image(path)
if (tmp[0].length != 0) {
// 广播 //
emitter.emit({ eventId: 712 }, { data: { meta: tmp, image: tmp_... | https://github.com/Nekofox-POT/LinMusic | f226439e54aaa89fae06772775f0be0a24f81ff6 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/DatabaseManager.ets | arkts | isDbInitialized | 检查数据库是否已初始化 | static isDbInitialized(): boolean {
return DatabaseManager.isInitialized && DatabaseManager.db !== null;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isDbInitialized 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... | static isDbInitialized(): boolean {
return DatabaseManager.isInitialized && DatabaseManager.db !== null;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9e1225a71ccf0647622a5c0b4d90b2bdf3dc09d3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelCoverGenerator.ets | arkts | savePixelMapToFile | 将 PixelMap 保存为图片文件 | private async savePixelMapToFile(pixelMap: image.PixelMap, filePath: string): Promise<boolean> {
try {
// 确保目录存在
const dirPath = filePath.substring(0, filePath.lastIndexOf('/'));
try {
await fileIo.mkdir(dirPath);
} catch (e) {
// 目录可能已存在
}
// 创建图片打包器
... | 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 savePixelMapToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identifie... | private async savePixelMapToFile(pixelMap: image.PixelMap, filePath: string): Promise<boolean> {
try {
// 确保目录存在
const dirPath = filePath.substring(0, filePath.lastIndexOf('/'));
try {
await fileIo.mkdir(dirPath);
} catch (e) {
// 目录可能已存在
}
// 创建图片打包器
... | https://github.com/DaLongZhuaZi/manxia | 5161744fa92bd342d6cbe6d51c5d59a3815b35f1 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/DeletePageViewModel.ets | arkts | unCheckedContact | No contact to be deleted is selected. | unCheckedContact(): void {
promptAction.showToast({
message: $r('app.string.prompt_delete'),
duration: CommonConstants.PROMPT_DURATION
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unCheckedContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | unCheckedContact(): void {
promptAction.showToast({
message: $r('app.string.prompt_delete'),
duration: CommonConstants.PROMPT_DURATION
});
} | https://gitee.com/harmonyos/codelabs.git | 4b0a4120f79b4279ceacbbd571066d3190d6df97 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableStringArray.ets | arkts | toUndefinableArray | Converts UndefinableStringArray to a standard (String | undefined) array
@returns { (String | undefined)[] } A new (String | undefined) array containing all elements
@syscap SystemCapability.Utils.Lang | public toUndefinableArray(): (String | undefined)[] {
let newData = new (String | undefined)[this.curSize](undefined)
for (let i = 0; i < this.curSize; ++i) {
newData[i] = this.data[i]
}
return newData
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left toUndefinableArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST... | public toUndefinableArray(): (String | undefined)[] {
let newData = new (String | undefined)[this.curSize](undefined)
for (let i = 0; i < this.curSize; ++i) {
newData[i] = this.data[i]
}
return newData
} | https://gitcode.com/iop123123/arkts-static-skills | 2af3fd9b3be5c100d17d90aa47445b2e3a33e30b | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/pages/EpisodeDetailPage.ets | arkts | formatDescription | 格式化描述,在时间戳前换行 | formatDescription(desc: string): string {
if (!desc) return '';
let result = desc.replace(/(\d{1,2}:\d{2}(?::\d{2})?)/g, '\n$1');
return result.replace(/^\n/, '').trim();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left desc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left... | formatDescription(desc: string): string {
if (!desc) return '';
let result = desc.replace(/(\d{1,2}:\d{2}(?::\d{2})?)/g, '\n$1');
return result.replace(/^\n/, '').trim();
} | https://github.com/pangpang20/antennaPodHM | f854378a7ebe13a3007369a908b8dba5dd8382fa | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVErrorAnalyzer.ets | arkts | analyzeByStatusCode | 根据HTTP状态码分析错误 | private static analyzeByStatusCode(statusCode: number, originalError: string, basePath: string): WebDAVErrorAnalysis {
switch (statusCode) {
case 401:
return {
errorType: WebDAVErrorType.AUTH_FAILED,
title: '认证失败',
description: '用户名或密码错误,服务器拒绝了您的登录请求。',
sugges... | 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 analyzeByStatusCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left statusCode AST#identifier#Right AST#ERROR#Left ... | private static analyzeByStatusCode(statusCode: number, originalError: string, basePath: string): WebDAVErrorAnalysis {
switch (statusCode) {
case 401:
return {
errorType: WebDAVErrorType.AUTH_FAILED,
title: '认证失败',
description: '用户名或密码错误,服务器拒绝了您的登录请求。',
sugges... | https://github.com/DaLongZhuaZi/manxia | 074ef98cbb02fd23031adbd9d48526d4a107d43e | github |
xblLab/HarmonyProjectTemplate | products/phone/src/main/ets/common/WindowUtils.ets | arkts | setAvoidArea | 存储避让区域
@param windowClass | public static setAvoidArea(windowClass: window.Window) {
let windowModel: WindowModel = AppStorageV2.connect(WindowModel, () => new WindowModel())!;
let type = window.AvoidAreaType.TYPE_SYSTEM;
let avoidArea = windowClass.getWindowAvoidArea(type);
windowModel.windowTopPadding = px2vp(avoidArea.topRect... | 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 setAvoidArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowClass AST#identifier#Rig... | public static setAvoidArea(windowClass: window.Window) {
let windowModel: WindowModel = AppStorageV2.connect(WindowModel, () => new WindowModel())!;
let type = window.AvoidAreaType.TYPE_SYSTEM;
let avoidArea = windowClass.getWindowAvoidArea(type);
windowModel.windowTopPadding = px2vp(avoidArea.topRect... | https://github.com/xblLab/HarmonyProjectTemplate | a34316931a9863e4dcc944595ec11859be7253f0 | github |
OHPG/FinMusic | entry/src/main/ets/player/AppPlaybackManager.ets | arkts | saveAudioQueue | 保存播放列表到服务端 | private saveAudioQueue(items: Array<BaseItemDto>): void {
if (!items || items.length <= 0) return
this.repository.setPlaylist(items)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveAudioQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation... | private saveAudioQueue(items: Array<BaseItemDto>): void {
if (!items || items.length <= 0) return
this.repository.setPlaylist(items)
} | https://github.com/OHPG/FinMusic | 16904005d4c3e57b55a7b6fb793a4c6e3e190d16 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/ESError.ets | arkts | cause | Sets the cause of the error in the ESValue. | override set cause(val: Object | undefined) {
if (val !== undefined) {
this.err_.setProperty("cause", val);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#identifier#Left cause AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L... | override set cause(val: Object | undefined) {
if (val !== undefined) {
this.err_.setProperty("cause", val);
}
} | https://gitcode.com/iop123123/arkts-static-skills | e3eb1b486dd6614b1d979477ff532d441067fed9 | gitcode |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/utils/PlaygroundRuntimeLogger.ets | arkts | setupLogDirectory | Setup log directory in app's files directory | private setupLogDirectory(context: common.UIAbilityContext): void {
try {
const filesDir = context.filesDir;
this.logDirectory = `${filesDir}/${PlaygroundRuntimeLogger.LOG_DIR_NAME}`;
if (!fs.accessSync(this.logDirectory)) {
fs.mkdirSync(this.logDirectory);
}
} catch (er... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupLogDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_e... | private setupLogDirectory(context: common.UIAbilityContext): void {
try {
const filesDir = context.filesDir;
this.logDirectory = `${filesDir}/${PlaygroundRuntimeLogger.LOG_DIR_NAME}`;
if (!fs.accessSync(this.logDirectory)) {
fs.mkdirSync(this.logDirectory);
}
} catch (er... | https://github.com/AGenUI/AGenUI | 8c55067a749bb874d32c079e6c45f35f4defe0b4 | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets | arkts | OnChangeSelectDate | 日期选择监听 | OnChangeSelectDate() {
const PARTS: string[] = this.currentSelectDate.split('-');
this.currentSelectDay.year = Number(PARTS[0]);
this.currentSelectDay.month = Number(PARTS[1]);
this.currentSelectDay.date = Number(PARTS[2]);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left OnChangeSelectDate 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... | OnChangeSelectDate() {
const PARTS: string[] = this.currentSelectDate.split('-');
this.currentSelectDay.year = Number(PARTS[0]);
this.currentSelectDay.month = Number(PARTS[1]);
this.currentSelectDay.date = Number(PARTS[2]);
} | https://gitcode.com/arkui-x/samples | db30657d4fc29cad3cc13d6bc4848dae668610b0 | gitcode |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/common/src/main/ets/utils/BreakpointSystem.ets | arkts | register | 注册监听器 | public register() {
this.smListener = this.mediaquery?.matchMediaSync(CommonConstant.BREAKPOINTS_SCOPE_1)
this.smListener?.on('change', this.isBreakpointSM)
this.mdListener = this.mediaquery?.matchMediaSync(CommonConstant.BREAKPOINTS_SCOPE_2)
this.mdListener?.on('change', this.isBreakpointMD)
this... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#... | public register() {
this.smListener = this.mediaquery?.matchMediaSync(CommonConstant.BREAKPOINTS_SCOPE_1)
this.smListener?.on('change', this.isBreakpointSM)
this.mdListener = this.mediaquery?.matchMediaSync(CommonConstant.BREAKPOINTS_SCOPE_2)
this.mdListener?.on('change', this.isBreakpointMD)
this... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 224c647cc53550b6bc7ca0a5cc0b232e61608cdc | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets | arkts | getNetProperties | 获取网络连接信息(提取 IP 地址) | getNetProperties() {
// 1. 获取默认网络
const netHandle = connection.getDefaultNetSync()
// 2. 获取网络连接信息
const connectionProperties = connection.getConnectionPropertiesSync(netHandle)
// 3. 提取链路信息
const linkAddress = connectionProperties.linkAddresses[0]
if (linkAddress) {
// 提取 IP 地址
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getNetProperties AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | getNetProperties() {
// 1. 获取默认网络
const netHandle = connection.getDefaultNetSync()
// 2. 获取网络连接信息
const connectionProperties = connection.getConnectionPropertiesSync(netHandle)
// 3. 提取链路信息
const linkAddress = connectionProperties.linkAddresses[0]
if (linkAddress) {
// 提取 IP 地址
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 749f2dc31b15500eca315795be61817c9f5b4f6b | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/orientationDevelopment/entry/src/main/ets/pages/Index.ets | arkts | canIUseNfc | [EndExclude enable_nfc] | canIUseNfc(): void {
// [Start caniuse_nfc_core]
if (canIUse('SystemCapability.Communication.NFC.Core')) {
hilog.info(0x0000, 'Index', `该设备支持SystemCapability.Communication.NFC.Core`);
} else {
hilog.error(0x0000, 'Index', `该设备不支持SystemCapability.Communication.NFC.Core`);
}
// [End cani... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left canIUseNfc 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#L... | canIUseNfc(): void {
// [Start caniuse_nfc_core]
if (canIUse('SystemCapability.Communication.NFC.Core')) {
hilog.info(0x0000, 'Index', `该设备支持SystemCapability.Communication.NFC.Core`);
} else {
hilog.error(0x0000, 'Index', `该设备不支持SystemCapability.Communication.NFC.Core`);
}
// [End cani... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 0794c159c864b38c1246008142c965f6d836d145 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | getWordById | Get word by ID | async getWordById(id: number): Promise<WordItem | null> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.equalTo(WordColumns.ID, id);
const resultSet = await this.store!.query(predicates);
try {
if (resultSet.goToFirstRow()) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getWordById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST... | async getWordById(id: number): Promise<WordItem | null> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.equalTo(WordColumns.ID, id);
const resultSet = await this.store!.query(predicates);
try {
if (resultSet.goToFirstRow()) {
... | https://github.com/CLMC2025/Vignette | 376bbedd9298cd428b4b192606dad821222b9064 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | getStatistics | 获取识别统计 | static async getStatistics(userId: number): Promise<OCRStatistics> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
COUNT(*) as total_records,
SUM(CASE WHEN recognition_status = 'success' THEN 1 ELSE 0 END) as success_count,
SUM(CASE WHEN ... | 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 getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A... | static async getStatistics(userId: number): Promise<OCRStatistics> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
COUNT(*) as total_records,
SUM(CASE WHEN recognition_status = 'success' THEN 1 ELSE 0 END) as success_count,
SUM(CASE WHEN ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f83f9d956c05599aa9b9ec2375fafdb04ae30669 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | toLocaleString | Converts Uint16Array to a string with respect to locale
@param locales
@param options
@returns string representation | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Uint16Array.toLocaleString: not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Uint16Array.toLocaleString: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5f4fc3842ad64124f4ab4e30d4d73d2235db218e | gitee |
openharmony/codelabs | ETSUI/SchoolTimeTable/entry/src/main/ets/service/CourseDataService.ets | arkts | saveCoursesToPreferences | --- 核心修改:保存课程 (从 AppStorage 获取最新数据持久化) --- | private async saveCoursesToPreferences(courses: Course[]): Promise<void> {
if (!this.preferences) {
return;
}
try {
const key = this.getUserKey('courses');
await this.preferences.put(key, JSON.stringify(courses));
await this.preferences.flush();
} catch (error) {
console.... | 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 saveCoursesToPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left courses AST#identifier#Right... | private async saveCoursesToPreferences(courses: Course[]): Promise<void> {
if (!this.preferences) {
return;
}
try {
const key = this.getUserKey('courses');
await this.preferences.put(key, JSON.stringify(courses));
await this.preferences.flush();
} catch (error) {
console.... | https://gitcode.com/openharmony/codelabs | 198a6c0c1692e082f938983646c2359968ce6a9d | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarDataSet.ets | arkts | setBarBorderColor | Sets the color drawing borders around the bars.
@return | public setBarBorderColor(color: number): void {
this.mBarBorderColor = color;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBarBorderColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setBarBorderColor(color: number): void {
this.mBarBorderColor = color;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 75b09ef224b8531382eec514ea18e335d5cd2374 | gitee |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/model/ScanSize.ets | arkts | updateBreakpoint | 更新BreakPoint
@param windowWidth | private updateBreakpoint(windowWidth: number): void {
logger.info('Start to update breakpoint.');
let newBp: string = '';
if (windowWidth < BreakpointConstants.MIDDLE_DEVICE_WIDTH) {
newBp = BreakpointConstants.BREAKPOINT_SM;
} else if (windowWidth < BreakpointConstants.LARGE_DEVICE_WIDTH) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateBreakpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left windowWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS... | private updateBreakpoint(windowWidth: number): void {
logger.info('Start to update breakpoint.');
let newBp: string = '';
if (windowWidth < BreakpointConstants.MIDDLE_DEVICE_WIDTH) {
newBp = BreakpointConstants.BREAKPOINT_SM;
} else if (windowWidth < BreakpointConstants.LARGE_DEVICE_WIDTH) {
... | https://gitcode.com/arkui-x/samples | 35e97e7a04e07c26a5d444791b98932c6f9fd101 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | runInitializeWorkflowIfPresent | 执行初始化工作流(如果存在) | private async runInitializeWorkflowIfPresent(): Promise<void> {
if (!this.config) {
return;
}
const actions = this.configParser.getWorkflow(this.config, 'initialize');
if (!actions || actions.length === 0) {
return;
}
logger.info(TAG, `检测到initialize工作流,开始执行,共 ${actions.length} 个操作`... | 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 runInitializeWorkflowIfPresent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_exp... | private async runInitializeWorkflowIfPresent(): Promise<void> {
if (!this.config) {
return;
}
const actions = this.configParser.getWorkflow(this.config, 'initialize');
if (!actions || actions.length === 0) {
return;
}
logger.info(TAG, `检测到initialize工作流,开始执行,共 ${actions.length} 个操作`... | https://github.com/DaLongZhuaZi/manxia | e1246d2f4c79b5b5bec25ecf658935c1b8388df1 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | handleTabAppear | Tab 出现时根据选中状态播放或重置动画
@param {number} index - 当前渲染的 Tab 索引
@returns {void} 无返回值 | handleTabAppear(index: number): void {
if (this.currentPageIndex === index) {
this.lottieControllers[index].stop();
this.lottieControllers[index].play();
return;
}
this.lottieControllers[index].goToAndStop(0, true);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleTabAppear 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 ... | handleTabAppear(index: number): void {
if (this.currentPageIndex === index) {
this.lottieControllers[index].stop();
this.lottieControllers[index].play();
return;
}
this.lottieControllers[index].goToAndStop(0, true);
} | https://github.com/Joker-x-dev/CoolMallArkTS | f0e0cea3dda2d79f0596bb40c741d582f3adad48 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets | arkts | flushPage | 刷新图层显示 | flushPage(): void {
this.tempPixelMap = this.pixelMap;
this.pixelMap = null;
this.pixelMap = this.tempPixelMap;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left flushPage 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#Le... | flushPage(): void {
this.tempPixelMap = this.pixelMap;
this.pixelMap = null;
this.pixelMap = this.tempPixelMap;
} | https://github.com/openharmony/applications_app_samples | 1ba53cd2cc69fdba3e9fc3efd515e5dfe72c04e5 | github |
dingzhilin1990/zhilinclaw | src/plugins/PluginManager.ets | arkts | getPlugin | 获取插件实例
@param name 插件名称 | public getPlugin<T extends Plugin>(name: string): T | undefined {
const wrapper = this.plugins.get(name);
return wrapper?.plugin as T;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left getPlugin AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#type_identifier#Left Plugin AST#type_identifier#Right AST... | public getPlugin<T extends Plugin>(name: string): T | undefined {
const wrapper = this.plugins.get(name);
return wrapper?.plugin as T;
} | https://github.com/dingzhilin1990/zhilinclaw | df3e6d2768313df4a984cf4cae788c8fd6caaea8 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets | arkts | extractStringFromObject | 从对象中提取字符串值
@param obj 对象
@param key 键
@param defaultValue 默认值
@return string 字符串值 | protected extractStringFromObject(obj: Record<string, Object>, key: string, defaultValue: string = ''): string {
const value = obj[key];
if (value === undefined || value === null) {
return defaultValue;
}
return String(value);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left extractStringFromObject 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#... | protected extractStringFromObject(obj: Record<string, Object>, key: string, defaultValue: string = ''): string {
const value = obj[key];
if (value === undefined || value === null) {
return defaultValue;
}
return String(value);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L314-L320 | 5ab6f74fb03152757cbc6eb9a739b0faff0bc4c5 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/AccountKitService.ets | arkts | getLoginTime | 登录时间戳 | getLoginTime(): number {
return this.credential?.loginTime || 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLoginTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement... | getLoginTime(): number {
return this.credential?.loginTime || 0;
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 8510a361f3ff52499993762cf5142cf15a568b64 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/BuiltinPackLoader.ets | arkts | loadAll | Read all 5 builtin rawfiles and return them in the order declared in
`BUILTIN_PACK_FILES` (fruit → school → home → animal → ocean).
Files that fail to read or parse are skipped with a console.error so
one corrupt file cannot brick the home-page chip row. | static async loadAll(ctx: common.UIAbilityContext): Promise<Pack[]> {
const packs: Pack[] = [];
const decoder: util.TextDecoder = util.TextDecoder.create('utf-8');
for (let i = 0; i < BUILTIN_PACK_FILES.length; i++) {
const path: string = BUILTIN_PACK_FILES[i];
try {
const bytes: Uint8... | 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 loadAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Righ... | static async loadAll(ctx: common.UIAbilityContext): Promise<Pack[]> {
const packs: Pack[] = [];
const decoder: util.TextDecoder = util.TextDecoder.create('utf-8');
for (let i = 0; i < BUILTIN_PACK_FILES.length; i++) {
const path: string = BUILTIN_PACK_FILES[i];
try {
const bytes: Uint8... | https://github.com/terryma2024/happyword | 77d009c67c2635843e78cce35df6b76deda1cae5 | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/LoginPage.ets | arkts | onLoginTimeout | 登录超时后要执行的逻辑。 | onLoginTimeout() {
// * 清除登录状态等
this.isLogining = false;
// 确认Action
let confrimAction: Callback<void> = () => {
// 重试
this.doLogin();
};
// 退出Action
let cancelAction: Callback<void> = () => {
// 取消登陆中的状态
this.isLogining = false;
};
// 显示超时提示窗
ToolKit... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onLoginTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | onLoginTimeout() {
// * 清除登录状态等
this.isLogining = false;
// 确认Action
let confrimAction: Callback<void> = () => {
// 重试
this.doLogin();
};
// 退出Action
let cancelAction: Callback<void> = () => {
// 取消登陆中的状态
this.isLogining = false;
};
// 显示超时提示窗
ToolKit... | https://github.com/JackJiang2011/harmonychat | a2004e3ba89ef452a292307111756b6fdc36d7f0 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | getWidth | Gets the 'width'.
@return the 'width' | public getWidth(): number {
return this.defaultWidth;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWidth 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... | public getWidth(): number {
return this.defaultWidth;
} | https://gitee.com/openharmony-sig/commons-cli.git | 723f93acea4dec926f357fd81b9e425d0d6f6322 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxExportService.ets | arkts | createFileName | 创建文件名
@param fileName
@param exportType | public static createFileName(fileName: string, exportType: ExportType, appendDate: boolean | undefined = true): string {
const nowTime = DateUtils.getCurrentDate();
fileName = fileName || nowTime;
if (ExportType.KDBX === exportType) {
fileName = FilenameUtils.replaceExt(fileName, ".kdbx");
} els... | 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 createFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left... | public static createFileName(fileName: string, exportType: ExportType, appendDate: boolean | undefined = true): string {
const nowTime = DateUtils.getCurrentDate();
fileName = fileName || nowTime;
if (ExportType.KDBX === exportType) {
fileName = FilenameUtils.replaceExt(fileName, ".kdbx");
} els... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxExportService.ets#L133-L147 | ce274346ec46a6332fe46eadd12bf26a38029c27 | github |
openharmony/codelabs | Media/AudioPlayer/entry/src/main/ets/common/utils/ResourceManagerUtil.ets | arkts | getSrcPath | Obtains the description of a media file.
@param path Resource path.
@param callback Callback function. | public static getSrcPath(path: string, callback: Function) {
if (callback === undefined) {
Logger.error(TAG, 'getSrcPath fail,callback is empty.');
return;
}
try {
let resourceManager = GlobalContext.getContext()
.getObject('resourceManager') as resourceManager.ResourceManager;
... | 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 getSrcPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:... | public static getSrcPath(path: string, callback: Function) {
if (callback === undefined) {
Logger.error(TAG, 'getSrcPath fail,callback is empty.');
return;
}
try {
let resourceManager = GlobalContext.getContext()
.getObject('resourceManager') as resourceManager.ResourceManager;
... | https://gitee.com/openharmony/codelabs.git | 0591b983243880c7c86ea81d791763653c40858a | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | resolvedOptions | Returns resolved options
@return resolved options | public resolvedOptions(): ResolvedCollatorOptions {
return this.options;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resolvedOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Resolv... | public resolvedOptions(): ResolvedCollatorOptions {
return this.options;
} | https://gitcode.com/iop123123/arkts-static-skills | 5d6faf51835c07af2790f99971575f9c5aeb3d31 | gitcode |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets | arkts | set_audio_play | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
外部函数 //
//////////
播放歌曲 // | async set_audio_play(song_index: number = this.play_list_index) {
if (song_index != this.play_list_index) { this.play_list_index = song_index }
// 非0检测
if (this.play_list.length == 0) { return }
// 广播序号
emitter.emit({ eventId: 718 }, { data: { list: [], index: this.play_list_index } })
// 使用 f... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left set_audio_play AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left song_index AST#identifier#Righ... | async set_audio_play(song_index: number = this.play_list_index) {
if (song_index != this.play_list_index) { this.play_list_index = song_index }
// 非0检测
if (this.play_list.length == 0) { return }
// 广播序号
emitter.emit({ eventId: 718 }, { data: { list: [], index: this.play_list_index } })
// 使用 f... | https://github.com/Nekofox-POT/LinMusic | 72ab3936afe8669dd652e3e1a6ebaeb1775d363d | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | removeLimitLine | Removes the specified LimitLine from the axis.
@param l | public removeLimitLine(l: LimitLine): void {
this.mLimitLines.remove(l);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeLimitLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left l AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Lim... | public removeLimitLine(l: LimitLine): void {
this.mLimitLines.remove(l);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 692bc4b70aadb62c6d44add488f9b5febb29c675 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/LRU.ets | arkts | has | Checks if a key is present in the cache.
Does not affect the access order.
@param { K } - the key to check
@returns { true } if the key exists in the cache
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public has(key: K): boolean {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
return this.map.has(key);
} finally {
ConcurrencyHelpers.mutexUnlock(this.mutex);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identi... | public has(key: K): boolean {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
return this.map.has(key);
} finally {
ConcurrencyHelpers.mutexUnlock(this.mutex);
}
} | https://gitcode.com/iop123123/arkts-static-skills | 09ac118e30d72c61139eb70b908d2463e05ced65 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/HttpUtil.ets | arkts | getFamilyToken | ==================== 家属相关方法 ====================
获取家属Token | static getFamilyToken(): string | null {
try {
const tokenFromAppStorage: string | undefined = AppStorage.get<string>('familyToken');
if (tokenFromAppStorage && tokenFromAppStorage.length > 0) {
return tokenFromAppStorage;
}
const settings: SettingsUtil = SettingsUtil.getInstance()... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFamilyToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left ... | static getFamilyToken(): string | null {
try {
const tokenFromAppStorage: string | undefined = AppStorage.get<string>('familyToken');
if (tokenFromAppStorage && tokenFromAppStorage.length > 0) {
return tokenFromAppStorage;
}
const settings: SettingsUtil = SettingsUtil.getInstance()... | https://github.com/LJ666-ui/harmony-health-care | 145eb6c6d454a2f81d2d1ecdf6c5c56ab83d49be | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | getDouble | Gets a double value from an object by key and ensures it is a double.
@param {string} key - The key to look up
@returns {double} The double value
@throws {JsonTypeError} If the value is not a double or if this element is not an object
@throws {RangeError} If the key is not found | getDouble(key: string): double {
return this.getElement(key).asDouble()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#... | getDouble(key: string): double {
return this.getElement(key).asDouble()
} | https://gitcode.com/iop123123/arkts-static-skills | 86f8b044febedf25fe9398b5f35fac84b6805bad | gitcode |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/detail/DetailPresenter.ets | arkts | getTimeDetailByCallTime | Obtain the time details based on the call record generation time.
@param {number} callTime Initial Talk Time
@return {string} timeDetail Talk time after processing | getTimeDetailByCallTime(element: CallLog) {
let callTime = element.createTime.toString();
let callLogTime = new Date(parseInt(callTime, 10) * 1000);
// time detail
let year = callLogTime.getFullYear();
let mounth = callLogTime.getMonth() + 1;
let day = callLogTime.getDate();
let hour = callLogTime.getHour... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTimeDetailByCallTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left element AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CallLog AST#id... | getTimeDetailByCallTime(element: CallLog) {
let callTime = element.createTime.toString();
let callLogTime = new Date(parseInt(callTime, 10) * 1000);
// time detail
let year = callLogTime.getFullYear();
let mounth = callLogTime.getMonth() + 1;
let day = callLogTime.getDate();
let hour = callLogTime.getHour... | https://gitee.com/openharmony/applications_contacts.git | a375ea4b67f0c4529158339d99f5999755fdc2e3 | gitee |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | onApplicationBackground | Called when the app goes to background while playing; keeps continuous task if needed. | public onApplicationBackground(): void {
if (this.getAppState().isPlay) {
this.ensureBackgroundAudioTask();
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onApplicationBackground 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... | public onApplicationBackground(): void {
if (this.getAppState().isPlay) {
this.ensureBackgroundAudioTask();
}
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 94f2110dcb18db16e5b427c7580f6081fed8706a | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test3_original_index.ets | arkts | testDefaultParam | === Default Parameters === | function testDefaultParam(x: number, y: number = 10): number {
return x + y;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testDefaultParam AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function testDefaultParam(x: number, y: number = 10): number {
return x + y;
} | https://github.com/miaochiahao/ark-ghidra | 70e66ba4760c479ae412591c864bd66bcd90177d | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnFormViewModel.ets | arkts | setPatternValue | ==================== 自定义校验表单操作 ====================
设置正则校验值
@param value 输入值 | setPatternValue(value: string): void {
this.customRuleForm.patternValue = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPatternValue 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 ... | setPatternValue(value: string): void {
this.customRuleForm.patternValue = value;
} | https://github.com/codelably/tuniao-ui | 8ebac25acef43a56ad51fd9982119e52385dd560 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | saveReadingProgress | 保存阅读进度
@param comicId 漫画ID
@param chapterId 章节ID
@param pageIndex 页码
@param readDuration 阅读时长
@param sourceId 可选的图源ID,用于在线漫画自动保存到数据库
@param mangaData 可选的漫画数据,用于在线漫画自动保存到数据库 | public async saveReadingProgress(
comicId: string,
chapterId: string,
pageIndex: number,
readDuration: number,
sourceId?: number,
mangaData?: OnlineComicSourceSaveInput
): Promise<void> {
try {
let effectiveComicId: string = comicId;
let effectiveChapterId: string = chapterId... | 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#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#L... | public async saveReadingProgress(
comicId: string,
chapterId: string,
pageIndex: number,
readDuration: number,
sourceId?: number,
mangaData?: OnlineComicSourceSaveInput
): Promise<void> {
try {
let effectiveComicId: string = comicId;
let effectiveChapterId: string = chapterId... | https://github.com/DaLongZhuaZi/manxia | cc3316088d808cc2f8a41d82b985ef1ba5e8b8e4 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets | arkts | cancelLeave | 取消请假申请 | async cancelLeave(leaveId: string): Promise<ApiResponse<any>> {
return this.delete<any>(`/api/attendance/leave/${leaveId}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cancelLeave AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left leaveId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async cancelLeave(leaveId: string): Promise<ApiResponse<any>> {
return this.delete<any>(`/api/attendance/leave/${leaveId}`)
} | https://github.com/David8Idira/AI-OA | 506505c52273b4aaee802990298232e750fa2fd5 | github |
hiyuey3/Hixy_MyMemories | entry/src/main/ets/utils/MemDBUtils.ets | arkts | makeValuesBucket | 兼容性实例方法包装器 | public makeValuesBucket(taskName: string, finished: number, targetDate?: number, content?: string): relationalStore.ValuesBucket {
return makeValuesBucket(taskName, finished, targetDate, content);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left makeValuesBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left taskName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | public makeValuesBucket(taskName: string, finished: number, targetDate?: number, content?: string): relationalStore.ValuesBucket {
return makeValuesBucket(taskName, finished, targetDate, content);
} | https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/utils/MemDBUtils.ets#L289-L291 | 168ada1a4533ed1d3f101770a9cdc9d810cb0e69 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | reduceRight | Calls the specified callback function for all the elements in an array, in descending order.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduceR... | public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Float32Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue: number = (this.getUnsaf... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#L... | public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Float32Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue: number = (this.getUnsaf... | https://gitcode.com/iop123123/arkts-static-skills | 346c2cf483142740ee4aa07ed878d3401da1753d | gitcode |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/pages/DashboardPage.ets | arkts | onPageShow | 页面重新可见时刷新统计数据 | onPageShow(): void {
if (this.hasAppeared) {
this.loadStats()
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left... | onPageShow(): void {
if (this.hasAppeared) {
this.loadStats()
}
} | https://github.com/encorexin/WordPressCMS | f627f3ab0f181365885967d9bb19b0cb8b3c75e2 | github |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/AutoMenuManager.ets | arkts | _getFileByMetaData | Query the JSON data of metaData based on the package name | private async _getFileByMetaData(context: Context, bundleName: string, fileName: string): Promise<string> {
let resourceManager = resourceUtil.getBundleResourceManager(bundleName, context) as resourceManager.ResourceManager;
return await RawFileUtil.getStringByFile(resourceManager, fileName);
} | 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 _getFileByMetaData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:... | private async _getFileByMetaData(context: Context, bundleName: string, fileName: string): Promise<string> {
let resourceManager = resourceUtil.getBundleResourceManager(bundleName, context) as resourceManager.ResourceManager;
return await RawFileUtil.getStringByFile(resourceManager, fileName);
} | https://gitee.com/openharmony/security_privacy_center.git | c034eb15bb633e77569dfe608d67252c7bb1f826 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxCsvService.ets | arkts | parseEntry | 解析CSV行
@param heads
@param line
@returns | private static parseEntry(heads: Map<string, number>, line: string[], parentGroup: KdbxGroup, fieldProtection: Map<string, boolean>): KdbxEntry {
const entry = KdbxEntry.create(FileService.getDatabase().meta, parentGroup);
for (let item of heads) {
const fieldName = item[0];
const fieldValue = lin... | 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 parseEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left heads AST#identifier#R... | private static parseEntry(heads: Map<string, number>, line: string[], parentGroup: KdbxGroup, fieldProtection: Map<string, boolean>): KdbxEntry {
const entry = KdbxEntry.create(FileService.getDatabase().meta, parentGroup);
for (let item of heads) {
const fieldName = item[0];
const fieldValue = lin... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxCsvService.ets#L94-L128 | 87f2b1675a93450282a0b37c77ed62d25e31fb97 | github |
Dige945/EmoCollector | entry/src/main/ets/service/AIService.ets | arkts | getMoodLabel | 获取心情标签 | private getMoodLabel(score: number): string {
switch (score) {
case 1:
return '😔 低落';
case 2:
return '😐 平淡';
case 3:
return '😄 开心';
case 4:
return '😡 愤怒';
case 5:
return '😰 焦虑';
case 6:
return '😫 累';
default:
r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getMoodLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left score AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private getMoodLabel(score: number): string {
switch (score) {
case 1:
return '😔 低落';
case 2:
return '😐 平淡';
case 3:
return '😄 开心';
case 4:
return '😡 愤怒';
case 5:
return '😰 焦虑';
case 6:
return '😫 累';
default:
r... | https://github.com/Dige945/EmoCollector | 6acb044e8188d974aa1f012bdf059a3cc3247cda | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/NumberPassPage.ets | arkts | togglePasswordVisibility | 事件处理: togglePasswordVisibility
描述: 切换密码的明文/密文显示状态。
切换密码显示/隐藏 | togglePasswordVisibility() {
this.showPassword = !this.showPassword;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left togglePasswordVisibility 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... | togglePasswordVisibility() {
this.showPassword = !this.showPassword;
} | https://gitcode.com/openharmony/codelabs | 18345b10544b032f22ff274d4640f255adad7c6b | gitcode |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/uiShell/utils/DragDropManager.ets | arkts | createPlainTextDragData | 构造全局纯文本拖拽数据,可用于 `onDragStart` 事件返回
@param text 拖拽的文本内容 | createPlainTextDragData(text: string): unifiedDataChannel.UnifiedData | null {
try {
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = text;
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
logger.info(TAG, '生成文本拖拽数据,内容长度: ' + String(text.le... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createPlainTextDragData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right... | createPlainTextDragData(text: string): unifiedDataChannel.UnifiedData | null {
try {
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = text;
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
logger.info(TAG, '生成文本拖拽数据,内容长度: ' + String(text.le... | https://github.com/DaLongZhuaZi/NGF | 33711df9840883e0994c842d06bf619748f38cd9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce<U = number>(
callbackfn: (previousValue: U, currentValue: number, currentIndex: int, array: Int8Array) => U,
initialValue: U): U {
let accumulatedValue = initialValue
for (let i = 0; i < this.lengthInt; ++i) {
accumulatedValue = callbackfn(ac... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Right AST... | public reduce<U = number>(
callbackfn: (previousValue: U, currentValue: number, currentIndex: int, array: Int8Array) => U,
initialValue: U): U {
let accumulatedValue = initialValue
for (let i = 0; i < this.lengthInt; ++i) {
accumulatedValue = callbackfn(ac... | https://gitcode.com/iop123123/arkts-static-skills | b6a8d09d16297986f2f584b79995205adec45bf2 | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/ApiClient.ets | arkts | getUserReactions | 获取用户回应(/discourse-reactions/posts/reactions.json) | async getUserReactions(username: string, beforeReactionUserId: number = 0): Promise<UserReactionsResponse> {
const params: Record<string, Object> = {};
params['username'] = username;
if (beforeReactionUserId > 0) {
params['before_reaction_user_id'] = beforeReactionUserId.toString();
}
const... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserReactions AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#L... | async getUserReactions(username: string, beforeReactionUserId: number = 0): Promise<UserReactionsResponse> {
const params: Record<string, Object> = {};
params['username'] = username;
if (beforeReactionUserId > 0) {
params['before_reaction_user_id'] = beforeReactionUserId.toString();
}
const... | https://github.com/Amaz1ny/HarmonyDO-public | b35f00a35e35cbe60a3a3d2c6eb9fe2206119e7a | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/CategoryDao.ets | arkts | insertCategory | 新增分类
@param category 分类对象
@returns 新增分类的ID | public async insertCategory(category: Category): Promise<number> {
const valueBucket: relationalStore.ValuesBucket = {
name: category.name,
icon_name: category.icon_name || '',
type: category.type
};
try {
const result: number = await this.rdbStore.insert(DBManager.TABLE_CATEGORIE... | 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 insertCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left ... | public async insertCategory(category: Category): Promise<number> {
const valueBucket: relationalStore.ValuesBucket = {
name: category.name,
icon_name: category.icon_name || '',
type: category.type
};
try {
const result: number = await this.rdbStore.insert(DBManager.TABLE_CATEGORIE... | https://github.com/fuhhhhhhhh/openharmony | df2a12fe7a802fb728849841de76160a039af09d | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | sendMessageWithSearchResult | 带搜索结果上下文发送消息(新版) | async sendMessageWithSearchResult(
content: string,
searchResult: SearchResult,
providerId: string,
providerType: ProviderType,
apiStyle: ApiStyle,
apiKey: string,
baseUrl: string,
modelId: string,
modelName: string,
messages: ChatMessage[],
attachments: MessageAttachment[]... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendMessageWithSearchResult AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Le... | async sendMessageWithSearchResult(
content: string,
searchResult: SearchResult,
providerId: string,
providerType: ProviderType,
apiStyle: ApiStyle,
apiKey: string,
baseUrl: string,
modelId: string,
modelName: string,
messages: ChatMessage[],
attachments: MessageAttachment[]... | https://github.com/LongLiveY96/chatcube | a4863bc5528762fe0c04bc83e1fda7f12a46fbfd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | capacity | Gets the configured capacity of the queue.
Returns the maximum number of elements that the queue can ideally hold.
@returns { int } The configured capacity of the LinkedConcurrentQueue,
else returns the implementation maximum when the queue is unbounded.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get capacity(): int {
return this.actualCapacity;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left capacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ... | public get capacity(): int {
return this.actualCapacity;
} | https://gitcode.com/iop123123/arkts-static-skills | f44fa95b76ed3074f610b3dacf76526d0591b531 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/AutoPageTurnController.ets | arkts | notifyNewChapter | 通知新章节开始 | public notifyNewChapter(): void {
this.isFirstPageOfChapter = true;
logger.debug(TAG, '新章节开始,标记为章节首页');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyNewChapter 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#expre... | public notifyNewChapter(): void {
this.isFirstPageOfChapter = true;
logger.debug(TAG, '新章节开始,标记为章节首页');
} | https://github.com/DaLongZhuaZi/manxia | 1451a1ecde66df0cd9ad062720bcc1348c9b2162 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnCheckboxViewModel.ets | arkts | setCheckboxValues5 | 设置复选框组5的选中值集合
@param values 新的选中值数组 | setCheckboxValues5(values: Array<string | number>): void {
this.checkboxValues5 = values;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCheckboxValues5 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left A... | setCheckboxValues5(values: Array<string | number>): void {
this.checkboxValues5 = values;
} | https://github.com/codelably/tuniao-ui | 908992da1617c27108b3baa83576f27bfb190319 | github |
zmuxuny/ai-guardian-star | entry/src/main/ets/database/DatabaseHelper.ets | arkts | close | 彻底关闭 RdbStore(应用退出时调用) | public close(): void {
if (this.store) {
this.store.close();
this.store = undefined;
this.initPromise = undefined;
hilog.info(DOMAIN, TAG, "RdbStore 已关闭");
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left close 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 close(): void {
if (this.store) {
this.store.close();
this.store = undefined;
this.initPromise = undefined;
hilog.info(DOMAIN, TAG, "RdbStore 已关闭");
}
} | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L813-L820 | cfd757fb8d6329fc70f0798b673003ef7fbefedc | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.