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 |
|---|---|---|---|---|---|---|---|---|---|---|
harmonyos/codelabs | HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/view/HomeComponent.ets | arkts | onConfirm | confirm clockL | onConfirm(task: TaskInfo) {
this.homeStore.taskClock(task).then((res: AchievementInfo) => {
if (res.showAchievement) {
let achievementLevel = res.achievementLevel;
if (achievementLevel) {
this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG, achievementLevel);
} else {... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TaskInfo AST#identifier#Right A... | onConfirm(task: TaskInfo) {
this.homeStore.taskClock(task).then((res: AchievementInfo) => {
if (res.showAchievement) {
let achievementLevel = res.achievementLevel;
if (achievementLevel) {
this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG, achievementLevel);
} else {... | https://gitee.com/harmonyos/codelabs.git | 560ccf32eea162aa58a198c9147bdcbfbbafb0d6 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | downloadFile | ==================== 文件操作增强 ====================
下载文件 | async downloadFile(url: string): Promise<string> {
try {
const key = this.md5Encode16(url);
const suffix = this.getUrlSuffix(url);
const path = `${key}.${suffix}`;
const fullPath = this.resolvePath(path);
const content = await this.ajax(url);
if (content) {
await... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left downloadFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async downloadFile(url: string): Promise<string> {
try {
const key = this.md5Encode16(url);
const suffix = this.getUrlSuffix(url);
const path = `${key}.${suffix}`;
const fullPath = this.resolvePath(path);
const content = await this.ajax(url);
if (content) {
await... | https://github.com/DaLongZhuaZi/manxia | 0afa00252ee891a5891ed6e880e198cc28814243 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ProviderViewModel.ets | arkts | saveProvider | ============================================================================
写操作(委托 Store)
============================================================================ | async saveProvider(provider: ModelProvider, insertAtFront: boolean = false): Promise<void> {
await this.store.upsertProvider(provider, insertAtFront)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveProvider AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left provider AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async saveProvider(provider: ModelProvider, insertAtFront: boolean = false): Promise<void> {
await this.store.upsertProvider(provider, insertAtFront)
} | https://github.com/LongLiveY96/chatcube | f0377ac002bbf05bfa6540287cb0970fc019bd1b | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | addFootprint | 添加足迹记录
@param {Footprint} footprint 足迹记录
@returns {Promise<void>} Promise<void> | addFootprint(footprint: Footprint): Promise<void> {
return this.dataSource.addFootprint(footprint);
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left addFootprint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left footprint AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | addFootprint(footprint: Footprint): Promise<void> {
return this.dataSource.addFootprint(footprint);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 9f1c16093e0afe1a331e3dfa958ccc167e7979c1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | offThemeChange | 移除主题变化监听器 | public offThemeChange(callback: ThemeChangeCallback): void {
this.themeChangeCallbacks.delete(callback);
logger.debug(TAG, `移除主题变化监听器,当前监听器数量: ${this.themeChangeCallbacks.size}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left offThemeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public offThemeChange(callback: ThemeChangeCallback): void {
this.themeChangeCallbacks.delete(callback);
logger.debug(TAG, `移除主题变化监听器,当前监听器数量: ${this.themeChangeCallbacks.size}`);
} | https://github.com/DaLongZhuaZi/manxia | a5a6c6455b80c57c3cf6c86da89657ad0e9ceb0c | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics2D/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/CanvasGetResult.ets | arkts | aboutToAppear | 4. 在MyNodeController的aboutToAppear中创建PixeMap | aboutToAppear(): void {
let task = new taskpool.Task(createPixelMapAsync);
try {
taskpool.execute(task).then((pixel:Object)=>{
this.myRenderNode.setPixelMap(pixel as image.PixelMap);
this.myRenderNode.invalidate();
})
} catch (error) {
console.error("execute failed")
... | 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 {
let task = new taskpool.Task(createPixelMapAsync);
try {
taskpool.execute(task).then((pixel:Object)=>{
this.myRenderNode.setPixelMap(pixel as image.PixelMap);
this.myRenderNode.invalidate();
})
} catch (error) {
console.error("execute failed")
... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | c2a4227b104d8652ddb37620c6ba9305fa682400 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | find | Returns the first element in the provided array that satisfies the provided testing function
@param fn testing function
@returns found element or null otherwise | public find(fn: (elem: T) => boolean): T | null {
for (let i = 0; i < this.data.length; i++) {
if (fn(this.data[i])) {
return this.data[i];
}
}
return null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left ... | public find(fn: (elem: T) => boolean): T | null {
for (let i = 0; i < this.data.length; i++) {
if (fn(this.data[i])) {
return this.data[i];
}
}
return null;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6deb4256153089af1e5b5fa4a4dfb512e11b7b7b | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Diagnostics/StartupTest.ets | arkts | testNormalStartup | 测试正常启动流程 | async testNormalStartup(): Promise<boolean> {
logger.info('StartupTest', '🧪 开始测试正常启动流程');
try {
// 开始监控
startupController.startMonitoring();
// 模拟各个启动阶段
await this.simulatePhase(StartupPhase.ABILITY_STAGE_CREATE, 100);
await this.simulatePhase(StartupPhase.ENTRY_ABIL... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left testNormalStartup 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#:#Rig... | async testNormalStartup(): Promise<boolean> {
logger.info('StartupTest', '🧪 开始测试正常启动流程');
try {
// 开始监控
startupController.startMonitoring();
// 模拟各个启动阶段
await this.simulatePhase(StartupPhase.ABILITY_STAGE_CREATE, 100);
await this.simulatePhase(StartupPhase.ENTRY_ABIL... | https://github.com/DaLongZhuaZi/manxia | fc891a9ec27565fd8f930bf3e000b1b006c85a9c | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | isDrawHighlightCircleEnabled | Returns true if highlight circle should be drawn, false if not
@Override | public isDrawHighlightCircleEnabled(): boolean {
return this.mDrawHighlightCircleEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDrawHighlightCircleEnabled 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#L... | public isDrawHighlightCircleEnabled(): boolean {
return this.mDrawHighlightCircleEnabled;
} | https://gitee.com/openharmony/developtools_profiler.git | 1ec2e996590b494471a66c6680e048426dcd7ce3 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | contains | Checks if this String contains the specified string.
The search starts from specified index (negative fromIndex is equivalent to fromIndex = 0,
and fromIndex >= length implies no match).
@param { String } str string to search
@param { number } fromIndex index to start search from
@throws { NullPointerError } if str par... | public contains(str: String, fromIndex: number): boolean {
return this.contains(str, fromIndex.toInt());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left contains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String A... | public contains(str: String, fromIndex: number): boolean {
return this.contains(str, fromIndex.toInt());
} | https://gitcode.com/iop123123/arkts-static-skills | 684c83762585918168637618324f7096f061f453 | gitcode |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | getPendingTaskCount | 获取等待中的任务数量 | public getPendingTaskCount(): number {
return this.taskQueue.length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPendingTaskCount 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... | public getPendingTaskCount(): number {
return this.taskQueue.length;
} | https://github.com/jjjjjjava/ffmpeg_tools | b0baf7678d019f5ab04797bd0e90c0fae356a473 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets | arkts | updateOrder | 更新订单信息
@param {Unknown} params - 订单更新参数
@returns {Promise<NetworkResponse<Unknown>>} 更新结果 | async updateOrder(params: Unknown): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("order/info/update", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateOrder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async updateOrder(params: Unknown): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("order/info/update", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | cbb3d30e620178b44a09c88453f227b89612ec86 | github |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/component/WoDe/PatientManager.ets | arkts | loadPatients | 从后端获取就诊人列表 | loadPatients() {
if (!this.currentUser) return;
axios.get(`${Constants.BASE_URL}/patient/list`, {
params: { userId: this.currentUser.id }
})
.then((res: AxiosResponse) => {
if (res.data && res.data.code === 200 && Array.isArray(res.data.data)) {
this.patients = res.data.data;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left loadPatients 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 ... | loadPatients() {
if (!this.currentUser) return;
axios.get(`${Constants.BASE_URL}/patient/list`, {
params: { userId: this.currentUser.id }
})
.then((res: AxiosResponse) => {
if (res.data && res.data.code === 200 && Array.isArray(res.data.data)) {
this.patients = res.data.data;
... | https://github.com/luojiang001/Pulse | 2748232519a36ee41c236b3eb9a6bb0e82bc979c | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | update | 更新共享账本 | static async update(ledger: SharedLedger): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
ledger.updatedAt = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
name: ledger.name,
description: ledger.description || null,
type: ... | 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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ledger AST#identifier#Right AST#:#Left : AST#:#Ri... | static async update(ledger: SharedLedger): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
ledger.updatedAt = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
name: ledger.name,
description: ledger.description || null,
type: ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | c1eac94b1b22fa357a52eba0bead710b7106a030 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | size | The content-size of the Blob. | get size(): int { return this.blobSize } | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left size 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 int AST#identifier#Right A... | get size(): int { return this.blobSize } | https://gitcode.com/iop123123/arkts-static-skills | 370544e415badb8104396b8f07705c30e1a90d62 | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/RestorationChannel.ets | arkts | setRestorationData | Set the restoration data from which the framework will restore its state. | setRestorationData(data: Uint8Array) {
this.engineHasProvidedData = true;
if (this.pendingFrameworkRestorationChannelRequest != null) {
// If their is a pending request from the framework, answer it.
this.pendingFrameworkRestorationChannelRequest.success(RestorationChannelMethodCallHandler.package... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setRestorationData 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#identifier#Left Uint8Array AST#identif... | setRestorationData(data: Uint8Array) {
this.engineHasProvidedData = true;
if (this.pendingFrameworkRestorationChannelRequest != null) {
// If their is a pending request from the framework, answer it.
this.pendingFrameworkRestorationChannelRequest.success(RestorationChannelMethodCallHandler.package... | https://gitee.com/openharmony-sig/flutter_engine.git | 64ff6605e2ece228f68a48be6c1e8a915a500ed3 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | resumePushQueue | Wakes one coroutine waiting to insert an element into the queue.
Performs the notification while holding the push-side mutex.
@returns { void } No return value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private resumePushQueue(): void {
ConcurrencyHelpers.mutexLock(this.pushMutex);
this.pushCondVar.notifyOne();
ConcurrencyHelpers.mutexUnlock(this.pushMutex);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resumePushQueue 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#exp... | private resumePushQueue(): void {
ConcurrencyHelpers.mutexLock(this.pushMutex);
this.pushCondVar.notifyOne();
ConcurrencyHelpers.mutexUnlock(this.pushMutex);
} | https://gitcode.com/iop123123/arkts-static-skills | d10fdfc02fae0287837ac73dd2267669ee6136ce | gitcode |
openharmony/codelabs | ETSUI/CoinNote/entry/src/main/ets/pages/Index.ets | arkts | updateCalendarBills | 更新日历模式下的账单列表 | updateCalendarBills(): void {
if (this.isCalendarMode) {
this.calendarBills = this.getGroupedBills(this.calendarSelectedDate);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateCalendarBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expres... | updateCalendarBills(): void {
if (this.isCalendarMode) {
this.calendarBills = this.getGroupedBills(this.calendarSelectedDate);
}
} | https://gitcode.com/openharmony/codelabs | 3144faf1146e8c24a27de6bb31d3d03ba0a6a106 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | analyzeErrorType | 分析错误类型 | private analyzeErrorType(errorMsg: string): SearchErrorType {
const lowerMsg = errorMsg.toLowerCase();
if (lowerMsg.includes('timeout') || lowerMsg.includes('超时')) {
return SearchErrorType.TIMEOUT;
}
if (lowerMsg.includes('ssl') || lowerMsg.includes('certificate')) {
return SearchErrorTyp... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left analyzeErrorType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorMsg AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private analyzeErrorType(errorMsg: string): SearchErrorType {
const lowerMsg = errorMsg.toLowerCase();
if (lowerMsg.includes('timeout') || lowerMsg.includes('超时')) {
return SearchErrorType.TIMEOUT;
}
if (lowerMsg.includes('ssl') || lowerMsg.includes('certificate')) {
return SearchErrorTyp... | https://github.com/DaLongZhuaZi/manxia | b5fd3330e3c29ab9355ee4e288d17c6c9537748c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | setSendCallback | 设置即时发送回调
当陀螺仪数据更新时会通过此回调立即发送融合后的手柄状态
对齐 Android 的 updateContextWithGyroData → sendControllerInputPacket 流程 | setSendCallback(callback: GyroSendCallback | null): void {
this.sendCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSendCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left GyroSendC... | setSendCallback(callback: GyroSendCallback | null): void {
this.sendCallback = callback;
} | https://github.com/AlkaidLab/moonlight-harmony | b9452a80236570c6eb0622267c387d6a5c6b8c06 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/NotificationManager.ets | arkts | generateNotificationId | 生成新的通知ID | public generateNotificationId(): number {
return this.notificationIdCounter++;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateNotificationId 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 num... | public generateNotificationId(): number {
return this.notificationIdCounter++;
} | https://github.com/DaLongZhuaZi/manxia | 946ce8ba1cb3d72253ad92ed13d6ba920493cf11 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/info/AccessibilityInfo.ets | arkts | playAccessibilityByStr | 通过accessibilityResourceMap主动播报
@param { string } accessibilityResourceMap的字符串key值. | public static playAccessibilityByStr(info: string): void {
let playStr = AccessibilityInfo.getPlayInfoByResource(info);
LogUtil.info(TAG, 'playAccessibilityByStr', playStr)
AccessibilityPlayUtil.announceForAccessibility(playStr);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left playAccessibilityByStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#... | public static playAccessibilityByStr(info: string): void {
let playStr = AccessibilityInfo.getPlayInfoByResource(info);
LogUtil.info(TAG, 'playAccessibilityByStr', playStr)
AccessibilityPlayUtil.announceForAccessibility(playStr);
} | https://gitee.com/openharmony-sig/applications_calculator.git | 4bb211fac217aee979b8d9580c13722a556a8dc2 | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitRepeatedBool | 访问 repeated bool 字段 | visitRepeatedBool(value: boolean[], fieldNumber: number): void {
for (const item of value) {
this.visitBool(item, fieldNumber)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedBool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left boolean... | visitRepeatedBool(value: boolean[], fieldNumber: number): void {
for (const item of value) {
this.visitBool(item, fieldNumber)
}
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 4b56c043c0efc68cd2d5b768e36326f175dcbd63 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets | arkts | startContinuousTask | Start background task.
@param context | public static startContinuousTask(context?: common.UIAbilityContext): void {
if (!context) {
Logger.error('this avPlayer: ', `context undefined`);
return
}
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
ab... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left startContinuousTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#... | public static startContinuousTask(context?: common.UIAbilityContext): void {
if (!context) {
Logger.error('this avPlayer: ', `context undefined`);
return
}
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
ab... | https://gitee.com/harmonyos/codelabs.git | 99e71bf03def86939d03c256ea5a301181de6a56 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/SettingsService.ets | arkts | getAll | 获取所有的数据
@returns | public static getAll(): Object {
try {
const pref = SettingsService.getInstance().preferences;
if (!pref) {
return new Object();
}
return pref.getAllSync();
} catch (error) {
hilog.error(DOMAIN, TAG, `Failed to get all. Code: ${error}`);
}
return new Object();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :... | public static getAll(): Object {
try {
const pref = SettingsService.getInstance().preferences;
if (!pref) {
return new Object();
}
return pref.getAllSync();
} catch (error) {
hilog.error(DOMAIN, TAG, `Failed to get all. Code: ${error}`);
}
return new Object();
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L307-L318 | 70febd0d56a36b322981f33bb0033d0bf5a6b8de | github |
codelably/HCompass | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | 应用创建时调用
初始化应用上下文、设置颜色模式、注册路由
@param want 启动意图
@param launchParam 启动参数 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
// 初始化框架
this.InitializerFramework(this.context);
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
// 初始化框架
this.InitializerFramework(this.context);
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed t... | https://github.com/codelably/HCompass | 5984fc19794f5cfe1a91c783625db44554721449 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/AuthVM.ets | arkts | applyAccountLanguageIfUnset | 当用户尚未显式设置 CONTENT_LANG 偏好时,把账号 profile 的 language 同步给 HttpClient,
让首次登录的首页热门 / 近期就匹配账号语言(与 zlib 官方 app 一致)。
不写入 PreferencesStore,保留用户随时切换的能力——一旦用户在设置里手动切换,那次写盘后此 helper 不再覆盖。 | private static async applyAccountLanguageIfUnset(user: User): Promise<void> {
const lang: string | undefined = user.language;
if (lang === undefined || lang.length === 0) {
return;
}
const explicit: string = await PreferencesStore.getString('settings', AppStorageKeys.CONTENT_LANG, '');
if (e... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left applyAccountLanguageIfUnset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#ide... | private static async applyAccountLanguageIfUnset(user: User): Promise<void> {
const lang: string | undefined = user.language;
if (lang === undefined || lang.length === 0) {
return;
}
const explicit: string = await PreferencesStore.getString('settings', AppStorageKeys.CONTENT_LANG, '');
if (e... | https://github.com/LZZLHY/hlib | 8e26cf755116d5f36c3eebf4c45368a09e72dec9 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setArrowTopLeftRadius | 箭头尖左边弧度,单位:vp,气泡弹窗有效
@param arrowTopLeftRadius
@returns | setArrowTopLeftRadius(arrowTopLeftRadius: number): Builder {
this.popupConfig.arrowTopLeftRadius = arrowTopLeftRadius
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setArrowTopLeftRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arrowTopLeftRadius AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right ... | setArrowTopLeftRadius(arrowTopLeftRadius: number): Builder {
this.popupConfig.arrowTopLeftRadius = arrowTopLeftRadius
return this
} | https://github.com/wuba/omni-ui | 2a7adffab77120d1e2f74ec982391100f4cf4c97 | github |
arkui-x/samples | CodeLab/Cases/feature/gridexchange/src/main/ets/model/AttributeModifier.ets | arkts | applyNormalAttribute | 定义组件普通状态时的样式
@param instance | applyNormalAttribute(instance: GridItemAttribute): void {
instance.translate({ x: this.offsetX, y: this.offsetY });
instance.opacity(this.opacity);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyNormalAttribute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instance AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GridItemAttribute AST#identifie... | applyNormalAttribute(instance: GridItemAttribute): void {
instance.translate({ x: this.offsetX, y: this.offsetY });
instance.opacity(this.opacity);
} | https://gitcode.com/arkui-x/samples | 154b5fdc3cb19f6e4ce8665ca09e459aae02d05b | gitcode |
huaweicloud/huaweicloud-iot-device-sdk-arkts | huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets | arkts | onRead | 读属性回调
@param fields 指定读取的字段名,不指定则读取全部可读字段
@return 属性值 | onRead(fields?: string[]): object {
let result: Map<string, object> = new Map();
// 读取指定字段
if (fields && fields.length > 0) {
fields.forEach(field => {
const propertyName = this.readableFields.get(field);
if (propertyName === null || propertyName === undefined) {
LogUtil.lo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fields AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifi... | onRead(fields?: string[]): object {
let result: Map<string, object> = new Map();
// 读取指定字段
if (fields && fields.length > 0) {
fields.forEach(field => {
const propertyName = this.readableFields.get(field);
if (propertyName === null || propertyName === undefined) {
LogUtil.lo... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts | 6aac79cff462e9131a28574027c909324bf51963 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/VMListPanel.ets | arkts | setSelectedVM | 公共方法:设置选中项 | setSelectedVM(vmId: string) {
this.selectedVMId = vmId
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSelectedVM AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right... | setSelectedVM(vmId: string) {
this.selectedVMId = vmId
} | https://github.com/AetheriumSimulator/qemu-hmos | bb79f5843fb776ca4df40e50edcc200146c3efc1 | github |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets | arkts | playNextAuto | Play next music.
@param isFromControl | public playNextAuto(isFromControl: boolean) {
Logger.info(TAG, 'playNextAuto mode:' + this.playMode);
switch (this.playMode) {
case MusicPlayMode.SINGLE_CYCLE:
if (isFromControl) {
this.playNext();
} else if (this.avPlayer) {
this.avPlayer.play();
}
br... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playNextAuto AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFromControl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | public playNextAuto(isFromControl: boolean) {
Logger.info(TAG, 'playNextAuto mode:' + this.playMode);
switch (this.playMode) {
case MusicPlayMode.SINGLE_CYCLE:
if (isFromControl) {
this.playNext();
} else if (this.avPlayer) {
this.avPlayer.play();
}
br... | https://gitee.com/harmonyos/codelabs.git | 53b5d64b7643a4f8d8c5b4fef2acccf3187cd038 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | slice | Creates a new ArrayBuffer with a copy of bytes in the range [begin, end).
@param { number } begin An inclusive index to start copying from.
@param { number } [end] An exclusive index to stop copying.
@returns { ArrayBuffer } The new ArrayBuffer.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public slice(begin: number, end?: number): ArrayBuffer {
if (end == undefined) return this.slice(begin.toInt())
else return this.slice(begin.toInt(), end.toInt())
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number, end?: number): ArrayBuffer {
if (end == undefined) return this.slice(begin.toInt())
else return this.slice(begin.toInt(), end.toInt())
} | https://gitcode.com/iop123123/arkts-static-skills | 2a059a99ba92f042b1198c66c6e16cf67c0211ca | gitcode |
openharmony/arkui_advanced_ui_component | customappbar/source/custom_app_bar.ets | arkts | onCloseButtonClick | 关闭按钮点击回调
在ets无法实现,需要在编译后的js中加入对应的实现方法 | static onCloseButtonClick(): void {
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left onCloseButtonClick 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#exp... | static onCloseButtonClick(): void {
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 2246d45179f8bbaecf1a0da35f25354484ac710f | gitee |
codelably/HCompass | core/network/src/main/ets/NetworkResult.ets | arkts | error | 创建异常响应
@param error 异常对象
@returns NetworkResult 实例 | static error<T>(error: Error): NetworkResult<T> {
return new NetworkResult<T>({
code: -1,
data: null,
message: error.message ?? '网络异常'
} as StandardResponse<T>);
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_par... | static error<T>(error: Error): NetworkResult<T> {
return new NetworkResult<T>({
code: -1,
data: null,
message: error.message ?? '网络异常'
} as StandardResponse<T>);
} | https://github.com/codelably/HCompass | 9ab517ada62261227ca4b6d9b22ba9025279d841 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_long.ets | arkts | main | ---
desc: check postfix increment for long integer operand
--- | function main(): void {
let value: long = {{v.value}}
let result: long = value++
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: long = {{v.value}}
let result: long = value++
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8c75e9b2da3f4c106e6f7a8b8a28661bc3ac9927 | gitee |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/CouponRepository.ets | arkts | getUserCouponPage | 分页查询用户优惠券
@param params 分页查询参数
@returns 用户优惠券分页数据 | async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
return this.networkDataSource.getUserCouponPage(params);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserCouponPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
return this.networkDataSource.getUserCouponPage(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | cece4c9f09e04ce0b4553a4b1c1a880908f3f958 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/OneDriveManager.ets | arkts | deleteCachedFile | 删除缓存文件 | public async deleteCachedFile(fileName: string): Promise<boolean> {
try {
const filePath = `${this.config.cachePath}/${fileName}`;
fs.unlinkSync(filePath);
this.cachedFiles.delete(fileName);
console.info(`[OneDriveManager] Deleted cached file: ${fileName}`);
return true;
} catch ... | 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 deleteCachedFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async deleteCachedFile(fileName: string): Promise<boolean> {
try {
const filePath = `${this.config.cachePath}/${fileName}`;
fs.unlinkSync(filePath);
this.cachedFiles.delete(fileName);
console.info(`[OneDriveManager] Deleted cached file: ${fileName}`);
return true;
} catch ... | https://github.com/AetheriumSimulator/qemu-hmos | 06bebc2510aa0bcf2ebe95ba1857a16fdbb8cfe1 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/LightSensingService.ets | arkts | getLightIntensity | 获取建议的光效强度 (0.0 ~ 1.0) | getLightIntensity(): number {
if (this.currentLux < 50) {
return 0.85;
}
if (this.currentLux < 200) {
return 0.70;
}
if (this.currentLux < 500) {
return 0.50;
}
return 0.30;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLightIntensity 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#stat... | getLightIntensity(): number {
if (this.currentLux < 50) {
return 0.85;
}
if (this.currentLux < 200) {
return 0.70;
}
if (this.currentLux < 500) {
return 0.50;
}
return 0.30;
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 77f9fb7adf5cf24d851bb70d1d29a294e907620c | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/TrendsPage.ets | arkts | getBarWidth | 计算柱状图宽度(百分比) | getBarWidth(date: string): string {
const value = this.getValueForDate(date);
if (value === 0) return '0%';
const maxValue = Math.max(...this.recentDates.map(d => this.getValueForDate(d)));
if (maxValue === 0) return '0%';
const percentage = (value / maxValue) * 100;
return `${Math.max(5, pe... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBarWidth 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 string AST#identifier#Right AST#)#Left ) AST... | getBarWidth(date: string): string {
const value = this.getValueForDate(date);
if (value === 0) return '0%';
const maxValue = Math.max(...this.recentDates.map(d => this.getValueForDate(d)));
if (maxValue === 0) return '0%';
const percentage = (value / maxValue) * 100;
return `${Math.max(5, pe... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 48a9a548cca5ffeb908dd20f870d4754e6364561 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | constructor | Constructor for InterfaceType
@param {RuntimeTypeDescriptor} td Type descriptor
@param {RuntimeLinker} contextLinker Runtime linker context
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) {
super(td, contextLinker)
this.cls = TypeAPI.getClass(td, contextLinker)!
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left td AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Runtim... | public constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) {
super(td, contextLinker)
this.cls = TypeAPI.getClass(td, contextLinker)!
} | https://gitcode.com/iop123123/arkts-static-skills | 4b79309c69fca1120657ba009f0d102a30ea09e0 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | asInteger | Gets an integer value from an object by key.
@param {string} key - The key to look up
@returns {int} The integer value
@throws {JsonTypeError} If the value is not an integer or if this element is not an object
@throws {RangeError} the number is out of the range of int | asInteger(): int {
if (this.jsonType != JsonType.JsonNumber) {
throw new JsonTypeError("This value's ValueKind is not Number.")
}
if (this.maybeDoubleValue != undefined) {
throw new JsonTypeError("Expected integer, but element contains a double... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left asInteger 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 int AST#identifier#Right AST#ERROR#Right AST#stateme... | asInteger(): int {
if (this.jsonType != JsonType.JsonNumber) {
throw new JsonTypeError("This value's ValueKind is not Number.")
}
if (this.maybeDoubleValue != undefined) {
throw new JsonTypeError("Expected integer, but element contains a double... | https://gitcode.com/iop123123/arkts-static-skills | 6a18f25dd0f4da41352a30af0cdd0d892a10762d | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | HasReadLock | Checks if the lock is held by readers.
@param { long } state Current lock state
@returns { boolean } True if the lock is held by readers, false otherwise
@syscap SystemCapability.Utils.Lang | public static HasReadLock(state: long): boolean {
return (state & State.STATE_MASK) == State.READ_LOCKED;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left HasReadLock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | public static HasReadLock(state: long): boolean {
return (state & State.STATE_MASK) == State.READ_LOCKED;
} | https://gitcode.com/iop123123/arkts-static-skills | ffe0dc338550a18995d09c0f3c1f3cdc3cf3db0e | gitcode |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/pages/Index.ets | arkts | aboutToDisappear | Lifecycle callback: invoked before the component is destroyed
Cleans up immersive mode and listeners to prevent memory leaks | aboutToDisappear(): void {
this.winUtil.setImmersiveType(ImmersiveType.NORMAL);
this.winUtil.unregisterWindowStatusListener();
AppStorage.delete(StorageKey.UI_CONTEXT);
AppStorageV2.remove(StorageKey.CODE_SHEET_SHOW);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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... | aboutToDisappear(): void {
this.winUtil.setImmersiveType(ImmersiveType.NORMAL);
this.winUtil.unregisterWindowStatusListener();
AppStorage.delete(StorageKey.UI_CONTEXT);
AppStorageV2.remove(StorageKey.CODE_SHEET_SHOW);
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 7dd433b9aee17f80321d5d8f56c2518f521771f4 | gitcode |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | setTextInputController | 设置TextInputController.
@param TextInputController 需要设置的TextInputController | public setTextInputController(controller: TextInputController): void {
this.controller = controller;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTextInputController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left controller AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | public setTextInputController(controller: TextInputController): void {
this.controller = controller;
} | https://gitee.com/openharmony-sig/applications_calculator.git | ee74059fb541dd1600969e407f56b2e38c83cdaf | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelCoverGenerator.ets | arkts | initialize | 初始化封面生成器
@param context 应用上下文 | async initialize(filesDir: string): Promise<void> {
if (this.isInitialized) {
return;
}
try {
// 设置封面存储目录
this.coverDir = `${filesDir}/novel_covers`;
// 确保目录存在
try {
await fileIo.mkdir(this.coverDir);
logger.info(TAG, `封面目录已创建: ${this.coverDir}`);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filesDir AST#identifier#Right AST#... | async initialize(filesDir: string): Promise<void> {
if (this.isInitialized) {
return;
}
try {
// 设置封面存储目录
this.coverDir = `${filesDir}/novel_covers`;
// 确保目录存在
try {
await fileIo.mkdir(this.coverDir);
logger.info(TAG, `封面目录已创建: ${this.coverDir}`);
... | https://github.com/DaLongZhuaZi/manxia | 28338bfc16c071599399c2392626a1256025becc | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitMapStringString | 访问 map<string, string> 字段
JSON: object with string keys and values | visitMapStringString(value: Map<string, string>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
obj[k] = v as Object
})
this.json[fieldName] = obj as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapStringString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifi... | visitMapStringString(value: Map<string, string>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
obj[k] = v as Object
})
this.json[fieldName] = obj as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 66bab85ba4719a2d2cc72b7b9176f39ea1d0f697 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/StatusEnums.ets | arkts | mangaStatusToDisplayText | 将MangaStatus转换为显示文本 | static mangaStatusToDisplayText(status: MangaStatus): string {
switch (status) {
case MangaStatus.ONGOING:
return '连载中';
case MangaStatus.COMPLETED:
return '已完结';
case MangaStatus.HIATUS:
return '暂停';
case MangaStatus.CANCELLED:
return '已取消';
case Mang... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left mangaStatusToDisplayText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | static mangaStatusToDisplayText(status: MangaStatus): string {
switch (status) {
case MangaStatus.ONGOING:
return '连载中';
case MangaStatus.COMPLETED:
return '已完结';
case MangaStatus.HIATUS:
return '暂停';
case MangaStatus.CANCELLED:
return '已取消';
case Mang... | https://github.com/DaLongZhuaZi/manxia | 5ce710433d7981bc1378f52032aa36ff48f92ee2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an object of std.core.Array<number>.
@param { Array<number> } arr - An instance of the std.core.Array type to convert to an array.
@returns { Float32Array } - A new Float32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: Array<number>): Float32Array {
let result = new Float32Array(arr.length)
result.set(arr)
return result
} | 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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: Array<number>): Float32Array {
let result = new Float32Array(arr.length)
result.set(arr)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | b4daaf0dcd1f723e20ae53cabd3efa36ee8b8756 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | getAlarmListFromResultSet | 从数据库查询的返回对象中,获取前台可用的闹钟信息列表
@param resultSet 数据库返回的结果集对象
@return 闹钟信息列表 | async getAlarmListFromResultSet(resultSet: rdb.ResultSet): Promise<AlarmInfo[]> {
const alarmClockList: AlarmInfo[] = [];
while (resultSet.goToNextRow()) {
const daysOfWeekNative: Uint8Array = resultSet.getBlob(resultSet.getColumnIndex('DAYS_OF_WEEK'));
const daysOfWeek: number[] = [];
daysO... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAlarmListFromResultSet AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resultSet AST#identifier#Right AST#type_annotation#Le... | async getAlarmListFromResultSet(resultSet: rdb.ResultSet): Promise<AlarmInfo[]> {
const alarmClockList: AlarmInfo[] = [];
while (resultSet.goToNextRow()) {
const daysOfWeekNative: Uint8Array = resultSet.getBlob(resultSet.getColumnIndex('DAYS_OF_WEEK'));
const daysOfWeek: number[] = [];
daysO... | https://gitee.com/openharmony-sig/applications_clock.git | 0ca2c57c148b305648d8c990b0aab4469549af17 | gitee |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | addToLearningQueue | 添加到学习队列 | addToLearningQueue(word: string): boolean {
try {
// 检查是否已存在
const record = this.vocabularyTracker.getRecord(word);
if (record === null) {
// 创建新记录
const newRecord = new VocabularyRecord(
word,
WordStatus.NEW,
Date.now(),
0,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addToLearningQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Lef... | addToLearningQueue(word: string): boolean {
try {
// 检查是否已存在
const record = this.vocabularyTracker.getRecord(word);
if (record === null) {
// 创建新记录
const newRecord = new VocabularyRecord(
word,
WordStatus.NEW,
Date.now(),
0,
... | https://github.com/CLMC2025/Vignette | c6241dc1f0afd23543e57935003bec82bc4578e5 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/Post.ets | arkts | getAvatarUrl | 获取头像 URL | getAvatarUrl(size: number = 120): string {
if (this.animatedAvatar !== null && this.animatedAvatar.length > 0) {
const t: string = this.animatedAvatar as string;
return t.indexOf('{size}') >= 0 ? t.replace('{size}', size.toString()) : t;
}
const template: string = this.avatarTemplate !== undef... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAvatarUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left number AST#i... | getAvatarUrl(size: number = 120): string {
if (this.animatedAvatar !== null && this.animatedAvatar.length > 0) {
const t: string = this.animatedAvatar as string;
return t.indexOf('{size}') >= 0 ? t.replace('{size}', size.toString()) : t;
}
const template: string = this.avatarTemplate !== undef... | https://github.com/Amaz1ny/HarmonyDO-public | e152f7cf58805b40fa11a85bfa381b1fc737418d | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ToolExecutionService.ets | arkts | executeToolCall | 执行单个工具调用 | async executeToolCall(
toolCall: ToolCall,
context: ToolExecutionContext = new ToolExecutionContext()
): Promise<ToolResult> {
console.info('ToolExecutionService', `Executing tool call: ${toolCall.functionName} (${toolCall.id})`)
// 检查是否已取消
if (this.isCancelled()) {
console.info('ToolExec... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left executeToolCall AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left toolCall AST#identifier#Right AST#type_annotation#Left... | async executeToolCall(
toolCall: ToolCall,
context: ToolExecutionContext = new ToolExecutionContext()
): Promise<ToolResult> {
console.info('ToolExecutionService', `Executing tool call: ${toolCall.functionName} (${toolCall.id})`)
// 检查是否已取消
if (this.isCancelled()) {
console.info('ToolExec... | https://github.com/LongLiveY96/chatcube | 6ae89c39e28ec4736350929b97facb34c76b4609 | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/TimeUtil.ets | arkts | getAlarmTime | Get the next alarm time
@param daysOfWeek Days-of-week information for repetition
@return The next alarm time | static getAlarmTime(alarmInfo: AlarmInfo): number {
const daysOfWeek: number[] = alarmInfo.daysOfWeek;
const hour: number = alarmInfo.hour;
const minute: number = alarmInfo.minute;
const alarmTime = new Date();
alarmTime.setHours(hour);
alarmTime.setMinutes(minute);
alarmTime.setSeconds(0... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAlarmTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static getAlarmTime(alarmInfo: AlarmInfo): number {
const daysOfWeek: number[] = alarmInfo.daysOfWeek;
const hour: number = alarmInfo.hour;
const minute: number = alarmInfo.minute;
const alarmTime = new Date();
alarmTime.setHours(hour);
alarmTime.setMinutes(minute);
alarmTime.setSeconds(0... | https://gitee.com/openharmony-sig/applications_clock.git | b55a6d122c0368812f13e4f5ad00659b6c0c31a9 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | handleCrashEvent | 处理崩溃事件 | private handleCrashEvent(domain: string, appEventGroups: Array<hiAppEvent.AppEventGroup>): void {
hilog.info(DOMAIN, TAG, 'HiAppEvent onReceive: domain=%{public}s', domain);
for (const eventGroup of appEventGroups) {
hilog.info(DOMAIN, TAG, 'HiAppEvent eventName=%{public}s', eventGroup.name);
for... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleCrashEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private handleCrashEvent(domain: string, appEventGroups: Array<hiAppEvent.AppEventGroup>): void {
hilog.info(DOMAIN, TAG, 'HiAppEvent onReceive: domain=%{public}s', domain);
for (const eventGroup of appEventGroups) {
hilog.info(DOMAIN, TAG, 'HiAppEvent eventName=%{public}s', eventGroup.name);
for... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L163-L172 | 90d4920270519abfd80c2108d219c3ce7491a169 | github |
xblLab/HarmonyProjectTemplate | components/module_feedback/src/main/ets/services/FuncService.ets | arkts | queryFeedbackList | 查询反馈记录列表
@returns | public queryFeedbackList(): Promise<FeedbackResponseParams[]> {
return new Promise((resolve) => {
setTimeout(() => {
resolve(MockData.list);
}, 500);
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryFeedbackList 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#instantiation_expres... | public queryFeedbackList(): Promise<FeedbackResponseParams[]> {
return new Promise((resolve) => {
setTimeout(() => {
resolve(MockData.list);
}, 500);
});
} | https://github.com/xblLab/HarmonyProjectTemplate | 11cffe5be2e5eb3bffc7d8dd24c1cc10c5b99649 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Transformer.ets | arkts | pathValueToPixel | transform a path with all the given matrices VERY IMPORTANT: keep order
to value-touch-offset
@param path | public pathValueToPixel(path: Path2D): Path2D {
path = this.pathTransform(path, this.mMatrixValueToPx);
path = this.pathTransform(path, this.mViewPortHandler.getMatrixTouch());
path = this.pathTransform(path, this.mMatrixOffset);
return path;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pathValueToPixel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public pathValueToPixel(path: Path2D): Path2D {
path = this.pathTransform(path, this.mMatrixValueToPx);
path = this.pathTransform(path, this.mViewPortHandler.getMatrixTouch());
path = this.pathTransform(path, this.mMatrixOffset);
return path;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 73138fddd6586b938802a5093b06894fcb2166cb | gitee |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | from | Creates a byte buffer.
@param source The data source.
@param byteOffset The byte offset.
@param byteLength The byte length.
@returns A byte buffer. | static from(source: ArrayBuffer, byteOffset?: number, byteLength?: number): ByteBuffer {
// if (ArrayBuffer.isView(source)) {
// byteOffset = source.byteOffset + (byteOffset || 0)
// }
const byteBuffer = new ByteBuffer()
byteBuffer.dataView = byteLength === undefined ? new DataView(source, byteO... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left from 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#ER... | static from(source: ArrayBuffer, byteOffset?: number, byteLength?: number): ByteBuffer {
// if (ArrayBuffer.isView(source)) {
// byteOffset = source.byteOffset + (byteOffset || 0)
// }
const byteBuffer = new ByteBuffer()
byteBuffer.dataView = byteLength === undefined ? new DataView(source, byteO... | https://gitee.com/openharmony-sig/flutter_engine.git | e2b1af7ac7cd1af241f49c3d7bf7d0b6cb52c8d9 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/CombinedChartModel.ets | arkts | getHighlightByTouchPoint | Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
point
inside the CombinedChart.
@param x
@param y
@return
@Override | public getHighlightByTouchPoint(x: number, y: number): Highlight | null {
if (this.mData == null) {
LogUtil.log("Can't select by touch. No data set.");
return null;
} else {
let highlighter = this.getHighlighter();
if (!highlighter) {
return null
}
let h: Highlight... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighlightByTouchPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public getHighlightByTouchPoint(x: number, y: number): Highlight | null {
if (this.mData == null) {
LogUtil.log("Can't select by touch. No data set.");
return null;
} else {
let highlighter = this.getHighlighter();
if (!highlighter) {
return null
}
let h: Highlight... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0f0aed712f531758998c37ee64bbede3b72b1f40 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | syncRecentFiles | 同步最近文件到远端 | public static async syncRecentFiles(recentFiles: RecentFile[]): Promise<void> {
if (!(SyncSettingsService.isSyncEnabled())) {
return;
}
try {
const localVersion = SyncSettingsService.getLocalVersion('recent_files');
const newVersion = localVersion + 1;
SyncSettingsService.setLocal... | 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 syncRecentFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left re... | public static async syncRecentFiles(recentFiles: RecentFile[]): Promise<void> {
if (!(SyncSettingsService.isSyncEnabled())) {
return;
}
try {
const localVersion = SyncSettingsService.getLocalVersion('recent_files');
const newVersion = localVersion + 1;
SyncSettingsService.setLocal... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L253-L276 | b103a0b106454710edfb2b230fabe99dd7222a02 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxExportService.ets | arkts | exportDatabase | 导出数据库
@param router
@param exportType | public static exportDatabase(exportType: ExportType) {
LocationParam.of({
mode: LocationMode.SAVE,
fileName: KdbxExportService.createFileName(FileService.getDbFileParam().fileName, exportType, true),
onLocation: async (locationInfo: LocationInfo) => {
try {
await KdbxExportServ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left exportDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left exportType AST#identifier#Right AST#:#Le... | public static exportDatabase(exportType: ExportType) {
LocationParam.of({
mode: LocationMode.SAVE,
fileName: KdbxExportService.createFileName(FileService.getDbFileParam().fileName, exportType, true),
onLocation: async (locationInfo: LocationInfo) => {
try {
await KdbxExportServ... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxExportService.ets#L23-L37 | 9911d84b1742a1d28e3e33c4f9d2914ef3350bef | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | setStructuredData | 设置结构化数据 | setStructuredData(data: StructuredReceiptData): void {
this.structuredDataJson = JSON.stringify(data);
this.updatedAt = new Date().toISOString();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setStructuredData 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#identifier#Left StructuredReceiptData AST#identifier#R... | setStructuredData(data: StructuredReceiptData): void {
this.structuredDataJson = JSON.stringify(data);
this.updatedAt = new Date().toISOString();
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f22d009ea71095dec5b89b03ff7a087a8e65934f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | showCustom | 显示自定义内容(使用Markdown) | showCustom(title: string, content: string, source: ContentSource = ContentSource.INLINE, icon?: Resource): string {
return this.addTab({
title,
type: ContentPanelType.CUSTOM,
source,
content,
icon
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showCustom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | showCustom(title: string, content: string, source: ContentSource = ContentSource.INLINE, icon?: Resource): string {
return this.addTab({
title,
type: ContentPanelType.CUSTOM,
source,
content,
icon
});
} | https://github.com/DaLongZhuaZi/manxia | f70229696d099d80162fb1f3eb64f56463119a27 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | sqrt | Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
significant digits using rounding mode `rounding`.
@returns { Decimal } the Decimal type | public sqrt(): Decimal {
let x = this;
let d = x.d;
let s: double = x.s;
if (s !== 1 || !d || !d![0]) {
return new Decimal(!s || s < 0 && (!d || d![0]) ? NaN : d ? x : Infinity);
}
external = false;
s = Math.sqrt(+(x.toNumber()));
let n: ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sqrt AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public sqrt(): Decimal {
let x = this;
let d = x.d;
let s: double = x.s;
if (s !== 1 || !d || !d![0]) {
return new Decimal(!s || s < 0 && (!d || d![0]) ? NaN : d ? x : Infinity);
}
external = false;
s = Math.sqrt(+(x.toNumber()));
let n: ... | https://gitcode.com/iop123123/arkts-static-skills | 268398db48d9092d75afe03e18c6b4e4e01ec7fa | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/DeviceTypeUtil.ets | arkts | getAdaptiveSpacing | 获取适配后的间距
@param baseSpacing 基础间距 | public getAdaptiveSpacing(baseSpacing: number): number {
if (this.isWatchOrWearable()) {
// 手环手表间距缩小50%
return Math.round(baseSpacing * 0.5);
} else if (this.isPhone()) {
return baseSpacing;
} else if (this.isTablet()) {
return Math.round(baseSpacing * 1.2);
} else {
retu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAdaptiveSpacing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSpacing AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | public getAdaptiveSpacing(baseSpacing: number): number {
if (this.isWatchOrWearable()) {
// 手环手表间距缩小50%
return Math.round(baseSpacing * 0.5);
} else if (this.isPhone()) {
return baseSpacing;
} else if (this.isTablet()) {
return Math.round(baseSpacing * 1.2);
} else {
retu... | https://github.com/LJ666-ui/harmony-health-care | ee7a1240f0a76c15a2f34e4983b12f32e086c212 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/smartwardMock.ets | arkts | generateWardRooms | 生成指定数量的病房数据 | public generateWardRooms(count: number): SmartWardRoom[] {
const rooms: SmartWardRoom[] = [];
for (let i = 0; i < count; i++) {
const roomNumber = String(301 + i);
const roomId = `ROOM_${roomNumber}`;
const room: SmartWardRoom = {
roomId: roomId,
roomNumber: roomNumber,
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateWardRooms AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public generateWardRooms(count: number): SmartWardRoom[] {
const rooms: SmartWardRoom[] = [];
for (let i = 0; i < count; i++) {
const roomNumber = String(301 + i);
const roomId = `ROOM_${roomNumber}`;
const room: SmartWardRoom = {
roomId: roomId,
roomNumber: roomNumber,
... | https://github.com/LJ666-ui/harmony-health-care | 03cf0ecd254f234513954494fb41bff0c28cbe93 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets | arkts | equals | Checks for equality this instance with provided object, treated as a Boolean Returns false if type of provided
object is not the same as this type
@param { Any } other object to be checked against
@returns { boolean } True if the objects are equal, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(other: Any): boolean {
if (this === other) {
return true
}
if (!(other instanceof Boolean)) {
return false
}
return this.value == (other as Boolean).value
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Any AST#identifier#Right... | public equals(other: Any): boolean {
if (this === other) {
return true
}
if (!(other instanceof Boolean)) {
return false
}
return this.value == (other as Boolean).value
} | https://gitcode.com/iop123123/arkts-static-skills | 1ee8cc12f41a95df5f3a3e40c0e1ccde986675c8 | gitcode |
daugf2527/harmonyos-libretro-emulator | deprecated/legacy/archive/entry/src/main/ets/components/KeyboardMapper.ets | arkts | getKeyboardLayoutDescription | 获取当前键盘布局的说明 | getKeyboardLayoutDescription(): string {
if (this.keyboardLayout === 'wasd') {
return `
键盘布局 (WASD):
方向键: W/A/S/D
动作键: J(B) K(A) U(Y) I(X)
肩键: Q(L) E(R) 1(L2) 3(R2)
功能键: Enter(Start) RShift(Select)
`.trim();
} else {
return `
键盘布局 (方向键):
方向键: ↑/←/↓/→
动作键: Z(B) X(A) A(Y) S(X)
肩键... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getKeyboardLayoutDescription 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#Rig... | getKeyboardLayoutDescription(): string {
if (this.keyboardLayout === 'wasd') {
return `
键盘布局 (WASD):
方向键: W/A/S/D
动作键: J(B) K(A) U(Y) I(X)
肩键: Q(L) E(R) 1(L2) 3(R2)
功能键: Enter(Start) RShift(Select)
`.trim();
} else {
return `
键盘布局 (方向键):
方向键: ↑/←/↓/→
动作键: Z(B) X(A) A(Y) S(X)
肩键... | https://github.com/daugf2527/harmonyos-libretro-emulator | c0ad80929fe07b28e3e8664d6e9073f70282775e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | findLastIndex | Finds an index of the last element in the BigInt64Array that satisfies the condition
@param fn condition
@returns the index of the last element that satisfies fn, -1 otherwise | public findLastIndex(fn: (val: long, index: int, array: BigInt64Array) => 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: long, index: int, array: BigInt64Array) => 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 | 278e7ecdb943c308ceae017e33136a1e27e5aac8 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | getLatestComics | 获取最新更新的漫画 | public async getLatestComics(options?: LatestComicsOptions): Promise<ComicInfo[]> {
try {
const sourceId = options?.sourceId;
const limit = options?.limit || 20;
const comics = await this.dataManager.searchComics('', sourceId);
// 按最后更新时间排序
comics.sort((a, b) => b.lastUpdateTi... | 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 getLatestComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#?#Left ... | public async getLatestComics(options?: LatestComicsOptions): Promise<ComicInfo[]> {
try {
const sourceId = options?.sourceId;
const limit = options?.limit || 20;
const comics = await this.dataManager.searchComics('', sourceId);
// 按最后更新时间排序
comics.sort((a, b) => b.lastUpdateTi... | https://github.com/DaLongZhuaZi/manxia | 92393febf8dee7345b44996d9a95627c4bfa7798 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | findElementsByText | 按文本内容查找元素
添加性能保护:限制元素数量和内容大小以避免ANR | private findElementsByText(content: string, searchText: string, maxElementsHint: number = 0): string[] {
const results: string[] = [];
// 性能保护:使用统一配置
let maxElements = this.getMaxElements(PerformanceConfig.MAX_ELEMENTS);
if (maxElementsHint > 0) {
maxElements = Math.min(maxElements, maxElem... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findElementsByText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private findElementsByText(content: string, searchText: string, maxElementsHint: number = 0): string[] {
const results: string[] = [];
// 性能保护:使用统一配置
let maxElements = this.getMaxElements(PerformanceConfig.MAX_ELEMENTS);
if (maxElementsHint > 0) {
maxElements = Math.min(maxElements, maxElem... | https://github.com/DaLongZhuaZi/manxia | b042425bdcecc5fb10588f504a06f7bcee23e879 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CredentialsService.ets | arkts | createKdbxCredentials | 创建凭证
@param param 请求
@return Promise<KdbxCredentials> 凭证
@throws Error 错误 | public static async createKdbxCredentials(param: CredentialsParam): Promise<KdbxCredentials> {
// 创建凭证
let credentials: KdbxCredentials;
if (AuthType.isKeyfileOnly(param.authType)) {
// 仅密钥文件模式
if (param.keyLocation === undefined) {
throw new Error(ResourceManager.getString($r('app.st... | 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 createKdbxCredentials AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L... | public static async createKdbxCredentials(param: CredentialsParam): Promise<KdbxCredentials> {
// 创建凭证
let credentials: KdbxCredentials;
if (AuthType.isKeyfileOnly(param.authType)) {
// 仅密钥文件模式
if (param.keyLocation === undefined) {
throw new Error(ResourceManager.getString($r('app.st... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CredentialsService.ets#L21-L48 | 08cbd49fee00c14f8ebf8b872202c7775a8186a9 | github |
wodekouwei/qlog | qloglib/src/main/ets/qlog/xlog/LogFileUtil.ets | arkts | getPushFiles | 获取log push目录 | public static getPushFiles(): string[] | undefined {
let pushDir = LogFileUtil.getPushDir();
if (fs.accessSync(pushDir)) {
return fs.listFileSync(pushDir, {
recursion: false, // true:子目录下也遍历,false:不遍历子目录,与Android中Flie的listFiles实现一致
listNum: 0 // 0:全部
})
}
return undefined;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getPushFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public static getPushFiles(): string[] | undefined {
let pushDir = LogFileUtil.getPushDir();
if (fs.accessSync(pushDir)) {
return fs.listFileSync(pushDir, {
recursion: false, // true:子目录下也遍历,false:不遍历子目录,与Android中Flie的listFiles实现一致
listNum: 0 // 0:全部
})
}
return undefined;
... | https://gitcode.com/wodekouwei/qlog | 5cca03d6c417c69ef40688592bba71a11585092e | gitcode |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | syncCurrentAnimation | 同步当前选中项的动画播放,用于首次进入或生命周期回调
@returns {void} 无返回值 | syncCurrentAnimation(): void {
this.playSelectedAnimation(this.currentPageIndex);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncCurrentAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme... | syncCurrentAnimation(): void {
this.playSelectedAnimation(this.currentPageIndex);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 7f9be665a12f955f20df1a0dda0f5e9bd608d6fa | github |
openharmony/applications_mms | entry/src/main/ets/pages/infomsg/InfoMsgController.ets | arkts | setSelectLockChange | Delete the checkbox lockout event. | setSelectLockChange(event) {
this.isSelectLockMsg = event.checked;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSelectLockChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left event AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AS... | setSelectLockChange(event) {
this.isSelectLockMsg = event.checked;
} | https://gitee.com/openharmony/applications_mms.git | bfca3c4810a3229283be6009b9bf0903d02e78fa | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/TypeConverter.ets | arkts | timestampToDate | 时间戳转换为 Date
@param timestamp Unix 时间戳(毫秒)
@returns Date 对象 | static timestampToDate(timestamp: number): Date {
return new Date(timestamp)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left timestampToDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | static timestampToDate(timestamp: number): Date {
return new Date(timestamp)
} | https://github.com/offlinecat-dev/OCNetORM | 88e1e56b789657f3eab8f31a87ede7d4b1d557dc | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setXEntrySpace | sets the space between the legend entries on a horizontal axis in pixels,
converts to dp internally
@param space | public setXEntrySpace(space: number): void {
this.mXEntrySpace = space;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setXEntrySpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left space AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public setXEntrySpace(space: number): void {
this.mXEntrySpace = space;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 89ead487fc7102064ab39cc91ebddf4bb0d72c62 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | toggleMultiSelectMode | ==================== 多选模式操作 ====================
切换多选模式 | toggleMultiSelectMode(): void {
this.isMultiSelectMode = !this.isMultiSelectMode;
if (!this.isMultiSelectMode) {
// 退出多选模式时清空选中列表
this.selectedSourceIds = new Set();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleMultiSelectMode 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#statem... | toggleMultiSelectMode(): void {
this.isMultiSelectMode = !this.isMultiSelectMode;
if (!this.isMultiSelectMode) {
// 退出多选模式时清空选中列表
this.selectedSourceIds = new Set();
}
} | https://github.com/DaLongZhuaZi/manxia | 810e2c5f450883bceb6dd4960c93506907fdbebe | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | skipAsn1Tag | 检查 ASN.1 tag 并跳过 | private static skipAsn1Tag(data: Uint8Array, pos: number, expectedTag: number): number {
if (pos >= data.length || data[pos] !== expectedTag) return -1;
return pos + 1;
} | 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 skipAsn1Tag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : A... | private static skipAsn1Tag(data: Uint8Array, pos: number, expectedTag: number): number {
if (pos >= data.length || data[pos] !== expectedTag) return -1;
return pos + 1;
} | https://github.com/AlkaidLab/moonlight-harmony | a0b6da6e1cafe6b2b91954bbda7e5293502b4423 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | size | Get the number of unique elements in the Set.
@returns { int } - The number of unique elements in the Set.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | override get size(): int {
return this.elements.size;
} | 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 {
return this.elements.size;
} | https://gitcode.com/iop123123/arkts-static-skills | 50a1c999c0982cb0d5168ee930d14af1305fafa0 | gitcode |
HarmonyOS_Samples/MusicHome | products/tv/src/main/ets/pages/Index.ets | arkts | build | Builds HdsNavigation with home content and bound playback cover. | build() {
HdsNavigation(this.pageIndexInfos) {
Column() {
HomeCapsuleHeader()
PanelMusicHomePage()
.layoutWeight(1)
}
.expandSafeArea([SafeAreaType.SYSTEM, SafeAreaType.CUTOUT], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width(StyleConstants.FULL_WIDTH)
.heig... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
HdsNavigation(this.pageIndexInfos) {
Column() {
HomeCapsuleHeader()
PanelMusicHomePage()
.layoutWeight(1)
}
.expandSafeArea([SafeAreaType.SYSTEM, SafeAreaType.CUTOUT], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width(StyleConstants.FULL_WIDTH)
.heig... | https://gitcode.com/HarmonyOS_Samples/MusicHome | f5b3c040e12becdfbe0009312a62e85b97c3c5bb | gitcode |
openharmony-sig/flutter_packages | packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/JavaScriptChannelHostApiImpl.ets | arkts | constructor | Handles creating {@link JavaScriptChannel}s for a {@link JavaScriptChannelHostApiImpl}.
Creates a host API that handles creating {@link JavaScriptChannel}s.
@param instanceManager maintains instances stored to communicate with Dart
objects
@param javaScriptChannelCreator handles creating {@link JavaScriptChannel}s
@par... | constructor(
instanceManager: InstanceManager, javaScriptChannelCreator: JavaScriptChannelCreator,
flutterApi: JavaScriptChannelFlutterApiImpl
) {
super()
this.instanceManager = instanceManager;
this.javaScriptChannelCreator = javaScriptChannelCreator;
this.flutterApi = flutterApi;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instanceManager AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InstanceManager AS... | constructor(
instanceManager: InstanceManager, javaScriptChannelCreator: JavaScriptChannelCreator,
flutterApi: JavaScriptChannelFlutterApiImpl
) {
super()
this.instanceManager = instanceManager;
this.javaScriptChannelCreator = javaScriptChannelCreator;
this.flutterApi = flutterApi;
} | https://gitee.com/openharmony-sig/flutter_packages.git | 7949d0f597f0cdba2d6d64f33b1341eea8ee6ee0 | gitee |
XHXYT/Pixark | entry/src/main/ets/viewmodel/SearchViewModel.ets | arkts | resetSearchState | 重置搜索状态
通常在全局模式切换后,或重新进入搜索主页时调用 | private resetSearchState() {
// 强制将 searchType 对齐到当前全局模式
this.searchType = appSettings.novel_mode ? 'novel' : 'illust';
// 清空所有搜索结果和翻页 URL
this.resultIllusts = [];
this.resultNovels = [];
this.resultUsers = [];
this.IllustNextUrl = '';
this.novelNextUrl = '';
this.userNextUrl = '';... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetSearchState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#... | private resetSearchState() {
// 强制将 searchType 对齐到当前全局模式
this.searchType = appSettings.novel_mode ? 'novel' : 'illust';
// 清空所有搜索结果和翻页 URL
this.resultIllusts = [];
this.resultNovels = [];
this.resultUsers = [];
this.IllustNextUrl = '';
this.novelNextUrl = '';
this.userNextUrl = '';... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/SearchViewModel.ets#L68-L84 | 2a3291e4689b571ae69505c673092390fb0f9a7f | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/FileProcessorUtil.ets | arkts | processFilesConcurrently | 分块处理,将文件列表分成多个块,每个块内的文件串行处理,不同块之间并行执行,通过MAX_CONCURRENT控制最大并发数 | public static async processFilesConcurrently(
fileList: string[],
context: Context,
sandbox_video: string,
sandbox_path: string,
video_meta_data: VideoMetadata[],
progressCallback: (info: ProgressInfo) => void,
fileFolder?: FileFolder
): Promise<void> {
if (fileList.length === 0) {
... | 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 processFilesConcurrently AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileList... | public static async processFilesConcurrently(
fileList: string[],
context: Context,
sandbox_video: string,
sandbox_path: string,
video_meta_data: VideoMetadata[],
progressCallback: (info: ProgressInfo) => void,
fileFolder?: FileFolder
): Promise<void> {
if (fileList.length === 0) {
... | https://github.com/Yebingiscn/SweetVideo | 43389db6cb57fcf84669223c5420f6629e4ba75c | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets | arkts | dailyEarningsForDate | Returns the per-day earnings for a given date, accounting for overtime. | private dailyEarningsForDate(date: Date): number {
const ds: string = this.dateStringFromDate(date)
const override: DayOverride | undefined = this.dayOverrides.get(ds)
if (override !== undefined && override.dayType === DayType.OVERTIME) {
const multiplier: number = override.overtimeMultiplier
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dailyEarningsForDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private dailyEarningsForDate(date: Date): number {
const ds: string = this.dateStringFromDate(date)
const override: DayOverride | undefined = this.dayOverrides.get(ds)
if (override !== undefined && override.dayType === DayType.OVERTIME) {
const multiplier: number = override.overtimeMultiplier
... | https://github.com/OMGCA/sakipay | 873a5fe1f68a6081f23a6ebec96aeced9c8ce074 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/addition/addition_ushort.ets | arkts | main | ---
desc: check addition of two unsigned short integers
--- | function main(): void {
const a: ushort = {{v.left}}
const b: ushort = {{v.right}}
assert (a + b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ushort = {{v.left}}
const b: ushort = {{v.right}}
assert (a + b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 05f75dfdd7ee065a8e3f0e878e5e24fbbfdb81e6 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/data/hospitalData.ets | arkts | createPOI | 创建POI对象的辅助函数 | function createPOI(
id: string,
name: string,
category: DestinationCategory,
building: string,
floor: number,
position: Position3D,
description: string,
isAccessible: boolean,
tags: string[]
): NavigationDestination {
return {
id,
name,
category,
building,
floor,
position,
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createPOI 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 AS... | function createPOI(
id: string,
name: string,
category: DestinationCategory,
building: string,
floor: number,
position: Position3D,
description: string,
isAccessible: boolean,
tags: string[]
): NavigationDestination {
return {
id,
name,
category,
building,
floor,
position,
... | https://github.com/LJ666-ui/harmony-health-care | 4c5bc0ebd4d852f80a516fa1c2db40aa59284ee3 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/PerformanceMonitor.ets | arkts | getMark | 获取打点时间戳 | getMark(name: string): NGFPerformanceMark | null {
const mark = this.marks.get(name.trim());
return mark !== undefined ? mark : null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getMark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | getMark(name: string): NGFPerformanceMark | null {
const mark = this.marks.get(name.trim());
return mark !== undefined ? mark : null;
} | https://github.com/DaLongZhuaZi/NGF | 42e26a0033da743f397665a528e32474c2f6f695 | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/select/picker/components/BasicStylePicker.ets | arkts | TimePickerDialogBuilder | --- TimePicker dialog component --- | @Builder
function TimePickerDialogBuilder(params: TimePickerParams) {
TimePickerContent({ params: params })
} | 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 TimePickerDialogBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig... | @Builder
function TimePickerDialogBuilder(params: TimePickerParams) {
TimePickerContent({ params: params })
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 9f838c715da82870c1cf64ed8532fef7b4292a9e | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | readLock | Gets the read lock instance for acquiring read locks.
@returns { AsyncReadLock } Read lock instance
@syscap SystemCapability.Utils.Lang | public readLock(): AsyncReadLock {
return this.rLock_;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readLock 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 AsyncReadLock... | public readLock(): AsyncReadLock {
return this.rLock_;
} | https://gitcode.com/iop123123/arkts-static-skills | ff31a91807e6e5be8f402b06089b27caa71645ac | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets | arkts | execColorInfo | Picture pixel calculation | function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number, hsvIndex: number) {
// ...
const newBufferArr = bufferArray;
let colorInfo = new Uint8Array(newBufferArr);
for (let i = 0; i < colorInfo?.length; i += CommonConstants.PIXEL_STEP) {
const hsv = rgb2hsv(colorInfo[i + RGBIndex.RED], co... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left execColorInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bufferArray AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number, hsvIndex: number) {
// ...
const newBufferArr = bufferArray;
let colorInfo = new Uint8Array(newBufferArr);
for (let i = 0; i < colorInfo?.length; i += CommonConstants.PIXEL_STEP) {
const hsv = rgb2hsv(colorInfo[i + RGBIndex.RED], co... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 043b39050187ccb07490688e3b5657ee5138e104 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Byte.ets | arkts | valueOf | Returns boxed representation of the primitive
@param value value to box
@returns boxed value | public static valueOf(value: byte): Byte {
// TODO(ivan-tyulyandin): caching is possible
return new Byte(value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public static valueOf(value: byte): Byte {
// TODO(ivan-tyulyandin): caching is possible
return new Byte(value);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 87a05557bf76cc5e3c42983973656d78225c21de | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | insert | Inserts an element at the specified index.
@param index The index at which to insert the element.
@param element The element to insert.
@throws BusinessError if the index is out of range. | public insert(index: int, element: T): void {
this.checkIndexType(index);
this.checkIndex(index, this.length);
let newNode: ListNode<T> = new ListNode<T>(element);
if (this.elementNum == 0) {
this.head = this.tail = newNode;
this.elementNum++;
re... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right... | public insert(index: int, element: T): void {
this.checkIndexType(index);
this.checkIndex(index, this.length);
let newNode: ListNode<T> = new ListNode<T>(element);
if (this.elementNum == 0) {
this.head = this.tail = newNode;
this.elementNum++;
re... | https://gitcode.com/iop123123/arkts-static-skills | a8e38edfc8ae17ce3e54bbee78c4ebdaedfc987a | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/PairingManager.ets | arkts | getClientCertSignature | 获取客户端证书签名 | getClientCertSignature(): Uint8Array {
if (!this.clientCertDer) {
return new Uint8Array(0);
}
return CryptoUtil.extractCertSignature(this.clientCertDer);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getClientCertSignature 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#ERR... | getClientCertSignature(): Uint8Array {
if (!this.clientCertDer) {
return new Uint8Array(0);
}
return CryptoUtil.extractCertSignature(this.clientCertDer);
} | https://github.com/AlkaidLab/moonlight-harmony | d0cd4f86cfb2c3f951dde8c6cbae85423b33e8df | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | getTotalUnreadCount | ============ 消息提醒 ============
获取未读消息数 | async getTotalUnreadCount(): Promise<ApiResponse<{ count: number }>> {
return this.client.get<{ count: number }>('/api/v1/im/unread-count')
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTotalUnreadCount 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#... | async getTotalUnreadCount(): Promise<ApiResponse<{ count: number }>> {
return this.client.get<{ count: number }>('/api/v1/im/unread-count')
} | https://github.com/David8Idira/AI-OA | 89a6789ddec45f0aa32d5b5a569b49be55ce1cb5 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/DevicesApi.ets | arkts | updateDeviceOptions | updateDeviceOptions
@summary Update device options.
@param {DevicesApiUpdateDeviceOptionsRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof DevicesApi | public async updateDeviceOptions(requestParameters: DevicesApiUpdateDeviceOptionsRequest): Promise<void> {
let params: Record<string, string> = {
"id": requestParameters.id
}
return this.apiClient.post({path: "/Devices/Options", parameters: params, data: requestParameters.deviceOptionsDto})
} | 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 updateDeviceOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Rig... | public async updateDeviceOptions(requestParameters: DevicesApiUpdateDeviceOptionsRequest): Promise<void> {
let params: Record<string, string> = {
"id": requestParameters.id
}
return this.apiClient.post({path: "/Devices/Options", parameters: params, data: requestParameters.deviceOptionsDto})
} | https://github.com/OHPG/FinSdk | 821da9c1a6cc61efda7f7afef9496449dd89c187 | github |
openharmony/codelabs | ETSUI/MultipleDialog/entry/src/main/ets/view/CustomDialogWidget.ets | arkts | setHobbiesValue | Set hobbies value
@param {HobbyModel[]} hobby model array | setHobbiesValue(hobbyModels: HobbyModel[]) {
if (CommonUtils.isEmptyArr(hobbyModels)) {
Logger.error(CommonConstants.TAG_HOME, 'hobbyModels length is 0');
return;
}
let hobbiesText: string = '';
hobbiesText = hobbyModels.filter((isCheckItem: HobbyModel) => isCheckItem?.isChecked)
.ma... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setHobbiesValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hobbyModels AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#iden... | setHobbiesValue(hobbyModels: HobbyModel[]) {
if (CommonUtils.isEmptyArr(hobbyModels)) {
Logger.error(CommonConstants.TAG_HOME, 'hobbyModels length is 0');
return;
}
let hobbiesText: string = '';
hobbiesText = hobbyModels.filter((isCheckItem: HobbyModel) => isCheckItem?.isChecked)
.ma... | https://gitee.com/openharmony/codelabs.git | 571e16973da2b5d974e016d28d9013d9862bf481 | gitee |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/ThemeManager.ets | arkts | toggleTheme | 切换明暗主题 | toggleTheme(): void {
const newTheme = this.currentTheme === ThemeType.LIGHT ? ThemeType.DARK : ThemeType.LIGHT;
this.switchTheme(newTheme);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#... | toggleTheme(): void {
const newTheme = this.currentTheme === ThemeType.LIGHT ? ThemeType.DARK : ThemeType.LIGHT;
this.switchTheme(newTheme);
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 95266bc8a5eba5fe6d4dfcb0fd1dc25fde4f007e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/NativeHidParserService.ets | arkts | parseHidReport | 解析 HID 报告
@param vendorId 设备厂商 ID
@param productId 设备产品 ID
@param data HID 报告数据
@param forceType 可选,强制使用的协议类型 (0=自动, 1=Xbox, 2=DS4, 3=Switch, 5=DualSense)
@returns 解析后的手柄状态,如果解析失败返回 null | parseHidReport(vendorId: number, productId: number, data: Uint8Array, forceType?: number): NativeGamepadState | null {
if (!this.gamepadModule) {
console.warn(`${TAG} 服务未初始化`);
return null;
}
try {
return this.gamepadModule.parseHidReport(vendorId, productId, data, forceType ?? 0);
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left parseHidReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left vendorId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | parseHidReport(vendorId: number, productId: number, data: Uint8Array, forceType?: number): NativeGamepadState | null {
if (!this.gamepadModule) {
console.warn(`${TAG} 服务未初始化`);
return null;
}
try {
return this.gamepadModule.parseHidReport(vendorId, productId, data, forceType ?? 0);
... | https://github.com/AlkaidLab/moonlight-harmony | 43da630eb9c5d9475e3092fb53ed55018c0d21fc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getClassDescriptor | General helpers | static getClassDescriptor(cls: Class): RuntimeTypeDescriptor {
return cls.getDescriptor()
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getClassDescriptor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cls AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static getClassDescriptor(cls: Class): RuntimeTypeDescriptor {
return cls.getDescriptor()
} | https://gitcode.com/iop123123/arkts-static-skills | 6bea406e37a72e1eff2b8c31d996df7f841dea97 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.