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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundBasicMessageChannel.ets | arkts | send | Sends the specified message to the Flutter application, optionally expecting a reply.
<p>Any uncaught exception thrown by the reply callback will be caught and logged.
@param message the message, possibly null.
@param callback a {@link Reply} callback, possibly null. | send(message: T, callback?: (reply: T)=>void): void {
this.messenger.send(this.name, this.codec.encodeMessage(message),
callback == null ? null : new IncomingReplyHandler(callback, this.codec));
} | AST#program#Left AST#ERROR#Left AST#identifier#Left send AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST#identifier#Left... | send(message: T, callback?: (reply: T)=>void): void {
this.messenger.send(this.name, this.codec.encodeMessage(message),
callback == null ? null : new IncomingReplyHandler(callback, this.codec));
} | https://gitee.com/openharmony-sig/flutter_engine.git | dacf17d58d283488bf5df2b7c35d9f78aa9e469d | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | entries | Returns an array of key, value pairs for every entry in the Uint16Array
@returns { IterableIterator<[int, Number]> } - key, value pairs for every entry in the array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public entries(): IterableIterator<[int, Number]> {
return new Uint16ArrayIteratorEntries(this)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta... | public entries(): IterableIterator<[int, Number]> {
return new Uint16ArrayIteratorEntries(this)
} | https://gitcode.com/iop123123/arkts-static-skills | 21169e87dcb274536cc73c944c42851f9115abf2 | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | handleDeleteClick | delete Editing an Area Item | handleDeleteClick(content: GridObjectSortComponentItem): void {
if (this.clickAddBtn || this.clickRemoveBtn) {
return;
}
this.clickRemoveBtn = true;
this.scaleIcon = 0;
this.arraySelectIsChange = 1;
let currentIndex: int = this.selected.findIndex(val => val.id === content.id);
this.c... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleDeleteClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left content AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GridObjectSortComponentItem AST#ide... | handleDeleteClick(content: GridObjectSortComponentItem): void {
if (this.clickAddBtn || this.clickRemoveBtn) {
return;
}
this.clickRemoveBtn = true;
this.scaleIcon = 0;
this.arraySelectIsChange = 1;
let currentIndex: int = this.selected.findIndex(val => val.id === content.id);
this.c... | https://gitcode.com/openharmony/arkui_ace_engine | 0983d891caacba0d8267499973d985085c63bfbb | gitcode |
midori52000/ArkPilot | Agent/entry/src/main/ets/backend/ProviderConfigStore.ets | arkts | parseTomlString | ── TOML parser (minimal, for our config.toml format) ── | function parseTomlString(value: string): string {
const trimmed = value.trim();
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
return trimmed.substring(1, trimmed.length - 1);
}
return trimmed;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseTomlString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function parseTomlString(value: string): string {
const trimmed = value.trim();
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
return trimmed.substring(1, trimmed.length - 1);
}
return trimmed;
} | https://github.com/midori52000/ArkPilot | d95cd0c72a812900c2acd3502b535a74a210acb5 | github |
Delsin-Yu/JustPDF | entry/src/main/ets/components/PageInfo.ets | arkts | ensureCached | Ensures the page is cached at the specified render scale.
If already cached or caching is in progress, this is a no-op. | public ensureCached(
renderScale: number,
priority: taskpool.Priority
): Promise<PageCache> | undefined {
if (this.caches.has(renderScale) || this.pendingTasks.has(renderScale)) {
return undefined;
}
return this.startNewCacheTask(renderScale, priority);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left ensureCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left renderScale AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | public ensureCached(
renderScale: number,
priority: taskpool.Priority
): Promise<PageCache> | undefined {
if (this.caches.has(renderScale) || this.pendingTasks.has(renderScale)) {
return undefined;
}
return this.startNewCacheTask(renderScale, priority);
} | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L407-L415 | 477cde16f2b870dfcf9692c251f73ea04f68d632 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/TypedEntityData.ets | arkts | getNumber | 获取数字类型的属性值
@param key 属性名
@returns 属性值,如果不存在返回 null | getNumber(key: string): number | null {
const value = this.data.get(key)
if (value === undefined || value === null) {
return null
}
if (typeof value === 'number') {
return value
}
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getNumber 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 strin... | getNumber(key: string): number | null {
const value = this.data.get(key)
if (value === undefined || value === null) {
return null
}
if (typeof value === 'number') {
return value
}
return null
} | https://github.com/offlinecat-dev/OCNetORM | 0627e0f4bc766d0900a44d348529f8b0a1b94c97 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/PaginationHandler.ets | arkts | buildPaginationParams | 构建分页参数 | buildPaginationParams(
sourceId: string,
config: PaginationConfig
): Record<string, string> {
const state = this.paginationStates.get(sourceId);
const params: Record<string, string> = {};
if (!state) {
return params;
}
switch (config.type) {
case 'offset':
params['o... | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left buildPaginationParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | buildPaginationParams(
sourceId: string,
config: PaginationConfig
): Record<string, string> {
const state = this.paginationStates.get(sourceId);
const params: Record<string, string> = {};
if (!state) {
return params;
}
switch (config.type) {
case 'offset':
params['o... | https://github.com/DaLongZhuaZi/manxia | 628750b8312f68e28636a0e92097b4548a25b2da | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CloudSyncRecordDAO.ets | arkts | getById | 根据ID查询同步记录 | static async getById(userId: number, syncId: number): Promise<CloudSyncRecord | null> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
const sql: string = `SELECT * FROM ${CloudSyncRecord.tableName} WHERE user_id = ? AND sync_id = ?`;
let rs: relationalStore.ResultSet | null = null... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#R... | static async getById(userId: number, syncId: number): Promise<CloudSyncRecord | null> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
const sql: string = `SELECT * FROM ${CloudSyncRecord.tableName} WHERE user_id = ? AND sync_id = ?`;
let rs: relationalStore.ResultSet | null = null... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5dd021eef60bf4f9539fc0e04aad0012e3188dd5 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/ToolsUtil.ets | arkts | getVersionName | 获取版本号 | static async getVersionName() {
try {
if (canIUse("SystemCapability.BundleManager.BundleFramework.Core")) {
const bundleInfo =
await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
return bundleInfo.versionName + '(' + bundleInfo.versio... | 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 getVersionName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#E... | static async getVersionName() {
try {
if (canIUse("SystemCapability.BundleManager.BundleFramework.Core")) {
const bundleInfo =
await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
return bundleInfo.versionName + '(' + bundleInfo.versio... | https://github.com/Yebingiscn/SweetVideo | ea19611237e9ecd0992aa6f4ce0584d1758399c3 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/NetworkBoostService.ets | arkts | reportConnectionStatus | connectionStatusUpdate 驱动的 QoE 反馈 | reportConnectionStatus(poor: boolean): void {
if (!this.active) {
return;
}
this.reportInternal(poor ? 'poor' : 'good');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reportConnectionStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left poor AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#... | reportConnectionStatus(poor: boolean): void {
if (!this.active) {
return;
}
this.reportInternal(poor ? 'poor' : 'good');
} | https://github.com/AlkaidLab/moonlight-harmony | 59bdba320e9d2906c214d413950f8b6c45ec2009 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableObjectArray.ets | arkts | set | Sets an element at the specified index
@param { int } index - Element position
@param { UndefinableObject } e - New value
@syscap SystemCapability.Utils.Lang | public set(index: int, e: UndefinableObject): void {
this.data[index] = e
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden... | public set(index: int, e: UndefinableObject): void {
this.data[index] = e
} | https://gitcode.com/iop123123/arkts-static-skills | 8c0adca0b97f0b239b653f2f400f0a2cfe33281d | gitcode |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue312.ets.audit.ets | arkts | globalFancy | 定义在全局的@Styles封装的样式 | @Styles function globalFancy() {
.width(150)
.height(100)
.backgroundColor(Color.Pink)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Styles AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left globalFancy AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left... | @Styles function globalFancy() {
.width(150)
.height(100)
.backgroundColor(Color.Pink)
} | https://gitee.com/openharmony-sig/earth.git | e984ab1817ea2a4e9d1aed24a06ac42d7575dbc3 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | toggleController | 切换虚拟控制器显示 | toggleController(): void {
this.showController = !this.showController;
console.info(`StreamViewModel: 虚拟控制器 ${this.showController ? '显示' : '隐藏'}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | toggleController(): void {
this.showController = !this.showController;
console.info(`StreamViewModel: 虚拟控制器 ${this.showController ? '显示' : '隐藏'}`);
} | https://github.com/AlkaidLab/moonlight-harmony | 231a959cde88134f30405fd0d6a5a645bbe826ec | github |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | products/phone/src/main/ets/pages/customScan/model/ScanLayout.ets | arkts | refreshBreakpoint | Update the breakpoint when the window width and height change.
@param width
@param height | public refreshBreakpoint(width: number, height: number): void {
Logger.info(TAG, `Start to refresh breakpoint. width: ${width}, height ${height}.`);
this.height = height;
this.setWidthBreakpoint(width);
this.setHeightBreakpoint(height);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left refreshBreakpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public refreshBreakpoint(width: number, height: number): void {
Logger.info(TAG, `Start to refresh breakpoint. width: ${width}, height ${height}.`);
this.height = height;
this.setWidthBreakpoint(width);
this.setHeightBreakpoint(height);
} | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | 51df457d28d43ec5cd213ebaf0929a76cadba248 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | toStr | 格式化字符串
@param source
@param defaultValue
@returns | static toStr(source: number | boolean | string | null | undefined, defaultValue = ""): string {
if (source === null || source === undefined) {
return defaultValue;
}
return String(source);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left toStr AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#E... | static toStr(source: number | boolean | string | null | undefined, defaultValue = ""): string {
if (source === null || source === undefined) {
return defaultValue;
}
return String(source);
} | https://github.com/tdcare/tdwebrtc | 260d38567e3e9fa8c8a0ea4d95198922eb2e78a3 | github |
openharmony/update_update_app | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | notifyUpdateStatusRemote | 状态刷新
@param otaStatus 状态 | private async notifyUpdateStatusRemote(eventInfo: update.EventInfo): Promise<void> {
this.log(`notifyUpdateStatusRemote ${JSON.stringify(eventInfo)}`);
let message: Message = {
context: globalThis.extensionContext || globalThis.abilityContext,
eventInfo: eventInfo,
};
this.messageQueue.ex... | 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 notifyUpdateStatusRemote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left eventInfo AST#id... | private async notifyUpdateStatusRemote(eventInfo: update.EventInfo): Promise<void> {
this.log(`notifyUpdateStatusRemote ${JSON.stringify(eventInfo)}`);
let message: Message = {
context: globalThis.extensionContext || globalThis.abilityContext,
eventInfo: eventInfo,
};
this.messageQueue.ex... | https://gitee.com/openharmony/update_update_app.git | 680d1e1466d3e4284fbaf742aeef773d81a550e9 | gitee |
751496032/ZRouter | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | defaultAnimateBuilder | 全局转场动画构造器,构造后还是需要给页面设置NavAnimationModifier,不然不生效
@returns | public defaultAnimateBuilder(): NavAnimParamBuilder {
return NavAnimationStore.getInstance().defaultAnimateBuilder()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left defaultAnimateBuilder 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 ... | public defaultAnimateBuilder(): NavAnimParamBuilder {
return NavAnimationStore.getInstance().defaultAnimateBuilder()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L72-L74 | 4152f4e12785bc8dc94f1c0a74ba27490577b620 | github |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/swipecell/index.ets | arkts | rePosition | 重置偏移并运动 | rePosition() {
// 暂存上一次移动后的位置
this.positionX = this.offsetX
// 判断 positionX 落在哪个区间范围
if (this.positionX < -1 * this.leftWidth - (this.l2r ? (1 - this.rate) : this.rate) * this.rightWidth) {
this.positionX = -1 * (this.leftWidth + this.rightWidth)
} else if (this.positionX < -1 * (this.l2r ? ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left rePosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | rePosition() {
// 暂存上一次移动后的位置
this.positionX = this.offsetX
// 判断 positionX 落在哪个区间范围
if (this.positionX < -1 * this.leftWidth - (this.l2r ? (1 - this.rate) : this.rate) * this.rightWidth) {
this.positionX = -1 * (this.leftWidth + this.rightWidth)
} else if (this.positionX < -1 * (this.l2r ? ... | https://github.com/itrainhub/wu-ui | c1064f8cf8d7a601f54ebb693e736b9c81d88250 | github |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/utils/PreferenceUtil.ets | arkts | getLoginInfo | 【修复】返回类型改为 UserLoginInfo 类,解决 "Object literal" 报错 | async getLoginInfo(): Promise<UserLoginInfo | null> {
if (!this.preferences) return null;
try {
const userId = await this.preferences.get(PreferenceUtil.KEY_CURRENT_USER_ID, 0) as number;
const username = await this.preferences.get(PreferenceUtil.KEY_CURRENT_USERNAME, '') as string;
if (use... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getLoginInfo 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#... | async getLoginInfo(): Promise<UserLoginInfo | null> {
if (!this.preferences) return null;
try {
const userId = await this.preferences.get(PreferenceUtil.KEY_CURRENT_USER_ID, 0) as number;
const username = await this.preferences.get(PreferenceUtil.KEY_CURRENT_USERNAME, '') as string;
if (use... | https://gitcode.com/openharmony/codelabs | 8fcb5890141ae21a128c18317eb9dca77e68c5ef | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | createGlassModifierWithOptions | 使用给定的玻璃效果参数创建修饰符(不含边距/内边距) | public createGlassModifierWithOptions(options: GlassEffectOptions): CommonModifier {
const modifier: CommonModifier = new CommonModifier();
modifier
.backgroundColor(options.backgroundColor ?? options.backgroundColorResource)
.backgroundBlurStyle(options.blurStyle, options.blurOptions)
.bord... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createGlassModifierWithOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | public createGlassModifierWithOptions(options: GlassEffectOptions): CommonModifier {
const modifier: CommonModifier = new CommonModifier();
modifier
.backgroundColor(options.backgroundColor ?? options.backgroundColorResource)
.backgroundBlurStyle(options.blurStyle, options.blurOptions)
.bord... | https://github.com/DaLongZhuaZi/manxia | 232d3aa9144c594435f298f5af41a949f857fffb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Workflow/WorkflowExecutor.ets | arkts | executeWorkflow | 执行工作流 | async executeWorkflow(
workflow: WorkflowDefinition,
context: WorkflowContext
): Promise<ExecutionResult> {
logger.info(TAG, `开始执行工作流: ${workflow.name}`);
logger.debug(TAG, this.capabilities.getCapabilityStats(context));
this.runNgfWorkflowShadow(workflow, context);
try {
let result: ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left executeWorkflow AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left workflow AST#identifier#Right AST#type_annotation#Left... | async executeWorkflow(
workflow: WorkflowDefinition,
context: WorkflowContext
): Promise<ExecutionResult> {
logger.info(TAG, `开始执行工作流: ${workflow.name}`);
logger.debug(TAG, this.capabilities.getCapabilityStats(context));
this.runNgfWorkflowShadow(workflow, context);
try {
let result: ... | https://github.com/DaLongZhuaZi/manxia | 1c52b35bdf8172f15f7db9bcc2dd864caf2cef0e | github |
SMAT-Lab/ArkAnalyzer-HapRay | test_hap/entry/src/main/ets/common/TestRunner.ets | arkts | discoverTestSuite | 发现并加载所有测试模块 | private async discoverTestSuite(): Promise<void> {
try {
// 获取所有已安装应用(包括HSP)
const bundleInfo = await bundleManager.getBundleInfoForSelf(
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA
);
for (const hapModu... | 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 discoverTestSuite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async discoverTestSuite(): Promise<void> {
try {
// 获取所有已安装应用(包括HSP)
const bundleInfo = await bundleManager.getBundleInfoForSelf(
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA
);
for (const hapModu... | https://github.com/SMAT-Lab/ArkAnalyzer-HapRay | ac303977c0890475e6aaaccfb2230f8314d884f0 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncArrayConcurrentQueue.ets | arkts | pop | Removes and returns the first element in the ConcurrentQueue. If the queue is empty, waiting asynchronously.
@returns { Promise<T> } A Promise that resolves when the element has been successfully removed from the queue.
@syscap SystemCapability.Utils.Lang | public async pop(): Promise<Awaited<T>> {
ConcurrencyHelpers.mutexLock(this.mutex);
await this.waitUntilQueueIsNotEmpty();
try {
const val = this.array[this.curHeadIdx];
this.array[this.curHeadIdx] = undefined;
this.increaseHead... | 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 pop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST... | public async pop(): Promise<Awaited<T>> {
ConcurrencyHelpers.mutexLock(this.mutex);
await this.waitUntilQueueIsNotEmpty();
try {
const val = this.array[this.curHeadIdx];
this.array[this.curHeadIdx] = undefined;
this.increaseHead... | https://gitcode.com/iop123123/arkts-static-skills | 584e77cbf54ba377a3936bdd99032331f4bb8c15 | gitcode |
OHPG/FinSdk | plex/src/main/ets/api/SystemApi.ets | arkts | getIdentity | Get server identity info (no auth required)
GET /identity | public async getIdentity(): Promise<PlexResponse> {
return this.apiClient.get({ path: "/identity" })
} | 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 getIdentity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public async getIdentity(): Promise<PlexResponse> {
return this.apiClient.get({ path: "/identity" })
} | https://github.com/OHPG/FinSdk | 09ec7efa2a266ca6f4c32d08f87f51a1240faf78 | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/viewmodel/CalendarViewModel.ets | arkts | formatDateKey | 辅助方法:生成统一的 Key (yyyy-m-d) | private formatDateKey(date: Date): string {
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatDateKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private formatDateKey(date: Date): string {
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
} | https://gitcode.com/openharmony/codelabs | 155ba96aa1a41beb7dc5acb49371a20ecb07c39f | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyStore.ets | arkts | deleteProfile | 删除配置(不允许删除最后一个) | static async deleteProfile(name: string): Promise<boolean> {
await CustomKeyStore.ensureInit();
if (CustomKeyStore.profiles!.length <= 1) return false;
const idx = CustomKeyStore.profiles!.findIndex(p => p.name === name);
if (idx === -1) return false;
CustomKeyStore.profiles!.splice(idx, 1);
i... | 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 deleteProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST... | static async deleteProfile(name: string): Promise<boolean> {
await CustomKeyStore.ensureInit();
if (CustomKeyStore.profiles!.length <= 1) return false;
const idx = CustomKeyStore.profiles!.findIndex(p => p.name === name);
if (idx === -1) return false;
CustomKeyStore.profiles!.splice(idx, 1);
i... | https://github.com/AlkaidLab/moonlight-harmony | 69995f1ce1cf6534fbba21603152c8d208b171bc | github |
codelably/HCompass | core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets | arkts | init | 初始化配置
@param option 配置项
@param writer 自定义写入器实例 | static init(option: Partial<LogOption>, writer?: LogWriter) {
if (option.domain !== undefined) Logger.option.domain = option.domain;
if (option.tag !== undefined) Logger.option.tag = option.tag;
if (option.icon !== undefined) Logger.option.icon = option.icon;
if (option.close !== undefined) Logger.opt... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST... | static init(option: Partial<LogOption>, writer?: LogWriter) {
if (option.domain !== undefined) Logger.option.domain = option.domain;
if (option.tag !== undefined) Logger.option.tag = option.tag;
if (option.icon !== undefined) Logger.option.icon = option.icon;
if (option.close !== undefined) Logger.opt... | https://github.com/codelably/HCompass | 970174ce0f77d5736010dd085a57073e9a72bef3 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | flatMap | Applies flat and than map
fn a function to apply
@return new Array after map and than flat | public flatMap(fn: (v: T, k: number) => Object): Array<Object | null> {
let mapped: Array<Object> = this.map<Object>(fn)
return mapped.flat()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left flatMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public flatMap(fn: (v: T, k: number) => Object): Array<Object | null> {
let mapped: Array<Object> = this.map<Object>(fn)
return mapped.flat()
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7c2a30016a2a6eb2ab46c91f8f5ae6cbe874a80b | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | handleStartLongPress | Start 长按检测(handleGCButtonEvent 和 handleKeyEvent 共用)
@returns true 表示长按已触发,调用方应吐掉此次按键释放 | private handleStartLongPress(isPressed: boolean): boolean {
if (isPressed) {
this.startKeyDownTime = Date.now();
} else if (this.startKeyDownTime > 0) {
const pressDuration = Date.now() - this.startKeyDownTime;
this.startKeyDownTime = 0;
if (pressDuration > GamepadManager.START_LONG_PR... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleStartLongPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isPressed AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolea... | private handleStartLongPress(isPressed: boolean): boolean {
if (isPressed) {
this.startKeyDownTime = Date.now();
} else if (this.startKeyDownTime > 0) {
const pressDuration = Date.now() - this.startKeyDownTime;
this.startKeyDownTime = 0;
if (pressDuration > GamepadManager.START_LONG_PR... | https://github.com/AlkaidLab/moonlight-harmony | a241a94c61f4bb3d39e88e7a23ad22fd717f63ae | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/utils/StepUtils.ets | arkts | syncWithRealData | 同步真实步数数据(现在主要是启动后台监听) | async syncWithRealData(): Promise<void> {
try {
// 启动后台步数监听
await this.stepCounterService.startBackgroundStepTracking();
} catch (error) {
console.error('同步真实步数数据失败:', error);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left syncWithRealData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen... | async syncWithRealData(): Promise<void> {
try {
// 启动后台步数监听
await this.stepCounterService.startBackgroundStepTracking();
} catch (error) {
console.error('同步真实步数数据失败:', error);
}
} | https://gitcode.com/openharmony/codelabs | f27b7f8955651c7613491b9b2b87cd89e1f6c781 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/PatientMonitorController.ets | arkts | sendCommand | 发送控制命令到监护仪设备
监护仪主要是采集数据,不支持太多控制命令 | public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> {
console.log(`PatientMonitorController: Sending command to ${deviceId}`, command);
// 监护仪主要支持重置、校准等操作
const params = command.params;
let action = command.action;
if (action === 'reset') {
// 重置监护仪
cons... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left sendCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> {
console.log(`PatientMonitorController: Sending command to ${deviceId}`, command);
// 监护仪主要支持重置、校准等操作
const params = command.params;
let action = command.action;
if (action === 'reset') {
// 重置监护仪
cons... | https://github.com/LJ666-ui/harmony-health-care | a0fdf7a6e2e60114c70dafd87a01419da9d8500d | github |
AuspiciousSign/HarmonyOS | entry/src/main/ets/database/Rdb.ets | arkts | insertData | 插入数据的方法,入参为表格的存储键值对,和回调函数 | insertData(data: relationalStore.ValuesBucket, callback: Function = () => {
}) {
// 如果回调函数为空、或undefined 打印错误日志,退出方法
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'insertData() has no callback!');
return;
}
// 创建结果标识局部变量... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insertData 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#member_expression#Left AST#identifier#Left rel... | insertData(data: relationalStore.ValuesBucket, callback: Function = () => {
}) {
// 如果回调函数为空、或undefined 打印错误日志,退出方法
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'insertData() has no callback!');
return;
}
// 创建结果标识局部变量... | https://github.com/AuspiciousSign/HarmonyOS | 48a36d497e2bc662aaf693c9dcd3f4ff29a0d56f | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/ContactPage.ets | arkts | showInitial | 显示字母索引的条件 | showInitial(contact: ContactsItem, list: Array<ContactsItem>): boolean {
const index = list.findIndex(item => item.id === contact.id)
if (index === 0) {
return true
}
const prevContact = list[index - 1]
return prevContact.initial !== contact.initial
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showInitial AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contact AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactsItem AST#identifier#Right AST#,#L... | showInitial(contact: ContactsItem, list: Array<ContactsItem>): boolean {
const index = list.findIndex(item => item.id === contact.id)
if (index === 0) {
return true
}
const prevContact = list[index - 1]
return prevContact.initial !== contact.initial
} | https://gitcode.com/openharmony/codelabs | 98a9b95deae538a1db259d244a06bf8ad3fa3b28 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test43_original_index.ets | arkts | testTrim | --- String.trim variants --- | function testTrim(): string {
let s1: string = ' hello ';
let trimmed: string = s1.trim();
let s2: string = 'xxworldxx';
let noTrim: string = s2.trim();
return String(trimmed.length) + ',' + noTrim;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTrim 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#Le... | function testTrim(): string {
let s1: string = ' hello ';
let trimmed: string = s1.trim();
let s2: string = 'xxworldxx';
let noTrim: string = s2.trim();
return String(trimmed.length) + ',' + noTrim;
} | https://github.com/miaochiahao/ark-ghidra | 63f60057f3441167240d6e90344fc1fc86208c85 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new DivideByZeroError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super("DivideByZeroError", message, options)
} | 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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super("DivideByZeroError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 0a2354d1d94763b589e4c5b452226d0f389d271f | gitcode |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets | arkts | getWidthWeightMessage | Get Width Weight Message
@param sectionStatus - page's section number
@return WidthWeightMessage | getWidthWeightMessage(sectionStatus: number): WidthWeightMessage {
LogUtil.info(TAG, "sectionStatus " + sectionStatus.toString())
return widthWeightMessageMap[sectionStatus]
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWidthWeightMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sectionStatus AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)... | getWidthWeightMessage(sectionStatus: number): WidthWeightMessage {
LogUtil.info(TAG, "sectionStatus " + sectionStatus.toString())
return widthWeightMessageMap[sectionStatus]
} | https://gitee.com/openharmony/applications_notes.git | c4bcdc807d49628f828a142b9e075c425af29298 | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | login | Login user. | static async login(username: string, password: string): Promise<boolean> {
const result = await UserManager.loginWithResult(username, password);
return result.success;
} | 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 login AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | static async login(username: string, password: string): Promise<boolean> {
const result = await UserManager.loginWithResult(username, password);
return result.success;
} | https://github.com/Harrisonls2004/WaterFlow | 99e32c5e91ae23cc479507f455f23e423920c647 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | select | 查询指定字段的数据,仅最后调用有效
@param sql sql语句
@returns Wrapper | select(...field: string[]): Wrapper {
this.selectSql = field.join(',')
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left select AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | select(...field: string[]): Wrapper {
this.selectSql = field.join(',')
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L321-L324 | f2759a335258c76620af0431d27ffec5cc943e1b | github |
arkui-x/samples | CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/components/Component.ets | arkts | aboutToAppear | 窗口管理model | aboutToAppear(): void {
const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage');
if (!windowStage) {
console.info('windowStage init error!');
return;
}
const windowClass: window.Window | undefined = windowStage.getMainWindowSync();
windowClass.on('avoidAreaCha... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage');
if (!windowStage) {
console.info('windowStage init error!');
return;
}
const windowClass: window.Window | undefined = windowStage.getMainWindowSync();
windowClass.on('avoidAreaCha... | https://gitcode.com/arkui-x/samples | 6aee65e4b87aaf93d1cab3b7d12e2bc5261119a9 | gitcode |
Joker-x-dev/CoolMallArkTS | core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets | arkts | loadListData | 加载列表数据
@returns {void} 无返回值 | protected loadListData(): void {
RequestHelper.repository<NetworkPageData<T>>(this.requestListData())
.toast(this.showErrorToast)
.execute()
.then((data: NetworkPageData<T>): void => this.handleSuccess(data))
.catch((err: Error): void => this.handleError(err))
.finally((): void => {
... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left loadListData 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#... | protected loadListData(): void {
RequestHelper.repository<NetworkPageData<T>>(this.requestListData())
.toast(this.showErrorToast)
.execute()
.then((data: NetworkPageData<T>): void => this.handleSuccess(data))
.catch((err: Error): void => this.handleError(err))
.finally((): void => {
... | https://github.com/Joker-x-dev/CoolMallArkTS | 8ee420de2777672b5f43de1cf1772dda77854e99 | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | loadState | 加载状态
@param slot 存档槽位索引 (0-9)
@returns 加载是否成功 | static loadState(slot: number): boolean {
return MelonDSNative.native.loadState(slot);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left loadState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slot AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | static loadState(slot: number): boolean {
return MelonDSNative.native.loadState(slot);
} | https://github.com/richshaw2015/nds | ec186555e873b6196e195fab65d2b9532c19e6c1 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets | arkts | generateFileName | 生成录音文件名 | private generateFileName(): string {
const timestamp = Date.now()
return `recording_${timestamp}.m4a`
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateFileName 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... | private generateFileName(): string {
const timestamp = Date.now()
return `recording_${timestamp}.m4a`
} | https://gitcode.com/openharmony/codelabs | 051d88f5543868213273c791f7c1f5d44f170565 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | clearSourceIconCache | 清除所有图源图标缓存 | public clearSourceIconCache(): boolean {
try {
const iconDir = this.getSourceIconCacheDir();
const files = SafeFileUtils.listFileSync(iconDir);
for (const file of files) {
try {
SafeFileUtils.unlinkSync(`${iconDir}/${file}`);
} catch (e) {
// ignore
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearSourceIconCache 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 bool... | public clearSourceIconCache(): boolean {
try {
const iconDir = this.getSourceIconCacheDir();
const files = SafeFileUtils.listFileSync(iconDir);
for (const file of files) {
try {
SafeFileUtils.unlinkSync(`${iconDir}/${file}`);
} catch (e) {
// ignore
}
... | https://github.com/DaLongZhuaZi/manxia | 85a2fa5559e84d0d7425ffc65dd7efc09ee310dc | github |
Countly/countly-sdk-hos | library/src/main/ets/Countly.ets | arkts | initShared | Returns the default shared instance, creating one if it doesn't exist.
If a shared instance already exists AND is still usable (not stopped,
not halted, not locked post-UCM-revoke), returns it unchanged, this
keeps initShared idempotent in the common case where an integrator
calls it from multiple entry points without ... | public static async initShared(config: CountlyConfig, storageOverride?: Storage, networkOverride?: Network): Promise<CountlyInstance> {
if (Countly.shared) {
const existing: CountlyInstance = Countly.shared;
const needsReplace: boolean = existing.config.halted || existing.config.consentLockedPostUnkno... | 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 initShared AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config ... | public static async initShared(config: CountlyConfig, storageOverride?: Storage, networkOverride?: Network): Promise<CountlyInstance> {
if (Countly.shared) {
const existing: CountlyInstance = Countly.shared;
const needsReplace: boolean = existing.config.halted || existing.config.consentLockedPostUnkno... | https://github.com/Countly/countly-sdk-hos | 4d942c28b11623f2b68df723373ab24de224a03d | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | getTitleColor | 获取标题颜色
@returns 文字颜色 | public getTitleColor(): ColorType {
return this.titleColor;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTitleColor 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 ColorTyp... | public getTitleColor(): ColorType {
return this.titleColor;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | a592d2abd0f4b6ab00593648516ea61a699a3024 | gitcode |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/AudioUtils.ets | arkts | getDuration | 获取总时长 (秒) | getDuration(): number {
return this.player?.duration ? Math.floor(this.player.duration / 1000) : 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_... | getDuration(): number {
return this.player?.duration ? Math.floor(this.player.duration / 1000) : 0;
} | https://github.com/Coke0807/NewsAPP-HarmonyOS | 51adeb8231a2348fb0dad1db17564ff073b04084 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/views/pages/CfChallengePage.ets | arkts | onTurnstileError | ---------------------------------------------------------------------------
JS Bridge 回调(由 registerJavaScriptProxy 注入)
--------------------------------------------------------------------------- | onTurnstileError(message: string): void {
if (this.finished) return;
if (message.length > 0) {
this.errorMessage = message;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTurnstileError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST... | onTurnstileError(message: string): void {
if (this.finished) return;
if (message.length > 0) {
this.errorMessage = message;
}
} | https://github.com/Amaz1ny/HarmonyDO-public | a120c0413a6f5ea2c6dda0fce7c1996adf8570e1 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | with | Creates a copy with replaced value on index
@param { int } index - index to change
@param { number } value - value to set
@returns { Int8Array } - an Int8Array with replaced value on index
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageMo... | public with(index: int, value: number): Int8Array {
let res = new Int8Array(this)
res.set(index, value.toByte())
return res
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | public with(index: int, value: number): Int8Array {
let res = new Int8Array(this)
res.set(index, value.toByte())
return res
} | https://gitcode.com/iop123123/arkts-static-skills | f3197df003e3115f25ca15e53bd55dd7a212e44b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getAncestorElements | 获取祖先元素 | private getAncestorElements(element: string, tag: string, fullContent: string): string[] {
const results: string[] = [];
let currentElement = element;
while (true) {
const parents = this.getParentElement(currentElement, '*', fullContent);
if (parents.length === 0) break;
cons... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getAncestorElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private getAncestorElements(element: string, tag: string, fullContent: string): string[] {
const results: string[] = [];
let currentElement = element;
while (true) {
const parents = this.getParentElement(currentElement, '*', fullContent);
if (parents.length === 0) break;
cons... | https://github.com/DaLongZhuaZi/manxia | 00f0477dbda9315c2bf83f4cb2f80bfb7377fc22 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | enterBackgroundMode | ==================== Background Mode & Audio Priority ====================
Enter background mode (stop graphics, continue audio)
Use when app goes to background or screen is locked | static enterBackgroundMode(inst: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpEnterBackgroundMode(inst);
} catch (e) {
console.error(`${LibFreeRDP.TAG}: enterBackgroundMode... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left enterBackgroundMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static enterBackgroundMode(inst: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpEnterBackgroundMode(inst);
} catch (e) {
console.error(`${LibFreeRDP.TAG}: enterBackgroundMode... | https://github.com/tangwengang-del/freerdp-harmonyos | 662816e96254cdff77ca4f75715881937f637910 | github |
openharmony-sig/flutter_packages | packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets | arkts | launchAppGallery | 跳转到应用商店详情页
文档参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs/faqs-ability-kit#section42001122242
@param url
@returns | launchAppGallery(url: string): boolean {
Log.d(TAG, 'launchAppGallery:' + url);
//url 格式示范 store://appgallery.huawei.com/app/detail?id=C5765880207855137621
let want: Want = {
'action': 'ohos.want.action.appdetail',
'uri': url,
};
try {
this.context.startAbility(want)
} catch ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left launchAppGallery 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 )... | launchAppGallery(url: string): boolean {
Log.d(TAG, 'launchAppGallery:' + url);
//url 格式示范 store://appgallery.huawei.com/app/detail?id=C5765880207855137621
let want: Want = {
'action': 'ohos.want.action.appdetail',
'uri': url,
};
try {
this.context.startAbility(want)
} catch ... | https://gitee.com/openharmony-sig/flutter_packages.git | 4bff4ca915c463a702878339fc424dca377794b9 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<short> } items - a set of elements to include in the new array object.
@returns { Uint8Array } - a new Uint8Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<short>): Uint8Array {
let res = new Uint8Array(items.length.toInt())
res.ofShort(stub.toValueArray(items))
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<short>): Uint8Array {
let res = new Uint8Array(items.length.toInt())
res.ofShort(stub.toValueArray(items))
return res
} | https://gitcode.com/iop123123/arkts-static-skills | 7d4dfc607d97ac1c107b32f0143b2c5d4c98902c | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/network/JellyfinApiClient.ets | arkts | buildAuthorization | 构建 X-Emby-Authorization 值
格式:MediaBrowser Client="...", Device="...", DeviceId="...", Version="...", Token="..."
Jellyfin 10.12+ 默认不再支持标准 Authorization header,必须使用 X-Emby-Authorization
@param includeToken 是否包含 Token(登录请求时不含) | private buildAuthorization(includeToken: boolean): string {
let values: string[] = [
`Client="${encodeURIComponent(this.clientInfo.name)}"`,
`Device="${encodeURIComponent(this.deviceInfo.name)}"`,
`DeviceId="${encodeURIComponent(this.deviceInfo.id)}"`,
`Version="${encodeURIComponent(this.c... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildAuthorization AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left includeToken AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boole... | private buildAuthorization(includeToken: boolean): string {
let values: string[] = [
`Client="${encodeURIComponent(this.clientInfo.name)}"`,
`Device="${encodeURIComponent(this.deviceInfo.name)}"`,
`DeviceId="${encodeURIComponent(this.deviceInfo.id)}"`,
`Version="${encodeURIComponent(this.c... | https://github.com/OHPG/FinSdk | f0336c0bb834ab2532b2aba3f5496c70367c30a9 | github |
apap6628114/nga_oh | entry/src/main/ets/common/managers/ThreadPaginationManager.ets | arkts | appendPosts | 向后追加一页帖子,按 lou 去重。
@param rawPosts - 待追加的帖子
@param page - 页码
@param totalPages - 总页数
@returns 实际新增(去重后)的帖子 | appendPosts(rawPosts: PostInfo[], page: number, totalPages: number): PostInfo[] {
const deduped: PostInfo[] = []
for (let i = 0; i < rawPosts.length; i++) {
if (!this.loadedLouSet.has(rawPosts[i].lou)) {
deduped.push(rawPosts[i])
}
this.loadedLouSet.add(rawPosts[i].lou)
}
if ... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left appendPosts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rawPosts AST#identifier#Right AST#:#Left : AST#:#Right ... | appendPosts(rawPosts: PostInfo[], page: number, totalPages: number): PostInfo[] {
const deduped: PostInfo[] = []
for (let i = 0; i < rawPosts.length; i++) {
if (!this.loadedLouSet.has(rawPosts[i].lou)) {
deduped.push(rawPosts[i])
}
this.loadedLouSet.add(rawPosts[i].lou)
}
if ... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L73-L105 | bbcd62148900f252a88b6b66c8a946f666ee8874 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Search/SearchIntentParser.ets | arkts | parsePrefixedId | 解析带前缀的ID | private static parsePrefixedId(text: string): SearchIntent | null {
const lowerText = text.toLowerCase();
for (let i = 0; i < SearchIntentParser.ID_PREFIXES.length; i++) {
const config = SearchIntentParser.ID_PREFIXES[i];
if (lowerText.startsWith(config.prefix)) {
const id = text.substrin... | 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 parsePrefixedId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left... | private static parsePrefixedId(text: string): SearchIntent | null {
const lowerText = text.toLowerCase();
for (let i = 0; i < SearchIntentParser.ID_PREFIXES.length; i++) {
const config = SearchIntentParser.ID_PREFIXES[i];
if (lowerText.startsWith(config.prefix)) {
const id = text.substrin... | https://github.com/DaLongZhuaZi/manxia | 3e06f153b67003df5b80b275a375145cb5f7d016 | github |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/AudioUtils.ets | arkts | seek | 跳转到指定位置 (毫秒) | async seek(position: number): Promise<void> {
if (this.player && this.isPrepared) {
await this.player.seek(position);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left seek AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left position AST#identifier#Right AST#type_a... | async seek(position: number): Promise<void> {
if (this.player && this.isPrepared) {
await this.player.seek(position);
}
} | https://github.com/Coke0807/NewsAPP-HarmonyOS | 22b6ced5df54b8ea13fe79e1a48c4f8be64f2cc0 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int32Array from Array<int>
@param { Array<int> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: Array<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i])
}
} | 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#instantiation_expression#Left AST#identifier#Left numbers AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST... | public constructor(numbers: Array<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i])
}
} | https://gitcode.com/iop123123/arkts-static-skills | 38b1ef25ce23e3e00e2c2e67efd98dce761694a7 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarDataSet.ets | arkts | setBarBorderWidth | Sets the width used for drawing borders around the bars.
If borderWidth == 0, no border will be drawn.
@return | public setBarBorderWidth(width: number): void {
this.mBarBorderWidth = width;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBarBorderWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setBarBorderWidth(width: number): void {
this.mBarBorderWidth = width;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6081ccd38b92794ceadd2ee93e9f1e0d6e569539 | gitee |
CsCesium/KantaiHomo | entry/src/main/ets/features/alerts/module/expeditionNotification.ets | arkts | refresh | ── 核心刷新 ── | async refresh(): Promise<void> {
try {
const hub = getRepositoryHub();
// 从 expeditions 表取进行中的远征(progress = 1 = RUNNING)
const expeditions = await hub.expedition.list();
const decks = await hub.deck.list();
const deckNameMap = new Map<number, string>(decks.map(d => [d.deckId, d.nam... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left refresh AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type... | async refresh(): Promise<void> {
try {
const hub = getRepositoryHub();
// 从 expeditions 表取进行中的远征(progress = 1 = RUNNING)
const expeditions = await hub.expedition.list();
const decks = await hub.deck.list();
const deckNameMap = new Map<number, string>(decks.map(d => [d.deckId, d.nam... | https://github.com/CsCesium/KantaiHomo | 1ba986b0b688a719029ebcc6debc0a908f5137da | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ImportExportService.ets | arkts | writeTextFile | ============ 工具方法 ============ | private writeTextFile(filePath: string, content: string): void {
try {
const file = fileIo.openSync(filePath, fileIo.OpenMode.CREATE | fileIo.OpenMode.READ_WRITE)
fileIo.writeSync(file.fd, content)
fileIo.closeSync(file)
} catch (error) {
throw new Error(`Write text file failed: ${JSON... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left writeTextFile 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#stri... | private writeTextFile(filePath: string, content: string): void {
try {
const file = fileIo.openSync(filePath, fileIo.OpenMode.CREATE | fileIo.OpenMode.READ_WRITE)
fileIo.writeSync(file.fd, content)
fileIo.closeSync(file)
} catch (error) {
throw new Error(`Write text file failed: ${JSON... | https://github.com/LongLiveY96/chatcube | 5cc8d961a6513242d3472c2fdfd1becc9863caf9 | github |
RoooyHe/toona-ohos | toona/src/main/ets/pages/components/MessageBubble.ets | arkts | startPlayAnimation | 启动播放动画 (1 -> 2 -> 3 循环) | startPlayAnimation() {
this.waveIndex = 1;
// 每 400ms 切换一帧,模拟声波向外扩散
const self = this;
this.animationInterval = setInterval(() => {
self.waveIndex = (self.waveIndex % 3) + 1;
}, 400);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startPlayAnimation 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... | startPlayAnimation() {
this.waveIndex = 1;
// 每 400ms 切换一帧,模拟声波向外扩散
const self = this;
this.animationInterval = setInterval(() => {
self.waveIndex = (self.waveIndex % 3) + 1;
}, 400);
} | https://github.com/RoooyHe/toona-ohos | f3ff18e0d2f88d5dd2b7c132a195dc99c4f5fbf7 | github |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/AutoMenuManager.ets | arkts | _readConfigFromSingleAbilityInfo | Read access method configuration information and convert it to the corresponding data class | private async _readConfigFromSingleAbilityInfo(context: Context,
abilityInfo: bundleManager.ExtensionAbilityInfo | bundleManager.AbilityInfo): Promise<MenuConfig[]> {
// Get MetaData data
let singleAbilityMenuConfigList: MenuConfig[] = [];
for (let index = 0; index < abilityInfo.metadata.length; ind... | 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 _readConfigFromSingleAbilityInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifi... | private async _readConfigFromSingleAbilityInfo(context: Context,
abilityInfo: bundleManager.ExtensionAbilityInfo | bundleManager.AbilityInfo): Promise<MenuConfig[]> {
// Get MetaData data
let singleAbilityMenuConfigList: MenuConfig[] = [];
for (let index = 0; index < abilityInfo.metadata.length; ind... | https://gitee.com/openharmony/security_privacy_center.git | 4e648c97104c0216547274c6f6ad0fc5cbc0ea47 | gitee |
openharmony/applications_call | mobiledatasettings/src/main/ets/pages/index.ets | arkts | getAirPlaneMode | query AirPlane Mode | getAirPlaneMode() {
LogUtils.i(TAG, 'getAirPlaneMode');
try {
queryAirPlaneMode((data) => {
LogUtils.i(TAG, 'getAirPlaneMode callback');
this.isAirPlaneMode = data == 1 ? true : false;
});
} catch (err) {
LogUtils.e(TAG, `getAirPlaneMode err = ${JSON.stringify(err)}`);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAirPlaneMode 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#Le... | getAirPlaneMode() {
LogUtils.i(TAG, 'getAirPlaneMode');
try {
queryAirPlaneMode((data) => {
LogUtils.i(TAG, 'getAirPlaneMode callback');
this.isAirPlaneMode = data == 1 ? true : false;
});
} catch (err) {
LogUtils.e(TAG, `getAirPlaneMode err = ${JSON.stringify(err)}`);
... | https://gitee.com/openharmony/applications_call.git | e1fdefa55c273a2d9320f23d6f07e9a85ad77ad6 | gitee |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets | arkts | stopContinuousTask | 结束后台任务
@returns {void} | stopContinuousTask(): void {
// 避免重新停止后台任务
if (!this.isBackgroundTaskRunning) {
return;
}
// TODO:知识点:停止后台任务
backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => {
console.info(`Succeeded in operationing stopBackgroundRunning.`);
this.isBackgroundTaskRunning... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopContinuousTask 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... | stopContinuousTask(): void {
// 避免重新停止后台任务
if (!this.isBackgroundTaskRunning) {
return;
}
// TODO:知识点:停止后台任务
backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => {
console.info(`Succeeded in operationing stopBackgroundRunning.`);
this.isBackgroundTaskRunning... | https://gitcode.com/arkui-x/samples | 55a97db82a03ed17741226d44bece0591f79e292 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | detach | 解除多对多关联
从中间表中删除一条关联记录
@param sourceId 源实体主键值
@param targetId 目标实体主键值
@param relationName 关联属性名
@returns Promise<DeleteResult>
@throws RelationNotFoundError 如果关联关系未注册
Requirements: 5.6 | async detach(sourceId: ValueType, targetId: ValueType, relationName: string): Promise<DeleteResult> {
this.ensureWritePathAllowed('DETACH')
return await this.withSessionStore(async (repo) => {
const result = await repo.relationManager.detach(sourceId, targetId, relationName)
return repo.ensureDele... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left detach AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AS... | async detach(sourceId: ValueType, targetId: ValueType, relationName: string): Promise<DeleteResult> {
this.ensureWritePathAllowed('DETACH')
return await this.withSessionStore(async (repo) => {
const result = await repo.relationManager.detach(sourceId, targetId, relationName)
return repo.ensureDele... | https://github.com/offlinecat-dev/OCNetORM | 0c36cf3ca25dde19db6ef881e90621b43de28e9a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets | arkts | enterPrivacyMode | 进入隐私模式 | public async enterPrivacyMode(): Promise<boolean> {
try {
// 优先尝试生物识别
const biometricSupported = await this.checkBiometricSupport();
let authenticated = false;
if (biometricSupported) {
authenticated = await this.authenticateWithBiometric();
}
// 如果生物识别失败或不支持,返回false让... | 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 enterPrivacyMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public async enterPrivacyMode(): Promise<boolean> {
try {
// 优先尝试生物识别
const biometricSupported = await this.checkBiometricSupport();
let authenticated = false;
if (biometricSupported) {
authenticated = await this.authenticateWithBiometric();
}
// 如果生物识别失败或不支持,返回false让... | https://github.com/DaLongZhuaZi/manxia | fdf65eb23cfef2294ee4dffc7fbee0a586d65ca8 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | findLastIndex | Finds an index of the last element in the BigUint64Array that satisfies the condition
@param fn condition
@returns the index of the last element that satisfies fn, -1 otherwise | public findLastIndex(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): int {
for (let i = this.length - 1; i >= 0; --i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public findLastIndex(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): int {
for (let i = this.length - 1; i >= 0; --i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2ce7ecd3e02ec5142d8c516091fb7e0959efe0c7 | gitee |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | setMaxUnknownWords | 设置最大未知词汇数量 | setMaxUnknownWords(max: number): void {
this.maxUnknownWords = max;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMaxUnknownWords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left max AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left... | setMaxUnknownWords(max: number): void {
this.maxUnknownWords = max;
} | https://github.com/CLMC2025/Vignette | c4d6480d66d0a58e903a64903d8e020b4872a567 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | startDownload | 开始下载任务
@param taskId 任务ID
@param sourceId 书源ID
@param chapters 要下载的章节列表(已筛选的章节)
@param callback 进度回调 | async startDownload(
taskId: string,
sourceId: string,
chapters: LegadoChapter[],
callback?: DownloadProgressCallback
): Promise<void> {
const task = this.downloadTasks.get(taskId);
if (!task) {
logger.error(TAG, `下载任务不存在: ${taskId}`);
return;
}
if (this.activeDownloads.... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startDownload AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left taskId AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async startDownload(
taskId: string,
sourceId: string,
chapters: LegadoChapter[],
callback?: DownloadProgressCallback
): Promise<void> {
const task = this.downloadTasks.get(taskId);
if (!task) {
logger.error(TAG, `下载任务不存在: ${taskId}`);
return;
}
if (this.activeDownloads.... | https://github.com/DaLongZhuaZi/manxia | b9a64c3d7528bd7121a0093f1439bb6f0da74be4 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | getRelatedArray | 获取关联数据(数组类型)
@param propertyName 关联属性名
@returns 关联实体数组,如果不存在或类型不匹配返回空数组 | getRelatedArray(propertyName: string): Array<EntityData> {
const value = this.relatedData.get(propertyName)
if (value && value.isArray) {
return value.entityArray
}
return []
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getRelatedArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right A... | getRelatedArray(propertyName: string): Array<EntityData> {
const value = this.relatedData.get(propertyName)
if (value && value.isArray) {
return value.entityArray
}
return []
} | https://github.com/offlinecat-dev/OCNetORM | 7d5caabd6b8729ef5dc59ee74832c9864cd61d6e | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/ParentApiClient.ets | arkts | rejectLessonDraft | Reject a pending draft. Server returns the (now-rejected) draft. | async rejectLessonDraft(draftId: string): Promise<LessonDraftDto> {
const url: string = `${this.lessonFamilyBase()}/lesson-drafts/${draftId}/reject`;
const headers: Record<string, string> = ParentApiClient.jsonHeaders();
const res: ParentFetchResult = await this.adapter.post(url, headers, '{}');
Paren... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left rejectLessonDraft AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left draftId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async rejectLessonDraft(draftId: string): Promise<LessonDraftDto> {
const url: string = `${this.lessonFamilyBase()}/lesson-drafts/${draftId}/reject`;
const headers: Record<string, string> = ParentApiClient.jsonHeaders();
const res: ParentFetchResult = await this.adapter.post(url, headers, '{}');
Paren... | https://github.com/terryma2024/happyword | 85b0f08af19b25f29ec4447a3ff9e29baa293be7 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/FilterRuleEngine.ets | arkts | parseIgnorePatterns | 从字符串解析过滤规则配置(用于 UI 输入) | static parseIgnorePatterns(input: string): string[] {
return input.split(/[,\n]/).map(s => s.trim()).filter(s => s.length > 0);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseIgnorePatterns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static parseIgnorePatterns(input: string): string[] {
return input.split(/[,\n]/).map(s => s.trim()).filter(s => s.length > 0);
} | https://github.com/XJTUWYD/ArkDiff | 6b049bc9afa618a12a37d985a4848895dfd82df0 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/QueryHelper.ets | arkts | mapRowToBill | 将查询结果映射为 Bill 实例
@param resultSet 查询结果集
@returns Bill 对象
@throws | private static mapRowToBill(resultSet: relationalStore.ResultSet): Bill {
return new Bill(
resultSet.getLong(resultSet.getColumnIndex('bill_id')),
resultSet.getLong(resultSet.getColumnIndex('user_id')),
resultSet.getLong(resultSet.getColumnIndex('account_id')),
resultSet.getLong(resultSet.... | 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 mapRowToBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Le... | private static mapRowToBill(resultSet: relationalStore.ResultSet): Bill {
return new Bill(
resultSet.getLong(resultSet.getColumnIndex('bill_id')),
resultSet.getLong(resultSet.getColumnIndex('user_id')),
resultSet.getLong(resultSet.getColumnIndex('account_id')),
resultSet.getLong(resultSet.... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 71f61f1b2132f131018250e2fb7f46404454ec5a | github |
HarmonyOS_Samples/BestPracticeSnippets | ComponentReuse/entry/src/main/ets/view/UpdaterComponent.ets | arkts | getUpdaterComponent | [End opt_updater]
[End updater_component] | @Builder
function getUpdaterComponent(name: string): void {
if (name === Constants.NAV_DESTINATION_ITEM_1) {
NavDestination() {
UpdaterComponent()
}
.title(title())
.backgroundColor('#F1F3F5')
}
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left getUpdaterComponent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right A... | @Builder
function getUpdaterComponent(name: string): void {
if (name === Constants.NAV_DESTINATION_ITEM_1) {
NavDestination() {
UpdaterComponent()
}
.title(title())
.backgroundColor('#F1F3F5')
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | fbf9c7b6f624ff47cb71df78e840050cb687ebad | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/UnknownFields.ets | arkts | toBytes | 获取原始二进制数据
@returns 未知字段的原始数据
注意:返回的是内部数组的引用,不要修改!
如需修改,请先调用 slice() 复制。 | toBytes(): Uint8Array {
return this.data
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toBytes 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 Uint8Array AST#identifier#Right AST#ERROR#Right AST#st... | toBytes(): Uint8Array {
return this.data
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 707a9b157be8a3dbea1dad9a155834c68e3b4919 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | getWorkflowCount | 获取工作流数量 | private getWorkflowCount(workflows: Workflow): number {
let count = 0;
if (this.getWorkflowByType(workflows, WorkflowType.INITIALIZE)) count++;
if (this.getWorkflowByType(workflows, WorkflowType.LOGIN)) count++;
if (this.getWorkflowByType(workflows, WorkflowType.SEARCH)) count++;
if (this.getWorkf... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getWorkflowCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left workflows AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Workflo... | private getWorkflowCount(workflows: Workflow): number {
let count = 0;
if (this.getWorkflowByType(workflows, WorkflowType.INITIALIZE)) count++;
if (this.getWorkflowByType(workflows, WorkflowType.LOGIN)) count++;
if (this.getWorkflowByType(workflows, WorkflowType.SEARCH)) count++;
if (this.getWorkf... | https://github.com/DaLongZhuaZi/manxia | fad44804a08e8da31fdabae602dd2b9360a9c1b4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SessionManager.ets | arkts | isRefreshing | 是否正在刷新 | isRefreshing(sourceId: number): boolean {
return this.refreshTimers.has(sourceId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRefreshing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#... | isRefreshing(sourceId: number): boolean {
return this.refreshTimers.has(sourceId);
} | https://github.com/DaLongZhuaZi/manxia | 6d0e9eb2d3b4e0cd154bb05ab43b5d84818aac94 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | every | Checks that all elements of BigUint64Array satisfy the passed function
@param fn check function
@returns true if all elements satisfy fn | public every(fn: (element: BigInt, index: int, array: BigUint64Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Rig... | public every(fn: (element: BigInt, index: int, array: BigUint64Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | da520c1979956b629ef0e997a7fda4d7d6cfb510 | gitee |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/WindowService.ets | arkts | setup | 在 EntryAbility.onWindowStageCreate 的 loadContent 成功回调里调用。 | static setup(windowStage: window.WindowStage): void {
try {
const win: window.Window = windowStage.getMainWindowSync();
WindowService.win = win;
// 隐藏系统标题栏的图标与应用名,仅保留右上角三键区,内容延伸至顶部
win.setWindowDecorVisible(false);
try { win.setWindowDecorHeight(48); } catch (e) {
hilog.warn... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left setup AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Lef... | static setup(windowStage: window.WindowStage): void {
try {
const win: window.Window = windowStage.getMainWindowSync();
WindowService.win = win;
// 隐藏系统标题栏的图标与应用名,仅保留右上角三键区,内容延伸至顶部
win.setWindowDecorVisible(false);
try { win.setWindowDecorHeight(48); } catch (e) {
hilog.warn... | https://github.com/picklerick422/zju-learning-assistant-OH | 65ac5e4df85f231f7cc0ffd6961f7e00efe4841a | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | sendCursorEvent | Send a cursor/mouse event | static sendCursorEvent(inst: number, x: number, y: number, flags: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
return freerdpNative!.freerdpSendCursorEvent(inst, x, y, flags);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendCursorEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static sendCursorEvent(inst: number, x: number, y: number, flags: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
return freerdpNative!.freerdpSendCursorEvent(inst, x, y, flags);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 393f89db270f0f7d0efa221b81863fc5f32d77fb | github |
arkui-x/samples | CodeLab/Cases/feature/blendmode/src/main/ets/model/DataSource.ets | arkts | getData | 获取当前下标的数据
@param index 下标
@returns 当前下标所对应的数据 | getData(index: number): PendantType {
return this.pendantData[index];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#... | getData(index: number): PendantType {
return this.pendantData[index];
} | https://gitcode.com/arkui-x/samples | 13af436644ebc4a82f24ed7a300c048bf0cb2e5c | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | setImageRect | Set image rect.
@param image | setImageRect(image: RectF) {
this.imageRect.set(image.left, image.top, image.right, image.bottom);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setImageRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left image AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RectF AST#identifier#Right ... | setImageRect(image: RectF) {
this.imageRect.set(image.left, image.top, image.right, image.bottom);
} | https://gitee.com/openharmony/codelabs.git | 422dd0cf29541c3b8450fa50942a97c330d97296 | gitee |
HarmonyOS_Samples/BestPracticeSnippets | ClickResponseOptimization/entry/src/main/ets/pages/ProfilePage.ets | arkts | pageTransition | Page B transition animation settings | pageTransition() {
PageTransitionEnter({ type: RouteType.None, duration: 400 })
.slide(SlideEffect.Right)
PageTransitionExit({ type: RouteType.None, duration: 400 })
.slide(SlideEffect.Right)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | pageTransition() {
PageTransitionEnter({ type: RouteType.None, duration: 400 })
.slide(SlideEffect.Right)
PageTransitionExit({ type: RouteType.None, duration: 400 })
.slide(SlideEffect.Right)
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 57ab77ca044247273e299ed3804f8981691b09ee | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayBlockingQueue.ets | arkts | size | Returns size of a ArrayBlockingQueue.
@returns { int } size | override get size(): int {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
let size: int = 0;
if (this.curTailIdx >= this.curHeadIdx && !this.isQueueFull) {
size = this.curTailIdx - this.curHeadIdx;
} else {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS... | override get size(): int {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
let size: int = 0;
if (this.curTailIdx >= this.curHeadIdx && !this.isQueueFull) {
size = this.curTailIdx - this.curHeadIdx;
} else {
... | https://gitcode.com/iop123123/arkts-static-skills | c0f756e230ede3c31e4d629c9a49e9239c7fb122 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/query/WhereCondition.ets | arkts | toString | 获取条件的字符串表示(用于调试)
@returns 条件描述字符串 | toString(): string {
let valueStr: string
if (this.value === null) {
valueStr = 'NULL'
} else if (Array.isArray(this.value)) {
const arr = this.value as Array<ValueType>
const strArr: Array<string> = []
for (let i = 0; i < arr.length; i++) {
const v = arr[i]
if (v =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | toString(): string {
let valueStr: string
if (this.value === null) {
valueStr = 'NULL'
} else if (Array.isArray(this.value)) {
const arr = this.value as Array<ValueType>
const strArr: Array<string> = []
for (let i = 0; i < arr.length; i++) {
const v = arr[i]
if (v =... | https://github.com/offlinecat-dev/OCNetORM | fd8af95948532f3cbe6ad44b8a240efa5f27bb4f | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | getLocalVersion | 获取本地版本号
返回 0 表示未追踪(重启后默认为 0,远端 version >= 1 总是赢) | private static getLocalVersion(key: string): number {
return SyncSettingsService.versionMap.get(key) ?? 0;
} | 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 getLocalVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left ... | private static getLocalVersion(key: string): number {
return SyncSettingsService.versionMap.get(key) ?? 0;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L452-L454 | 5904ba95ad57b5136f51c6ed81daf354329d1411 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/AnnotationEngine.ets | arkts | updateAnnotationStyle | 更新标注样式
@param annotation 标注
@param style 新样式
@returns 更新后的标注 | updateAnnotationStyle(annotation: ImageAnnotation, style: AnnotationStyle): ImageAnnotation {
const updated: ImageAnnotation = {
id: annotation.id,
type: annotation.type,
label: annotation.label,
boundingBox: annotation.boundingBox,
description: annotation.description,
style: s... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateAnnotationStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left annotation AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageAnnotation AST#identifi... | updateAnnotationStyle(annotation: ImageAnnotation, style: AnnotationStyle): ImageAnnotation {
const updated: ImageAnnotation = {
id: annotation.id,
type: annotation.type,
label: annotation.label,
boundingBox: annotation.boundingBox,
description: annotation.description,
style: s... | https://github.com/LJ666-ui/harmony-health-care | b236e2c7c87bf88d5fe44c83ce47f40de799d6ca | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | markMemCacheHit | 标记内存缓存命中 | markMemCacheHit(pageIndex: number): void {
// 【修复】从loading中移除
this.loading.delete(pageIndex);
this.completed.add(pageIndex);
this.pageStatusMap.set(pageIndex, PreloadItemStatus.MEM_CACHE_HIT);
this.stats.memCacheHits++;
this.updateDebugInfo();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markMemCacheHit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AS... | markMemCacheHit(pageIndex: number): void {
// 【修复】从loading中移除
this.loading.delete(pageIndex);
this.completed.add(pageIndex);
this.pageStatusMap.set(pageIndex, PreloadItemStatus.MEM_CACHE_HIT);
this.stats.memCacheHits++;
this.updateDebugInfo();
} | https://github.com/DaLongZhuaZi/manxia | 8d86aabb10dae9603f3b128e09389effa8e2a080 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/search/SearchEngineRegistry.ets | arkts | getSensitiveKeys | 获取需要 API Key 的引擎 ID 列表(用于敏感键过滤) | getSensitiveKeys(): string[] {
const keys: string[] = []
for (const engine of this.engines) {
for (const field of engine.configFields) {
if (field.isPassword) {
keys.push(field.key)
}
}
}
return keys
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSensitiveKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#... | getSensitiveKeys(): string[] {
const keys: string[] = []
for (const engine of this.engines) {
for (const field of engine.configFields) {
if (field.isPassword) {
keys.push(field.key)
}
}
}
return keys
} | https://github.com/LongLiveY96/chatcube | 95121f746ecff4a11caafd27e44fafa5efdd91df | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | isZero | Check whether the current RationalNumber object is 0.
@returns { boolean } if the value represented by the current object is 0 return true Otherwise return false. | public isZero(): boolean {
return this.mnum === 0 && this.mden !== 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isZero 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#boolea... | public isZero(): boolean {
return this.mnum === 0 && this.mden !== 0;
} | https://gitcode.com/iop123123/arkts-static-skills | e22ec4aebccfd9d0ce85d56978a8d82143b0f379 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/DataBackupService.ets | arkts | importData | 从文件导入恢复数据 | public async importData(): Promise<RestoreResult> {
try {
// 选择文件
const fileContent = await this.selectAndReadFile();
if (!fileContent) {
return {
success: false,
message: '未选择文件或读取失败'
};
}
// 解析JSON
const backupData = JSON.parse(fileConten... | 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 importData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public async importData(): Promise<RestoreResult> {
try {
// 选择文件
const fileContent = await this.selectAndReadFile();
if (!fileContent) {
return {
success: false,
message: '未选择文件或读取失败'
};
}
// 解析JSON
const backupData = JSON.parse(fileConten... | https://github.com/the-wwyang/kids-learning-app | 4196e6305a4650da33df6e6ab6b501e295e97863 | github |
revalue-o/HarmonyOS-Next-Hook-demo | source_codes/ArkTS-inject/entry/src/main/ets/utils/LocationUtil.ets | arkts | requestLocationPermissions | 请求位置权限 | static async requestLocationPermissions(): Promise<boolean> {
try {
if (!LocationUtil.context) {
hilog.error(DOMAIN, 'LocationUtil', 'Context not initialized');
return false;
}
const permissions: Array<Permissions> = ['ohos.permission.LOCATION'];
hilog.info(DOMAIN, 'Locat... | 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 requestLocationPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | static async requestLocationPermissions(): Promise<boolean> {
try {
if (!LocationUtil.context) {
hilog.error(DOMAIN, 'LocationUtil', 'Context not initialized');
return false;
}
const permissions: Array<Permissions> = ['ohos.permission.LOCATION'];
hilog.info(DOMAIN, 'Locat... | https://github.com/revalue-o/HarmonyOS-Next-Hook-demo | 22f29b049b222326cd71735af6cfea493c08971b | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/TimeUtil.ets | arkts | getCurrentFormattedDateWithWeek | Get current formatted date with week day
@return Current formatted date with week day like 'Friday, August 19' | static getCurrentFormattedDateWithWeek(): string {
const nowDate = new Date();
return nowDate.toLocaleDateString(i18n.getSystemLanguage(), {
weekday: 'long',
month: 'long',
day: 'numeric',
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentFormattedDateWithWeek 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... | static getCurrentFormattedDateWithWeek(): string {
const nowDate = new Date();
return nowDate.toLocaleDateString(i18n.getSystemLanguage(), {
weekday: 'long',
month: 'long',
day: 'numeric',
});
} | https://gitee.com/openharmony-sig/applications_clock.git | a75ac3233e3d3c364501eab7fafe12a2d0bb34b5 | gitee |
CLMC2025/Vignette | entry/src/main/ets/algorithm/Algorithm.ets | arkts | previewIntervals | Preview intervals for all ratings
Returns map of rating -> interval in days | previewIntervals(currentState: FSRSState, elapsedDays: number, shortTerm: boolean = false): Map<Rating, number> {
const intervals = new Map<Rating, number>();
const ratings: Rating[] = [Rating.AGAIN, Rating.HARD, Rating.GOOD, Rating.EASY];
for (const rating of ratings) {
const result = this.review... | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left previewIntervals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentState AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | previewIntervals(currentState: FSRSState, elapsedDays: number, shortTerm: boolean = false): Map<Rating, number> {
const intervals = new Map<Rating, number>();
const ratings: Rating[] = [Rating.AGAIN, Rating.HARD, Rating.GOOD, Rating.EASY];
for (const rating of ratings) {
const result = this.review... | https://github.com/CLMC2025/Vignette | 701da898ffe87a2ab48d266a0d796036e87b998f | github |
rg2304luyue/ToDoList | entry/src/main/ets/view/ToDoItem.ets | arkts | isOverdue | 校验当前事项是否已逾期 | isOverdue(): boolean {
if (this.task.isComplete || !this.task.dueDate) return false;
let today = new Date();
let due = new Date(this.task.dueDate);
today.setHours(0, 0, 0, 0);
due.setHours(0, 0, 0, 0);
return today.getTime() > due.getTime();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isOverdue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | isOverdue(): boolean {
if (this.task.isComplete || !this.task.dueDate) return false;
let today = new Date();
let due = new Date(this.task.dueDate);
today.setHours(0, 0, 0, 0);
due.setHours(0, 0, 0, 0);
return today.getTime() > due.getTime();
} | https://github.com/rg2304luyue/ToDoList | 5fcaa34a1560f988ae18021d33329e31db6390b8 | github |
Explore-In-HMOS-Wearable/music-player | entry/src/main/ets/utils/MediaController.ets | arkts | seek | Seek player media
@param ms | public seek(ms: number) {
if (!this.player) {
return;
}
this.updateProgress(ms)
this.player.seek(ms);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left seek AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#R... | public seek(ms: number) {
if (!this.player) {
return;
}
this.updateProgress(ms)
this.player.seek(ms);
} | https://github.com/Explore-In-HMOS-Wearable/music-player | 5dec750c72a59ee8ddd2fb9f8501b7361976ef6e | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/data/WishlistCatalog.ets | arkts | makeWish | Default wishes shipped with V0.3. Costs are calibrated against the
20-coin daily cap so that:
- "看 iPad 20 分钟" is reachable in roughly half a day's play
- the higher-effort wishes encourage multi-day saving | function makeWish(id: string, name: string, cost: number, emoji: string): MagicWish {
const w: MagicWish = new MagicWish();
w.id = id;
w.displayName = name;
w.costCoins = cost;
w.iconEmoji = emoji;
w.state = WishState.Idle;
w.isCustom = false;
return w;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left makeWish AST#identifier#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#:#Right AST... | function makeWish(id: string, name: string, cost: number, emoji: string): MagicWish {
const w: MagicWish = new MagicWish();
w.id = id;
w.displayName = name;
w.costCoins = cost;
w.iconEmoji = emoji;
w.state = WishState.Idle;
w.isCustom = false;
return w;
} | https://github.com/terryma2024/happyword | 34b294d11437913e3d49da91666457d44794f1fd | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFMpegUtils.ets | arkts | generateUUID32 | 生成32位 UUID
@returns UUID 字符串 | private static generateUUID32(): string {
const chars = '0123456789abcdef';
let uuid = '';
for (let i = 0; i < 32; i++) {
// 替换索引访问为 charAt() 方法
uuid += chars.charAt(Math.floor(Math.random() * 16));
}
return uuid;
} | 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 generateUUID32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private static generateUUID32(): string {
const chars = '0123456789abcdef';
let uuid = '';
for (let i = 0; i < 32; i++) {
// 替换索引访问为 charAt() 方法
uuid += chars.charAt(Math.floor(Math.random() * 16));
}
return uuid;
} | https://github.com/jjjjjjava/ffmpeg_tools | 6c3f2d53cda1024edcd418920af98fec438044d9 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | generateQuestionHash | 生成题目的唯一哈希值 | private generateQuestionHash(question: MathQuestion): string {
// 根据题型生成不同的哈希策略
switch (question.type) {
case QuestionType.CALCULATION:
// 计算题:基于操作数和运算符
return `${question.type}_${question.num1}_${question.operator}_${question.num2}`;
case QuestionType.COMPARISON:
// 比较题:基... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateQuestionHash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left question AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private generateQuestionHash(question: MathQuestion): string {
// 根据题型生成不同的哈希策略
switch (question.type) {
case QuestionType.CALCULATION:
// 计算题:基于操作数和运算符
return `${question.type}_${question.num1}_${question.operator}_${question.num2}`;
case QuestionType.COMPARISON:
// 比较题:基... | https://github.com/the-wwyang/kids-learning-app | 758233d3eb54446227d70f21367a3a0ae7b9d163 | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | previousVideo | Previous video. | previousVideo() {
if (this.avPlayer === null) {
return;
}
if (CommonConstants.OPERATE_STATE.indexOf(this.avPlayer.state) === -1) {
return;
}
this.playerModel.playSpeed = PlayConstants.PLAY_SPEED;
let globalVideoList = GlobalContext.getContext().getObject('globalVideoList') as Video... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left previousVideo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | previousVideo() {
if (this.avPlayer === null) {
return;
}
if (CommonConstants.OPERATE_STATE.indexOf(this.avPlayer.state) === -1) {
return;
}
this.playerModel.playSpeed = PlayConstants.PLAY_SPEED;
let globalVideoList = GlobalContext.getContext().getObject('globalVideoList') as Video... | https://gitee.com/openharmony/codelabs.git | b17b1e076a1f193d5b14a449e097a47618e6400f | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.