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 |
|---|---|---|---|---|---|---|---|---|---|---|
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | isWordUnknown | 检查词汇是否为未知 | isWordUnknown(word: string): boolean {
return this.unknownWords.has(word.toLowerCase());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isWordUnknown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | isWordUnknown(word: string): boolean {
return this.unknownWords.has(word.toLowerCase());
} | https://github.com/CLMC2025/Vignette | 08b5defa2c4ffdc697fbbbaf1be486d0c27e8d8d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DuplicateDetection/DuplicateDetectionService.ets | arkts | loadConfig | 从用户设置加载检测配置 | private async loadConfig(): Promise<DuplicateDetectionConfig> {
const settingsManager = SettingsManager.getInstance();
const enabled = await settingsManager.getDuplicateDetectionEnabled();
const threshold = await settingsManager.getDuplicateDetectionThreshold();
const scope = await settingsManager.get... | 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 loadConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | private async loadConfig(): Promise<DuplicateDetectionConfig> {
const settingsManager = SettingsManager.getInstance();
const enabled = await settingsManager.getDuplicateDetectionEnabled();
const threshold = await settingsManager.getDuplicateDetectionThreshold();
const scope = await settingsManager.get... | https://github.com/DaLongZhuaZi/manxia | 51193093bff1200319a9590abe8aea50a8a0e6dd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets | arkts | setMangaDetail | 设置漫画详情缓存 | setMangaDetail(sourceId: number, mangaId: string, data: MangaInfo): void {
const key = this.generateKey(sourceId, mangaId);
const now = Date.now();
this.mangaDetailCache.set(key, {
data,
timestamp: now,
expireTime: now + this.config.mangaDetailTTL
});
logger.info(TAG, `... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMangaDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | setMangaDetail(sourceId: number, mangaId: string, data: MangaInfo): void {
const key = this.generateKey(sourceId, mangaId);
const now = Date.now();
this.mangaDetailCache.set(key, {
data,
timestamp: now,
expireTime: now + this.config.mangaDetailTTL
});
logger.info(TAG, `... | https://github.com/DaLongZhuaZi/manxia | 4d2d42e993f299291aa8971855f12bc1291e1401 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/common/database/ContactsDataBase.ets | arkts | deleteKVStore | Deletes a specified KVStore database by package name. | deleteKVStore(): void {
try {
this.kvManager?.deleteKVStore(this.context.abilityInfo.bundleName, CommonConstants.DB_STORE_ID);
} catch (err) {
Logger.error(TAG, `DeleteKVStore an unexpected error occurred, error message is ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteKVStore 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... | deleteKVStore(): void {
try {
this.kvManager?.deleteKVStore(this.context.abilityInfo.bundleName, CommonConstants.DB_STORE_ID);
} catch (err) {
Logger.error(TAG, `DeleteKVStore an unexpected error occurred, error message is ${JSON.stringify(err)}`);
}
} | https://gitee.com/harmonyos/codelabs.git | 7992811079566299beb5d204fad2c696fec44b1d | gitee |
dingzhilin1990/zhilinclaw | src/events/EventBus.ets | arkts | unsubscribe | 取消订阅
@param event 事件名称
@param subscriptionId 订阅 ID | public unsubscribe(event: string, subscriptionId: string): void {
const subs = this.subscribers.get(event);
if (!subs) return;
const index = subs.findIndex(s => s.id === subscriptionId);
if (index !== -1) {
subs.splice(index, 1);
}
// 清理空数组
if (subs.length === 0) {
this.subsc... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unsubscribe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | public unsubscribe(event: string, subscriptionId: string): void {
const subs = this.subscribers.get(event);
if (!subs) return;
const index = subs.findIndex(s => s.id === subscriptionId);
if (index !== -1) {
subs.splice(index, 1);
}
// 清理空数组
if (subs.length === 0) {
this.subsc... | https://github.com/dingzhilin1990/zhilinclaw | 375001940d4b526ff23a87476efd24738e2e484d | github |
YANGZX22/Voot | entry/src/main/ets/storage/OnboardingStorage.ets | arkts | acceptAllPolicies | 标记用户已接受所有最新政策(用于首次引导完成时)
@param ctx UI Ability Context | static async acceptAllPolicies(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_PRIVACY_VERSION, POLICY_VERSIONS.PRIVACY);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_TERMS_VERSION, POLICY_VERSIONS.TERMS);... | 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 acceptAllPolicies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : ... | static async acceptAllPolicies(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_PRIVACY_VERSION, POLICY_VERSIONS.PRIVACY);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_TERMS_VERSION, POLICY_VERSIONS.TERMS);... | https://github.com/YANGZX22/Voot | 3e1a3869d9453513af6868681cf70a6b07880621 | github |
openharmony-sig/flutter_packages | packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets | arkts | stopSession | 停止Session | async stopSession() {
if (this.photoSession != null) {
await this.photoSession.stop();
this.photoSession = null;
}
if (this.videoSession != null) {
await this.videoSession.stop();
this.videoSession = null;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left stopSession AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Ri... | async stopSession() {
if (this.photoSession != null) {
await this.photoSession.stop();
this.photoSession = null;
}
if (this.videoSession != null) {
await this.videoSession.stop();
this.videoSession = null;
}
} | https://gitee.com/openharmony-sig/flutter_packages.git | 6e254e6b29653eb1bb51b48151046ba3c1559c05 | gitee |
chenchl/GMLogger-HarmonyOS | gmlogger/src/main/ets/components/security/logger/LoggerCryptoUtil.ets | arkts | genSymKeyByData | 根据给定的数据生成SM4对称密钥。
该函数将输入的字节数组转换为SM4对称密钥。
@param {Uint8Array} symKeyData - 用于生成对称密钥的字节数组。
@returns {cryptoFramework.SymKey} 返回生成的SM4对称密钥。 | static genSymKeyByData(symKeyData: Uint8Array) {
// 将输入的字节数组封装为DataBlob对象。
const symKeyBlob: cryptoFramework.DataBlob = { data: symKeyData };
// 创建SM4对称密钥生成器实例。
const sm4Generator = cryptoFramework.createSymKeyGenerator('SM4_128');
// 将DataBlob对象转换为对称密钥。
const symKey = sm4Generator.convertKeyS... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left genSymKeyByData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left symKeyData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static genSymKeyByData(symKeyData: Uint8Array) {
// 将输入的字节数组封装为DataBlob对象。
const symKeyBlob: cryptoFramework.DataBlob = { data: symKeyData };
// 创建SM4对称密钥生成器实例。
const sm4Generator = cryptoFramework.createSymKeyGenerator('SM4_128');
// 将DataBlob对象转换为对称密钥。
const symKey = sm4Generator.convertKeyS... | https://github.com/chenchl/GMLogger-HarmonyOS | b247c4f4cde6ad004ee81774e360eee9f69d4321 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | fill | Fills the Uint32Array with specified value
@param { number } value - new valuy
@param { int } [start] - start index to begin fill from
@param { int } [end] - last index to end fill from, excluded
@returns { Uint32Array } - modified Uint32Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public fill(value: number, start?: int, end?: int): Uint32Array {
this.fill(Uint32Array.doubleToInt(value), start, end)
return this
} | 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#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public fill(value: number, start?: int, end?: int): Uint32Array {
this.fill(Uint32Array.doubleToInt(value), start, end)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 85ae0ad751b17e29c336123c12337008ab8c283b | gitcode |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/TotpEngine.ets | arkts | _hmac | ==================== HMAC (通用, 调度 sha1/sha256/sha512) ==================== | function _hmac(
hashFn: (d: Uint8Array) => Uint8Array,
blockSize: number, outLen: number,
key: Uint8Array, message: Uint8Array
): Uint8Array {
let keyBytes: Uint8Array = key;
if (keyBytes.length > blockSize) { keyBytes = hashFn(keyBytes); }
const paddedKey: Uint8Array = new Uint8Array(blockSize);
for (let... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left _hmac AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left hashFn AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS... | function _hmac(
hashFn: (d: Uint8Array) => Uint8Array,
blockSize: number, outLen: number,
key: Uint8Array, message: Uint8Array
): Uint8Array {
let keyBytes: Uint8Array = key;
if (keyBytes.length > blockSize) { keyBytes = hashFn(keyBytes); }
const paddedKey: Uint8Array = new Uint8Array(blockSize);
for (let... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 07e21bd21e056fcf68293ff0cf0ed78166ca2286 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toString | Converts this object to a string
@param { int } radix the radix base for string representation
@returns { string }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toString(radix: int): string {
return (new Long(this.value)).toString(radix);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left radix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig... | public toString(radix: int): string {
return (new Long(this.value)).toString(radix);
} | https://gitcode.com/iop123123/arkts-static-skills | 4264974dd6b4552ce8df33203d96fb273b4a7d98 | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineBridge.ets | arkts | registerImageLoader | MARK: - Image Loader
Registers a global image loader
Wraps IImageLoader in the format expected by the C++ bridge layer. | registerImageLoader(loader: IImageLoader): void {
g_imageLoader = loader;
const wrappedLoader: WrappedImageLoader = {
loadImage: (url: string, options: Record<string, Object> | null, requestId: string): string => {
if (g_imageLoader === null) {
return '';
}
g_imageLoad... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerImageLoader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loader AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IImageLoader AST#identifier#Right ... | registerImageLoader(loader: IImageLoader): void {
g_imageLoader = loader;
const wrappedLoader: WrappedImageLoader = {
loadImage: (url: string, options: Record<string, Object> | null, requestId: string): string => {
if (g_imageLoader === null) {
return '';
}
g_imageLoad... | https://github.com/AGenUI/AGenUI | 33417dd9d1c51cc932334e291a3862195268decb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | $_iterator | Returns the default iterator of the Set, which is the values() iterator.
@returns {IterableIterator<K> } - The default iterator of the Set.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | override $_iterator(): IterableIterator<K> {
return new SetIteratorImpl<K>(this.values())
} | AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#Right AST#call_expression#Left AST#identifier#Left $_iterator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expre... | override $_iterator(): IterableIterator<K> {
return new SetIteratorImpl<K>(this.values())
} | https://gitcode.com/iop123123/arkts-static-skills | dbfaa321fc55da6c7d67e3de004765d89cd31f54 | gitcode |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/BattleAnswerRecorder.ets | arkts | recordMonsterDefeat | Moved from BattlePage.recordMonsterDefeat. | recordMonsterDefeat(catalogIndex: number): void {
if (catalogIndex <= 0) {
return;
}
this.monsterProgress.recordDefeat(catalogIndex);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left recordMonsterDefeat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left catalogIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Le... | recordMonsterDefeat(catalogIndex: number): void {
if (catalogIndex <= 0) {
return;
}
this.monsterProgress.recordDefeat(catalogIndex);
} | https://github.com/terryma2024/happyword | dfbffa7fdced1de2e275545c34a4edde991ededf | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | concat | concat
@param { String[] } strings
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public concat(...strings: String[]): String {
let length = strings.length
if (length == 0) {
return this
}
let res = new StringBuilder(this);
for (let i = 0; i < length; i++) {
res = res.append(strings[i])
}
return res.toString();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left concat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left strings AST#identifier#Right AST#:#Left :... | public concat(...strings: String[]): String {
let length = strings.length
if (length == 0) {
return this
}
let res = new StringBuilder(this);
for (let i = 0; i < length; i++) {
res = res.append(strings[i])
}
return res.toString();
} | https://gitcode.com/iop123123/arkts-static-skills | 66058f0523745476fa7495c5cb17b2b8dc73eb8e | gitcode |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/utils/CommonUtils.ets | arkts | getCurrentFormattedTime | Gets the current time formatted as "yyyy-MM-dd HH:mm:ss" | public static getCurrentFormattedTime(): string {
const date = new Date();
const year = date.getFullYear().toString();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const hours = date.getHours().toString().padStart(2, '0');... | 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 getCurrentFormattedTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | public static getCurrentFormattedTime(): string {
const date = new Date();
const year = date.getFullYear().toString();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const hours = date.getHours().toString().padStart(2, '0');... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | f46de45ebde42a226e569c754d2c50a4239d44a1 | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/DormWaterService.ets | arkts | startWater | ===== 开始接水 ===== | async startWater(deviceId: string): Promise<void> {
const url: string = API_BASE + '/api/v1/dev/start?args=&cnt=1&did=' + deviceId + '&pip=21&rcp=0&upgrade=1';
const resp: string = await httpGet(url, authHeaders());
const obj: Record<string, Object> = JSON.parse(resp) as Record<string, Object>;
if (Nu... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startWater AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async startWater(deviceId: string): Promise<void> {
const url: string = API_BASE + '/api/v1/dev/start?args=&cnt=1&did=' + deviceId + '&pip=21&rcp=0&upgrade=1';
const resp: string = await httpGet(url, authHeaders());
const obj: Record<string, Object> = JSON.parse(resp) as Record<string, Object>;
if (Nu... | https://github.com/PollenWang6/HiXD | 74cc58ffba54111fa39036c2112d3560a158b6e7 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | with | 指定需要加载的关联关系
@param relationName 关联属性名
@returns 当前实例(支持链式调用)
@throws RelationNotFoundError 如果关联关系未注册 | with(relationName: string): QueryBuilder {
this.relationStrategySupport.registerWith(relationName)
return this
} | AST#program#Left AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#identifier#Left relationName AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#string#Left string AST#string#Right AST#predefined_ty... | with(relationName: string): QueryBuilder {
this.relationStrategySupport.registerWith(relationName)
return this
} | https://github.com/offlinecat-dev/OCNetORM | b4f75dd0c6934e584068dc08226d034eda9fdb9e | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/JArrayList.ets | arkts | getElement | 返回当前位置的元素 | getElement() {
return this.dataSource[this.pos];
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | getElement() {
return this.dataSource[this.pos];
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 19cce3de1cb39005d47d9bcf55a82588e3ce97a3 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/otp/OtpCompatibilityManager.ets | arkts | resetInstance | 重置单例(仅用于测试) | public static resetInstance(): void {
OtpCompatibilityManager.instance = null;
} | 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 resetInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public static resetInstance(): void {
OtpCompatibilityManager.instance = null;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/OtpCompatibilityManager.ets#L104-L106 | 58800e53e263c6e056255cc0cbd34d264f90cbac | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | analyzeDownloadManga | 分析Download漫画文件
路径: /Download/com.dlzz.manxia/manga/ | private async analyzeDownloadManga(): Promise<StorageItem> {
try {
const dirInfo = await this.getDownloadSubdirInfo('manga');
const basePath = DownloadDirManager.isReady() ? `${DownloadDirManager.getPath()}/manga` : '';
return {
type: StorageType.DOWNLOAD_MANGA,
name: '下载的... | 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 analyzeDownloadManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | private async analyzeDownloadManga(): Promise<StorageItem> {
try {
const dirInfo = await this.getDownloadSubdirInfo('manga');
const basePath = DownloadDirManager.isReady() ? `${DownloadDirManager.getPath()}/manga` : '';
return {
type: StorageType.DOWNLOAD_MANGA,
name: '下载的... | https://github.com/DaLongZhuaZi/manxia | ce71912c0b7d15f8b3115b4f8da1e761de0e6b90 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test32_original_index.ets | arkts | httpStatusText | === Round 32: Switch with return, nested Map iteration,
String.repeat/trimEnd/trimStart, Array.sort/reverse,
Number.isFinite/isNaN, Object.keys traversal,
chained string transforms, class with computed state ===
--- Switch with return (no fall-through) --- | function httpStatusText(code: number): string {
if (code === 200) {
return 'OK';
}
if (code === 301) {
return 'Moved';
}
if (code === 404) {
return 'Not Found';
}
if (code === 500) {
return 'Server Error';
}
return 'Unknown';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left httpStatusText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function httpStatusText(code: number): string {
if (code === 200) {
return 'OK';
}
if (code === 301) {
return 'Moved';
}
if (code === 404) {
return 'Not Found';
}
if (code === 500) {
return 'Server Error';
}
return 'Unknown';
} | https://github.com/miaochiahao/ark-ghidra | 5d03c4419860edcb6b570f01e172a0fdf160466f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AirConditionerController.ets | arkts | unsubscribeStatusChange | 取消订阅设备状态变化 | public unsubscribeStatusChange(subscriptionId: string): boolean {
const parts = subscriptionId.split('_');
if (parts.length < 2) return false;
const deviceId = parts[1];
const callbacks = this.subscribers.get(deviceId);
if (callbacks && callbacks.length > 0) {
callbacks.pop();
consol... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unsubscribeStatusChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left subscriptionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st... | public unsubscribeStatusChange(subscriptionId: string): boolean {
const parts = subscriptionId.split('_');
if (parts.length < 2) return false;
const deviceId = parts[1];
const callbacks = this.subscribers.get(deviceId);
if (callbacks && callbacks.length > 0) {
callbacks.pop();
consol... | https://github.com/LJ666-ui/harmony-health-care | d89da8b9701f010bb5545584752d8fd66ee8de0e | github |
anhao0226/harmony-music-player | entry/src/main/ets/common/utils/AudioService.ets | arkts | play | prepared/paused/complete | public async play() {
if (this._avPlayer) {
if (this._avPlayerState === AvPlayerState.IDLE) {
this.start(this._shareData.playIndex);
} else {
this._avPlayer.play().then(() => {
this._shareData.isPlaying = true;
});
}
}
} | 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 play AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right... | public async play() {
if (this._avPlayer) {
if (this._avPlayerState === AvPlayerState.IDLE) {
this.start(this._shareData.playIndex);
} else {
this._avPlayer.play().then(() => {
this._shareData.isPlaying = true;
});
}
}
} | https://github.com/anhao0226/harmony-music-player | 20b8100f74590da8390ae89790e608e349299905 | github |
tdcare/tdwebrtc | src/main/ets/CameraCapture.ets | arkts | start | ============================================================
启停控制
============================================================
开始采集
会话在 initialize() 中已启动,此方法只需设置运行状态,
使 ImageReceiver 回调开始处理帧数据。 | public async start(): Promise<boolean> {
if (this.session === null) {
LogUtil.error('[CameraCapture] 未初始化,无法启动');
return false;
}
this.isRunning = true;
this.frameCount = 0;
LogUtil.info('[CameraCapture] 采集已启动');
return true;
} | 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 start AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A... | public async start(): Promise<boolean> {
if (this.session === null) {
LogUtil.error('[CameraCapture] 未初始化,无法启动');
return false;
}
this.isRunning = true;
this.frameCount = 0;
LogUtil.info('[CameraCapture] 采集已启动');
return true;
} | https://github.com/tdcare/tdwebrtc | b784a47a99b7330c793b53a63197fe7ec2490c3c | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/OrderRepository.ets | arkts | constructor | 构造函数
@param networkDataSource 可选的数据源实例,便于测试注入 | constructor(networkDataSource?: OrderNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new OrderNetworkDataSourceImpl();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left networkDataSource AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | constructor(networkDataSource?: OrderNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new OrderNetworkDataSourceImpl();
} | https://github.com/Joker-x-dev/CoolMallArkTS | b2d87ce2e369d718937da562001a2dbde7614bc7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceManager.ets | arkts | getPinnedSources | 获取置顶的图源 | async getPinnedSources(): Promise<SourceInfo[]> {
const sources = await this.getAllSources();
return sources.filter(s => s.isPinned);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPinnedSources 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#gen... | async getPinnedSources(): Promise<SourceInfo[]> {
const sources = await this.getAllSources();
return sources.filter(s => s.isPinned);
} | https://github.com/DaLongZhuaZi/manxia | 91393905c681827e804dc606c7e9b14980bfb07b | github |
2763981847/Clock-Alarm | entry/src/main/ets/pages/DetailPage.ets | arkts | aboutToAppear | 生命周期函数,在页面即将显示时触发 | aboutToAppear() {
// 获取路由参数,判断是否为编辑已有闹钟
let params = router.getParams() as Record<string, Object | undefined>;
if (params !== undefined) {
let alarmItem: AlarmItem = params.alarmItem as AlarmItem;
if (alarmItem !== undefined) {
this.isNew = false;
this.alarmItem = alarmItem;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 获取路由参数,判断是否为编辑已有闹钟
let params = router.getParams() as Record<string, Object | undefined>;
if (params !== undefined) {
let alarmItem: AlarmItem = params.alarmItem as AlarmItem;
if (alarmItem !== undefined) {
this.isNew = false;
this.alarmItem = alarmItem;
... | https://github.com/2763981847/Clock-Alarm | ba074006c44c160b55196191d231df8624415f1c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | loadSettings | 加载字体设置 | private async loadSettings(): Promise<void> {
if (!this.preferences) return;
try {
const settingsJson = await this.preferences.get('settings', '') as string;
logger.info(TAG, `加载字体设置JSON: ${settingsJson ? settingsJson.substring(0, 200) : '空'}`);
if (settingsJson) {
const saved = Saf... | 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 loadSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | private async loadSettings(): Promise<void> {
if (!this.preferences) return;
try {
const settingsJson = await this.preferences.get('settings', '') as string;
logger.info(TAG, `加载字体设置JSON: ${settingsJson ? settingsJson.substring(0, 200) : '空'}`);
if (settingsJson) {
const saved = Saf... | https://github.com/DaLongZhuaZi/manxia | 005e78cecafbbd6f4e1701182c99ba00af1c22b3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getCoverCachePath | 获取封面缓存文件路径
@param mangaId 漫画ID
@param coverUrl 封面URL(用于生成唯一文件名) | public getCoverCachePath(mangaId: string, coverUrl: string): string {
const cacheDir = this.getCoverCacheDir();
const ext = this.getExtensionFromUrl(coverUrl);
const hash = this.hashString(coverUrl);
return `${cacheDir}/${mangaId}_${hash}.${ext}`;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCoverCachePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | public getCoverCachePath(mangaId: string, coverUrl: string): string {
const cacheDir = this.getCoverCacheDir();
const ext = this.getExtensionFromUrl(coverUrl);
const hash = this.hashString(coverUrl);
return `${cacheDir}/${mangaId}_${hash}.${ext}`;
} | https://github.com/DaLongZhuaZi/manxia | 8699029a9b1676b18fe43bba995d27f64465e9cc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts bigint to JSON format
@param d: bigint - bigint to be converted to a JSON as a Number
@returns String - JSON representation of bigint | public static stringify(d: bigint): String {
return d.toString()
} | 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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: bigint): String {
return d.toString()
} | https://gitcode.com/iop123123/arkts-static-skills | a7139bb914227d59b227e11a388eaad1a86f7500 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Image/AvifDecoder.ets | arkts | decode | 解码AVIF图片为PixelMap(异步,不阻塞主线程)
@param data AVIF图片数据
@returns PixelMap或null | async decode(data: ArrayBuffer | Uint8Array): Promise<image.PixelMap | null> {
const decoder = loadNativeDecoder();
if (!decoder) {
logger.error(TAG, 'Native AVIF解码器不可用');
return null;
}
if (!decoder.isLibavifAvailable()) {
logger.error(TAG, 'libavif不可用 - 无法解码AVIF');
retur... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left decode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | async decode(data: ArrayBuffer | Uint8Array): Promise<image.PixelMap | null> {
const decoder = loadNativeDecoder();
if (!decoder) {
logger.error(TAG, 'Native AVIF解码器不可用');
return null;
}
if (!decoder.isLibavifAvailable()) {
logger.error(TAG, 'libavif不可用 - 无法解码AVIF');
retur... | https://github.com/DaLongZhuaZi/manxia | 5f8f189045a06e043260c08db753327c57c7126b | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | videoSnapshot | 视频截图(单帧)
@param input 输入视频路径
@param output 输出图片路径
@param time 截图时间点,格式 "00:00:05" | public static videoSnapshot(input: string, output: string, time: string = '00:00:01'): string[] {
return [
'ffmpeg',
'-ss', time,
'-i', input,
'-vframes', '1',
'-q:v', '2',
'-y', output
];
} | 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 videoSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : A... | public static videoSnapshot(input: string, output: string, time: string = '00:00:01'): string[] {
return [
'ffmpeg',
'-ss', time,
'-i', input,
'-vframes', '1',
'-q:v', '2',
'-y', output
];
} | https://github.com/jjjjjjava/ffmpeg_tools | 646f2ddf434954aa4472babde0e2088432be2088 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | applyUsageRange | ==================== 使用统计聚合查询 ==================== | private applyUsageRange(
predicates: relationalStore.RdbPredicates,
field: string,
rangeStartMs: number
): void {
if (rangeStartMs > 0) {
predicates.greaterThanOrEqualTo(field, rangeStartMs)
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyUsageRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_... | private applyUsageRange(
predicates: relationalStore.RdbPredicates,
field: string,
rangeStartMs: number
): void {
if (rangeStartMs > 0) {
predicates.greaterThanOrEqualTo(field, rangeStartMs)
}
} | https://github.com/LongLiveY96/chatcube | a1d3d02ec63451cf9a526be532dec9a7d86a080a | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/ReminderManager.ets | arkts | getInstance | 获取ReminderManager单例 | static getInstance(): ReminderManager {
if (!ReminderManager.instance) {
ReminderManager.instance = new ReminderManager();
}
return ReminderManager.instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#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#:#Left : AST#:#Right AST#identifier#Left ReminderMa... | static getInstance(): ReminderManager {
if (!ReminderManager.instance) {
ReminderManager.instance = new ReminderManager();
}
return ReminderManager.instance;
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 60f3265c0b3f36c91da17cf348073a1447e51e56 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets | arkts | setAxisMinLabels | The minumum number of labels on the axis | public setAxisMinLabels(labels: number): void {
if (labels > 0) {
this.mAxisMinLabels = labels;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAxisMinLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left labels AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setAxisMinLabels(labels: number): void {
if (labels > 0) {
this.mAxisMinLabels = labels;
}
} | https://gitee.com/openharmony/developtools_profiler.git | e1df5ef945afc20081254c122c0d43c824ea9b5d | gitee |
openharmony/codelabs | ETSUI/ContactManager/entry/src/main/ets/pages/ContactListPage.ets | arkts | aboutToUpdate | 监听刷新标志变化 | aboutToUpdate(): void {
if (this.refreshFlag !== this.lastRefreshFlag) {
console.info('[ContactListPage] 检测到刷新标志变化,重新加载数据')
this.lastRefreshFlag = this.refreshFlag
this.loadData()
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToUpdate 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... | aboutToUpdate(): void {
if (this.refreshFlag !== this.lastRefreshFlag) {
console.info('[ContactListPage] 检测到刷新标志变化,重新加载数据')
this.lastRefreshFlag = this.refreshFlag
this.loadData()
}
} | https://gitcode.com/openharmony/codelabs | ded0814b4d5733d9201946bc97b1a9eb52a8832b | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/MultiShopping/features/orderdetail/src/main/ets/components/ConfirmOrder.ets | arkts | confirmOrder | Confirm order to request server. | confirmOrder(status: number) {
this.orderList.map((item: Order) => {
let orderStatus: InsertOrderProps = {
order: item,
status: status
};
let orderId: string | undefined = this.localDataManager.insertOrder(orderStatus);
if (orderId !== undefined) {
this.localDataMan... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left confirmOrder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ... | confirmOrder(status: number) {
this.orderList.map((item: Order) => {
let orderStatus: InsertOrderProps = {
order: item,
status: status
};
let orderId: string | undefined = this.localDataManager.insertOrder(orderStatus);
if (orderId !== undefined) {
this.localDataMan... | https://gitee.com/harmonyos/codelabs.git | 2ae19a7d5f151efb6c6f0dba38e166ac4344dcf3 | gitee |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/FootprintViewModel.ets | arkts | hideClearDialogModal | 隐藏清空弹窗
@returns {void} 无返回值 | hideClearDialogModal(): void {
this.showClearDialog = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hideClearDialogModal 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... | hideClearDialogModal(): void {
this.showClearDialog = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 66bfc068cfcf14f5b4116050a698d3bf10235485 | github |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/view/MiniBarPlayerAside.ets | arkts | build | Builds title, subtitle, play/pause, skip, optional previous, and queue actions. | build() {
Row() {
Column() {
Text(this.playerViewModel.songTitle())
.fontColor($r('app.color.mini_bar_primary'))
.fontSize(12)
.fontWeight(600)
.lineHeight(16)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width... | 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() {
Column() {
Text(this.playerViewModel.songTitle())
.fontColor($r('app.color.mini_bar_primary'))
.fontSize(12)
.fontWeight(600)
.lineHeight(16)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 86eb68b38e56e7a9813b882ea7dea14034985da5 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/pages/Password.ets | arkts | changeDatabase | 更改数据库 | changeDatabase() {
// 返回到文件选择页面
DataService.selectKdbx(this.router);
CommonUtils.pushUrl({ url: 'pages/open/SelectLocation' })
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | changeDatabase() {
// 返回到文件选择页面
DataService.selectKdbx(this.router);
CommonUtils.pushUrl({ url: 'pages/open/SelectLocation' })
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/pages/Password.ets#L342-L346 | 9f65d07326dfb36a2349c58ef14eb02d63f2a429 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | delete_song | 歌曲删除 // | delete_song(index: number) {
// 防溢出检测 //
try {this.play_list[index]} catch {return}
// 移除歌曲 //
this.play_list.splice(index, 1)
// 指针修正 //
if (index < this.play_list_index) {
// 删除了当前指针之前的歌曲,指针前移 //
this.play_list_index--
} else if (index === this.play_list_index) {
// ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left delete_song AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ... | delete_song(index: number) {
// 防溢出检测 //
try {this.play_list[index]} catch {return}
// 移除歌曲 //
this.play_list.splice(index, 1)
// 指针修正 //
if (index < this.play_list_index) {
// 删除了当前指针之前的歌曲,指针前移 //
this.play_list_index--
} else if (index === this.play_list_index) {
// ... | https://github.com/Nekofox-POT/LinMusic | 8e66c28bcb28ce1b46065a92b550035b6924b23d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | checkEscDoubleTap | ==================== 菜单键双击检测 ====================
菜单键双击检测(2in1 设备通过物理键盘可配置按键打开串流菜单)
参照 Android 版 Game.java 的 ESC 双击菜单逻辑:
- 第一次按键:正常透传给主机 + 显示 Toast 提示
- 第二次按键(500ms 内):消费事件,释放所有键,打开串流菜单
@param isDown true=按下, false=抬起
@returns true 表示事件应被消费(不发送给主机),false 表示正常透传 | private checkEscDoubleTap(isDown: boolean): boolean {
if (isDown) {
if (this.hasShownEscHint && Date.now() - this.lastEscUpTime <= StreamInputHandler.ESC_DOUBLE_TAP_INTERVAL) {
return true;
}
return false;
}
const now = Date.now();
if (this.hasShownEscHint && now - this.last... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkEscDoubleTap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isDown AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private checkEscDoubleTap(isDown: boolean): boolean {
if (isDown) {
if (this.hasShownEscHint && Date.now() - this.lastEscUpTime <= StreamInputHandler.ESC_DOUBLE_TAP_INTERVAL) {
return true;
}
return false;
}
const now = Date.now();
if (this.hasShownEscHint && now - this.last... | https://github.com/AlkaidLab/moonlight-harmony | 35de48da88f9712c9417d991d9a40a0f32045840 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/util/ComponentRectFUtil.ets | arkts | pointInRectF | 获取指定点是否在指定区域内
@param pointX 指定点的x坐标
@param pointY 指定点的y坐标
@param rect 指定区域
@returns 指定点是否在指定区域内 | public static pointInRectF(pointX: number, pointY: number, rect: RectF): boolean {
if (pointX == null || pointX == undefined || pointY == null || pointY == undefined || !rect) {
return false;
}
if (!rect.left) {
rect.left = 0;
}
if (!rect.right) {
rect.right = 0;
}
if (!r... | 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 pointInRectF AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pointX AST#identifier#Right AST#:#Left : A... | public static pointInRectF(pointX: number, pointY: number, rect: RectF): boolean {
if (pointX == null || pointX == undefined || pointY == null || pointY == undefined || !rect) {
return false;
}
if (!rect.left) {
rect.left = 0;
}
if (!rect.right) {
rect.right = 0;
}
if (!r... | https://github.com/wuba/omni-ui | 29d622b2d25f2402ddca31ef5813deb6ab9a5251 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets | arkts | calculateRemindTime | 计算提醒时间 | private calculateRemindTime(eventStartTime: number, reminderMinutes: number): number | null {
if (reminderMinutes < 0) {
return null;
}
if (reminderMinutes === 0) {
return eventStartTime;
}
const remindTime = eventStartTime - (reminderMinutes * 60 * 1000);
return remindTime < Date... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateRemindTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventStartTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left num... | private calculateRemindTime(eventStartTime: number, reminderMinutes: number): number | null {
if (reminderMinutes < 0) {
return null;
}
if (reminderMinutes === 0) {
return eventStartTime;
}
const remindTime = eventStartTime - (reminderMinutes * 60 * 1000);
return remindTime < Date... | https://gitcode.com/openharmony/codelabs | 6aed3700f6840b53a87cb5d6a8f9eff1c0ea14b7 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/DataSet.ets | arkts | setEntries | Sets the array of entries that this DataSet represents, and calls notifyDataSetChanged()
@return | public setEntries(entries: JArrayList<T>): void {
this.mEntries = entries;
this.notifyDataSetChanged();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setEntries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr... | public setEntries(entries: JArrayList<T>): void {
this.mEntries = entries;
this.notifyDataSetChanged();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a8ea73da4737ce3ff2226c27915b16badc7af0ce | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/InteractionManager.ets | arkts | vibrate | 触发震动
@param scene 震动场景 | public vibrate(scene: VibrationScene): void {
// 检查全局开关
if (!this.settings.vibrationEnabled) {
return;
}
// 检查场景开关
if (this.settings.sceneSettings[scene] === false) {
return;
}
try {
const duration = this.getVibrationDuration(scene);
vibrator.startVibration({
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left vibrate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scene AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Vibrati... | public vibrate(scene: VibrationScene): void {
// 检查全局开关
if (!this.settings.vibrationEnabled) {
return;
}
// 检查场景开关
if (this.settings.sceneSettings[scene] === false) {
return;
}
try {
const duration = this.getVibrationDuration(scene);
vibrator.startVibration({
... | https://github.com/DaLongZhuaZi/manxia | bf1781df0b96dcd15d9d50933c65b592efbd7b81 | github |
openharmony-sig/knowledge_demo_entainment | FA/GuoChat/entry/src/main/ets/MainAbility/common/bottomTabs.ets | arkts | getTabItems | 用于初始化TabItem的数组 | function getTabItems(): Array<TabItem> {
let itemsArray: Array<TabItem> = []
itemsArray.push(new TabItem($r('app.media.chat2') , $r('app.media.chat') ,$r('app.string.bottom_tab_chat') ))
itemsArray.push(new TabItem($r('app.media.md_contacts1') , $r('app.media.md_contacts') ,$r('app.string.bottom_tab_contact') ))
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getTabItems 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#generic_type#Le... | function getTabItems(): Array<TabItem> {
let itemsArray: Array<TabItem> = []
itemsArray.push(new TabItem($r('app.media.chat2') , $r('app.media.chat') ,$r('app.string.bottom_tab_chat') ))
itemsArray.push(new TabItem($r('app.media.md_contacts1') , $r('app.media.md_contacts') ,$r('app.string.bottom_tab_contact') ))
... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 8751c6121ab3fbbf3e7fe3b34a364a02617e4143 | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/network/WebSocketDemo.ets | arkts | launchWebSocketClient | 启动 websocket 客户端 | launchWebSocketClient() {
let defaultIpAddress = "ws://127.0.0.1:8888/service";
let ws = webSocket.createWebSocket();
ws.on('open', (err:BusinessError, value: Object) => {
ws.send("arkts 的 websocket 客户端发送数据到 arkts 的 websocket 服务端", (err: BusinessError, value: boolean) => {
});
});
ws.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left launchWebSocketClient 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_bl... | launchWebSocketClient() {
let defaultIpAddress = "ws://127.0.0.1:8888/service";
let ws = webSocket.createWebSocket();
ws.on('open', (err:BusinessError, value: Object) => {
ws.send("arkts 的 websocket 客户端发送数据到 arkts 的 websocket 服务端", (err: BusinessError, value: boolean) => {
});
});
ws.... | https://github.com/webabcd/HarmonyDemo | a1780a468d9ee4a86a9391d3c7c8d7642447ed32 | github |
openharmony/applications_mms | entry/src/main/ets/utils/MmsDatabaseHelper.ets | arkts | deleteItem | Deleting an Interface
@param predicates
@return | async deleteItem(predicates) {
if (this.mRdbStore !== null) {
let deletedRows = await this.mRdbStore.delete(predicates);
HiLog.i(TAG, 'deleteItem, deletedRows=' + deletedRows);
} else {
HiLog.w(TAG, 'mRdbStore is null, delete item fail.');
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteItem AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left predicates AST#identifier#Right AST#)#Left ) AST#)#Rig... | async deleteItem(predicates) {
if (this.mRdbStore !== null) {
let deletedRows = await this.mRdbStore.delete(predicates);
HiLog.i(TAG, 'deleteItem, deletedRows=' + deletedRows);
} else {
HiLog.w(TAG, 'mRdbStore is null, delete item fail.');
}
} | https://gitee.com/openharmony/applications_mms.git | 7376bdc7366c7fbf10bb029e9b75513d2414b179 | gitee |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridViewManager.ets | arkts | destroyArkTsView | Destroys an ArkTS view.
@param nodeId Node ID | public destroyArkTsView(nodeId: string) {
let view: HybridBaseView | undefined = this.hybridViews.get(nodeId);
if (view) {
view.toDestroyArkTsView();
this.hybridViews.delete(nodeId);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroyArkTsView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public destroyArkTsView(nodeId: string) {
let view: HybridBaseView | undefined = this.hybridViews.get(nodeId);
if (view) {
view.toDestroyArkTsView();
this.hybridViews.delete(nodeId);
}
} | https://github.com/AGenUI/AGenUI | 28ba597454e7f3e37d8c9b96eeafc53e8c3b9170 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/MessageManager.ets | arkts | init | Initialize preferences. | static async init(context: Context): Promise<void> {
try {
MessageManager.dataPreferences = await preferences.getPreferences(context, MessageManager.PREFERENCE_NAME);
Logger.info('MessageManager', 'Preferences initialized successfully');
} catch (err) {
Logger.error('MessageManager', `Failed... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig... | static async init(context: Context): Promise<void> {
try {
MessageManager.dataPreferences = await preferences.getPreferences(context, MessageManager.PREFERENCE_NAME);
Logger.info('MessageManager', 'Preferences initialized successfully');
} catch (err) {
Logger.error('MessageManager', `Failed... | https://github.com/Harrisonls2004/WaterFlow | 19922c7efa778fc7975e648803282d5222955f15 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | setAxisLineColor | Sets the color of the border surrounding the chart.
@param color | public setAxisLineColor(color: number): void {
this.mAxisLineColor = color;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAxisLineColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public setAxisLineColor(color: number): void {
this.mAxisLineColor = color;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 2769b67949f13df8ad784300d434c64d277275a4 | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Reader.ets | arkts | uint64 | Read unsigned varint64 as bigint | uint64(): bigint {
let x = 0n, s = 0n
while (true) { const b = BigInt(this.b[this.pos++]); x |= (b & 0x7Fn) << s; if ((b & 0x80n) === 0n) break; s += 7n }
return x
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left uint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left bigint AST#identifier#Right AST#ERROR#Right AST#stateme... | uint64(): bigint {
let x = 0n, s = 0n
while (true) { const b = BigInt(this.b[this.pos++]); x |= (b & 0x7Fn) << s; if ((b & 0x80n) === 0n) break; s += 7n }
return x
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | f770b0b58ed154fe5d0c6e7410eb7f1e9efcc006 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | log10 | Return a new Decimal whose value is the base 10 logarithm of `n`, rounded to `precision`
significant digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | static log10(n: Value): Decimal {
return new Decimal(n).log(10);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left log10 AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | static log10(n: Value): Decimal {
return new Decimal(n).log(10);
} | https://gitcode.com/iop123123/arkts-static-skills | 74b167480bb74cb23b38281e8143bf7350e04d4b | gitcode |
openharmony/codelabs | Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets | arkts | isLoginAvailable | Check whether the login button can be clicked. | isLoginAvailable() {
this.isLogin = false;
if (this.username.length > 0 && this.password.length > 0) {
this.isLogin = true;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isLoginAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | isLoginAvailable() {
this.isLogin = false;
if (this.username.length > 0 && this.password.length > 0) {
this.isLogin = true;
}
} | https://gitee.com/openharmony/codelabs.git | f96f04bd57c88ea20b9c6f68ff4f2fe0bc4d7407 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyManager.ets | arkts | executeShortcut | 执行快捷键动作(一次性组合键或多步序列) | private executeShortcut(action: ShortcutAction, session: SessionLike): void {
sendShortcutKeys((keys: number[]) => session.sendKeys(keys), action.keys, action.keySequence);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeShortcut AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private executeShortcut(action: ShortcutAction, session: SessionLike): void {
sendShortcutKeys((keys: number[]) => session.sendKeys(keys), action.keys, action.keySequence);
} | https://github.com/AlkaidLab/moonlight-harmony | 7f167c881e1b91cf4dab29734292e739408d2622 | github |
arkui-x/samples | CodeLab/Cases/feature/barchart/src/main/ets/view/CustomMarkerView.ets | arkts | getOffsetForDrawingAtPoint | 根据给定的X和Y位置计算并返回第二个偏移量对象 | getOffsetForDrawingAtPoint(posX: number, posY: number): MPPointF {
let offset: MPPointF = this.getOffset();
this.mOffset2.x = offset.x;
this.mOffset2.y = offset.y;
return this.mOffset2;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOffsetForDrawingAtPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left posX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A... | getOffsetForDrawingAtPoint(posX: number, posY: number): MPPointF {
let offset: MPPointF = this.getOffset();
this.mOffset2.x = offset.x;
this.mOffset2.y = offset.y;
return this.mOffset2;
} | https://gitcode.com/arkui-x/samples | 983451ac96f5dce2f6d18663d704e63873ff3f00 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | handleFeedbackOverlayUrl | @internal, called by the exported feedback overlay on WebView load intercept. | public handleFeedbackOverlayUrl(url: string): boolean {
this.config.logger.w('handleFeedbackOverlayUrl, feedback module is disabled, no-op');
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleFeedbackOverlayUrl 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#identifi... | public handleFeedbackOverlayUrl(url: string): boolean {
this.config.logger.w('handleFeedbackOverlayUrl, feedback module is disabled, no-op');
return false;
} | https://github.com/Countly/countly-sdk-hos | a2504d2f5bd396500a01bdde893e39610d678a11 | github |
honjow/Next2V | shared/src/main/ets/settings/CloudSyncSettings.ets | arkts | isReuploadFlushDone | One-time re-upload flush guard (see StorageKeys.CLOUD_SYNC_REUPLOAD_FLUSH_DONE). Best-effort: on a
read error we report "not done" so the flush is attempted rather than skipped. | static async isReuploadFlushDone(context: common.UIAbilityContext): Promise<boolean> {
try {
const store = await preferences.getPreferences(context, STORE_NAME)
return store.getSync(StorageKeys.CLOUD_SYNC_REUPLOAD_FLUSH_DONE, false) as boolean
} catch (error) {
const e = error as Error
... | 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 isReuploadFlushDone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L... | static async isReuploadFlushDone(context: common.UIAbilityContext): Promise<boolean> {
try {
const store = await preferences.getPreferences(context, STORE_NAME)
return store.getSync(StorageKeys.CLOUD_SYNC_REUPLOAD_FLUSH_DONE, false) as boolean
} catch (error) {
const e = error as Error
... | https://github.com/honjow/Next2V | 758f7184410fc518d1ee93b21ee7d60b63e30c7f | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test5_original_index.ets | arkts | testObjectMerge | === Object.assign pattern === | function testObjectMerge(): string {
let base: Record<string, string> = {};
base['name'] = 'test';
base['version'] = '1.0';
let override: Record<string, string> = {};
override['version'] = '2.0';
override['author'] = 'dev';
// Manual merge since Object.assign may not work
let merged: Record<string, stri... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectMerge AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_... | function testObjectMerge(): string {
let base: Record<string, string> = {};
base['name'] = 'test';
base['version'] = '1.0';
let override: Record<string, string> = {};
override['version'] = '2.0';
override['author'] = 'dev';
// Manual merge since Object.assign may not work
let merged: Record<string, stri... | https://github.com/miaochiahao/ark-ghidra | c43c410b67ac31a95221b99538eeec2838bde6e5 | github |
Tianpei-Shi/MusicDash | src/pages/LoginPage.ets | arkts | switchToRegister | 切换到注册视图 | switchToRegister(): void {
this.isRegistering = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left switchToRegister 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... | switchToRegister(): void {
this.isRegistering = true;
} | https://github.com/Tianpei-Shi/MusicDash | c0caaf701a717e691562ecf46e33de4e9ec31514 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/AppSettingsService.ets | arkts | init | 初始化 Preferences | static async init(context: common.UIAbilityContext): Promise<void> {
if (AppSettingsService.initPromise) {
return AppSettingsService.initPromise;
}
AppSettingsService.initPromise = (async () => {
try {
AppSettingsService.preferencesInstance = await preferences.getPreferences(context, ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig... | static async init(context: common.UIAbilityContext): Promise<void> {
if (AppSettingsService.initPromise) {
return AppSettingsService.initPromise;
}
AppSettingsService.initPromise = (async () => {
try {
AppSettingsService.preferencesInstance = await preferences.getPreferences(context, ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | da71820951a78eb8d64365e310bb93a869a70afd | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | isInt8Array | Check whether the entered value is of int8array array type.
@param { Object } value - A Int8Array value
@returns { boolean } Returns true if the value is a built-in Int8Array instance. | isInt8Array(value: Object): boolean {
return value instanceof Int8Array;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isInt8Array 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 Object AST#identifier#Right AST#)#Left ) AS... | isInt8Array(value: Object): boolean {
return value instanceof Int8Array;
} | https://gitcode.com/iop123123/arkts-static-skills | fbd2d88b5427d07cf24d48c6ad271093f907e281 | gitcode |
openharmony/arkui_ace_engine | examples/DrawableDescriptor/entry/src/main/ets/pages/DrawableDescriptorReleaseTest.ets | arkts | Test005 | E2E_005: LayeredDrawableDescriptor release() -> getBackground() 抛出 111002 | Test005() {
const id = 'E2E_005'
try {
let drawable = new LayeredDrawableDescriptor()
drawable.release()
try {
drawable.getBackground()
this.Fail(id, '预期抛出 111002 但未抛出')
} catch (e) {
let code = this.GetErrorCode(e as Object)
if (code === 111002) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left Test005 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#... | Test005() {
const id = 'E2E_005'
try {
let drawable = new LayeredDrawableDescriptor()
drawable.release()
try {
drawable.getBackground()
this.Fail(id, '预期抛出 111002 但未抛出')
} catch (e) {
let code = this.GetErrorCode(e as Object)
if (code === 111002) {
... | https://gitcode.com/openharmony/arkui_ace_engine | 06ac6a76d2589beac6de94b86daede2cc9b84a30 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/JSONPathParser.ets | arkts | parseNumber | 解析数字值 | static parseNumber(data: Record<string, Object>, path: string): number {
const result: JSONPathResult = JSONPathParser.parse(data, path);
if (typeof result === 'number') {
return result;
}
if (typeof result === 'string') {
const num = parseFloat(result);
return isNaN(num) ? 0 : num;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres... | static parseNumber(data: Record<string, Object>, path: string): number {
const result: JSONPathResult = JSONPathParser.parse(data, path);
if (typeof result === 'number') {
return result;
}
if (typeof result === 'string') {
const num = parseFloat(result);
return isNaN(num) ? 0 : num;
... | https://github.com/DaLongZhuaZi/manxia | 733dd08bc4700583ce8f7cd43bf72defebafd655 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/pages/DiscoverPage.ets | arkts | selectSearchHistory | 选择搜索历史 | selectSearchHistory(keyword: string) {
this.searchText = keyword;
this.showSearchHistory = false;
this.currentPage = 1;
this.hasMore = true;
this.loadArticles();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Righ... | selectSearchHistory(keyword: string) {
this.searchText = keyword;
this.showSearchHistory = false;
this.currentPage = 1;
this.hasMore = true;
this.loadArticles();
} | https://github.com/LJ666-ui/harmony-health-care | e25d6ca337ea060f7e1d502cab626597b4d02047 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test5_original_index.ets | arkts | testStringCompare | === String comparison === | function testStringCompare(a: string, b: string): number {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringCompare AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function testStringCompare(a: string, b: string): number {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
} | https://github.com/miaochiahao/ark-ghidra | 24af407b0341b943c0c3fa3243021ba0041162fd | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | sort | Sorts in-place according to the numeric ordering
@returns sorted Uint16Array | public sort(): Uint16Array {
let newF: (a: number, b: number) => number = (a: number, b: number): number => { throw new Error("not implemented") }
return this.sort(newF)
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public sort(): Uint16Array {
let newF: (a: number, b: number) => number = (a: number, b: number): number => { throw new Error("not implemented") }
return this.sort(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 14ea9fa8e0c2a7afb0c713f8767cb03225405c3d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets | arkts | innerRuleAsync | 内嵌规则替换(异步版本) | private async innerRuleAsync(str: string, startStr: string, endStr: string, fr: (expr: string) => Promise<string>): Promise<string> {
const result: string[] = [];
let pos = 0;
let startX = 0;
while (pos < str.length) {
const startIndex = str.indexOf(startStr, pos);
if (startIndex === -1) ... | 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 innerRuleAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : ... | private async innerRuleAsync(str: string, startStr: string, endStr: string, fr: (expr: string) => Promise<string>): Promise<string> {
const result: string[] = [];
let pos = 0;
let startX = 0;
while (pos < str.length) {
const startIndex = str.indexOf(startStr, pos);
if (startIndex === -1) ... | https://github.com/DaLongZhuaZi/manxia | 0e9169af6a98d2841f69c5db96c7f1ff0a29e245 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/NotificationDAO.ets | arkts | getByType | 根据类型筛选通知 | static async getByType(userId: number, type: NotificationType): Promise<Notification[]> {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT * FROM notifications
WHERE user_id = ? AND type = ?
ORDER BY created_at DESC
`;
let rs: relationalStore.ResultSet | null = null;... | 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 getByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:... | static async getByType(userId: number, type: NotificationType): Promise<Notification[]> {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT * FROM notifications
WHERE user_id = ? AND type = ?
ORDER BY created_at DESC
`;
let rs: relationalStore.ResultSet | null = null;... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ff36cefe135a82c9ba9a3e0fd809064e207bcf3d | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ModelCapabilityMatcher.ets | arkts | ensureCache | 确保缓存已加载 | private async ensureCache(): Promise<boolean> {
if (this.cache.size > 0 && (Date.now() - this.cacheTimestamp) < this.CACHE_TTL) {
return true
}
// 避免并发重复请求
if (this.fetchPromise !== null) {
return await this.fetchPromise
}
this.fetchPromise = this.fetchAndBuildCache()
const res... | 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 ensureCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | private async ensureCache(): Promise<boolean> {
if (this.cache.size > 0 && (Date.now() - this.cacheTimestamp) < this.CACHE_TTL) {
return true
}
// 避免并发重复请求
if (this.fetchPromise !== null) {
return await this.fetchPromise
}
this.fetchPromise = this.fetchAndBuildCache()
const res... | https://github.com/LongLiveY96/chatcube | d20628b3b8bd147bdb0c759aa59f3b9c2ed5022e | github |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityLifecycle/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageDestroy | [EndExclude onWindowStageDestroy]
[StartExclude onWindowStageWillDestroy] | onWindowStageDestroy(): void {
// 释放UI资源
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expre... | onWindowStageDestroy(): void {
// 释放UI资源
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 10be0d999a63f5042661f7486bbbff3742d44019 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets | arkts | buildSortKey | 获取排序 Key
@param {SortType} sortType - 排序类型
@param {SortState} sortState - 排序状态
@returns {string} 排序 Key | private buildSortKey(sortType: SortType, sortState: SortState): string {
return `${sortType}_${sortState}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildSortKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sortType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private buildSortKey(sortType: SortType, sortState: SortState): string {
return `${sortType}_${sortState}`;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 3d9cd70b0959d2eea4bda9a1a93e2cd2a4346a45 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | getTableCount | 获取表记录数量(类型安全的聚合查询) | public async getTableCount(tableName: string): Promise<number> {
try {
const sql = `SELECT COUNT(*) as count FROM ${tableName}`;
const result = await this.queryAggregation<CountQueryResult>(sql);
if (!result) {
logger.warn(TAG, `表 ${tableName} 计数查询无结果`);
return 0;
}
... | 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 getTableCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public async getTableCount(tableName: string): Promise<number> {
try {
const sql = `SELECT COUNT(*) as count FROM ${tableName}`;
const result = await this.queryAggregation<CountQueryResult>(sql);
if (!result) {
logger.warn(TAG, `表 ${tableName} 计数查询无结果`);
return 0;
}
... | https://github.com/DaLongZhuaZi/manxia | a9bca5b55a878c1c4f1d774b14ee51fe713f6f5e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceManager.ets | arkts | unpinSource | 取消置顶图源 | async unpinSource(sourceId: number): Promise<void> {
await this.dataManager.removeSourceFromPinnedList(sourceId);
logger.info(TAG, `图源已取消置顶: ${sourceId}`);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unpinSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async unpinSource(sourceId: number): Promise<void> {
await this.dataManager.removeSourceFromPinnedList(sourceId);
logger.info(TAG, `图源已取消置顶: ${sourceId}`);
} | https://github.com/DaLongZhuaZi/manxia | dbfb1daf25d2ebeef607d0ceabd5fc873c72b22e | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/TodayAdventureBuilder.ets | arkts | buildFromPack | V0.6.5.1 — pack-direct entry point. Synthesises an AdventureRegion
from `pack.scene` and uses `pack.words` as the candidate pool.
Sets `plan.regionId = pack.id` so BattlePage / ResultPage can
resolve the active pack from AppStorage on the home → battle hop.
The legacy `build(region, repo, …)` path stays in place for
re... | buildFromPack(
pack: Pack,
recorder: LearningRecorder,
nowMs: number,
isFirstToday: boolean,
selectedQuestionTypes?: string[],
): TodaySessionPlan {
const region: AdventureRegion = regionFromPack(pack);
const repo: WordRepository = new WordRepository();
repo.setEntries(pack.words);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildFromPack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Pack AST#identifier#Right AST#,#Left , AST... | buildFromPack(
pack: Pack,
recorder: LearningRecorder,
nowMs: number,
isFirstToday: boolean,
selectedQuestionTypes?: string[],
): TodaySessionPlan {
const region: AdventureRegion = regionFromPack(pack);
const repo: WordRepository = new WordRepository();
repo.setEntries(pack.words);
... | https://github.com/terryma2024/happyword | dc3054daf88ca72589028b092fbfe5b06a53329d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | formatBytes | ==================== 工具方法 ====================
格式化字节数 | private formatBytes(bytes: number): string {
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private formatBytes(bytes: number): string {
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
} | https://github.com/DaLongZhuaZi/manxia | f1e54c672ffde8f221134dd3c64fd47279904650 | github |
Eklps/harmony-mall-perf | entry/src/main/ets/pages/ListIndex.ets | arkts | onTouchEnd | 触摸结束:计算并输出估算帧率 | onTouchEnd() {
if (!this.isScrolling) {
return;
}
this.isScrolling = false;
const duration = (Date.now() - this.startTime) / 1000; // 转换为秒
if (duration > 0.1) { // 仅当滑动时间大于0.1秒时才计算,避免瞬时操作
const estimatedFps = (this.scrollCount / duration).toFixed(1);
console.info(`[帧率测试] 滑动估算帧率... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTouchEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onTouchEnd() {
if (!this.isScrolling) {
return;
}
this.isScrolling = false;
const duration = (Date.now() - this.startTime) / 1000; // 转换为秒
if (duration > 0.1) { // 仅当滑动时间大于0.1秒时才计算,避免瞬时操作
const estimatedFps = (this.scrollCount / duration).toFixed(1);
console.info(`[帧率测试] 滑动估算帧率... | https://github.com/Eklps/harmony-mall-perf | 74a060b88104d44b30a19874c857648afff3ecfc | github |
PollenWang6/HiXD | entry/src/main/ets/services/ScoreService.ets | arkts | mapCjxsToNumber | 等级文字 → 数值映射(用于 GPA 计算) | static mapCjxsToNumber(cjxs: string): string {
if (cjxs.includes('优秀') || cjxs.includes('优')) return '95';
if (cjxs.includes('良好') || cjxs.includes('良')) return '85';
if (cjxs.includes('中等') || cjxs.includes('中')) return '75';
if (cjxs.includes('及格') || cjxs.includes('通过')) return '65';
if (cjxs.i... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left mapCjxsToNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cjxs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static mapCjxsToNumber(cjxs: string): string {
if (cjxs.includes('优秀') || cjxs.includes('优')) return '95';
if (cjxs.includes('良好') || cjxs.includes('良')) return '85';
if (cjxs.includes('中等') || cjxs.includes('中')) return '75';
if (cjxs.includes('及格') || cjxs.includes('通过')) return '65';
if (cjxs.i... | https://github.com/PollenWang6/HiXD | 166371d8c40aa7398c15191df332c15a2905675c | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/SizeViewModel.ets | arkts | getFixedWidthItems | 获取固定宽度列表
@returns {FixedSizeItem[]} 固定宽度项数组 | getFixedWidthItems(): FixedSizeItem[] {
return [
new FixedSizeItem("tn_w_full", "100% 宽度", "100%"),
new FixedSizeItem("tn_w_auto", "自动宽度", "auto"),
new FixedSizeItem("tn_w_screen", "屏幕宽度", "屏幕宽度")
];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFixedWidthItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left FixedSizeItem AST#identifier... | getFixedWidthItems(): FixedSizeItem[] {
return [
new FixedSizeItem("tn_w_full", "100% 宽度", "100%"),
new FixedSizeItem("tn_w_auto", "自动宽度", "auto"),
new FixedSizeItem("tn_w_screen", "屏幕宽度", "屏幕宽度")
];
} | https://github.com/codelably/tuniao-ui | 9bd32551038652ddcaab17eadfe6bb4d967528c9 | github |
openharmony/codelabs | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | isInside | 判断两个元素是否有重叠 | isInside(v1, v2) {
var v1StartX = v1.positionX;
var v1EndX = v1.positionX + v1.imgWidth;
var v1StartY = v1.positionY;
var v1EndY = v1.positionY + v1.imgHeight;
var v2StartX = v2.positionX;
var v2EndX = v2.positionX + v2.imgWidth;
var v2StartY = v2.positionY;
var v2EndY = v2.positionY +... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isInside AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left v1 AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left v2 AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Ri... | isInside(v1, v2) {
var v1StartX = v1.positionX;
var v1EndX = v1.positionX + v1.imgWidth;
var v1StartY = v1.positionY;
var v1EndY = v1.positionY + v1.imgHeight;
var v2StartX = v2.positionX;
var v2EndX = v2.positionX + v2.imgWidth;
var v2StartY = v2.positionY;
var v2EndY = v2.positionY +... | https://gitee.com/openharmony/codelabs.git | 9df58da67436df992a469b70fb9f32a5220ffeed | gitee |
erosTeam/NextE | feature/gallery/src/main/ets/viewmodel/GalleryDetailViewModel.ets | arkts | applyRemoteFavoriteState | Apply the known result of an EH favorite write. `merge()` intentionally treats empty fields as
"unknown", so delete/move needs an explicit state replacement to clear stale filled hearts. | applyRemoteFavoriteState(favcat: string, favTitle: string, favNote: string): void {
const next: EhGallery = this.gallery.copy()
next.favcat = favcat
next.favTitle = favTitle
next.favNote = favNote
this.gallery = next
this.saveCurrentDetailCache()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyRemoteFavoriteState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left favcat AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | applyRemoteFavoriteState(favcat: string, favTitle: string, favNote: string): void {
const next: EhGallery = this.gallery.copy()
next.favcat = favcat
next.favTitle = favTitle
next.favNote = favNote
this.gallery = next
this.saveCurrentDetailCache()
} | https://github.com/erosTeam/NextE | f2afe09d8605644cf118efedc354e71d4adffa3f | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Test/PermissionsTestPage.ets | arkts | aboutToAppear | 页面加载时 | aboutToAppear() {
// 测试 manager 导入
themeManager.enableFullScreen()
permissionManager.checkPermissions([])
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 测试 manager 导入
themeManager.enableFullScreen()
permissionManager.checkPermissions([])
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 2a717fcc6774f184ff102abc63a20d2a2d89f760 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/decompressfile/src/main/ets/view/MainPage.ets | arkts | aboutToAppear | 解压后的文件列表 | aboutToAppear() {
this.initZip(this.rawfileZipName)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.initZip(this.rawfileZipName)
} | https://gitcode.com/arkui-x/samples | 7da9ade0ab7beaf95fc03384eff1ec6acb09438b | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets | arkts | hasValue | Checks if the LightWeightMap contains the specified value
@param value the value to check in the LightWeightMap
@returns true if the value is present, false otherwise | hasValue(value: V): boolean {
const index = this.buckets.entryValues.indexOf(value);
return index < 0 ? false : true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left V AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ... | hasValue(value: V): boolean {
const index = this.buckets.entryValues.indexOf(value);
return index < 0 ? false : true;
} | https://gitcode.com/iop123123/arkts-static-skills | 1799fc4d16ed4ccfd3fcd82977ecc2578551c6a7 | gitcode |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets | arkts | toObj | 获取标准格式节点内容 | public toObj(): object{
return this._formatResultObj;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left toObj AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public toObj(): object{
return this._formatResultObj;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 6de32c5a4fe4436768a87f0ca895d2732c4b772f | gitee |
HarmonyOS_Samples/BestPracticeSnippets | AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets | arkts | unregisterDataChangeListener | Log out the controller who changed the data | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.slice(pos, 1);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.slice(pos, 1);
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 01a77a1ccaa92a4a25dbfec7c2b4c3114650d1f9 | gitcode |
azhu0001/localsend-harmony | entry/src/main/ets/utils/FileProvider.ets | arkts | getReceiveFileInfo | 根据fileToken从队列中获取文件传输信息
@param fileToken token
@returns [FileReceiveQueueModel] | static getReceiveFileInfo(fileToken: string): FileReceiveQueueModel | undefined {
const queue: Map<string, FileReceiveQueueModel> | undefined =
AppStorage.get<Map<string, FileReceiveQueueModel>>(FileProvider.FILE_RECEIVE_QUEUE)
if (queue != undefined) {
return queue.get(fileToken)
}
return... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getReceiveFileInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileToken AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | static getReceiveFileInfo(fileToken: string): FileReceiveQueueModel | undefined {
const queue: Map<string, FileReceiveQueueModel> | undefined =
AppStorage.get<Map<string, FileReceiveQueueModel>>(FileProvider.FILE_RECEIVE_QUEUE)
if (queue != undefined) {
return queue.get(fileToken)
}
return... | https://gitcode.com/azhu0001/localsend-harmony | cb13fd6bd6d604ec92463c2871f3ff1dc3113b2a | gitcode |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/ThemeUtil.ets | arkts | getCurrentTheme | 获取当前主题类型 | static getCurrentTheme(): ThemeType {
return ThemeUtil.currentTheme;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentTheme 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 ThemeT... | static getCurrentTheme(): ThemeType {
return ThemeUtil.currentTheme;
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | e88fd82b165bf2f62e95bd3046162f2261441c6c | github |
openharmony/xts_tools | sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/WaterFlowDataSource.ets | arkts | totalCount | 获取数据总数 | public totalCount(): number {
return this.dataArray.length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left totalCount 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#numb... | public totalCount(): number {
return this.dataArray.length;
} | https://gitee.com/openharmony/xts_tools.git | 8a043773046c93ffb2693c8e1fcf56c9a0e08aa4 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginatedResult.ets | arkts | constructor | 构造函数
@param data 当前页数据
@param total 总记录数
@param page 当前页码
@param pageSize 每页数量 | constructor(data: Array<EntityData> = [], total: number = 0, page: number = 1, pageSize: number = 20) {
this.data = data
this.total = total
this.page = page
this.pageSize = pageSize
this.totalPages = PaginatedResult.calculateTotalPages(total, pageSize)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#non_null_expre... | constructor(data: Array<EntityData> = [], total: number = 0, page: number = 1, pageSize: number = 20) {
this.data = data
this.total = total
this.page = page
this.pageSize = pageSize
this.totalPages = PaginatedResult.calculateTotalPages(total, pageSize)
} | https://github.com/offlinecat-dev/OCNetORM | 0cd41a2db8967ad312056a04960bd3f63bed2c89 | github |
openharmony/applications_mms | entry/src/main/ets/utils/MmsPreferences.ets | arkts | getValueOfShowContactSwitch | Obtains the value of the switch for displaying contact avatars. | public getValueOfShowContactSwitch(): string {
return <string> this.getValueFromMap(common.string.KEY_OF_SHOW_CONTACT_SWITCH, common.bool.TRUE);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueOfShowContactSwitch 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#Lef... | public getValueOfShowContactSwitch(): string {
return <string> this.getValueFromMap(common.string.KEY_OF_SHOW_CONTACT_SWITCH, common.bool.TRUE);
} | https://gitee.com/openharmony/applications_mms.git | 7bfd6fc12dfef778f3738540c2cb2f1070e5423b | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/WindowUtil.ets | arkts | isLandscape | 是否为横屏模式 | static isLandscape(): boolean {
const displayInfo = display.getDefaultDisplaySync();
return displayInfo.width > displayInfo.height;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isLandscape AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | static isLandscape(): boolean {
const displayInfo = display.getDefaultDisplaySync();
return displayInfo.width > displayInfo.height;
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 7c06ed72450579c676e8b30df2639cf4c2f4108b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.scopes/interface_level1.ets | arkts | foo | overrides default interface method | public foo(): int {
return 100 + this.fld;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left foo 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 foo(): int {
return 100 + this.fld;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cf3acdb1639f3bc0445b27dd51cea70e25979879 | gitee |
LYM15/FireflyCompanion | entry/src/main/ets/utils/httpCore/http.ets | arkts | put | 封装put方法 | put<T>(url: string, data?: object): Promise<ApiResponse<T>> {
return instance.put<null, ApiResponse<T>>(url, data)
} | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left put AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#forma... | put<T>(url: string, data?: object): Promise<ApiResponse<T>> {
return instance.put<null, ApiResponse<T>>(url, data)
} | https://github.com/LYM15/FireflyCompanion | 393020bd148da2abae3b7f7b63cbc891fb20a412 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | updateSourceNSFW | 更新图源的NSFW状态
@param sourceId 图源ID
@param isNSFW 是否为NSFW图源 | async updateSourceNSFW(sourceId: number, isNSFW: boolean): Promise<void> {
try {
const sql = 'UPDATE comic_source SET isNSFW = ?, lastUpdateTime = ? WHERE id = ?';
await this.databaseManager.executeSql(sql, [isNSFW ? 1 : 0, Date.now(), sourceId]);
logger.info(TAG, `图源NSFW状态已更新: id=${sourceId}, i... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateSourceNSFW AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async updateSourceNSFW(sourceId: number, isNSFW: boolean): Promise<void> {
try {
const sql = 'UPDATE comic_source SET isNSFW = ?, lastUpdateTime = ? WHERE id = ?';
await this.databaseManager.executeSql(sql, [isNSFW ? 1 : 0, Date.now(), sourceId]);
logger.info(TAG, `图源NSFW状态已更新: id=${sourceId}, i... | https://github.com/DaLongZhuaZi/manxia | c28afff0a85b15bc24ad70bbe2f37effcbe309be | github |
HarmonyOS_Samples/BestPracticeSnippets | ApiUsingStandards/entry/src/main/ets/pages/camera.ets | arkts | onBackground | [Start close_release] | async function onBackground(): Promise<void> {
await cameraInput.close();
await cameraSession.release();
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left onBackground AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#... | async function onBackground(): Promise<void> {
await cameraInput.close();
await cameraSession.release();
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | d0194913231cbaf2a10e0793984669a9de3f5bc0 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoadResult.ets | arkts | isAllSuccess | 检查是否全部成功
@returns 是否全部成功 | isAllSuccess(): boolean {
for (let i = 0; i < this.results.length; i++) {
if (!this.results[i].success) {
return false
}
}
return true
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAllSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem... | isAllSuccess(): boolean {
for (let i = 0; i < this.results.length; i++) {
if (!this.results[i].success) {
return false
}
}
return true
} | https://github.com/offlinecat-dev/OCNetORM | b6df913ea45f82024e42d889091cafa5c7a25f5c | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicApiClient.ets | arkts | getQualityList | 获取指定源支持的音质列表 | public static getQualityList(source: string): string[] {
if (source === 'local') {
return [];
}
const qualities: string[] = [];
switch (source) {
case 'kw':
qualities.push(...MusicApiClient.MUSIC_QUALITY.kw);
break;
case 'kg':
qualities.push(...MusicApiClien... | 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 getQualityList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left :... | public static getQualityList(source: string): string[] {
if (source === 'local') {
return [];
}
const qualities: string[] = [];
switch (source) {
case 'kw':
qualities.push(...MusicApiClient.MUSIC_QUALITY.kw);
break;
case 'kg':
qualities.push(...MusicApiClien... | https://github.com/cpdd5201314/harmonyOS-music-app | a5f42c95aeb9cb2f4c63df395e2abaa807205378 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.