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 |
|---|---|---|---|---|---|---|---|---|---|---|
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/ImageLoader.ets | arkts | shared | Returns the singleton | public static shared(): ImageLoaderConfiguration {
if (ImageLoaderConfiguration._instance === null) {
ImageLoaderConfiguration._instance = new ImageLoaderConfiguration();
}
return ImageLoaderConfiguration._instance;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left shared AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :... | public static shared(): ImageLoaderConfiguration {
if (ImageLoaderConfiguration._instance === null) {
ImageLoaderConfiguration._instance = new ImageLoaderConfiguration();
}
return ImageLoaderConfiguration._instance;
} | https://github.com/AGenUI/AGenUI | 66008579dd0fc0bd0ba9786a30dbf70ba6238e91 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Core/ErrorHandler.ets | arkts | attemptRecovery | 尝试错误恢复 | private async attemptRecovery(error: GameError): Promise<boolean> {
if (!error.isRecoverable) {
logger.warn(ERROR_HANDLER_TAG, `❌ 错误不可恢复: ${error.code}`);
return false;
}
for (const strategy of this.recoveryStrategies) {
if (strategy.canHandle(error)) {
try {
logger.in... | 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 attemptRecovery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left... | private async attemptRecovery(error: GameError): Promise<boolean> {
if (!error.isRecoverable) {
logger.warn(ERROR_HANDLER_TAG, `❌ 错误不可恢复: ${error.code}`);
return false;
}
for (const strategy of this.recoveryStrategies) {
if (strategy.canHandle(error)) {
try {
logger.in... | https://github.com/DaLongZhuaZi/manxia | 1abf46a09119224ad73b3d46a6460b999a90633e | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/TimeUtils.ets | arkts | formatShortDate | 格式化时间为短日期
格式:1月15日 | static formatShortDate(time: Date | null): string {
if (time === null) {
return '';
}
return `${time.getMonth() + 1}月${time.getDate()}日`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatShortDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressio... | static formatShortDate(time: Date | null): string {
if (time === null) {
return '';
}
return `${time.getMonth() + 1}月${time.getDate()}日`;
} | https://github.com/Amaz1ny/HarmonyDO-public | b9583bc4bb6fe681c90afd52040183c0d739cbc3 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | updateLoginInfo | 更新登录信息,并保存到数据库
@param loginInfo
@param cookie
@param password | private async updateLoginInfo(loginInfo?: ILoginRegist, cookie?: string, password?: string) {
await lock.acquire();
try {
this.loginInfo = loginInfo;
this.cookie = cookie;
if (password !== null) {
globalVM_WanDB.saveLoginInfo(loginInfo.id, JSON.stringify(loginInfo), cookie, password)... | 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 updateLoginInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loginInfo AST#identifier#Right AST#?#... | private async updateLoginInfo(loginInfo?: ILoginRegist, cookie?: string, password?: string) {
await lock.acquire();
try {
this.loginInfo = loginInfo;
this.cookie = cookie;
if (password !== null) {
globalVM_WanDB.saveLoginInfo(loginInfo.id, JSON.stringify(loginInfo), cookie, password)... | https://github.com/RedRackham-R/WanAndroidHarmoney | 38b97b7b58f9b499ed200c3aa86ff9d645d803ca | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets | arkts | loadImage | 异步加载本地图片到缓存
@param pageId 页面ID
@param filePath 文件路径
@param config 加载配置
@returns Promise<PixelMap | null> | public async loadImage(pageId: string, filePath: string, config?: LocalLoadConfig): Promise<image.PixelMap | null> {
// 1. 检查缓存
const cached = this.get(pageId);
if (cached) {
logger.debug(TAG, `缓存命中: ${pageId}`);
return cached;
}
// 2. 检查是否正在加载
if (this.loadingTasks.has(pageId)) {... | 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 loadImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:... | public async loadImage(pageId: string, filePath: string, config?: LocalLoadConfig): Promise<image.PixelMap | null> {
// 1. 检查缓存
const cached = this.get(pageId);
if (cached) {
logger.debug(TAG, `缓存命中: ${pageId}`);
return cached;
}
// 2. 检查是否正在加载
if (this.loadingTasks.has(pageId)) {... | https://github.com/DaLongZhuaZi/manxia | 6008d4162f0a8c85ae0fd8b630a16563cb7e8c30 | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | formatCount | Group digits with thin separators (e.g. 12,345) for the notification line. | private formatCount(value: number): string {
const digits: string = `${Math.max(0, Math.floor(value))}`;
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatCount 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 ... | private formatCount(value: number): string {
const digits: string = `${Math.max(0, Math.floor(value))}`;
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
} | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1179-L1182 | 603d059dd2f09f3a8bf62e1e8d884f1fea0c1000 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AlertManager.ets | arkts | unsubscribe | 取消订阅告警变化 | public unsubscribe(callback: (alerts: WardAlert[]) => void): void {
const index = this.subscribers.indexOf(callback);
if (index > -1) {
this.subscribers.splice(index, 1);
console.log('AlertManager: Subscriber removed');
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left unsubscribe AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#R... | public unsubscribe(callback: (alerts: WardAlert[]) => void): void {
const index = this.subscribers.indexOf(callback);
if (index > -1) {
this.subscribers.splice(index, 1);
console.log('AlertManager: Subscriber removed');
}
} | https://github.com/LJ666-ui/harmony-health-care | 2e80910275d5d6990c13057f557b41f9edb07365 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | checkSinglePluginUpdate | 检查单个插件更新 | private async checkSinglePluginUpdate(pluginInfo: PluginInfo): Promise<PluginUpdateInfo | null> {
try {
// 模拟从服务器获取更新信息
const mockUpdateInfo: PluginUpdateInfo = {
pluginId: pluginInfo.id,
currentVersion: pluginInfo.version,
latestVersion: '1.1.0',
updateSize: 1024 * 102... | 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 checkSinglePluginUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pluginInfo AST#identifier#Rig... | private async checkSinglePluginUpdate(pluginInfo: PluginInfo): Promise<PluginUpdateInfo | null> {
try {
// 模拟从服务器获取更新信息
const mockUpdateInfo: PluginUpdateInfo = {
pluginId: pluginInfo.id,
currentVersion: pluginInfo.version,
latestVersion: '1.1.0',
updateSize: 1024 * 102... | https://github.com/DaLongZhuaZi/manxia | 00a34d9529152269bcd183f73aabdb892ff08e30 | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/viewmodel/CalendarViewModel.ets | arkts | getMonthData | 获取指定月份的日历数据(包含上个月结尾和下个月开头,补齐 42 格)
@param year 年份
@param month 月份 (1-12) | public getMonthData(year: number, month: number): Array<CalendarModel> {
CalendarViewModel.logger.info(`Generating calendar data for ${year}-${month}`);
const result: Array<CalendarModel> = [];
const now = new Date();
const currentYear = now.getFullYear();
const currentMonth = now.getMonth() + 1;... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMonthData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | public getMonthData(year: number, month: number): Array<CalendarModel> {
CalendarViewModel.logger.info(`Generating calendar data for ${year}-${month}`);
const result: Array<CalendarModel> = [];
const now = new Date();
const currentYear = now.getFullYear();
const currentMonth = now.getMonth() + 1;... | https://gitcode.com/openharmony/codelabs | de38d9cee9e6f203be6104f44afaf3e1dac493c8 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | sort | Sorts in-place
@param { function } [compareFn] - comparator _ used to determine the order of the elements.
compareFn returns a negative value if first argument is less than second argument,
zero if they're equal and a positive value otherwise.
@returns { this } - sorted Float64Array
@syscap SystemCapability.Utils.Lang... | public sort(compareFn?: (a: number, b: number) => int): this {
if (compareFn == undefined) {
this.sort()
return this
}
let cmp = (l: double, r: double): int => {
const result = compareFn!((l).toDouble(), (r).toDouble())
return result.toInt()
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left compareFn AST#identifi... | public sort(compareFn?: (a: number, b: number) => int): this {
if (compareFn == undefined) {
this.sort()
return this
}
let cmp = (l: double, r: double): int => {
const result = compareFn!((l).toDouble(), (r).toDouble())
return result.toInt()
... | https://gitcode.com/iop123123/arkts-static-skills | e945f589cfc5d8f9386fa351710541c4197f67bc | gitcode |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | offBLEConnectionStateChange | 取消订阅蓝牙低功耗设备的连接状态变化事件 | private offBLEConnectionStateChange() {
Log.showInfo(TAG, `offBLEConnectionStateChange`);
if (!this.mGattClientDevice) {
Log.showInfo(TAG, `offBLEConnectionStateChange: mGattClientDevice is null`);
return;
}
try {
this.mGattClientDevice.off('BLEConnectionStateChange');
} catch (... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left offBLEConnectionStateChange 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#... | private offBLEConnectionStateChange() {
Log.showInfo(TAG, `offBLEConnectionStateChange`);
if (!this.mGattClientDevice) {
Log.showInfo(TAG, `offBLEConnectionStateChange: mGattClientDevice is null`);
return;
}
try {
this.mGattClientDevice.off('BLEConnectionStateChange');
} catch (... | https://gitcode.com/arkui-x/samples | 3353293e27e4a5aed21eb545f6bc9091602d820d | gitcode |
cduestc-course/ArkLearn | entry/src/main/ets/pages/05/5.3.1re.ets | arkts | textFn | @Extend(组件名)
function 函数名 (参数, 参数2) {
} | @Extend(Text)
function textFn () {
.fontSize(20)
.fontWeight(FontWeight.Bold)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function textFn () {
.fontSize(20)
.fontWeight(FontWeight.Bold)
} | https://github.com/cduestc-course/ArkLearn | a702d9f34886a60c9d118eafbfed984d04b3d789 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/call/common/CallStore.ets | arkts | closeLocalCamera | 关闭本地摄像头 | closeLocalCamera(): void {
this.cameraStatus = DeviceStatus.off;
console.info('[DeviceStore] 关闭摄像头');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closeLocalCamera 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... | closeLocalCamera(): void {
this.cameraStatus = DeviceStatus.off;
console.info('[DeviceStore] 关闭摄像头');
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 0a595149e6c379f40909fddc6d7a81ba1ba7edfe | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ProviderViewModel.ets | arkts | getProviderById | 从内存缓存取 provider;未命中返回 null | getProviderById(providerId: string): ModelProvider | null {
return this.store.getProviderById(providerId)
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getProviderById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left providerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | getProviderById(providerId: string): ModelProvider | null {
return this.store.getProviderById(providerId)
} | https://github.com/LongLiveY96/chatcube | b67948617c1018991961bd28e8d7c6eaebbaf528 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/NativeHidController.ets | arkts | getForceProtocolType | 获取当前强制协议类型 | getForceProtocolType(): number {
return this.forceProtocolType;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getForceProtocolType 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#s... | getForceProtocolType(): number {
return this.forceProtocolType;
} | https://github.com/AlkaidLab/moonlight-harmony | 72606c1aa6c06edc58fa24a1e1258c54667f42e7 | github |
HarmonyOS_Samples/MusicHome | products/watch/src/main/ets/watchbackupability/WatchBackupAbility.ets | arkts | onBackup | Invoked when a backup operation runs; logs success placeholder. | async onBackup() {
Logger.info('WatchBackupAbility: onBackup ok');
await Promise.resolve();
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expression_... | async onBackup() {
Logger.info('WatchBackupAbility: onBackup ok');
await Promise.resolve();
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 759db574fc159ddcab6a75e0f8979175029b39c4 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/EBookDataManager.ets | arkts | deleteEBookChapters | 确保 ebook_reading_progress 表有 domPos 和 currentChapterIndex 列 | private async deleteEBookChapters(bookId: string): Promise<void> {
await this.dbManager.executeSql('DELETE FROM ebook_chapter WHERE bookId = ?', [bookId]);
} | 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 deleteEBookChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:... | private async deleteEBookChapters(bookId: string): Promise<void> {
await this.dbManager.executeSql('DELETE FROM ebook_chapter WHERE bookId = ?', [bookId]);
} | https://github.com/DaLongZhuaZi/manxia | ea4e252c74a7c71115d5ccee86f7bfce064b770b | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | getOne | 执行查询并返回第一条结果
@returns Promise<EntityData | null> | async getOne(): Promise<EntityData | null> {
try {
return await this.runWithTemporaryLimit(1, async (): Promise<EntityData | null> => {
const results = await this.get()
return results.length > 0 ? results[0] : null
})
} catch (error) {
const errorMessage = error instanceof Er... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOne 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 getOne(): Promise<EntityData | null> {
try {
return await this.runWithTemporaryLimit(1, async (): Promise<EntityData | null> => {
const results = await this.get()
return results.length > 0 ? results[0] : null
})
} catch (error) {
const errorMessage = error instanceof Er... | https://github.com/offlinecat-dev/OCNetORM | 48509b1ee281eb345d8da3e1bfe7f35c68f9ed3e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | of | Returns Type of value
@param {float} v value
@returns {Type} Type instance of this value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(v: float): Type {
return FloatType.VAL
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#... | public static of(v: float): Type {
return FloatType.VAL
} | https://gitcode.com/iop123123/arkts-static-skills | cf1462a897e6170ea84b5c4c59aab6acaa6389df | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/database/DatabaseManager.ets | arkts | startHealthCheck | 启动健康检查
@param intervalMs 检查间隔(毫秒) | private startHealthCheck(intervalMs: number): void {
// 停止现有的健康检查
this.stopHealthCheck()
this.healthCheckIntervalId = setInterval(async () => {
try {
const isHealthy = await this.ping()
if (!isHealthy && this.healthy) {
this.healthy = false
this.getLogger().logEr... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startHealthCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left intervalMs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | private startHealthCheck(intervalMs: number): void {
// 停止现有的健康检查
this.stopHealthCheck()
this.healthCheckIntervalId = setInterval(async () => {
try {
const isHealthy = await this.ping()
if (!isHealthy && this.healthy) {
this.healthy = false
this.getLogger().logEr... | https://github.com/offlinecat-dev/OCNetORM | 7d6793df57c9e641e0ec656f49ab78701eca67e6 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/common/database/ContactsDataBase.ets | arkts | subscriptionKvStore | Subscribe to distributed data changes.
@param callback Callback function. | subscriptionKvStore(callback: Callback<distributedKVStore.ChangeNotification>): void {
try {
this.kvStore?.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, callback);
} catch (err) {
Logger.error(TAG, `DataChange an unexpected error occured, error message is ${JSON.stringif... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left subscriptionKvStore 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#instantiation_expression#Left AST#identifier#Lef... | subscriptionKvStore(callback: Callback<distributedKVStore.ChangeNotification>): void {
try {
this.kvStore?.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, callback);
} catch (err) {
Logger.error(TAG, `DataChange an unexpected error occured, error message is ${JSON.stringif... | https://gitee.com/harmonyos/codelabs.git | c3df671d78308fd3ee13943aaf7bb2b068fcf44a | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | addInterface | Adds implemented interface (in ets it follows `implements` keyword)
@param iface interface to implement
@returns this | public addInterface(iface: InterfaceType): ClassTypeCreator throws {
this.ifaces.push(TypeOrCreator.from(iface))
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addInterface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iface AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left In... | public addInterface(iface: InterfaceType): ClassTypeCreator throws {
this.ifaces.push(TypeOrCreator.from(iface))
return this;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c3ec3cc727d76c44793735779833e3ec45bf0d51 | gitee |
erosTeam/NextE | feature/settings/src/main/ets/model/BackupFilePickerCoordinator.ets | arkts | readText | The picker returns a file:// uri; open it to a fd and read bytes (readTextSync(path) fails on uris). | private static readText(uri: string): string {
let file: fileIo.File | null = null
try {
file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY)
const size: number = fileIo.statSync(file.fd).size
const buffer = new ArrayBuffer(size)
const bytesRead: number = fileIo.readSync(file.fd, buf... | 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 readText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:... | private static readText(uri: string): string {
let file: fileIo.File | null = null
try {
file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY)
const size: number = fileIo.statSync(file.fd).size
const buffer = new ArrayBuffer(size)
const bytesRead: number = fileIo.readSync(file.fd, buf... | https://github.com/erosTeam/NextE | b43b827853c0ed15d3d67ca6f5c78bc43d1557f1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | showAddToGroupDialog | ==================== 分组管理功能 ====================
显示添加到分组对话框 | showAddToGroupDialog(): void {
this.openGroupPickerDialog('add');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showAddToGroupDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme... | showAddToGroupDialog(): void {
this.openGroupPickerDialog('add');
} | https://github.com/DaLongZhuaZi/manxia | 57853875f91bbbf8f5c491b403c45519c502c52b | github |
CPF-ApplicationTPC/openharmony_tpc_samples | Spine/entry/src/main/ets/pages/Example4.ets | arkts | start | 当此条目被设置为当前条目时调用。 | start(entry: TrackEntry) {
console.info('spine listener loadAnimation start entry:', entry)
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left start AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TrackEntry AST#identifier#Right AS... | start(entry: TrackEntry) {
console.info('spine listener loadAnimation start entry:', entry)
}, | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | cb1def02023921aa4203b20f64e93ed3d3a00928 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/NdsRomCache.ets | arkts | getCacheSizeAsync | 异步获取缓存大小 | async getCacheSizeAsync(): Promise<SizeUnit> {
return this.calculateCacheSize();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCacheSizeAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getCacheSizeAsync(): Promise<SizeUnit> {
return this.calculateCacheSize();
} | https://github.com/richshaw2015/nds | 4f8edfad54dd01b96658c65ca2a95b0ff060b7da | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/OrderRepository.ets | arkts | getOrderInfo | 获取订单详情
@param id 订单 ID
@returns 订单详情 | async getOrderInfo(id: number): Promise<NetworkResponse<Order>> {
return this.networkDataSource.getOrderInfo(id);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOrderInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async getOrderInfo(id: number): Promise<NetworkResponse<Order>> {
return this.networkDataSource.getOrderInfo(id);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 72d3b3174b3c347636461b8587989cb544cfd89d | github |
genjishare/snake-game | entry/src/main/ets/common/service/GameStateManager.ets | arkts | resetGameState | 重置游戏状态 | public resetGameState(): void {
this.currentGameState = null;
this.isInitialized = false;
hilog.info(DOMAIN, TAG, '游戏状态已重置');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetGameState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express... | public resetGameState(): void {
this.currentGameState = null;
this.isInitialized = false;
hilog.info(DOMAIN, TAG, '游戏状态已重置');
} | https://github.com/genjishare/snake-game | f3d52f7a34a80b96e351e12c0e14268ea26863e1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getThemeAdaptiveEBookTransitionBackgroundColor | 获取电子书背景设置(用于翻开动画) | private getThemeAdaptiveEBookTransitionBackgroundColor(): string {
return this.themeManager.isDarkThemeSync() ? '#1E1E1E' : '#FFFFFF';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getThemeAdaptiveEBookTransitionBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#... | private getThemeAdaptiveEBookTransitionBackgroundColor(): string {
return this.themeManager.isDarkThemeSync() ? '#1E1E1E' : '#FFFFFF';
} | https://github.com/DaLongZhuaZi/manxia | c4b17b053e0c4e650efc132654eee03830dab5e9 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/SwitchProController.ets | arkts | applyDefaultCalibration | 应用默认校准 | private applyDefaultCalibration(stick: number): void {
for (let axis = 0; axis < 2; axis++) {
this.stickCalibration[stick][axis][0] = 0x000;
this.stickCalibration[stick][axis][1] = 0x800;
this.stickCalibration[stick][axis][2] = 0xFFF;
this.stickExtends[stick][axis][0] = -0x700;
this.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyDefaultCalibration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stick AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private applyDefaultCalibration(stick: number): void {
for (let axis = 0; axis < 2; axis++) {
this.stickCalibration[stick][axis][0] = 0x000;
this.stickCalibration[stick][axis][1] = 0x800;
this.stickCalibration[stick][axis][2] = 0xFFF;
this.stickExtends[stick][axis][0] = -0x700;
this.... | https://github.com/AlkaidLab/moonlight-harmony | f38c1292adcbe2990fafa7459deb84b7ab80143a | github |
Octo-o-o-o/harmonyos-ai-workspace | samples/templates/error-event-builder/ErrorEventBuilder.ets | arkts | isAllowed | ---- stubs (replace with your real implementations) ---- | private isAllowed(_endpoint: string): boolean {
return true
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isAllowed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _endpoint AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | private isAllowed(_endpoint: string): boolean {
return true
} | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | 1baa320ee477043d2d9403780e5e2c765aed47a7 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AnomalyDetectionDAO.ets | arkts | batchAcknowledge | 批量确认异常记录 | static async batchAcknowledge(anomalyIds: number[]): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
is_acknowledged: 1,
acknowledged_at: now,
updated_at: now
... | 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 batchAcknowledge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left anomalyIds AST#identifier#Right AST#ERROR#Left AST#:#L... | static async batchAcknowledge(anomalyIds: number[]): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
is_acknowledged: 1,
acknowledged_at: now,
updated_at: now
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7f6eefb02d1e4c2e49cfbef44f7000e1b667bd28 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/auth/AuthService.ets | arkts | getCurrentUsername | 获取当前用户名 | getCurrentUsername(): string {
if (this.currentUser !== null && this.currentUser.username.trim().length > 0) {
return this.currentUser.username;
}
return this.currentUsername;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta... | getCurrentUsername(): string {
if (this.currentUser !== null && this.currentUser.username.trim().length > 0) {
return this.currentUser.username;
}
return this.currentUsername;
} | https://github.com/Amaz1ny/HarmonyDO-public | 9c64dc2ba378734c86a4825558ac2310b60d81f6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | isGreaterThan | Checks if this instance value is greater than value of provided instance
@param { Double } other Right hand side of the comparison
@returns { boolean } true if this value is greater than provided, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isGreaterThan(other: Double): boolean {
return this.value > other.toDouble();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGreaterThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left D... | public isGreaterThan(other: Double): boolean {
return this.value > other.toDouble();
} | https://gitcode.com/iop123123/arkts-static-skills | 3b04c81a2c5f235fd736db926d373a87cc2ca6c9 | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/settings/src/main/ets/service/UpdateService.ets | arkts | getInstance | 获取UpdateService实例
@returns UpdateService | public static getInstance(): UpdateService {
if (!UpdateService.instance) {
UpdateService.instance = new UpdateService()
return UpdateService.instance
}
return UpdateService.instance
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): UpdateService {
if (!UpdateService.instance) {
UpdateService.instance = new UpdateService()
return UpdateService.instance
}
return UpdateService.instance
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | bd2969f131f6659f1dbae9a7f981f205cc55b7b4 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setDragDecelerationEnabled | If set to true, chart continues to scroll after touch up. Default: true.
@param enabled | public setDragDecelerationEnabled(enabled: boolean) {
this.mDragDecelerationEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDragDecelerationEnabled 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#id... | public setDragDecelerationEnabled(enabled: boolean) {
this.mDragDecelerationEnabled = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0aaee6789d07777dca5c49d8defb035550879172 | gitee |
SMAT-Lab/ArkAnalyzer-HapRay | test_hap/test_suite/src/main/ets/testcases/imageknife/pages/ImageCacheUtil.ets | arkts | clearCache | 清除所有缓存 | static async clearCache(): Promise<void> {
try {
if (!ImageCacheUtil.initialized || !fileIO.accessSync(ImageCacheUtil.cacheDir)) {
return;
}
const files = fileIO.listFileSync(ImageCacheUtil.cacheDir);
for (let file of files) {
const filePath = ImageCacheUtil.cacheDir + '/' ... | 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 clearCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | static async clearCache(): Promise<void> {
try {
if (!ImageCacheUtil.initialized || !fileIO.accessSync(ImageCacheUtil.cacheDir)) {
return;
}
const files = fileIO.listFileSync(ImageCacheUtil.cacheDir);
for (let file of files) {
const filePath = ImageCacheUtil.cacheDir + '/' ... | https://github.com/SMAT-Lab/ArkAnalyzer-HapRay | 4ba183499e3c2393f677bfa1af01ca363e51def8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | formatDuration | 格式化持续时间
@param duration - 持续时间(毫秒)
@returns 格式化的持续时间字符串 | static formatDuration(duration: number): string {
const seconds = Math.floor(duration / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
if (days > 0) {
return `${days}天${hours % 24}小时`;
} else if (hours > 0) {... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | static formatDuration(duration: number): string {
const seconds = Math.floor(duration / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
if (days > 0) {
return `${days}天${hours % 24}小时`;
} else if (hours > 0) {... | https://github.com/DaLongZhuaZi/manxia | 92efb4ddd5bf4fc0ac1bb39c0a7c946d8f4e32df | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets | arkts | toggleTag | 切换标签选中状态 | toggleTag(tagId: string): void {
const index = this.selectedTags.indexOf(tagId)
if (index >= 0) {
this.selectedTags.splice(index, 1)
} else {
this.selectedTags.push(tagId)
}
// 更新日程颜色为第一个选中标签的颜色
if (this.selectedTags.length > 0) {
const selectedTag = this.availableTags.find((... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tagId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#... | toggleTag(tagId: string): void {
const index = this.selectedTags.indexOf(tagId)
if (index >= 0) {
this.selectedTags.splice(index, 1)
} else {
this.selectedTags.push(tagId)
}
// 更新日程颜色为第一个选中标签的颜色
if (this.selectedTags.length > 0) {
const selectedTag = this.availableTags.find((... | https://gitcode.com/openharmony/codelabs | 1d8c0955c727f6d4eb7b781bbe06e01025bc5724 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/rollingText/index.ets | arkts | getLength | 获取数字长度 | getLength(){
return `${Math.max(this.startNum, this.targetNum!)}`.length
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLength 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 AST... | getLength(){
return `${Math.max(this.startNum, this.targetNum!)}`.length
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/rollingText/index.ets#L92-L94 | 40d7dc4c4b3f85f7c18bc479752546080b8c97d0 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/OmniPopup.ets | arkts | setInSubWindow | 全局设置-是否在子窗口中显示
@param showInSubWindow
@returns | static setInSubWindow(showInSubWindow: boolean) {
Config.dialogOptions.showInSubWindow = showInSubWindow
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setInSubWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left showInSubWindow AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | static setInSubWindow(showInSubWindow: boolean) {
Config.dialogOptions.showInSubWindow = showInSubWindow
} | https://github.com/wuba/omni-ui | 9aca9b0a4e71155e12b5c2529bc415a2776241f9 | github |
the-wwyang/kids-learning-app | src/main/ets/pages/DrawingGalleryPage.ets | arkts | getAllWorks | 获取所有作品 | async getAllWorks(): Promise<DrawingWork[]> {
try {
const prefs = await preferences.getPreferences(this.context, this.preferencesName);
const worksJson = await prefs.get('works', '[]') as string;
const works: DrawingWork[] = JSON.parse(worksJson);
// 按时间倒序排列
return works.sort((a, b) ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllWorks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getAllWorks(): Promise<DrawingWork[]> {
try {
const prefs = await preferences.getPreferences(this.context, this.preferencesName);
const worksJson = await prefs.get('works', '[]') as string;
const works: DrawingWork[] = JSON.parse(worksJson);
// 按时间倒序排列
return works.sort((a, b) ... | https://github.com/the-wwyang/kids-learning-app | c6c848b4c60a747c31f494a3de87caed28dc2ff7 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ProviderViewModel.ets | arkts | initializeAllPresetProviders | 预设补齐 + 历史 URL 修复 + 加载到内存(幂等) | async initializeAllPresetProviders(): Promise<void> {
await this.store.ensureInitialized()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initializeAllPresetProviders AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left... | async initializeAllPresetProviders(): Promise<void> {
await this.store.ensureInitialized()
} | https://github.com/LongLiveY96/chatcube | 6f767858b8efb6c8563a0d32d8b936466005573a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | extractContents | Remove html tag, css, js of html string to extract the contents
@param {String} html
@return {String} contents of the html | static extractContents(html: string): string {
return html
.replace(new RegExp("(\n|\r|\t)", "gm"), '') // remove linebreaks
.replace(new RegExp("<(style|script|link|noscript).*?>.*?<\/(style|script|link|noscript)>", "g"), '') // remove css, js blocks
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractContents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static extractContents(html: string): string {
return html
.replace(new RegExp("(\n|\r|\t)", "gm"), '') // remove linebreaks
.replace(new RegExp("<(style|script|link|noscript).*?>.*?<\/(style|script|link|noscript)>", "g"), '') // remove css, js blocks
... | https://gitcode.com/iop123123/arkts-static-skills | b1c0e2750aeee9cf2151db05ff27f9dd8dbaf955 | gitcode |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/utils/CityClockCardUtil.ets | arkts | notifyCityClockCardUpdate | notify City Clock Card Content Update
@param formId formId
@param cityIndex cityIndex
@returns | public static async notifyCityClockCardUpdate(formId: string, cityIndex: string): Promise<void> {
const formData = CityClockCardUtil.initCityClockCard(cityIndex);
FormUtil.notifyFormDataChanged(formId, formData);
} | 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 notifyCityClockCardUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifi... | public static async notifyCityClockCardUpdate(formId: string, cityIndex: string): Promise<void> {
const formData = CityClockCardUtil.initCityClockCard(cityIndex);
FormUtil.notifyFormDataChanged(formId, formData);
} | https://gitee.com/openharmony-sig/applications_clock.git | 368686c551595c3d776e6c6e6e8b8806abbde2d6 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/utils/LunarCalendarUtils.ets | arkts | toString | 获取格式化的农历日期字符串
例如:农历乙巳年(蛇年)腊月十三 | toString(): string {
const leapPrefix = this.isLeapMonth ? '闰' : ''
return `农历${this.yearGanZhi}年(${this.shengXiao}年)${leapPrefix}${this.monthName}${this.dayName}`
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | toString(): string {
const leapPrefix = this.isLeapMonth ? '闰' : ''
return `农历${this.yearGanZhi}年(${this.shengXiao}年)${leapPrefix}${this.monthName}${this.dayName}`
} | https://github.com/LongLiveY96/chatcube | 2edf15dd3cd21bd8cae5ae087cce6744387ba10e | github |
tdcare/tdwebrtc | src/main/ets/utils/PermissionUtil.ets | arkts | checkPermissions | 校验当前是否已经授权
@param permissions 待判断的权限
@returns 已授权true,未授权false | static async checkPermissions(permissions: Permissions): Promise<boolean> {
let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtil.checkAccessToken(permissions);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { //判断是否授权
return true; //已经授权
} else {
return ... | 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 checkPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permissions AST#identifier#Right AST#:#... | static async checkPermissions(permissions: Permissions): Promise<boolean> {
let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtil.checkAccessToken(permissions);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { //判断是否授权
return true; //已经授权
} else {
return ... | https://github.com/tdcare/tdwebrtc | f5af4240068f73944673ecf9fa8135c4a6f5258b | github |
arkui-x/samples | CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets | arkts | isNullorEmpty | 判断数组为空或未定义
param 数组对象Array<Object>
@returns boolean | static isNullorEmpty(list: Array<Object> | undefined): boolean {
return null === list || undefined === list || list.length === 0;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNullorEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#... | static isNullorEmpty(list: Array<Object> | undefined): boolean {
return null === list || undefined === list || list.length === 0;
} | https://gitcode.com/arkui-x/samples | b7ad81bc15d94a037583a24a51d9830172841066 | gitcode |
chenchl/GMLogger-HarmonyOS | gmlogger/src/main/ets/components/security/logger/Logger.ets | arkts | isLoggable | 检查当前是否允许记录指定级别的日志
@param level - 需要检查的日志级别,类型为hilog.LogLevel
@returns 如果允许记录该级别日志则返回true,否则返回false
@remarks
该函数通过调用hilog.isLoggable方法,结合当前实例的mDomain和mTag,
判断指定日志级别是否可记录 | isLoggable(level: hilog.LogLevel): boolean {
return hilog.isLoggable(this.mDomain, this.mTag, level)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLoggable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left hilog AST#identif... | isLoggable(level: hilog.LogLevel): boolean {
return hilog.isLoggable(this.mDomain, this.mTag, level)
} | https://github.com/chenchl/GMLogger-HarmonyOS | 8d198fcf47a515481275c336bd6e643df637170e | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/pages/Home.ets | arkts | sortShopsByMostConsumed | 根据喝的最多的品牌排序店铺 | sortShopsByMostConsumed(records: CoffeeRecord[], dbShops: ShopRecord[]) {
const shopCounts: Map<string, number> = new Map()
records.forEach(r => {
const current = shopCounts.get(r.shopName) || 0
shopCounts.set(r.shopName, current + 1)
})
const shopNames = dbShops.map(s => s.shopName)
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sortShopsByMostConsumed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#... | sortShopsByMostConsumed(records: CoffeeRecord[], dbShops: ShopRecord[]) {
const shopCounts: Map<string, number> = new Map()
records.forEach(r => {
const current = shopCounts.get(r.shopName) || 0
shopCounts.set(r.shopName, current + 1)
})
const shopNames = dbShops.map(s => s.shopName)
... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | defc5ed94927cc62ddaeb5d1946a0e3fd8ac8682 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setDrawEntryLabels | Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).
@param enabled | public setDrawEntryLabels(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawEntryLabels 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 setDrawEntryLabels(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ea0f1005f5a8b6ac91581c059d6c5e22018eef8e | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test23_original_index.ets | arkts | testTryFinallyNoCatch | --- Try-finally without catch --- | function testTryFinallyNoCatch(): string {
let x: number = 0;
try {
x = 10;
} finally {
x = x + 5;
}
return String(x);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTryFinallyNoCatch 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#prede... | function testTryFinallyNoCatch(): string {
let x: number = 0;
try {
x = 10;
} finally {
x = x + 5;
}
return String(x);
} | https://github.com/miaochiahao/ark-ghidra | 54bb1bf6b5bb60f14e3f5d1df059439f697e50d4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Console.ets | arkts | log | Prints a boolean to the console and puts newline
@param i value to print | public log(i: boolean): void {
this.print(i);
this.println();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | public log(i: boolean): void {
this.print(i);
this.println();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | faa397952660e3ccb67633d0d0a3a0e3ddd53fb4 | gitee |
who7708/harmonyos-codelabs | ImageEdit/entry/src/main/ets/utils/AdjustUtil.ets | arkts | hsv2rgb | HSV to RGB conversion formula:
When 0 <= H <= 360, 0 <= S <= 1 and 0 <= V <= 1:
C = V * S
X = C * (1 - Math.abs((H / 60) mod 2 - 1))
m = V - C
| (C, X ,0), 0 <= H < 60
| (X, C, 0), 60 <= H < 120
| (0, C, X), 120 <= H < 180
(R', G', B') = | (0, X, C), 180 <= H < 240
| (X, 0, C), 240 <= H < 300
| (C, 0, X), 300 <... | function hsv2rgb(hue: number, saturation: number, value: number) {
let rgbR: number = 0, rgbG: number = 0, rgbB: number = 0;
if (saturation === 0) {
rgbR = rgbG = rgbB = Math.round((value * CommonConstants.COLOR_LEVEL_MAX) / CommonConstants.CONVERT_INT);
return { rgbR, rgbG, rgbB };
}
const cxmC = (valu... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hsv2rgb AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left hue AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function hsv2rgb(hue: number, saturation: number, value: number) {
let rgbR: number = 0, rgbG: number = 0, rgbB: number = 0;
if (saturation === 0) {
rgbR = rgbG = rgbB = Math.round((value * CommonConstants.COLOR_LEVEL_MAX) / CommonConstants.CONVERT_INT);
return { rgbR, rgbG, rgbB };
}
const cxmC = (valu... | https://github.com/who7708/harmonyos-codelabs | 5f0142335119b9c80d24a13ec51961eca2e960fb | github |
apap6628114/nga_oh | entry/src/main/ets/store/AppStore.ets | arkts | init | ============== Init & Lifecycle ============== | async init(context: Context): Promise<void> {
try {
this.context = context
await this.store.init(context, 'nga_app_store')
// 子 Store 中不依赖 uid 的先初始化(同步赋值引用)
await this.voteStore.init(this.store, this.writeQueue)
await this.historyStore.init(this.store, this.writeQueue)
// 认证 ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async init(context: Context): Promise<void> {
try {
this.context = context
await this.store.init(context, 'nga_app_store')
// 子 Store 中不依赖 uid 的先初始化(同步赋值引用)
await this.voteStore.init(this.store, this.writeQueue)
await this.historyStore.init(this.store, this.writeQueue)
// 认证 ... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AppStore.ets#L51-L74 | ad3a512e94e46377990900dab136991380c20b2b | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleCrashes.ets | arkts | setThreadStackProvider | Optional hook for collecting Worker-thread stacks at crash time. Without
this, `recordAllThreadsWithCrash=true` can only ship the main-thread
stack (ArkTS isolates can't enumerate each other). Typical wiring:
countly.setThreadStackProvider(() => myWorkerRegistry.snapshotStacks());
The SDK calls this synchronously durin... | public setThreadStackProvider(provider: ThreadStackProvider | null): void {
if (this.rejectIfHalted('ModuleCrashes', 'setThreadStackProvider')) return;
this.threadStackProvider = provider;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setThreadStackProvider AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left provider AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binar... | public setThreadStackProvider(provider: ThreadStackProvider | null): void {
if (this.rejectIfHalted('ModuleCrashes', 'setThreadStackProvider')) return;
this.threadStackProvider = provider;
} | https://github.com/Countly/countly-sdk-hos | 51710c03191fad5261a4f7a65ae840950bad2b35 | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | checkNotifyCountsReload | Pick up a fresh baseline from the UI and refresh the notification with it. | private checkNotifyCountsReload(): void {
const signature: string = this.notifyCountsSignature();
if (signature === this.lastNotifyCountsSignature) {
return;
}
this.lastNotifyCountsSignature = signature;
this.loadNotifyCounts();
this.updateStatsNotification(true);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkNotifyCountsReload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left v... | private checkNotifyCountsReload(): void {
const signature: string = this.notifyCountsSignature();
if (signature === this.lastNotifyCountsSignature) {
return;
}
this.lastNotifyCountsSignature = signature;
this.loadNotifyCounts();
this.updateStatsNotification(true);
} | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1069-L1077 | d44b625d113cba8bc70875364484fc54526ea0cd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | fill | Fills the Uint8ClampedArray with specified value
@param { int } value - new valuy
@param { int } [start] - start index to begin fill from
@param { int } [end] - last index to end fill from, excluded
@returns { Uint8ClampedArray } - modified Uint8ClampedArray
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public fill(value: int, start?: int, end?: int): Uint8ClampedArray {
value = Uint8ClampedArray.clamp(value)
const k = normalizeIndex(start ?? 0, this.lengthInt)
const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt)
this.fillInternal(value, k, finalPos)
return... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide... | public fill(value: int, start?: int, end?: int): Uint8ClampedArray {
value = Uint8ClampedArray.clamp(value)
const k = normalizeIndex(start ?? 0, this.lengthInt)
const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt)
this.fillInternal(value, k, finalPos)
return... | https://gitcode.com/iop123123/arkts-static-skills | 0c794fa2e437d21df65d48651be401376cbd9931 | gitcode |
zmuxuny/ai-guardian-star | entry/src/main/ets/common/UserManager.ets | arkts | getDefaultUsername | 获取默认用户名
@returns 默认用户名 | public getDefaultUsername(): string {
return UserManager.DEFAULT_USERNAME;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDefaultUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string ... | public getDefaultUsername(): string {
return UserManager.DEFAULT_USERNAME;
} | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/UserManager.ets#L61-L63 | c6c93118a8216fc667fbe5c124a5de2e748d4f2e | github |
the-wwyang/kids-learning-app | src/main/ets/storage/AchievementManager.ets | arkts | updateAchievementProgress | 手动更新特定成就进度(用于游戏等) | public async updateAchievementProgress(
achievementId: string,
progress: number
): Promise<AchievementUnlockedEvent | null> {
const achievements = await this.getUserAchievements();
let targetAchievement: Achievement | null = null;
for (let i = 0; i < achievements.length; i++) {
if (achiev... | 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 updateAchievementProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left achievementId AST#identifier#Right AST#ERROR#... | public async updateAchievementProgress(
achievementId: string,
progress: number
): Promise<AchievementUnlockedEvent | null> {
const achievements = await this.getUserAchievements();
let targetAchievement: Achievement | null = null;
for (let i = 0; i < achievements.length; i++) {
if (achiev... | https://github.com/the-wwyang/kids-learning-app | 449e06b77b1df33b7a7826251d9b58533ef549b9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | getHistory | 获取历史记录 | public getHistory(): PerformanceHistory {
return {
timestamps: this.history.timestamps.slice(),
memoryUsage: this.history.memoryUsage.slice(),
cpuUsage: this.history.cpuUsage.slice(),
gcCount: this.history.gcCount.slice(),
heapSize: this.history.heapSize.slice()
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHistory 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 Performance... | public getHistory(): PerformanceHistory {
return {
timestamps: this.history.timestamps.slice(),
memoryUsage: this.history.memoryUsage.slice(),
cpuUsage: this.history.cpuUsage.slice(),
gcCount: this.history.gcCount.slice(),
heapSize: this.history.heapSize.slice()
};
} | https://github.com/DaLongZhuaZi/manxia | dcb3e880b9360867cbc79fc3beff205fafe2f6ce | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/common/utils/permissionUtils.ets | arkts | grantPermissionWithResult | 授予权限并返回操作结果
@param permission 操作权限
@param flag 授权flag
@param tokenId 应用token
return | public static async grantPermissionWithResult(
permission: Permission, flag: number, tokenId: number
): Promise<optionAndState> {
try {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenId, permission, flag);
Log.info(`grant permission suc... | 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 grantPermissionWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifi... | public static async grantPermissionWithResult(
permission: Permission, flag: number, tokenId: number
): Promise<optionAndState> {
try {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenId, permission, flag);
Log.info(`grant permission suc... | https://gitee.com/openharmony/applications_permission_manager.git | 31193faa57b1433fe497917b4296daa27d4c5f4a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | previewUrl | 截断URL用于日志,避免日志过长 | private previewUrl(url: string): string {
if (!url) {
return '';
}
return url.length > 120 ? `${url.substring(0, 120)}...` : url;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left previewUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | private previewUrl(url: string): string {
if (!url) {
return '';
}
return url.length > 120 ? `${url.substring(0, 120)}...` : url;
} | https://github.com/DaLongZhuaZi/manxia | 0d1f7e73622cac3b962bd9198643fe1256dd05eb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | disable | 禁用性能分析 | public disable(): void {
this.isEnabled = false;
logger.info(PERFORMANCE_ANALYZER_TAG, 'Performance analyzer disabled');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left disable 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 disable(): void {
this.isEnabled = false;
logger.info(PERFORMANCE_ANALYZER_TAG, 'Performance analyzer disabled');
} | https://github.com/DaLongZhuaZi/manxia | 64f63cb9a6ce71ce64dc1bec614428b124e50d35 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/DeviceSensorService.ets | arkts | checkAvailability | 检测传感器可用性
通过 sensor.once() 尝试获取单次读数来判断传感器是否存在 | private checkAvailability(): void {
if (this.availabilityChecked) {
return;
}
try {
sensor.once(sensor.SensorId.GYROSCOPE, (_data: sensor.GyroscopeResponse) => {
// 成功获取数据说明陀螺仪可用
});
this.gyroAvailable = true;
} catch {
this.gyroAvailable = false;
}
try ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkAvailability 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 AS... | private checkAvailability(): void {
if (this.availabilityChecked) {
return;
}
try {
sensor.once(sensor.SensorId.GYROSCOPE, (_data: sensor.GyroscopeResponse) => {
// 成功获取数据说明陀螺仪可用
});
this.gyroAvailable = true;
} catch {
this.gyroAvailable = false;
}
try ... | https://github.com/AlkaidLab/moonlight-harmony | 62fac644d76ce0007fc4662ff15f815183b0b72d | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets | arkts | getElements | 获取当前节点的子节点 | public getElements(): object{
return this._formatResultObj[SVGAttrConstants.ATTR_KEY_ELEMENTS]as object;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getElements 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#object#Left object AST#obj... | public getElements(): object{
return this._formatResultObj[SVGAttrConstants.ATTR_KEY_ELEMENTS]as object;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | f52d3a18d0e062fe8a76da14c541c5d6b2cc15ca | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets | arkts | currentTabSearchSearchedKey | Gets the current tab search key that is searched last time. | get currentTabSearchSearchedKey() {
return this.currentTab?.searchedSearchKey;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left currentTabSearchSearchedKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#L... | get currentTabSearchSearchedKey() {
return this.currentTab?.searchedSearchKey;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 6faba3072859bafad6552990af103dad48a48ec0 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/WebSearchService.ets | arkts | parseBingSearchResults | 解析 Bing 搜索结果页 HTML(多策略,增强鲁棒性) | private parseBingSearchResults(html: string, maxCount: number): SearchResultItem[] {
const results: SearchResultItem[] = []
const seenUrls: Map<string, boolean> = new Map()
this.collectResultsFromBAlgoBlocks(html, maxCount, results, seenUrls)
if (results.length < maxCount) {
this.collectResults... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseBingSearchResults AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private parseBingSearchResults(html: string, maxCount: number): SearchResultItem[] {
const results: SearchResultItem[] = []
const seenUrls: Map<string, boolean> = new Map()
this.collectResultsFromBAlgoBlocks(html, maxCount, results, seenUrls)
if (results.length < maxCount) {
this.collectResults... | https://github.com/LongLiveY96/chatcube | bca480a22a13bed36ff417034f9c0aa6b9e7ac72 | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/AIConsultationSkill.ets | arkts | openAiChatPage | 打开AiChatPage引导用户深入交互 | static openAiChatPage(initialQuery?: string): void {
router.pushUrl({
url: 'pages/AiChatPage',
params: {
initialQuery: initialQuery || '',
skillId: this.SKILL_ID
}
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left openAiChatPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left initialQuery AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#... | static openAiChatPage(initialQuery?: string): void {
router.pushUrl({
url: 'pages/AiChatPage',
params: {
initialQuery: initialQuery || '',
skillId: this.SKILL_ID
}
});
} | https://github.com/LJ666-ui/harmony-health-care | 643138892e31359b0dab01747ad616b05adde7b7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | shadowEnabled | 是否启用阴影 | public get shadowEnabled(): boolean {
return this.currentProfile.effects.enableShadow;
} | 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 shadowEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public get shadowEnabled(): boolean {
return this.currentProfile.effects.enableShadow;
} | https://github.com/DaLongZhuaZi/manxia | 9ebf268e1edd8fa3e7d92e5415c5f6aed155ac74 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/client/tools/ControlPacket.ets | arkts | createCollapsePanels | ============ TYPE_COLLAPSE_PANELS (7) ============ | static createCollapsePanels(): ArrayBuffer {
const buf = new ArrayBuffer(1);
const view = new DataView(buf);
view.setUint8(0, ControlMessageType.TYPE_COLLAPSE_PANELS);
return buf;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createCollapsePanels 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 A... | static createCollapsePanels(): ArrayBuffer {
const buf = new ArrayBuffer(1);
const view = new DataView(buf);
view.setUint8(0, ControlMessageType.TYPE_COLLAPSE_PANELS);
return buf;
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | f758fe11c18ed8fb857e381bf9b1e4ab9040b88f | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | getOptPrefix | Gets the 'optPrefix'.
@return the 'optPrefix' | public getOptPrefix(): string {
return this.defaultOptPrefix;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOptPrefix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#st... | public getOptPrefix(): string {
return this.defaultOptPrefix;
} | https://gitee.com/openharmony-sig/commons-cli.git | d9bdd7811a8607008aac66f0c1205b482bd5e2e6 | gitee |
buqiuz/game-puzzle | entry/src/main/ets/pages/Login.ets | arkts | jumpToPrivacyWebView | 跳转华为账号用户认证协议页,该页面需在工程main_pages.json文件配置 | jumpToPrivacyWebView() {
router.pushUrl({
// 在工程main_pages.json文件配置跳转页,具体可参考AccountKit开发指南使用华为账号一键登录WebPage示例代码
url: 'pages/WebPage',
params: {
isFromDialog: true,
url: QuickLoginButtonComponent.USER_AUTHENTICATION_PROTOCOL,
}
}, (err) => {
if (err) {
hilo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToPrivacyWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | jumpToPrivacyWebView() {
router.pushUrl({
// 在工程main_pages.json文件配置跳转页,具体可参考AccountKit开发指南使用华为账号一键登录WebPage示例代码
url: 'pages/WebPage',
params: {
isFromDialog: true,
url: QuickLoginButtonComponent.USER_AUTHENTICATION_PROTOCOL,
}
}, (err) => {
if (err) {
hilo... | https://github.com/buqiuz/game-puzzle | c052ada0689ce6ce404418138815d76508fe928e | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | stopNavigationLoop | 停止导航循环 | private stopNavigationLoop(): void {
if (this.navigationLoopTimer !== null) {
clearInterval(this.navigationLoopTimer);
this.navigationLoopTimer = null;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopNavigationLoop 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#... | private stopNavigationLoop(): void {
if (this.navigationLoopTimer !== null) {
clearInterval(this.navigationLoopTimer);
this.navigationLoopTimer = null;
}
} | https://github.com/LJ666-ui/harmony-health-care | 643810ff39cbb5ac320e54cb565cef99ab475f1b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets | arkts | cleanUrl | 清理URL(去除换行符、多余空格等无效字符) | private cleanUrl(url: string): string {
if (!url) return '';
// 去除换行符和回车符
let cleaned = url.replace(/[\r\n]/g, '');
// 去除首尾空格
cleaned = cleaned.trim();
// 去除URL中的多余空格
cleaned = cleaned.replace(/\s+/g, '');
// 修复规则拼接导致的尾部脏字符,如 https://lnovel.tw/]
if (cleaned.endsWith('/]') || c... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left cleanUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | private cleanUrl(url: string): string {
if (!url) return '';
// 去除换行符和回车符
let cleaned = url.replace(/[\r\n]/g, '');
// 去除首尾空格
cleaned = cleaned.trim();
// 去除URL中的多余空格
cleaned = cleaned.replace(/\s+/g, '');
// 修复规则拼接导致的尾部脏字符,如 https://lnovel.tw/]
if (cleaned.endsWith('/]') || c... | https://github.com/DaLongZhuaZi/manxia | 4471809b439758a131283df5a3310f6e82cee87b | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | isSyncEnabled | 检查是否启用同步 | public static isSyncEnabled(): boolean {
return SettingsService.getInstance().getSync(
SettingsService.KEY_APP_SYNC_SETTING_ENABLE,
SettingsService.KEY_APP_SYNC_SETTING_ENABLE_DEFAULT
);
} | 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 isSyncEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public static isSyncEnabled(): boolean {
return SettingsService.getInstance().getSync(
SettingsService.KEY_APP_SYNC_SETTING_ENABLE,
SettingsService.KEY_APP_SYNC_SETTING_ENABLE_DEFAULT
);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L152-L157 | e9cbc1f8b889b19388c4ee968f1c5287543fb5fd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getShelfFilteredMangaList | 获取书架筛选后的漫画列表(应用排序和标签/作者筛选) | private getShelfFilteredMangaList(): Manga[] {
let baseList: Manga[] = this.mangaList;
// 如果是自定义书架,只显示用户明确添加的内容
if (this.selectedShelf !== null) {
const itemIds = this.typeShelfManager.getShelfItemIdsByType(this.selectedShelf.id, ContentType.MANGA);
baseList = this.mangaList.filter((manga... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getShelfFilteredMangaList 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#Rig... | private getShelfFilteredMangaList(): Manga[] {
let baseList: Manga[] = this.mangaList;
// 如果是自定义书架,只显示用户明确添加的内容
if (this.selectedShelf !== null) {
const itemIds = this.typeShelfManager.getShelfItemIdsByType(this.selectedShelf.id, ContentType.MANGA);
baseList = this.mangaList.filter((manga... | https://github.com/DaLongZhuaZi/manxia | f4d4172d02c0730495aa05628e770e6aebef241f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | getFiltered | 筛选漫画
@param page 页码
@param filterOrdering 排序方式(旧版参数)
@param filterRegion 地区筛选(旧版参数)
@param filterTheme 题材筛选(旧版参数)
@param dynamicFilters 动态筛选参数Map(新版参数,支持任意筛选组) | async getFiltered(page: number = 1, filterOrdering?: string, filterRegion?: string, filterTheme?: string, dynamicFilters?: Map<string, string>): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法筛选漫画');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getFiltered AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left page AST#identifier#Right AST#typ... | async getFiltered(page: number = 1, filterOrdering?: string, filterRegion?: string, filterTheme?: string, dynamicFilters?: Map<string, string>): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法筛选漫画');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_... | https://github.com/DaLongZhuaZi/manxia | 1bee06d5bcd14c02cf55a129167e778555887815 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MultiAgentOrchestrator.ets | arkts | orchestrate | 编排问诊流程
@param request 问诊请求
@returns 会诊响应 | async orchestrate(request: ConsultationRequest): Promise<ConsultationResponse> {
const startTime = Date.now();
// 1. 生成或获取会话ID
const sessionId = request.sessionId || this.generateSessionId();
// 2. 检索对话历史
const history = await this.memory.retrieve(sessionId);
// 3. 意图分类
const intent = a... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left orchestrate AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left request AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async orchestrate(request: ConsultationRequest): Promise<ConsultationResponse> {
const startTime = Date.now();
// 1. 生成或获取会话ID
const sessionId = request.sessionId || this.generateSessionId();
// 2. 检索对话历史
const history = await this.memory.retrieve(sessionId);
// 3. 意图分类
const intent = a... | https://github.com/LJ666-ui/harmony-health-care | f98e92cb1aeb52b90ac808dc19a0ca1cdbd1f427 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | map | Creates a new Uint8Array using fn(arr[i]) over all elements of current Uint8Array.
@param fn a function to apply for each element of current Uint8Array
@returns a new Uint8Array where for each element from current Uint8Array fn was applied | public map(fn: (val: number, index: int) => number): Uint8Array {
let resBuf = new ArrayBuffer(this.length * Uint8Array.BYTES_PER_ELEMENT)
let res = new Uint8Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: number, index: int) => number): Uint8Array {
let resBuf = new ArrayBuffer(this.length * Uint8Array.BYTES_PER_ELEMENT)
let res = new Uint8Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 35d2a2307103b6e11edb54d0570a6c39ea1313bc | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | $_get | Returns the first match if "0" is given and the first match exists
@param index
@returns the first match as string or null | public $_get(index: String): String {
if (index == "0") {
const v = this.$_get(0)
if (v !== undefined) return v
throw new Error("result[0] is undefined")
}
throw new Error("unsupported field name")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public $_get(index: String): String {
if (index == "0") {
const v = this.$_get(0)
if (v !== undefined) return v
throw new Error("result[0] is undefined")
}
throw new Error("unsupported field name")
} | https://gitcode.com/iop123123/arkts-static-skills | f1a64dec10de85bfc77712d808f70f3387b0891a | gitcode |
Eklps/harmony-mall-perf | entry/src/main/ets/viewmodel/CartModel.ets | arkts | addToCart | 添加商品到购物车(支持数量) | static addToCart(item: GoodsListItemType, quantity: number = 1) {
let cartList = AppStorage.get<CartItemType[]>('cartList') || [];
// 检查商品是否已在购物车中
const existingIndex = cartList.findIndex(cartItem => cartItem.goods.id === item.id);
if (existingIndex >= 0) {
// 商品已存在,增加数量
cartList... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left addToCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GoodsL... | static addToCart(item: GoodsListItemType, quantity: number = 1) {
let cartList = AppStorage.get<CartItemType[]>('cartList') || [];
// 检查商品是否已在购物车中
const existingIndex = cartList.findIndex(cartItem => cartItem.goods.id === item.id);
if (existingIndex >= 0) {
// 商品已存在,增加数量
cartList... | https://github.com/Eklps/harmony-mall-perf | c48be87309d00a11bcdea351833860b67a0fa3c6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets | arkts | getCachedCookie | 获取缓存的Cookie | private async getCachedCookie(sourceId: number, url?: string): Promise<string> {
if (url && url.includes('photos18.com')) {
try {
return await CookieManager.getInstance().getCookieStringForUrl(sourceId, url);
} catch (error) {
logger.warn(TAG, `按URL获取在线图片Cookie失败,回退普通缓存: sourceId=${sou... | 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 getCachedCookie AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#L... | private async getCachedCookie(sourceId: number, url?: string): Promise<string> {
if (url && url.includes('photos18.com')) {
try {
return await CookieManager.getInstance().getCookieStringForUrl(sourceId, url);
} catch (error) {
logger.warn(TAG, `按URL获取在线图片Cookie失败,回退普通缓存: sourceId=${sou... | https://github.com/DaLongZhuaZi/manxia | a83fa4ed8f8a8f2c9fe920281f36a20aefe185ab | github |
OHPG/FinSdk | emby/src/main/ets/api/UserApi.ets | arkts | updateUserPolicy | updateUserPolicy
@summary Updates a user policy.
@param {UserApiUpdateUserPolicyRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UserApi | public async updateUserPolicy(requestParameters: UserApiUpdateUserPolicyRequest): Promise<void> {
this.assertParam(requestParameters.userId)
return this.apiClient.post({ path: `/Users/${requestParameters.userId}/Policy`, data: requestParameters.userPolicy })
} | 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 updateUserPolicy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ... | public async updateUserPolicy(requestParameters: UserApiUpdateUserPolicyRequest): Promise<void> {
this.assertParam(requestParameters.userId)
return this.apiClient.post({ path: `/Users/${requestParameters.userId}/Policy`, data: requestParameters.userPolicy })
} | https://github.com/OHPG/FinSdk | 0e21ff0a05df50f7986cf9deb452be6e9de3e630 | github |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/AvPlayManager.ets | arkts | preDownload | 视频预下载 | async preDownload(url: string): Promise<void> {
if (this.avPlayer) {
let mediaSource: media.MediaSource = media.createMediaSourceWithUrl(url, {
'aa': 'bb', 'cc': 'dd'
});
let playbackStrategy: media.PlaybackStrategy = {
preferredWidth: 1,
preferredHeight: 2,
prefe... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left preDownload AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type... | async preDownload(url: string): Promise<void> {
if (this.avPlayer) {
let mediaSource: media.MediaSource = media.createMediaSourceWithUrl(url, {
'aa': 'bb', 'cc': 'dd'
});
let playbackStrategy: media.PlaybackStrategy = {
preferredWidth: 1,
preferredHeight: 2,
prefe... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | c5198622ab9b65377d3620eb770aab02fe13725d | gitee |
IoTAccessControl/ArkTSAnalysis | TestApps1/1.AccountKit_Codelab_QuickLogin_Clientdemo_ArkTS/entry/src/main/ets/pages/PermissionsPage.ets | arkts | startAudioCapturing | 本地录音 - AudioCapturer | startAudioCapturing() {
try {
// 如果已经在采集,先停止
if (this.isAudioCapturing && this.audioCapturer) {
this.stopAudioCapturing();
return;
}
// 创建音频采集配置
const audioCapturerOptions: audio.AudioCapturerOptions = {
streamInfo: {
samplingRate: audio.AudioSampli... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAudioCapturing 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_bloc... | startAudioCapturing() {
try {
// 如果已经在采集,先停止
if (this.isAudioCapturing && this.audioCapturer) {
this.stopAudioCapturing();
return;
}
// 创建音频采集配置
const audioCapturerOptions: audio.AudioCapturerOptions = {
streamInfo: {
samplingRate: audio.AudioSampli... | https://github.com/IoTAccessControl/ArkTSAnalysis | 58e050c16f2e063e44f1f6b37e9c2338f1aba88c | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/web_ui_old.ets | arkts | aboutToAppear | 音量条监听函数
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
基础函数 //
//////////
进入操作 // | aboutToAppear(): void {
// 检查目录 //
try {fs.statSync(web_ui_path)} catch {fs.mkdirSync(web_ui_path)}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
// 检查目录 //
try {fs.statSync(web_ui_path)} catch {fs.mkdirSync(web_ui_path)}
} | https://github.com/Nekofox-POT/LinMusic | 42eece0d269c8d964bc4a0e73fce13ccff21b778 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | pauseDownload | 暂停下载任务 | pauseDownload(taskId: string): void {
const task = this.downloadTasks.get(taskId);
if (task && task.status === 'downloading') {
task.status = 'paused';
task.updateTime = Date.now();
logger.info(TAG, `下载任务已暂停: ${taskId}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pauseDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )... | pauseDownload(taskId: string): void {
const task = this.downloadTasks.get(taskId);
if (task && task.status === 'downloading') {
task.status = 'paused';
task.updateTime = Date.now();
logger.info(TAG, `下载任务已暂停: ${taskId}`);
}
} | https://github.com/DaLongZhuaZi/manxia | d0295379c592baa1427ca30b759a7a8f00be3a2e | github |
apap6628114/nga_oh | entry/src/main/ets/common/utils/LinkUtils.ets | arkts | extractQueryString | 从 URL 中提取查询字符串(剥离片段标识符 #...)。
例:'https://nga.178.com/read.php?tid=1&pid=2' → 'tid=1&pid=2'
'https://nga.178.com/read.php?tid=1#pid123' → 'tid=1' | function extractQueryString(url: string): string {
const qsStart: number = url.indexOf('?')
if (qsStart < 0) return ''
const fragmentStart: number = url.indexOf('#', qsStart)
const end: number = fragmentStart >= 0 ? fragmentStart : url.length
return url.substring(qsStart + 1, end)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractQueryString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function extractQueryString(url: string): string {
const qsStart: number = url.indexOf('?')
if (qsStart < 0) return ''
const fragmentStart: number = url.indexOf('#', qsStart)
const end: number = fragmentStart >= 0 ? fragmentStart : url.length
return url.substring(qsStart + 1, end)
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/utils/LinkUtils.ets#L39-L45 | 89ac03ad99dfcc2a9478ce65d0b694592f34ee77 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | parseBookResults | 解析书籍查询结果 | private parseBookResults(rs: relationalStore.ResultSet): NovelBook[] {
const books: NovelBook[] = [];
if (rs.goToFirstRow()) {
do {
books.push({
id: rs.getString(rs.getColumnIndex('id')),
sourceId: rs.getString(rs.getColumnIndex('sourceId')),
sourceName: rs.getStrin... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseBookResults AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_express... | private parseBookResults(rs: relationalStore.ResultSet): NovelBook[] {
const books: NovelBook[] = [];
if (rs.goToFirstRow()) {
do {
books.push({
id: rs.getString(rs.getColumnIndex('id')),
sourceId: rs.getString(rs.getColumnIndex('sourceId')),
sourceName: rs.getStrin... | https://github.com/DaLongZhuaZi/manxia | da7fd19a5453e7e732da0bece1a73af9d263e833 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/common/Function/commonFn.ets | arkts | creteRandom | 生成11位数的抖音号
@param n 最小值
@param m 最大值 | creteRandom(n: number = 9999999999, m: number = 10000000000): number {
return Math.floor(Math.random() * (m - n + 1)) + m
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left creteRandom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left number AST#ident... | creteRandom(n: number = 9999999999, m: number = 10000000000): number {
return Math.floor(Math.random() * (m - n + 1)) + m
} | https://github.com/SMAT-Lab/PhantomRendering | 2977618de1660dfd2dc20662d0d21e9c5e9e59bc | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | getPhoneText | 获取手机号展示文本
@returns {ResourceStr} 手机号文本 | getPhoneText(): ResourceStr {
const phone: string = this.getUserInfo().phone ?? "";
return phone ? phone : $r("app.string.not_bound");
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPhoneText 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 ResourceStr AST#identifier#Right AST#ERROR#Right ... | getPhoneText(): ResourceStr {
const phone: string = this.getUserInfo().phone ?? "";
return phone ? phone : $r("app.string.not_bound");
} | https://github.com/Joker-x-dev/CoolMallArkTS | 6ad25d62502c1346d5240ce147722821433eab2d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/DdkUsbPoller.ets | arkts | stop | 停止轮询并释放资源 | stop(): void {
if (!this._running || this.pollerId < 0) return;
try {
ddkNative!.stopPoller(this.pollerId);
console.info(`${TAG} 轮询已停止: pollerId=${this.pollerId}`);
} catch (err) {
console.error(`${TAG} stop 异常:`, err);
}
this._running = false;
this.pollerId = -1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#property_ident... | stop(): void {
if (!this._running || this.pollerId < 0) return;
try {
ddkNative!.stopPoller(this.pollerId);
console.info(`${TAG} 轮询已停止: pollerId=${this.pollerId}`);
} catch (err) {
console.error(`${TAG} stop 异常:`, err);
}
this._running = false;
this.pollerId = -1;
} | https://github.com/AlkaidLab/moonlight-harmony | 8fcfb34449f391aa9f2bf2d247313a12469c77a4 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/SubQuery.ets | arkts | getRelationName | 获取关联关系名称
@returns 关联关系名称 | getRelationName(): string {
return this.relationName
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRelationName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem... | getRelationName(): string {
return this.relationName
} | https://github.com/offlinecat-dev/OCNetORM | 26f08bd9c69fec920ce6687662402af80e932c74 | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setDuplicateMergingEnabled | �����Ƿ����úϲ��ظ���Ļ
@param enable
@return | public setDuplicateMergingEnabled(enable: boolean): DanmakuContext {
if (this.mDuplicateMergingEnable != enable) {
this.mDuplicateMergingEnable = enable;
this.mGlobalFlagValues.updateFilterFlag();
this.notifyConfigureChanged(DanmakuConfigTag.DUPLICATE_MERGING_ENABLED, enable);
}
return t... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDuplicateMergingEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | public setDuplicateMergingEnabled(enable: boolean): DanmakuContext {
if (this.mDuplicateMergingEnable != enable) {
this.mDuplicateMergingEnable = enable;
this.mGlobalFlagValues.updateFilterFlag();
this.notifyConfigureChanged(DanmakuConfigTag.DUPLICATE_MERGING_ENABLED, enable);
}
return t... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 191531523aa2ca2bc6bfe6635ce122b77ca6a396 | gitee |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/view/TopAreaComponent.ets | arkts | build | Renders back and share row with safe-area aware trailing padding. | build() {
Row() {
Image($r('app.media.ic_back_down'))
.width(24)
.height(24)
.onClick((): void => {
this.onBackClick();
})
SymbolGlyph($r('sys.symbol.share'))
.fontSize(24)
.fontWeight(FontWeight.Regular)
.fontColor([$r('app.color.play_... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Row() {
Image($r('app.media.ic_back_down'))
.width(24)
.height(24)
.onClick((): void => {
this.onBackClick();
})
SymbolGlyph($r('sys.symbol.share'))
.fontSize(24)
.fontWeight(FontWeight.Regular)
.fontColor([$r('app.color.play_... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 155d5ea54d7eb52c3769657477791d1cd03c1e58 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | setLocalVersion | 设置本地版本号
纯内存存储,不经过 SettingsService,不触发同步 | private static setLocalVersion(key: string, version: number): void {
SyncSettingsService.versionMap.set(key, version);
} | 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 setLocalVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left ... | private static setLocalVersion(key: string, version: number): void {
SyncSettingsService.versionMap.set(key, version);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L460-L462 | 20560e5b4da4334e4b47844cb2333337bf4f80b7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | sup | The sup() method creates a string that embeds a string in a <sup> element (<sup>str</sup>),
which causes a string to be displayed in a big font.
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public sup(): String{
return this.CreateHTMLString('sup', '')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sup 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#:#Right... | public sup(): String{
return this.CreateHTMLString('sup', '')
} | https://gitcode.com/iop123123/arkts-static-skills | 36b1d4faf6f9bf0d37e84a43b8cdb9a3e07faa85 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | executeWait | 执行等待操作 | private async executeWait(action: WaitAction, context: ActionContext): Promise<boolean> {
logger.info(TAG, `等待条件: ${action.condition}`);
switch (action.condition) {
case WaitCondition.TIME:
await this.sleep(action.duration || 1000);
return true;
case WaitCondition.ELEMENT:
... | 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 executeWait AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : ... | private async executeWait(action: WaitAction, context: ActionContext): Promise<boolean> {
logger.info(TAG, `等待条件: ${action.condition}`);
switch (action.condition) {
case WaitCondition.TIME:
await this.sleep(action.duration || 1000);
return true;
case WaitCondition.ELEMENT:
... | https://github.com/DaLongZhuaZi/manxia | 15739df6768e526da0a4372f6bbb73eac113ba8c | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/PlaySpeedManager.ets | arkts | getNextSpeed | 获取下一个速度 | getNextSpeed(currentSpeed: number): number {
const currentIndex = PlaySpeedManager.SPEED_OPTIONS.findIndex(opt => opt.value === currentSpeed)
if (currentIndex === -1 || currentIndex === PlaySpeedManager.SPEED_OPTIONS.length - 1) {
return PlaySpeedManager.SPEED_OPTIONS[0].value // 回到第一个
}
return ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNextSpeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentSpeed AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AS... | getNextSpeed(currentSpeed: number): number {
const currentIndex = PlaySpeedManager.SPEED_OPTIONS.findIndex(opt => opt.value === currentSpeed)
if (currentIndex === -1 || currentIndex === PlaySpeedManager.SPEED_OPTIONS.length - 1) {
return PlaySpeedManager.SPEED_OPTIONS[0].value // 回到第一个
}
return ... | https://github.com/SMAT-Lab/PhantomRendering | f53c705da5a18bab22843a6f32edebb8d73e0009 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.