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 |
|---|---|---|---|---|---|---|---|---|---|---|
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/GlobalContextUtil.ets | arkts | setObject | 添加对象
@param key 键
@param objectClass 值 | public setObject(key: string, objectClass: Object): void {
this._objects.set(key, objectClass)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | public setObject(key: string, objectClass: Object): void {
this._objects.set(key, objectClass)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 39c35aa9b0e4f54e77b1c78f797ae6094a48f36a | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | hasReceiver | Checks if this method has a receiver
@returns {boolean} True if method has a receiver
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public hasReceiver(): boolean {
return this.getReceiverTypeDescriptor() !== undefined
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasReceiver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | public hasReceiver(): boolean {
return this.getReceiverTypeDescriptor() !== undefined
} | https://gitcode.com/iop123123/arkts-static-skills | 16cf3101af620d90b75d0d66696962a616c35d00 | gitcode |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/TikTokChatStore.ets | arkts | changeOneTiktokVideoCommentLike | 单条评论状态修改 | async changeOneTiktokVideoCommentLike(videoId: string, messageId: number, likeCount: number,likeFlag: boolean) {
const store = this.getVideoStore(videoId)
const list = this.getOneTiktokVideoAllComment(videoId)
const index = list.findIndex(item => item.id === messageId)
list[index].likeNum = likeCount
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left changeOneTiktokVideoCommentLike AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left videoId AST#identifier#Right AST#type_annotatio... | async changeOneTiktokVideoCommentLike(videoId: string, messageId: number, likeCount: number,likeFlag: boolean) {
const store = this.getVideoStore(videoId)
const list = this.getOneTiktokVideoAllComment(videoId)
const index = list.findIndex(item => item.id === messageId)
list[index].likeNum = likeCount
... | https://github.com/SMAT-Lab/PhantomRendering | 3289dd73ff07d6caa93968171f3ece4adf62978a | github |
harmonyos/codelabs | HarmonyOS_NEXT/MultiVideoApplication/commons/base/src/main/ets/utils/DeviceScreen.ets | arkts | getDeviceHeight | Get the screen height.
@returns screen height. | public static getDeviceHeight(): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI);
} | 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 getDeviceHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public static getDeviceHeight(): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI);
} | https://gitee.com/harmonyos/codelabs.git | 7733a66bced2833c9af283f7bbebd1ef70c33403 | gitee |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/toast/TnToast.ets | arkts | showLoading | 显示加载提示(便捷方法)
默认不自动关闭,需手动调用 hide()
@param option 加载配置选项 | public showLoading(option?: TnToastLoadingOption): void {
const toastOption: TnToastOption = new TnToastOption();
toastOption.type = "loading";
toastOption.message = option !== undefined ? option.message : "";
toastOption.duration = option !== undefined ? option.duration : 0;
toastOption.loadingMo... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left showLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | public showLoading(option?: TnToastLoadingOption): void {
const toastOption: TnToastOption = new TnToastOption();
toastOption.type = "loading";
toastOption.message = option !== undefined ? option.message : "";
toastOption.duration = option !== undefined ? option.duration : 0;
toastOption.loadingMo... | https://github.com/codelably/tuniao-ui | 55251e5c87fcf9d300940b6955588eec6561f782 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | find | Returns the value of the first element in the array where predicate is true, and undefined otherwise
@param { function } predicate - find calls predicate once for each element of the array, in ascending
order, until it finds one where predicate returns true. If such an element is found, find
immediately returns that el... | public find(predicate: (value: number, index: int, obj: Int8Array) => boolean): number | undefined {
for (let i = 0; i < this.lengthInt; ++i) {
let val = this.getUnsafe(i)
if (predicate((val).toDouble(), i, this)) {
return (val).toDouble()
}
}
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left ... | public find(predicate: (value: number, index: int, obj: Int8Array) => boolean): number | undefined {
for (let i = 0; i < this.lengthInt; ++i) {
let val = this.getUnsafe(i)
if (predicate((val).toDouble(), i, this)) {
return (val).toDouble()
}
}
... | https://gitcode.com/iop123123/arkts-static-skills | ad40e5a6d8d69f9f5c353ec926b85fb94f69e8e2 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | subarray | Creates a Uint16Array with the same underlying Buffer
@param { int } [begin] - start index, inclusive
@param { int } [end] - last index, exclusive
@returns { Uint16Array } - a new Uint16Array with the same underlying Buffer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public subarray(begin?: int, end?: int): Uint16Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le... | public subarray(begin?: int, end?: int): Uint16Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | https://gitcode.com/iop123123/arkts-static-skills | 7359bb87310488d495a786623ff62d12dd481f4b | gitcode |
CLMC2025/Vignette | entry/src/main/ets/utils/TimerManager.ets | arkts | clearAll | 清除所有定时器
应在组件 aboutToDisappear 中调用 | clearAll(): void {
console.info(`[TimerManager] Clearing ${this.timers.size} timers`);
for (const timerId of this.timers) {
try {
clearTimeout(timerId);
clearInterval(timerId);
} catch (e) {
// 忽略清除错误
}
}
this.timers.clear();
this.destroyed = tru... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | clearAll(): void {
console.info(`[TimerManager] Clearing ${this.timers.size} timers`);
for (const timerId of this.timers) {
try {
clearTimeout(timerId);
clearInterval(timerId);
} catch (e) {
// 忽略清除错误
}
}
this.timers.clear();
this.destroyed = tru... | https://github.com/CLMC2025/Vignette | ce27443f82c0f9f00aad057437ed204c5682dc67 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/20.additive_expressions/01.string_concatenation_operator/string_concat.ets | arkts | main | ---
desc: String concatenation
params: |
{{sc.x}} + {{sc.y}} == {{sc.result}}
--- | function main(): void {
assert ({{sc.x}} + {{sc.y}}) == {{sc.result}}; | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
assert ({{sc.x}} + {{sc.y}}) == {{sc.result}}; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1ad24895259e6402e6ea755830dcda67dde0a57b | gitee |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/calendar/TnCalendar.ets | arkts | getDaysInMonth | 获取某月天数
@param year 年
@param month 月(1-12)
@returns 天数 | function getDaysInMonth(year: number, month: number): number {
return new Date(year, month, 0).getDate();
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getDaysInMonth AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function getDaysInMonth(year: number, month: number): number {
return new Date(year, month, 0).getDate();
} | https://github.com/codelably/tuniao-ui | 9e07bba564922bd48724b0d9897e3266b15ae81e | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | getById | 根据ID获取账单 | static async getById(billId: number): Promise<SharedBill | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SharedBill.tableName);
predicates.equalTo('bill_id', billId);
... | 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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left : AST#:#R... | static async getById(billId: number): Promise<SharedBill | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SharedBill.tableName);
predicates.equalTo('bill_id', billId);
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 22e1c13adace51dd5b9aa6ef01f78974f18cb6ba | github |
CLMC2025/Vignette | entry/src/main/ets/context/OfflineContext.ets | arkts | getGenerationStats | 获取生成统计 | getGenerationStats(): GenerationStats {
const stats: GenerationStats = {
totalWords: this.getDatabaseSize(),
availableStyles: this.templateManager.getAvailableStyles().length,
availableDifficulties: this.templateManager.getAvailableDifficulties().length
};
return stats;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGenerationStats 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 GenerationStats AST#identifier#Right AST#ER... | getGenerationStats(): GenerationStats {
const stats: GenerationStats = {
totalWords: this.getDatabaseSize(),
availableStyles: this.templateManager.getAvailableStyles().length,
availableDifficulties: this.templateManager.getAvailableDifficulties().length
};
return stats;
} | https://github.com/CLMC2025/Vignette | de470b12482123a3150b94106164834b396cbf0d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Distributed/DistributedDataSyncManager.ets | arkts | addOnDataChangedCallback | 添加数据变更监听 | public addOnDataChangedCallback(callback: (state: SyncReadingState) => void): void {
this.dataChangedCallbacks.add(callback);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addOnDataChangedCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#L... | public addOnDataChangedCallback(callback: (state: SyncReadingState) => void): void {
this.dataChangedCallbacks.add(callback);
} | https://github.com/DaLongZhuaZi/manxia | d3215a0f79e5252028b517de74526884617f391e | github |
codelably/HCompass | core/di/src/main/ets/ServiceContainer.ets | arkts | getInstance | 获取服务实例
@template T 服务类型
@param descriptor 服务描述符
@returns 服务实例 | private getInstance<T>(descriptor: ServiceDescriptor<T>): T {
if (descriptor.singleton) {
// 单例模式:缓存实例
if (descriptor.instance === undefined) {
descriptor.instance = descriptor.factory();
}
return descriptor.instance;
}
// 非单例模式:每次创建新实例
return descriptor.factory();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#binary_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#... | private getInstance<T>(descriptor: ServiceDescriptor<T>): T {
if (descriptor.singleton) {
// 单例模式:缓存实例
if (descriptor.instance === undefined) {
descriptor.instance = descriptor.factory();
}
return descriptor.instance;
}
// 非单例模式:每次创建新实例
return descriptor.factory();
} | https://github.com/codelably/HCompass | 708ae484909326ebaff3431646f5c6d83f1b9ca3 | github |
offlinecat-dev/OCNetORM | example/UsageExample.ets | arkts | findArticleById | 根据 ID 查询文章 | async function findArticleById(id: number): Promise<EntityData | null> {
const repository = new Repository('ArticleEntity')
return await repository.findById(id)
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left findArticleById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_... | async function findArticleById(id: number): Promise<EntityData | null> {
const repository = new Repository('ArticleEntity')
return await repository.findById(id)
} | https://github.com/offlinecat-dev/OCNetORM | d426a0f810376426694bb4c73bfa1784eebefd46 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BaseEnum.ets | arkts | constructor | constructor for BaseEnum
@param { T } value The underlying value of the enum constant.
@param { string } name The name of the enum constant.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(value: T, name: string) {
this.name = name
this.value = value
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#,... | constructor(value: T, name: string) {
this.name = name
this.value = value
} | https://gitcode.com/iop123123/arkts-static-skills | 6c73add03f1a048825ca3896ebb964de09384813 | gitcode |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/ColorPickerUtil.ets | arkts | setRgba | Creates an RGBA color string from component values
@param red Red component (0-255)
@param green Green component (0-255)
@param blue Blue component (0-255)
@param opacity Opacity (0.0-1.0)
@returns Formatted RGBA string | public static setRgba(red: number, green: number, blue: number, opacity: number): string {
return `rgba(${red},${green},${blue},${opacity})`;
} | 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 setRgba AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left red AST#identifier#Right AST#:#Left : AST#:#Rig... | public static setRgba(red: number, green: number, blue: number, opacity: number): string {
return `rgba(${red},${green},${blue},${opacity})`;
} | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 6797311aec7c781d702c68aa1afc0c6aceefd22c | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnCountScrollViewModel.ets | arkts | increaseValue | 增加动态值 | increaseValue(): void {
const current: number = parseInt(this.dynamicValue, 10) || 0;
const newVal: number = current + Math.floor(Math.random() * 1000) + 100;
this.dynamicValue = newVal.toString();
this.dynamicStatusText = `当前值:${this.dynamicValue}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left increaseValue 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... | increaseValue(): void {
const current: number = parseInt(this.dynamicValue, 10) || 0;
const newVal: number = current + Math.floor(Math.random() * 1000) + 100;
this.dynamicValue = newVal.toString();
this.dynamicStatusText = `当前值:${this.dynamicValue}`;
} | https://github.com/codelably/tuniao-ui | b46846bf3f417581957036bdd1f2542e502065fc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates a copy of Uint8ClampedArray.
@param { Uint8ClampedArray } other - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(other: Uint8ClampedArray) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLengthInt = other.byteLength
this.lengthInt = other.length
this.byteOffsetInt = 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uin... | public constructor(other: Uint8ClampedArray) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLengthInt = other.byteLength
this.lengthInt = other.length
this.byteOffsetInt = 0
} | https://gitcode.com/iop123123/arkts-static-skills | 75126eee2abe8eea96e25eeea8c88e8d3e09074d | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationManager.ets | arkts | getHistory | 获取导航历史
@returns string[] | public getHistory(): string[] {
return [...this.navigationHistory];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left string AST#... | public getHistory(): string[] {
return [...this.navigationHistory];
} | https://github.com/LJ666-ui/harmony-health-care | 249c8ea7829b91fe8bfb7e55629761f5df4178f5 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | decodeMsg | 解析二进制数据转为字符串
@param buffer | private decodeMsg(buffer: ArrayBuffer): string {
Logger.info(TAG, `buffer type = ${typeof buffer}`);
Logger.info(TAG, `buffer = ${buffer}`);
let dataView = new Uint8Array(buffer);
Logger.info(TAG, `length = ${dataView.byteLength}`);
let data = '';
for (let i = 0; i < dataView.byteLength; ++i) ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left decodeMsg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left A... | private decodeMsg(buffer: ArrayBuffer): string {
Logger.info(TAG, `buffer type = ${typeof buffer}`);
Logger.info(TAG, `buffer = ${buffer}`);
let dataView = new Uint8Array(buffer);
Logger.info(TAG, `length = ${dataView.byteLength}`);
let data = '';
for (let i = 0; i < dataView.byteLength; ++i) ... | https://github.com/openharmony/applications_app_samples | 0256261515a047340c43d0726091f4e505188028 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CategoryDAO.ets | arkts | getAll | 查询用户所有未删除分类(带缓存)
性能优化:
- 使用内存缓存,缓存命中时响应时间 < 1ms
- TTL 5 分钟,自动过期清理
- 减少数据库查询次数 60-80% | static async getAll(userId: number): Promise<Category[]> {
const cacheKey = `categories:user:${userId}:all`;
// 尝试从缓存获取
return await CacheManager.getOrSet(
cacheKey,
async () => {
// 缓存未命中,从数据库查询
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FR... | 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 getAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Ri... | static async getAll(userId: number): Promise<Category[]> {
const cacheKey = `categories:user:${userId}:all`;
// 尝试从缓存获取
return await CacheManager.getOrSet(
cacheKey,
async () => {
// 缓存未命中,从数据库查询
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FR... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6258bc446f68318c066abb3125410a79364ec7a3 | github |
harmonyos/codelabs | HarmonyOS_NEXT/MultiShopping/common/src/main/ets/utils/LocalDataManager.ets | arkts | queryCommodityListById | Query commodity list by id of commodity.
@param id id of commodity
@returns Commodity | queryCommodityListById(id: string) {
const result = commodityData.filter(item => item.id === id)[0];
return result;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryCommodityListById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifie... | queryCommodityListById(id: string) {
const result = commodityData.filter(item => item.id === id)[0];
return result;
} | https://gitee.com/harmonyos/codelabs.git | 6d7889efa829186afc9bfaa549c2bca3db62af1b | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets | arkts | startReminderTimer | 启动提醒定时器 | private startReminderTimer(): void {
// 清除之前的定时器
this.stopReminderTimer();
// 创建新的定时器,每10秒检查一次提醒
this.reminderTimer = setInterval(() => {
this.checkRegularReminders();
}, 10000);
console.log('提醒定时器已启动');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startReminderTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private startReminderTimer(): void {
// 清除之前的定时器
this.stopReminderTimer();
// 创建新的定时器,每10秒检查一次提醒
this.reminderTimer = setInterval(() => {
this.checkRegularReminders();
}, 10000);
console.log('提醒定时器已启动');
} | https://gitcode.com/openharmony/codelabs | eb51aeff9403e7db42326c762f543ad4a8c8e525 | gitcode |
openharmony-sig/fluttertpc_camerawesome | ohos/ohos/src/main/ets/components/cameraX/ImageAnalysisBuilder.ets | arkts | stop | 销毁worker线程 | stop() {
Logger.debug(TAG, "stop")
this.workerInstance?.postMessage('releaseImageReceiver')
this.workerInstance?.terminate()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#ca... | stop() {
Logger.debug(TAG, "stop")
this.workerInstance?.postMessage('releaseImageReceiver')
this.workerInstance?.terminate()
} | https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git | 6d6f520db4f2624a5cddb8174a0fc2fe910ca138 | gitee |
openharmony/testfwk_arkxtest | jsunit/src_static/module/service/ExpectService.ets | arkts | removeMatchers | @todo 不支持 | removeMatchers(customAssertionName: string) {} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeMatchers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left customAssertionName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERR... | removeMatchers(customAssertionName: string) {} | https://gitee.com/openharmony/testfwk_arkxtest.git | fc590f9a7c1b36a9a9ae453fa69434f4e106fcf7 | gitee |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | destroyVideoEncoder | 销毁 Rust 层内部视频编码器 | public destroyVideoEncoder(): void {
if (!this.client) return;
this.client.destroyVideoEncoder();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroyVideoEncoder 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... | public destroyVideoEncoder(): void {
if (!this.client) return;
this.client.destroyVideoEncoder();
} | https://github.com/tdcare/tdwebrtc | 4ad0b5af33bc80da0a70918aa5efcabd10977d30 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/webdav/WebDAVStorage.ets | arkts | getInfo | 获取文件信息
@param path
@returns | public async getInfo(path: string): Promise<FileInfo> {
if (!this.client) {
hilog.error(DOMAIN, TAG, 'WebDAV not init:%{public}s', JSON.stringify(this.config));
return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.webdav_not_init'))));
... | 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 getInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Rig... | public async getInfo(path: string): Promise<FileInfo> {
if (!this.client) {
hilog.error(DOMAIN, TAG, 'WebDAV not init:%{public}s', JSON.stringify(this.config));
return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.webdav_not_init'))));
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/webdav/WebDAVStorage.ets#L137-L157 | 48d066909fd2d1b65808fd53aea8f22fbd4edda3 | github |
751496032/ZRouter | RouterApi/src/main/ets/model/NavDestBuilder.ets | arkts | redirect | 重定位页面,建议在拦截器中使用,与finishWithResult()方法搭配使用
比如用于拦截未登录的场景,当未登录时,在拦截器中重定向到登录页,当登录成功后,通过finishWithResult()方法关闭当前页,
在onPopListener的回调函数中返回true则会继续跳转到未登录前的页面。
注意:如果登录流程中间有多个页面,需要在finishWithResult()方法前手动调用pop()方法关闭。
@param name | public redirect(name: string, type: RedirectType = RedirectType.REPLACE) {
this.updateCurrentStackName()
this.optionsImpl.redirectType = type
if (this.optionsImpl.onPopListener) {
this.routerMgr.redirectForResult2<T>(name, this.mergeParams(), this.optionsImpl.onPopListener, this)
} else {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left redirect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | public redirect(name: string, type: RedirectType = RedirectType.REPLACE) {
this.updateCurrentStackName()
this.optionsImpl.redirectType = type
if (this.optionsImpl.onPopListener) {
this.routerMgr.redirectForResult2<T>(name, this.mergeParams(), this.optionsImpl.onPopListener, this)
} else {
... | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L252-L260 | 599d14a576f1a61d7c79a6040d9059e3b3b6c4aa | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/PersistedUriManager.ets | arkts | activateAllPermissions | 激活所有已保存的权限 | public async activateAllPermissions(): Promise<void> {
if (!PersistedUriManager.isSupported()) {
console.warn(`${TAG} Device does not support folder authorization`);
return;
}
if (this.fileUris.length === 0) {
return;
}
const policies: fileShare.PolicyInfo[] = this.fileUris.map... | 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 activateAllPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public async activateAllPermissions(): Promise<void> {
if (!PersistedUriManager.isSupported()) {
console.warn(`${TAG} Device does not support folder authorization`);
return;
}
if (this.fileUris.length === 0) {
return;
}
const policies: fileShare.PolicyInfo[] = this.fileUris.map... | https://github.com/richshaw2015/nds | d2b50a784ccce2363a5d5bbb7adbad59929f1d19 | github |
buqiuz/Account | entry/oh_modules/@ohos/mpchart/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | moveViewToAnimated | This will move the left side of the current viewport to the specified x-value
and center the viewport to the y value animated.
This also refreshes the chart by calling invalidate().
@param xValue
@param yValue
@param axis
@param duration the duration of the animation in milliseconds | public moveViewToAnimated(xValue: number, yValue: number, axis: AxisDependency, duration: number): void {
let bounds: MPPointD = this.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentTop(), axis);
let yInView: number = this.getAxisRange(axis) / this.mViewPortHandler.ge... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left moveViewToAnimated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xValue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public moveViewToAnimated(xValue: number, yValue: number, axis: AxisDependency, duration: number): void {
let bounds: MPPointD = this.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentTop(), axis);
let yInView: number = this.getAxisRange(axis) / this.mViewPortHandler.ge... | https://github.com/buqiuz/Account | 28638990ac69329c8201e3914ac56cf0ac713e3f | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/ImageFormat/ets/common/src/main/ets/common/utils/LogUtil.ets | arkts | debug | Show log in debug level.
@param args | public debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left debug AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left arg... | public debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | ee53dd50fcd2b26e9c74c538c3acad4d8f93c6cf | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/StringBuilder.ets | arkts | constructor | Construct a new builder instance with the provided array of chars
@param { ValueArray<char> } fromChars array that will be used to initialize the builder
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(fromChars: ValueArray<char>) {
let s: String = new String(fromChars);
this.buf[this.index++] = s;
this.length = s.getLength();
if (!s.isCompressed()) {
this.compress = false;
}
} | 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 fromChars AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identi... | constructor(fromChars: ValueArray<char>) {
let s: String = new String(fromChars);
this.buf[this.index++] = s;
this.length = s.getLength();
if (!s.isCompressed()) {
this.compress = false;
}
} | https://gitcode.com/iop123123/arkts-static-skills | 0576b4588f61270c79b1299aad7a75af4697299e | gitcode |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/client/tools/ControlPacket.ets | arkts | createUhidInput | ============ TYPE_UHID_INPUT (13) ============
格式: type(1) + id(2) + dataLen(2) + data(N) | static createUhidInput(id: number, data: Uint8Array): ArrayBuffer {
const buf = new ArrayBuffer(5 + data.byteLength);
const view = new DataView(buf);
const result = new Uint8Array(buf);
view.setUint8(0, ControlMessageType.TYPE_UHID_INPUT);
view.setUint16(1, id, false);
view.setUint16(3, data.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createUhidInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | static createUhidInput(id: number, data: Uint8Array): ArrayBuffer {
const buf = new ArrayBuffer(5 + data.byteLength);
const view = new DataView(buf);
const result = new Uint8Array(buf);
view.setUint8(0, ControlMessageType.TYPE_UHID_INPUT);
view.setUint16(1, id, false);
view.setUint16(3, data.... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 85f92cd838e9da08e8b06d0983d7ccddf1c85791 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | searchAllLegacy | 执行全局搜索
@param keyword 搜索关键词
@param filter 筛选配置
@param onProgress 进度回调 | private async searchAllLegacy(
keyword: string,
filter: SearchFilterConfig,
onProgress?: SearchProgressCallback
): Promise<SearchSourceGroup[]> {
const groups: SearchSourceGroup[] = [];
const searchTasks: Array<() => Promise<void>> = [];
// 根据筛选配置构建搜索任务
// 1. 本地搜索
if (filte... | 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 searchAllLegacy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Le... | private async searchAllLegacy(
keyword: string,
filter: SearchFilterConfig,
onProgress?: SearchProgressCallback
): Promise<SearchSourceGroup[]> {
const groups: SearchSourceGroup[] = [];
const searchTasks: Array<() => Promise<void>> = [];
// 根据筛选配置构建搜索任务
// 1. 本地搜索
if (filte... | https://github.com/DaLongZhuaZi/manxia | 0f232f4a870bae4950ad562cca6a25c8fe97a531 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/Category.ets | arkts | textColorValue | 获取文字颜色值(带 # 前缀) | get textColorValue(): string {
return `#${this.textColor}`;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left textColorValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | get textColorValue(): string {
return `#${this.textColor}`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 570616c29073190e9d3d09adf73cbe211683df09 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _validateChars | 验证字符是否为正确的xml字符
@param strCharacter 被验证的字符串 | private _validateChars(strCharacter: string): void{
let charIndex = 0;
for (let char of strCharacter) {
if (!isXmlChar(char)) {
this._svgStringReader!.reset(-(strCharacter.split('').length - charIndex));
this._error('Invalid character');
}
charIndex += 1;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _validateChars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left strCharacter AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private _validateChars(strCharacter: string): void{
let charIndex = 0;
for (let char of strCharacter) {
if (!isXmlChar(char)) {
this._svgStringReader!.reset(-(strCharacter.split('').length - charIndex));
this._error('Invalid character');
}
charIndex += 1;
}
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 71332eec109e0f0238b10acefe180eef4e372c9f | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | init | 初始化同步服务
必须在 initDeviceIdPreferences() 之后调用,否则跳过初始化 | public static async init(): Promise<void> {
if (SyncSettingsService.isInitialized) {
return;
}
// deviceIdPreferences 未初始化时跳过,等待 EntryAbility 正确调用
if (!SyncSettingsService.deviceIdPreferences) {
hilog.warn(DOMAIN, TAG, 'deviceIdPreferences not initialized, skipping SyncSettingsService.ini... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST... | public static async init(): Promise<void> {
if (SyncSettingsService.isInitialized) {
return;
}
// deviceIdPreferences 未初始化时跳过,等待 EntryAbility 正确调用
if (!SyncSettingsService.deviceIdPreferences) {
hilog.warn(DOMAIN, TAG, 'deviceIdPreferences not initialized, skipping SyncSettingsService.ini... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L54-L82 | 627d7f1f98541327a50bad4d8ebb2b014ef84d5f | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/I18nManager.ets | arkts | init | 初始化:传入 context 获取 resourceManager,读取用户语言偏好并创建 override。
在 EntryAbility.onCreate() 中调用。
直接从 Preferences 读取 app_language,不依赖 SettingsManager(因为此时 SM 尚未初始化)。 | async init(context?: Context): Promise<void> {
let lang: string = 'zh';
try {
const prefs = await preferences.getPreferences(context!, 'melonds_settings');
lang = await prefs.get('app_language', 'zh') as string;
} catch (_e) {
// Preferences 读取失败,使用默认值
}
this.currentLang = (lang ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left context AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_an... | async init(context?: Context): Promise<void> {
let lang: string = 'zh';
try {
const prefs = await preferences.getPreferences(context!, 'melonds_settings');
lang = await prefs.get('app_language', 'zh') as string;
} catch (_e) {
// Preferences 读取失败,使用默认值
}
this.currentLang = (lang ... | https://github.com/richshaw2015/nds | 5eac09ed85e410c2a34354a71ca0deb9e3de88b5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | isSupportedArchive | 检查是否为支持的压缩文件
@param filePath 文件路径
@returns 是否支持 | public isSupportedArchive(filePath: string): boolean {
// 转换URI路径为本地路径
const localPath = this.convertUriToLocalPath(filePath);
const extension = this.getFileExtension(localPath);
return this.supportedArchiveFormats.includes(extension);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSupportedArchive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | public isSupportedArchive(filePath: string): boolean {
// 转换URI路径为本地路径
const localPath = this.convertUriToLocalPath(filePath);
const extension = this.getFileExtension(localPath);
return this.supportedArchiveFormats.includes(extension);
} | https://github.com/DaLongZhuaZi/manxia | 2aa9c1e5549240984eed71b020bd5117b6c01a1e | github |
queueit/harmony-sdk | queueit_sdk/src/main/ets/view/QueueItViewManager.ets | arkts | showQueue | --- Public methods to control the View/State --- | public async showQueue(queueTryPassResult: QueueTryPassResult): Promise<void> {
if (!queueTryPassResult.queueUrl) {
Logger.error(QueueItViewManager.TAG, "Cannot show queue, Queue URL is missing.");
this.queueListener.onError(QueueError.INVALID_RESPONSE, "Missing Queue URL for display... | 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 showQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left queueTryPassResult AST#identifier#Right AST#:#... | public async showQueue(queueTryPassResult: QueueTryPassResult): Promise<void> {
if (!queueTryPassResult.queueUrl) {
Logger.error(QueueItViewManager.TAG, "Cannot show queue, Queue URL is missing.");
this.queueListener.onError(QueueError.INVALID_RESPONSE, "Missing Queue URL for display... | https://github.com/queueit/harmony-sdk | 21361a64e31d41857b903706ae0d8cd164bebb20 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | getComments | 获取文档评论列表
@param documentId 文档ID | async getComments(documentId: string, params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> {
return this.client.get<any>(`/api/v1/knowledge/documents/${documentId}/comments`, params as Record<string, any>)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getComments AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documentId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getComments(documentId: string, params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> {
return this.client.get<any>(`/api/v1/knowledge/documents/${documentId}/comments`, params as Record<string, any>)
} | https://github.com/David8Idira/AI-OA | 7f6a454c861df65984db2f9306be50ffd795a7a2 | github |
openharmony-sig/applications_filemanager | entry/src/main/ets/pages/SecondFold.ets | arkts | build | @State ScreenshotList: Array<FileInfo> = []
@State totalNum: number= 0; | build() {
Flex() {
Column() {
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Image($r('app.media.arrow_left'))
.width(50)
.aspectRatio(1)
.onClick(() => {
router.back()
})
Text() {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Flex() {
Column() {
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Image($r('app.media.arrow_left'))
.width(50)
.aspectRatio(1)
.onClick(() => {
router.back()
})
Text() {
... | https://gitee.com/openharmony-sig/applications_filemanager.git | 91edb39d4888d9c373971f9deb2864695da4834c | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/ColumnMetadata.ets | arkts | setAutoIncrement | 设置自增
@param isAuto 是否自增
@returns 当前实例,支持链式调用 | setAutoIncrement(isAuto: boolean): ColumnMetadata {
this.isAutoIncrement = isAuto
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAutoIncrement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isAuto AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Le... | setAutoIncrement(isAuto: boolean): ColumnMetadata {
this.isAutoIncrement = isAuto
return this
} | https://github.com/offlinecat-dev/OCNetORM | 9537e993c63b98495575ec1e79f85595ba651203 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | md5EncodeAsync | MD5编码 - 异步版本,使用真正的MD5算法 | async md5EncodeAsync(str: string): Promise<string> {
try {
const md = cryptoFramework.createMd('MD5');
const encoder = new util.TextEncoder();
const data = encoder.encodeInto(str);
await md.update({ data: data });
const result = await md.digest();
return this.uint8ArrayToHex(re... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left md5EncodeAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left str AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async md5EncodeAsync(str: string): Promise<string> {
try {
const md = cryptoFramework.createMd('MD5');
const encoder = new util.TextEncoder();
const data = encoder.encodeInto(str);
await md.update({ data: data });
const result = await md.digest();
return this.uint8ArrayToHex(re... | https://github.com/DaLongZhuaZi/manxia | e659e98a065149c21816359860bc4f88607de4aa | github |
XHXYT/Pixark | entry/src/main/ets/pages/More.ets | arkts | showLogoutDialog | 退出登录确认弹窗 | showLogoutDialog() {
toastUtil.showDialog({
title: $r('app.string.tips'),
message: $r('app.string.confirm_logout'),
buttons: [
{ text: $r('app.string.cancel'), color: $r('sys.color.font_secondary') },
{ text: $r('app.string.exit'), color: $r('sys.color.ohos_id_color_warning') }
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showLogoutDialog 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... | showLogoutDialog() {
toastUtil.showDialog({
title: $r('app.string.tips'),
message: $r('app.string.confirm_logout'),
buttons: [
{ text: $r('app.string.cancel'), color: $r('sys.color.font_secondary') },
{ text: $r('app.string.exit'), color: $r('sys.color.ohos_id_color_warning') }
... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/pages/More.ets#L253-L266 | a190e87598863ef5dff55b06e8b75b0fa1ec2ad5 | github |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/WindowSafeAreaState.ets | arkts | updateSafeArea | 更新安全区数据
@param {number} topInset - 顶部安全区高度(vp)
@param {number} leftInset - 左侧安全区宽度(vp)
@param {number} bottomInset - 底部安全区高度(vp)
@param {number} rightInset - 右侧安全区宽度(vp)
@returns {void} 无返回值
@example
state.updateSafeArea(24, 0, 32, 0); | updateSafeArea(topInset: number, leftInset: number, bottomInset: number, rightInset: number): void {
this.topInset = topInset;
this.leftInset = leftInset;
this.bottomInset = bottomInset;
this.rightInset = rightInset;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateSafeArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left topInset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | updateSafeArea(topInset: number, leftInset: number, bottomInset: number, rightInset: number): void {
this.topInset = topInset;
this.leftInset = leftInset;
this.bottomInset = bottomInset;
this.rightInset = rightInset;
} | https://github.com/Joker-x-dev/CoolMallArkTS | cd44cf0f8a964960ceed4eb34dba5284a5163528 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/JSONPathParser.ets | arkts | parseArray | 批量解析(用于数组)
@param data JSON数据
@param path JSONPath表达式
@returns 数组结果 | static parseArray(data: Record<string, Object>, path: string): Object[] {
const result: JSONPathResult = JSONPathParser.parse(data, path);
if (Array.isArray(result)) {
return result;
}
if (result !== null && result !== undefined) {
return [result as Object];
}
return [];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseArray 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_express... | static parseArray(data: Record<string, Object>, path: string): Object[] {
const result: JSONPathResult = JSONPathParser.parse(data, path);
if (Array.isArray(result)) {
return result;
}
if (result !== null && result !== undefined) {
return [result as Object];
}
return [];
} | https://github.com/DaLongZhuaZi/manxia | 0e1ef21d05926820c330c7a677b2ef275e95d807 | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets | arkts | startAdvertiser | 启动蓝牙广播服务 | startAdvertiser(): boolean {
Log.showInfo(TAG, `startAdvertiser`);
if (!this.isBluetoothEnabled()) {
Log.showInfo(TAG, `startBLEScan: bluetooth is disable.`);
this.enableBluetooth();
promptAction.showToast({
message: $r('app.string.ble_toast_enable_bluetooth'),
duration: Dur... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startAdvertiser 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#sta... | startAdvertiser(): boolean {
Log.showInfo(TAG, `startAdvertiser`);
if (!this.isBluetoothEnabled()) {
Log.showInfo(TAG, `startBLEScan: bluetooth is disable.`);
this.enableBluetooth();
promptAction.showToast({
message: $r('app.string.ble_toast_enable_bluetooth'),
duration: Dur... | https://gitcode.com/arkui-x/samples | 463ce2c9b1c0cb8a37d019b7bee2a44aad8e3264 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getChapterPagesCacheDir | 获取章节页面缓存目录 | private getChapterPagesCacheDir(): string {
return DownloadDirManager.ensureDirectory('suwayomi/chapters');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getChapterPagesCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left... | private getChapterPagesCacheDir(): string {
return DownloadDirManager.ensureDirectory('suwayomi/chapters');
} | https://github.com/DaLongZhuaZi/manxia | aad28a40977dcd888cf0e0bed644240d10b73065 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test19_original_index.ets | arkts | testLabeledContinue | --- Labeled continue --- | function testLabeledContinue(): string {
let result: string = '';
outer: for (let i: number = 0; i < 3; i++) {
for (let j: number = 0; j < 3; j++) {
if (i === 1 && j === 1) {
continue outer;
}
result = result + String(i) + String(j);
if (i < 2 || j < 2) {
result = result ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testLabeledContinue 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#predefi... | function testLabeledContinue(): string {
let result: string = '';
outer: for (let i: number = 0; i < 3; i++) {
for (let j: number = 0; j < 3; j++) {
if (i === 1 && j === 1) {
continue outer;
}
result = result + String(i) + String(j);
if (i < 2 || j < 2) {
result = result ... | https://github.com/miaochiahao/ark-ghidra | 3fff1b247f1f734de7660181ff0404c91e43cf6a | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getRandomAlbum | 查询随机专辑
@returns | public async getRandomAlbum(): Promise<Array<BaseItemDto>> {
return this.requireApi().getRandomAlbum()
} | 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 getRandomAlbum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async getRandomAlbum(): Promise<Array<BaseItemDto>> {
return this.requireApi().getRandomAlbum()
} | https://github.com/OHPG/FinMusic | 7434b203b541558e526484c1f2f391bfd6103e4c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | forEach | Performs the specified action for each element in Int32Array
@param { function } callbackfn - A function that accepts up to three arguments. forEach calls the
callbackfn function one time for each element in the array.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public forEach(callbackfn: (value: number, index: int, array: Int32Array) => void): void {
for (let i = 0; i < this.lengthInt; ++i) {
callbackfn((this.getUnsafe(i)).toDouble(), i, this)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left forEach AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | public forEach(callbackfn: (value: number, index: int, array: Int32Array) => void): void {
for (let i = 0; i < this.lengthInt; ++i) {
callbackfn((this.getUnsafe(i)).toDouble(), i, this)
}
} | https://gitcode.com/iop123123/arkts-static-skills | ff51a1f5a6aa22b3fe5ca95389c255e12514f2ed | gitcode |
openharmony-tpc/openharmony_tpc_samples | inversifyDemo/entry/src/ohosTest/ets/test/planner.test.ets | arkts | weapon | tslint:disable-next-line: no-empty | set weapon(weapon: Weapon) {
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left weapon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left weapon AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Weapon AST#ident... | set weapon(weapon: Weapon) {
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | da7ce5418b45c8c69fc8c8a62d78d43fd0f2fedc | gitee |
LongLiveY96/chatcube | entry/src/main/ets/models/ChatModels.ets | arkts | constructor | 总 token(若厂商未给则回退为 prompt+completion) | constructor(id: string, role: MessageRole, content: string, modelName: string = '', modelId: string = '') {
this.id = id
this.role = role
this.content = content
this.timestamp = Date.now()
this.modelName = modelName
this.modelId = modelId
this.reasoningContent = ''
this.attachments = [... | 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 id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST... | constructor(id: string, role: MessageRole, content: string, modelName: string = '', modelId: string = '') {
this.id = id
this.role = role
this.content = content
this.timestamp = Date.now()
this.modelName = modelName
this.modelId = modelId
this.reasoningContent = ''
this.attachments = [... | https://github.com/LongLiveY96/chatcube | de613d462949017255c3851adc7f502e07fe1d98 | github |
xblLab/HarmonyProjectTemplate | features/course/src/main/ets/viewmodels/Calendar.ets | arkts | getWeekHeaders | 获取星期标题(周日到周六)
@returns 星期标题数组 | static getWeekHeaders(): string[] {
return ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getWeekHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left string ... | static getWeekHeaders(): string[] {
return ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
} | https://github.com/xblLab/HarmonyProjectTemplate | b280189ddf3aa2afc4116434ef63e1c8e40a1e73 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | isShadowEffectEnabled | 检查是否启用阴影效果 | public isShadowEffectEnabled(): boolean {
try {
return UserThemeConfigManager.getInstance().shadowEnabled;
} catch {
return true;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isShadowEffectEnabled 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 boo... | public isShadowEffectEnabled(): boolean {
try {
return UserThemeConfigManager.getInstance().shadowEnabled;
} catch {
return true;
}
} | https://github.com/DaLongZhuaZi/manxia | ab9fbbc10e9f425d7d4f2a32bec5a7588825ce5b | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/PlayStateApi.ets | arkts | reportPlaybackProgress | reportPlaybackProgress
@summary Reports playback progress within a session.
@param {PlayStateApiReportPlaybackProgressRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof PlayStateApi | public async reportPlaybackProgress(requestParameters: PlayStateApiReportPlaybackProgressRequest = {}): Promise<void> {
return this.apiClient.post({path: "/Sessions/Playing/Progress", data: requestParameters.playbackProgressInfo})
} | 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 reportPlaybackProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#... | public async reportPlaybackProgress(requestParameters: PlayStateApiReportPlaybackProgressRequest = {}): Promise<void> {
return this.apiClient.post({path: "/Sessions/Playing/Progress", data: requestParameters.playbackProgressInfo})
} | https://github.com/OHPG/FinSdk | d74566fe85bf4b87bf7f52f873398d3213d8377d | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/ColorUtil.ets | arkts | hsbToRgb | 将HSB(HSV)颜色值转换回RGB颜色空间
@param hue 色调(hue) (0-360)
@param saturation 饱和度(saturation) (0-1)
@param brightness 亮度(Brightness) (0-1)
@returns RGB values as [r, g, b] in 0-255 range | private static hsbToRgb(hue: number, saturation: number, brightness: number): number[] {
const segment = Math.floor((hue / ColorUtil.DEGREES_PER_SEGMENT) % ColorUtil.HUE_SEGMENTS)
const fractional = (hue / ColorUtil.DEGREES_PER_SEGMENT) - segment
const p = brightness * (1 - saturation)
const q = brigh... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left hsbToRgb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hue AST#identifier#Right AST#:#Left : AST#:... | private static hsbToRgb(hue: number, saturation: number, brightness: number): number[] {
const segment = Math.floor((hue / ColorUtil.DEGREES_PER_SEGMENT) % ColorUtil.HUE_SEGMENTS)
const fractional = (hue / ColorUtil.DEGREES_PER_SEGMENT) - segment
const p = brightness * (1 - saturation)
const q = brigh... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 2664a8b9f21177f7e1066385f59b18446aa64b07 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | getAppAsset | 获取应用图标
使用 HttpClient 支持 HTTPS 和自签名证书 | async getAppAsset(appId: number): Promise<ArrayBuffer | null> {
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'appasset',
`appid=${appId}&AssetType=2&AssetIdx=0`);
try {
console.info(`NvHttp: 获取应用图标 appId=${appId}, url=${url}`);
let data: ArrayBuffer;
if (this.hasCertificat... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAppAsset AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left appId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async getAppAsset(appId: number): Promise<ArrayBuffer | null> {
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'appasset',
`appid=${appId}&AssetType=2&AssetIdx=0`);
try {
console.info(`NvHttp: 获取应用图标 appId=${appId}, url=${url}`);
let data: ArrayBuffer;
if (this.hasCertificat... | https://github.com/AlkaidLab/moonlight-harmony | 597ef9355fd2120c8469ff2f59a2983df50b7e00 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FootprintManager.ets | arkts | removeFootprint | Remove a footprint | static async removeFootprint(productId: string, username: string): Promise<boolean> {
try {
console.log('FootprintManager: Removing footprint:', productId);
if (!FootprintManager.preferencesInstance) {
console.error('FootprintManager: Preferences not initialized');
return false;
... | 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 removeFootprint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static async removeFootprint(productId: string, username: string): Promise<boolean> {
try {
console.log('FootprintManager: Removing footprint:', productId);
if (!FootprintManager.preferencesInstance) {
console.error('FootprintManager: Preferences not initialized');
return false;
... | https://github.com/Harrisonls2004/WaterFlow | 5dadef7fe373caacd4a2726cf5fe9ffc818df1d2 | github |
erosTeam/NextE | shared/src/main/ets/settings/CookieJarSettings.ets | arkts | save | Persist the current jar bundle to Preferences + refresh the AuthState mirror. | static async save(context: common.UIAbilityContext): Promise<void> {
try {
const store: preferences.Preferences = await preferences.getPreferences(
context,
StorageKeys.STORE_SETTINGS,
)
store.putSync(StorageKeys.COOKIE_JAR, CookieJarSettings.serialize())
store.flushSync()
... | 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 save 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 save(context: common.UIAbilityContext): Promise<void> {
try {
const store: preferences.Preferences = await preferences.getPreferences(
context,
StorageKeys.STORE_SETTINGS,
)
store.putSync(StorageKeys.COOKIE_JAR, CookieJarSettings.serialize())
store.flushSync()
... | https://github.com/erosTeam/NextE | 7896b4babcfaf66293e04951307ff54d6745d526 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/WatchHistoryManager.ets | arkts | addWatchHistory | 添加观看记录 | async addWatchHistory(videoData: mediaType, watchDuration: number = 0, watchProgress: number = 0): Promise<void> {
try {
const prefs = this.getPreferences()
if (!prefs) return
const historyList = this.getAllWatchHistory()
// 检查是否已存在相同视频的记录
const existingIndex = historyList.fi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addWatchHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left videoData AST#identifier#Right AST#type_annotation#Left AST#:#L... | async addWatchHistory(videoData: mediaType, watchDuration: number = 0, watchProgress: number = 0): Promise<void> {
try {
const prefs = this.getPreferences()
if (!prefs) return
const historyList = this.getAllWatchHistory()
// 检查是否已存在相同视频的记录
const existingIndex = historyList.fi... | https://github.com/SMAT-Lab/PhantomRendering | 62cb6fed19fba54505bff4816538e273261177ab | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineBridge.ets | arkts | setPathConfig | Sets path configuration | setPathConfig(configJson: string): boolean {
return nativeSetPathConfig(configJson);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPathConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left configJson AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST... | setPathConfig(configJson: string): boolean {
return nativeSetPathConfig(configJson);
} | https://github.com/AGenUI/AGenUI | 7cfad45f48f358b4eb6ffbf2a56990335d0acebd | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | getUint8Array | Gets an array of unsigned bytes.
@param byteOffset The byte offset.
@param byteLength The byte length.
@returns The value. | getUint8Array(byteOffset: number, byteLength?: number): Uint8Array {
return this.dataView == null
? new Uint8Array(StringUtils.stringToArrayBuffer(""), byteOffset, byteLength)
: new Uint8Array(this.dataView?.buffer, this.dataView?.byteOffset + byteOffset, byteLength)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST... | getUint8Array(byteOffset: number, byteLength?: number): Uint8Array {
return this.dataView == null
? new Uint8Array(StringUtils.stringToArrayBuffer(""), byteOffset, byteLength)
: new Uint8Array(this.dataView?.buffer, this.dataView?.byteOffset + byteOffset, byteLength)
} | https://gitee.com/openharmony-sig/flutter_engine.git | d68eceb1c38530e8d358824738d752bfabb2b509 | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/background/ContinuousTaskDemo.ets | arkts | startBackgroundRunning | 启动长时任务 | startBackgroundRunning() {
let context: Context = getContext(this);
this.bundleName = (context as common.UIAbilityContext).abilityInfo.bundleName
this.moduleName = (context as common.UIAbilityContext).currentHapModuleInfo.name
this.abilityName = (context as common.UIAbilityContext).abilityInfo.name
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startBackgroundRunning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_b... | startBackgroundRunning() {
let context: Context = getContext(this);
this.bundleName = (context as common.UIAbilityContext).abilityInfo.bundleName
this.moduleName = (context as common.UIAbilityContext).currentHapModuleInfo.name
this.abilityName = (context as common.UIAbilityContext).abilityInfo.name
... | https://github.com/webabcd/HarmonyDemo | a0b5fb9b5009af0fca22fbeb5e0a38127fedc99f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/accessibility/AccessibilityConfig.ets | arkts | enableElderlyMode | 启用老年模式(一键开启所有老年友好特性) | public async enableElderlyMode(): Promise<void> {
await this.updateSettings({
elderlyMode: true,
largeFontMode: true,
minTouchTarget: 52,
baseFontSize: 20,
voiceGuidance: true,
confirmationLevel: 'all',
reduceMotion: true,
contrastRatio: 7.0 // AAA级对比度
});
} | 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 enableElderlyMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public async enableElderlyMode(): Promise<void> {
await this.updateSettings({
elderlyMode: true,
largeFontMode: true,
minTouchTarget: 52,
baseFontSize: 20,
voiceGuidance: true,
confirmationLevel: 'all',
reduceMotion: true,
contrastRatio: 7.0 // AAA级对比度
});
} | https://github.com/LJ666-ui/harmony-health-care | 539e0100e76a9dca1588e1c6bfe8f5e2bbc662bc | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/EditPageViewModel.ets | arkts | commonRouter | Public routing method.
@param url Indicates the route address. | commonRouter(url: string, name: string): void {
let contactsKey = CommonConstants.CONTACTS_DATABASE_KEY + name;
router.pushUrl({
url: url,
params: {
key: contactsKey
}
}).catch((err: BusinessError) => {
Logger.error(`pushUrl failed, code message is ${JSON.stringify(err)}`);... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left commonRouter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | commonRouter(url: string, name: string): void {
let contactsKey = CommonConstants.CONTACTS_DATABASE_KEY + name;
router.pushUrl({
url: url,
params: {
key: contactsKey
}
}).catch((err: BusinessError) => {
Logger.error(`pushUrl failed, code message is ${JSON.stringify(err)}`);... | https://gitee.com/harmonyos/codelabs.git | f78415ed7e1132c935400d945985536e91c6b86d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | exitSortMode | 退出排序模式 | exitSortMode(): void {
this.isSortMode = false;
this.loadSources();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exitSortMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | exitSortMode(): void {
this.isSortMode = false;
this.loadSources();
} | https://github.com/DaLongZhuaZi/manxia | 86de4d032b4b88e20868c8110110479d1c5ab7c7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInternals.ets | arkts | isIntType | Checks if the given Class object represents an int type (including boxed and primitive types).
@static
@param { Class } type The Class object to be checked.
@returns { boolean } Returns true if it's an int type; otherwise returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isIntType(type: Class): boolean {
return type === Types.BOXED_INT || type === Class.PRIMITIVE_INT
} | 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 isIntType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#... | public static isIntType(type: Class): boolean {
return type === Types.BOXED_INT || type === Class.PRIMITIVE_INT
} | https://gitcode.com/iop123123/arkts-static-skills | 0a09cceb0989909858c870cf269947fc065f82f9 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/media/SoundPoolDemo.ets | arkts | playSound | 播放指定的短音频 | playSound(soundId: number) {
// 短音频的播放参数
let playParameters: media.PlayParameters = {
loop: 0, // 播放 1 此
rate: audio.AudioRendererRate.RENDER_RATE_NORMAL,
leftVolume: 0.5,
rightVolume: 0.5,
priority: 100,
};
// 根据 soundId 播放短音频(如果指定的 soundId 正在播放,则会将其停止,然后重新播放),并拿到对应的 st... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playSound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left soundId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Le... | playSound(soundId: number) {
// 短音频的播放参数
let playParameters: media.PlayParameters = {
loop: 0, // 播放 1 此
rate: audio.AudioRendererRate.RENDER_RATE_NORMAL,
leftVolume: 0.5,
rightVolume: 0.5,
priority: 100,
};
// 根据 soundId 播放短音频(如果指定的 soundId 正在播放,则会将其停止,然后重新播放),并拿到对应的 st... | https://github.com/webabcd/HarmonyDemo | 9bc52d9e4cf45983f8a305f3675fdec08473d9e6 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | getScreenLocked | Check if screen is locked | getScreenLocked(): boolean {
return this.isScreenLocked;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getScreenLocked 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#sta... | getScreenLocked(): boolean {
return this.isScreenLocked;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 0ff6d07133a87a230b80ea69f38142f7d6c46659 | github |
midori52000/ArkPilot | Agent/entry/src/main/ets/apim/ApiManagementService.ets | arkts | validateApiKey | ========== API Key 连通性验证 ========== | async validateApiKey(
baseUrl: string, apiKey: string
): Promise<ApiValidationResult> {
const trimmedBaseUrl = cleanBaseUrl(baseUrl);
const trimmedApiKey = apiKey.trim();
if (trimmedBaseUrl.length === 0) {
return new ApiValidationResult(false, 0, 0, 'Base URL 为空', 0, '');
}
if (trimme... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left validateApiKey AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left baseUrl AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async validateApiKey(
baseUrl: string, apiKey: string
): Promise<ApiValidationResult> {
const trimmedBaseUrl = cleanBaseUrl(baseUrl);
const trimmedApiKey = apiKey.trim();
if (trimmedBaseUrl.length === 0) {
return new ApiValidationResult(false, 0, 0, 'Base URL 为空', 0, '');
}
if (trimme... | https://github.com/midori52000/ArkPilot | d1b40bb8b61c53166277fb836879f9d6fc3dc6e4 | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/data/ItemRdb.ets | arkts | getInstance | 单例模式(全局唯一数据库实例) | static getInstance(): ItemRdb {
if (!ItemRdb.instance) {
ItemRdb.instance = new ItemRdb();
}
return ItemRdb.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 ItemRdb AS... | static getInstance(): ItemRdb {
if (!ItemRdb.instance) {
ItemRdb.instance = new ItemRdb();
}
return ItemRdb.instance;
} | https://gitcode.com/openharmony/codelabs | 2e4edd6af6da412755b0f32520e1f4985ad21b4f | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | claimTask | 签收审批任务
@param approvalId 审批ID
@param nodeId 节点ID | async claimTask(approvalId: string, nodeId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/nodes/${nodeId}/claim`, {})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left claimTask AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async claimTask(approvalId: string, nodeId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/nodes/${nodeId}/claim`, {})
} | https://github.com/David8Idira/AI-OA | d81a6db9ef4411a60f38e0803968c1c91d8a0ebf | github |
jiahaozheng406/huawei-travel-app-HarmonyOS | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getSwiperImages | Get swiper image data.
首页轮播图图片
@return {Array<Resource>} swiperImages. | getSwiperImages(): Array<Resource> {
let swiperImages: Resource[] = [
$r('app.media.Dt1'),
$r('app.media.Dt2'),
$r('app.media.1'),
$r('app.media.2'),
$r('app.media.3'),
$r('app.media.7'),
];
return swiperImages;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSwiperImages 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#:#L... | getSwiperImages(): Array<Resource> {
let swiperImages: Resource[] = [
$r('app.media.Dt1'),
$r('app.media.Dt2'),
$r('app.media.1'),
$r('app.media.2'),
$r('app.media.3'),
$r('app.media.7'),
];
return swiperImages;
} | https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS | d7c3b6aa044f52eab41c4f4724238a7d3f2aae9b | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/TaskDao.ets | arkts | deleteById | 根据 ID 删除任务
@param id 任务 ID
@returns Promise<number> 删除的行数 | async deleteById(id: number): Promise<number> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
p... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async deleteById(id: number): Promise<number> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
p... | https://github.com/Kira-Yagami-Light/Kira-Projects | 6f921a4e48c1bbc9c6455c3ee9b32ca31b71db63 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CommentManager.ets | arkts | toggleReplyLike | Toggle like on a reply | static async toggleReplyLike(commentId: string, replyId: string, username: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
const comments = await CommentManager.getAllComments();
con... | 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 toggleReplyLike AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static async toggleReplyLike(commentId: string, replyId: string, username: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
const comments = await CommentManager.getAllComments();
con... | https://github.com/Harrisonls2004/WaterFlow | 8a617b99d6d928f3b806b8e7359b143b16d22bf3 | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets | arkts | delayInit | update delay init all nodes | public delayInit(): void {
let timeId: number = 0;
timeId = setTimeout(() => {
let listNode: NodeInfo[] = [];
this.initHandler(listNode, 0);
this.listNode.splice(0, this.listNode.length);
this.listNode.push(...listNode);
this.listNode.forEach((value, index) => {
this.noti... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left delayInit 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_s... | public delayInit(): void {
let timeId: number = 0;
timeId = setTimeout(() => {
let listNode: NodeInfo[] = [];
this.initHandler(listNode, 0);
this.listNode.splice(0, this.listNode.length);
this.listNode.push(...listNode);
this.listNode.forEach((value, index) => {
this.noti... | https://gitcode.com/openharmony/arkui_ace_engine | 0e175d554fe4bedd54d517610bfa01c7fb349da0 | gitcode |
openharmony-tpc/zxing | library/src/main/ets/scan/model/CameraService.ets | arkts | decode | 相机扫码解析函数 | async decode(imageData: image.Image, imageComponent: image.Component): Promise<string | undefined | void> {
try {
let width = imageData.size.width
let height = imageData.size.height
const int32Array = new Uint8ClampedArray(imageComponent.byteBuffer)
const luminanceSource = new RGBLuminance... | 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 imageData AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async decode(imageData: image.Image, imageComponent: image.Component): Promise<string | undefined | void> {
try {
let width = imageData.size.width
let height = imageData.size.height
const int32Array = new Uint8ClampedArray(imageComponent.byteBuffer)
const luminanceSource = new RGBLuminance... | https://gitee.com/openharmony-tpc/zxing.git | e887ff95bdf44e6e558b01b41489b984a5ffc9cd | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AnomalyDetection.ets | arkts | calculateStatistics | 从数据数组计算统计摘要 | static calculateStatistics(data: number[]): StatisticalSummary {
const n = data.length;
if (n === 0) {
const empty: StatisticalSummary = {
mean: 0,
median: 0,
stdDev: 0,
variance: 0,
min: 0,
max: 0,
q1: 0,
q3: 0,
iqr: 0,
sam... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateStatistics 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#subscript_ex... | static calculateStatistics(data: number[]): StatisticalSummary {
const n = data.length;
if (n === 0) {
const empty: StatisticalSummary = {
mean: 0,
median: 0,
stdDev: 0,
variance: 0,
min: 0,
max: 0,
q1: 0,
q3: 0,
iqr: 0,
sam... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0fd018bf0349ceb9f029e1d263847859d2c139c8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets | arkts | hasNewPosition | 检查条目是否有新位置 | private hasNewPosition(id: string): boolean {
const snapshot = this.animatingSnapshots.find(s => s.id === id);
return snapshot ? snapshot.fromPos !== snapshot.toPos : false;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasNewPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private hasNewPosition(id: string): boolean {
const snapshot = this.animatingSnapshots.find(s => s.id === id);
return snapshot ? snapshot.fromPos !== snapshot.toPos : false;
} | https://github.com/DaLongZhuaZi/manxia | ca580bbb3bbf3324a74ed5250e4df68230174c86 | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/pbr_material.ets | arkts | setMetallic | Adjust the metallic factor of the PBR material | setMetallic(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).material.factor;
f.z = 2 * v / RESO;
(this.material as MetallicRoughnessMaterial).material.factor = f;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setMetallic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#... | setMetallic(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).material.factor;
f.z = 2 * v / RESO;
(this.material as MetallicRoughnessMaterial).material.factor = f;
}
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 2363c0576167027e7a63b27aa744a1755a0f70bd | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | upsertHostedWebSearchPart | 每次 hosted web_search_call 占用一个独立的 TOOL part, key=hws_<itemId>。
- 首次出现: 插到当前活跃 reasoning/text 之前, 不复用任何已有 part
- 后续事件: 仅在 part 上覆盖 query/url/status, 不影响其它 part
返回 true 表示真的有改动, 调用方可据此决定是否触发 UI 刷新。 | private upsertHostedWebSearchPart(
aiMessage: ChatMessage,
itemKey: string,
outputIndex: number,
query: string,
url: string,
actionType: string,
queries: string[],
status: string
): boolean {
const partId = this.buildOpenAIResponsesHostedPartId(OPENAI_RESPONSES_WEB_SEARCH_PREFIX,... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left upsertHostedWebSearchPart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | private upsertHostedWebSearchPart(
aiMessage: ChatMessage,
itemKey: string,
outputIndex: number,
query: string,
url: string,
actionType: string,
queries: string[],
status: string
): boolean {
const partId = this.buildOpenAIResponsesHostedPartId(OPENAI_RESPONSES_WEB_SEARCH_PREFIX,... | https://github.com/LongLiveY96/chatcube | 2e867b906f2709b84078b372a5e0cc50c890eac7 | github |
Gramony/Gramony | features/home/src/main/ets/entities/Message.ets | arkts | hasFormatting | 检查消息是否包含格式化内容 | public hasFormatting(): boolean {
return this.fmtEntities !== undefined && this.fmtEntities.length > 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasFormatting 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... | public hasFormatting(): boolean {
return this.fmtEntities !== undefined && this.fmtEntities.length > 0;
} | https://github.com/Gramony/Gramony | 63aa06b0b1c0975da2af7cd2ce1557273021a16b | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/utils/AsrDisplayManager.ets | arkts | addListener | Add a listener for state changes | addListener(callback: () => void): void {
this.listeners.add(callback);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left addListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argume... | addListener(callback: () => void): void {
this.listeners.add(callback);
} | https://github.com/Tencent-RTC/TUIKit_Harmony | b3c1fc3b2188c9f755c01b1b69d3e7014cdf9816 | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F001_hello_world/entry/src/main/ets/utils/StringUtil.ets | arkts | isEmpty | 判断字符串是否为空
@param str 待检查的字符串
@returns 如果为空返回 true,否则返回 false | static isEmpty(str: string | null | undefined): boolean {
return str === null || str === undefined || str.trim().length === 0;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AS... | static isEmpty(str: string | null | undefined): boolean {
return str === null || str === undefined || str.trim().length === 0;
} | https://github.com/mqxu/HarmonyOS_In_Action | 40876f5ab269402ed7e9a678684a18f17677fa01 | github |
fbinba3955/Flymby | main/src/main/ets/utils/StringUtil.ets | arkts | number2time | 时长数字(ms)转字符串 | static number2time(number: number) {
if (!number || number < 0) {
return '--:--'
}
const ms: number = number % 1000
const totalSeconds = (number - ms) / 1000
const s: number = totalSeconds % 60
const totalMinutes = (totalSeconds - s) / 60
const m: number = totalMinutes % 60
con... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left number2time AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left number AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | static number2time(number: number) {
if (!number || number < 0) {
return '--:--'
}
const ms: number = number % 1000
const totalSeconds = (number - ms) / 1000
const s: number = totalSeconds % 60
const totalMinutes = (totalSeconds - s) / 60
const m: number = totalMinutes % 60
con... | https://github.com/fbinba3955/Flymby | fc31a2d2ecca11b94e9dc54fea55110cab6a2d60 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/BackgroundRunningManager.ets | arkts | stopBackgroundRunning | 停止后台任务 | async stopBackgroundRunning() {
const context = new UIContext().getHostContext() as Context
backgroundTaskManager.stopBackgroundRunning(context)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left stopBackgroundRunning 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 ... | async stopBackgroundRunning() {
const context = new UIContext().getHostContext() as Context
backgroundTaskManager.stopBackgroundRunning(context)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 7ef62b39a9b379e0d1cb7421813ad33ab7d95ee9 | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/SettingsService.ets | arkts | getPlaybackSpeed | 获取播放速度 | getPlaybackSpeed(): number {
return this.settings.playbackSpeed;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPlaybackSpeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#state... | getPlaybackSpeed(): number {
return this.settings.playbackSpeed;
} | https://github.com/pangpang20/antennaPodHM | 63396e3bca7e1eb6548638b0d70d110d3d96f9db | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setCacheStuffer | ���û�������������Ĭ��ʹ��{@link SimpleTextCacheStuffer}ֻ֧�ִ�������ʾ, �����Ҫͼ�Ļ���������{@link SpannedCacheStuffer}
�����Ҫ����������ʽ����չ{@link SimpleTextCacheStuffer}|{@link SpannedCacheStuffer}
@param cacheStuffer
@param cacheStufferAdapter | public setCacheStuffer(cacheStuffer: BaseCacheStuffer, cacheStufferAdapter: Proxy): DanmakuContext {
this.mCacheStuffer = cacheStuffer;
if (this.mCacheStuffer != null) {
this.mCacheStuffer.setProxy(cacheStufferAdapter);
this.mDisplayer.setCacheStuffer(this.mCacheStuffer);
}
return this;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCacheStuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cacheStuffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public setCacheStuffer(cacheStuffer: BaseCacheStuffer, cacheStufferAdapter: Proxy): DanmakuContext {
this.mCacheStuffer = cacheStuffer;
if (this.mCacheStuffer != null) {
this.mCacheStuffer.setProxy(cacheStufferAdapter);
this.mDisplayer.setCacheStuffer(this.mCacheStuffer);
}
return this;
... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 68147309340acc293f7fbe9e1d2662166be1ed43 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets | arkts | authorize | 使用授权码获取访问令牌
@param authRequest 授权请求
@return Promise<OAuth2Token> 访问令牌
@throws 如果获取令牌失败则抛出异常 | public async authorize(authRequest: OAuth2AuthRequest): Promise<OAuth2Token> {
if (!authRequest.code || authRequest.code.trim().length === 0) {
throw new OAuth2Error(OAuth2ErrorCodes.INVALID_PARAMETERS, 'Authorization code is required');
}
if (this.config.state && authRequest.state !== this.config.... | 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 authorize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left authRequest AST#identifier#Right AST#:#Left : ... | public async authorize(authRequest: OAuth2AuthRequest): Promise<OAuth2Token> {
if (!authRequest.code || authRequest.code.trim().length === 0) {
throw new OAuth2Error(OAuth2ErrorCodes.INVALID_PARAMETERS, 'Authorization code is required');
}
if (this.config.state && authRequest.state !== this.config.... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L70-L96 | 3008fa90e2ead0610d1347e282ecc94edf022dfd | github |
dingzhilin1990/zhilinclaw | src/security/CredentialVault.ets | arkts | delete | 删除凭证
@param id 凭证 ID | public async delete(id: string): Promise<boolean> {
const credential = this.credentials.get(id);
if (!credential) {
return false;
}
this.credentials.delete(id);
this.accessPolicies.delete(id);
// 记录审计日志
await this.securityContext.log({
action: 'delete_credential',
execu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | public async delete(id: string): Promise<boolean> {
const credential = this.credentials.get(id);
if (!credential) {
return false;
}
this.credentials.delete(id);
this.accessPolicies.delete(id);
// 记录审计日志
await this.securityContext.log({
action: 'delete_credential',
execu... | https://github.com/dingzhilin1990/zhilinclaw | 31e5da057daa67b7425fb8efaed199b090cf5c46 | github |
veaba/EsptouchForHarmony | entry/src/main/ets/esptouch/provision/APProvisioner.ets | arkts | normalizeAuth | Normalize auth type string | private normalizeAuth(auth: string): string {
let upper: string = auth.toUpperCase();
if (upper === 'NOPASS' || upper === 'NO PASS' || upper === 'OPEN' || upper === 'NONE') {
return 'open';
}
if (upper === 'WEP') {
return 'WEP';
}
if (upper === 'WPA' || upper === 'WPA2' || upper ==... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left auth AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private normalizeAuth(auth: string): string {
let upper: string = auth.toUpperCase();
if (upper === 'NOPASS' || upper === 'NO PASS' || upper === 'OPEN' || upper === 'NONE') {
return 'open';
}
if (upper === 'WEP') {
return 'WEP';
}
if (upper === 'WPA' || upper === 'WPA2' || upper ==... | https://github.com/veaba/EsptouchForHarmony | 28ce541fc5ba895c442bc5b3013b99e0597512e1 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/component/GoodsDetailRichImageItem.ets | arkts | build | 构建商品详情图片项
@returns {void} 无返回值 | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium")
}
}) {
NetWorkImage({
model: this.pic,
widthValue: P100,
imageFit: ImageFit.Contain,
... | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium")
}
}) {
NetWorkImage({
model: this.pic,
widthValue: P100,
imageFit: ImageFit.Contain,
... | https://github.com/Joker-x-dev/CoolMallArkTS | b48e7e5de1bf05326def0fc20da149a37ff623cd | github |
LiHuaJZOAQ/GuardSysAPP | entry/src/main/ets/pages/WifiManager.ets | arkts | isConnected | 检查WiFi是否已连接 | static isConnected(): boolean {
try {
return wifiManager.isConnected();
} catch (e) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isConnected 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 isConnected(): boolean {
try {
return wifiManager.isConnected();
} catch (e) {
return false;
}
} | https://github.com/LiHuaJZOAQ/GuardSysAPP | a1643faefdb522f387d2f3083ce27e033d90f0ee | github |
bhengubv/aether-protocol | arkts/src/main/ets/vault/ReedSolomonCodec.ets | arkts | invertMatrix | ── GF(256) matrix inversion (Gauss-Jordan) ──────────────────────────────────
Inverts a K×K GF(256) matrix via Gauss-Jordan elimination. The Cauchy/identity
stack guarantees the picked submatrix is non-singular. | private invertMatrix(m: Uint8Array[]): Uint8Array[] {
const n: number = this.k;
// Augment [m | I].
const aug: Uint8Array[] = new Array<Uint8Array>(n);
for (let r = 0; r < n; r++) {
aug[r] = new Uint8Array(2 * n);
aug[r].set(m[r].subarray(0, n), 0);
aug[r][n + r] = 1;
}
for ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left invertMatrix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left m AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expressio... | private invertMatrix(m: Uint8Array[]): Uint8Array[] {
const n: number = this.k;
// Augment [m | I].
const aug: Uint8Array[] = new Array<Uint8Array>(n);
for (let r = 0; r < n; r++) {
aug[r] = new Uint8Array(2 * n);
aug[r].set(m[r].subarray(0, n), 0);
aug[r][n + r] = 1;
}
for ... | https://github.com/bhengubv/aether-protocol | 35bf121805fbecfe10253a1ea21f6a3015425b8b | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/SwipeStateController.ets | arkts | isMenuOpen | 检查指定位置的菜单是否打开 | public isMenuOpen(position: number): boolean {
return this._currentOpenPosition === position;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isMenuOpen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Rig... | public isMenuOpen(position: number): boolean {
return this._currentOpenPosition === position;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | ae3695500d081989b8f8be4f5f223c56e118d1e3 | gitcode |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/model/BreakpointModel.ets | arkts | isLargeOrExtraLargeScreen | Checks if the current device is considered a large or extra large screen.
A screen is considered large if the width breakpoint is WIDTH_LG or WIDTH_XL.
@returns {boolean} True if the current screen is large or extra large, false otherwise. | public isLargeOrExtraLargeScreen(): boolean {
return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_LG ||
this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_XL;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLargeOrExtraLargeScreen 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... | public isLargeOrExtraLargeScreen(): boolean {
return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_LG ||
this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_XL;
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 52f6007fa77a9cec956ad8ee98459418541a7631 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Box.ets | arkts | get | Returns the value contained in the box
@returns T - value in the box | public get(): T|null {
return this.value;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call... | public get(): T|null {
return this.value;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 14732a680456921db0ea4447afeeebd5299563a3 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.