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 |
|---|---|---|---|---|---|---|---|---|---|---|
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/plan/index.ets | arkts | build | 渲染日程主页骨架与测试交互入口。 | build() {
Stack({ alignContent: Alignment.BottomEnd }) {
MainTabPageLayout({
title: "日程",
actionIcon: $r("sys.symbol.magnifyingglass"),
onActionTap: () => {
this.app.nav.pushOverlayByName(
AppOverlayRoute.SEARCH,
this.app.nav.createSearchParam("plan"... | 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() {
Stack({ alignContent: Alignment.BottomEnd }) {
MainTabPageLayout({
title: "日程",
actionIcon: $r("sys.symbol.magnifyingglass"),
onActionTap: () => {
this.app.nav.pushOverlayByName(
AppOverlayRoute.SEARCH,
this.app.nav.createSearchParam("plan"... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/plan/index.ets#L37-L94 | a268c2392c9fb864dbbf0293fd75ec3f170f0253 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | jsonType | Gets the type of the JSON element.
@returns {JsonType} The type of the current JSON value | get jsonType(): JsonType {
if (this.maybeNullValue === null) {
return JsonType.JsonNull
}
if (this.maybeObjectValues != undefined) {
return JsonType.JsonObject
}
if (this.maybeArrayValues != undefined) {
... | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left jsonType 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 JsonType AST#identifie... | get jsonType(): JsonType {
if (this.maybeNullValue === null) {
return JsonType.JsonNull
}
if (this.maybeObjectValues != undefined) {
return JsonType.JsonObject
}
if (this.maybeArrayValues != undefined) {
... | https://gitcode.com/iop123123/arkts-static-skills | 5bb0be2869dfb54293e785d2908f7e5bfd15de96 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Errors.ets | arkts | constructor | The AggregateError() constructor creates AggregateError
object with message given.
@param errors An iterable of errors, may not actually be Error instances.
@param s An human-readable description of the aggregate error. | constructor(errors: Error[], s: String) {
super(s);
this.errors = errors;
this.name = "AggregateError";
} | 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 errors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Le... | constructor(errors: Error[], s: String) {
super(s);
this.errors = errors;
this.name = "AggregateError";
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 57daeeb4e5cd989b136352b34e020f6ab9e38b33 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetInformation.ets | arkts | opacityTextStyle | Custom Transparent Text Styles | @Extend(Text) function opacityTextStyle() {
.fontSize($r('app.float.text_font'))
.fontColor($r('app.color.title_black_color'))
.opacity(CommonConstants.OPACITY)
.fontWeight(CommonConstants.FONT_WEIGHT)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text) function opacityTextStyle() {
.fontSize($r('app.float.text_font'))
.fontColor($r('app.color.title_black_color'))
.opacity(CommonConstants.OPACITY)
.fontWeight(CommonConstants.FONT_WEIGHT)
} | https://gitee.com/harmonyos/codelabs.git | 1cf41bb912faf298da00b5716daeb6d867598c59 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | encodeSync | Synchronously encodes the input byte array into a Base64 encoded Uint8Array.
@param src The byte array to encode.
@param options The encoding options (Base64 type).
@returns A Uint8Array containing the Base64 encoded string. | encodeSync(src: Uint8Array, options?: Type): Uint8Array {
if (options === undefined) {
options = Type.BASIC;
}
if (options != Type.BASIC && options != Type.BASIC_URL_SAFE){
throw createBusinessError(TypeErrorCodeId,
`Paramet... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left encodeSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AST#,#Left , A... | encodeSync(src: Uint8Array, options?: Type): Uint8Array {
if (options === undefined) {
options = Type.BASIC;
}
if (options != Type.BASIC && options != Type.BASIC_URL_SAFE){
throw createBusinessError(TypeErrorCodeId,
`Paramet... | https://gitcode.com/iop123123/arkts-static-skills | dcb968cf8cfdfd02f2158abece33d83ac1c61e4e | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/UserCalendarManager.ets | arkts | getOverdueEvents | 获取过期日程 | async getOverdueEvents() {
const calendar = await this.getDefaultCalendar() as calendarManager.Calendar
// 添加查询条件能查询全部,0 ~ Date.now 查询所有过期日程
try {
if (canIUse('SystemCapability.Applications.CalendarData')) {
const filter = calendarManager.EventFilter.filterByTime(0, Date.now())
retur... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOverdueEvents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST... | async getOverdueEvents() {
const calendar = await this.getDefaultCalendar() as calendarManager.Calendar
// 添加查询条件能查询全部,0 ~ Date.now 查询所有过期日程
try {
if (canIUse('SystemCapability.Applications.CalendarData')) {
const filter = calendarManager.EventFilter.filterByTime(0, Date.now())
retur... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 989dd6ce39c4d43c27e0fdd990c0374d39f7d6d0 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | getCurrentAverageDifficulty | 获取当前平均难度 | private getCurrentAverageDifficulty(): Difficulty {
if (this.answerHistory.length === 0) {
return Difficulty.EASY;
}
const recentAnswers = this.answerHistory.slice(-this.difficultyConfig.windowSize);
const difficultyScores = recentAnswers.map(a => this.difficultyToScore(a.difficulty));
cons... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCurrentAverageDifficulty 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#identif... | private getCurrentAverageDifficulty(): Difficulty {
if (this.answerHistory.length === 0) {
return Difficulty.EASY;
}
const recentAnswers = this.answerHistory.slice(-this.difficultyConfig.windowSize);
const difficultyScores = recentAnswers.map(a => this.difficultyToScore(a.difficulty));
cons... | https://github.com/the-wwyang/kids-learning-app | 2352fd9c60a8e048fcbedf5cfcf5af6516ac01c9 | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BudgetManager.ets | arkts | getBudgetsByMonth | 查询指定月份的预算列表。 | static async getBudgetsByMonth(month: string): Promise<BudgetBean[]> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('month', month);
predicates.orderByAsc('id');
return new Promise<BudgetBean[]>((resolve, reject) => {
dbManager.dbStore?.query(predicates)
... | 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 getBudgetsByMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left month AST#identifier#Right AST#:#Left ... | static async getBudgetsByMonth(month: string): Promise<BudgetBean[]> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('month', month);
predicates.orderByAsc('id');
return new Promise<BudgetBean[]>((resolve, reject) => {
dbManager.dbStore?.query(predicates)
... | https://github.com/ZestBox-18/kitebook-frontend | b2be98064f80df829238a4006031a9194df9b3fd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/BookTransitionOverlay.ets | arkts | isCancellingTransition | 是否正在取消动画 | public isCancellingTransition(): boolean {
return this.isCancelling;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isCancellingTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left bo... | public isCancellingTransition(): boolean {
return this.isCancelling;
} | https://github.com/DaLongZhuaZi/manxia | 418563d969777b454716de4b93a828687b3574fe | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | subarray | Creates a Int16Array with the same ArrayBuffer
@param begin start index, inclusive
@returns new Int16Array with the same ArrayBuffer | public subarray(begin: number): Int16Array {
return this.subarray(begin as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public subarray(begin: number): Int16Array {
return this.subarray(begin as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7cc4549da74f762a4d4f81fd9991a448fd61ef5b | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/ReminderDAO.ets | arkts | exists | 检查提醒是否存在 | static async exists(reminderId: number): Promise<boolean> {
return await DAOHelper.exists(Reminder.tableName, 'reminder_id', reminderId);
} | 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 exists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reminderId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async exists(reminderId: number): Promise<boolean> {
return await DAOHelper.exists(Reminder.tableName, 'reminder_id', reminderId);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | cd2354e1604c6500380ef9ac432312bef57c67d7 | github |
ibestservices/ibest-ui | library/src/main/ets/components/button/index.ets | arkts | getBorderRadius | 获取按钮的borderRadius | getBorderRadius() {
return this.btnBorderRadius !== '' ? getSizeByUnit(this.btnBorderRadius) : this.btnBorder?.radius ?? (this.square ? 0 : this.baseStyle[`borderRadius${this.round ? 'Max' : 'Md'}`])
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBorderRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | getBorderRadius() {
return this.btnBorderRadius !== '' ? getSizeByUnit(this.btnBorderRadius) : this.btnBorder?.radius ?? (this.square ? 0 : this.baseStyle[`borderRadius${this.round ? 'Max' : 'Md'}`])
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/button/index.ets#L234-L236 | 1c334e5bb9d04f8841d17cf862fd2f3e86ff9fc2 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleRemoteConfig.ets | arkts | getValueAndEnroll | Convenience: return `getValue(key)` and enroll the caller in the A/B
tests attached to that key. No enroll fires if the key is unknown. | public async getValueAndEnroll(key: string): Promise<RCData | null> {
const value: RCData | null = this.getValue(key);
if (value !== null) await this.enrollIntoABTestsForKeys([key]);
return value;
} | 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 getValueAndEnroll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : ... | public async getValueAndEnroll(key: string): Promise<RCData | null> {
const value: RCData | null = this.getValue(key);
if (value !== null) await this.enrollIntoABTestsForKeys([key]);
return value;
} | https://github.com/Countly/countly-sdk-hos | f8e5ae62f2e73ad0327a47ead90c0a375c95249e | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets | arkts | computePlatformResolvedLocale | /** Invoked by native to obtain the results of OHOS's locale resolution algorithm. | computePlatformResolvedLocale(strings: Array<string>): Array<string> {
Log.d(TAG, "called computePlatformResolvedLocale " + JSON.stringify(strings))
return []
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left computePlatformResolvedLocale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left strings AST#identifier#Ri... | computePlatformResolvedLocale(strings: Array<string>): Array<string> {
Log.d(TAG, "called computePlatformResolvedLocale " + JSON.stringify(strings))
return []
} | https://gitee.com/openharmony-sig/flutter_engine.git | 24e236707e6b81d67a2cdfa7a1e07bc5be8cc0ef | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | getFrame | 获取缓存的帧 | getFrame(id: string): FrameCacheItem | null {
const frame = this.cache.get(id)
if (frame) {
this.hitCount++
return frame
}
this.missCount++
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | getFrame(id: string): FrameCacheItem | null {
const frame = this.cache.get(id)
if (frame) {
this.hitCount++
return frame
}
this.missCount++
return null
} | https://github.com/AetheriumSimulator/qemu-hmos | 96075c220df68492cb523a44917c7515af9a9f62 | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | setOnPcmData | 设置 PCM 数据钩子(从 AudioRenderer 的 writeData 回调中同步触发)。
@remarks
- 回调在音频写入线程/回调中触发:必须足够轻量,严禁做重 IO/重计算。
- pcmBuffer 可能会被系统复用;如需异步使用请自行复制。
- bytesWritten 表示本次写入有效字节数(仅前 bytesWritten 字节有效)。 | public setOnPcmData(callback: PcmDataCallback | null, options?: PcmDataOptions): void {
this.onPcmDataCallback = callback;
const minIntervalMs = options?.minIntervalMs ?? 0;
this.pcmTapMinIntervalMs = Number.isFinite(minIntervalMs) && minIntervalMs > 0 ? Math.floor(minIntervalMs) : 0;
this.lastPcmTapT... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnPcmData 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_expressi... | public setOnPcmData(callback: PcmDataCallback | null, options?: PcmDataOptions): void {
this.onPcmDataCallback = callback;
const minIntervalMs = options?.minIntervalMs ?? 0;
this.pcmTapMinIntervalMs = Number.isFinite(minIntervalMs) && minIntervalMs > 0 ? Math.floor(minIntervalMs) : 0;
this.lastPcmTapT... | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L92-L97 | 85ec4f638f8d220c7c6b8aa67bedbb1ffd6c3d51 | github |
ccccjiemo/glview | src/main/ets/glview/GLViewController.ets | arkts | registerOnCreated | getEGLConfig(): egl.EGLConfig {
return this.eglConfig;
}
getEGLSurface(): egl.EGLSurface {
return this.eglSurface;
}
getEGLContext(): egl.EGLContext {
return this.eglContext;
} | registerOnCreated(onCreated?: Function) {
this.onCreated = onCreated;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerOnCreated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left onCreated AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left Function ... | registerOnCreated(onCreated?: Function) {
this.onCreated = onCreated;
} | https://github.com/ccccjiemo/glview | 67c364500fc76faaba1e98f786183a81da5e9e02 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | setBaseUrl | 设置基础URL | setBaseUrl(baseUrl: string): LegadoRuleAnalyzer {
this.baseUrl = baseUrl;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig... | setBaseUrl(baseUrl: string): LegadoRuleAnalyzer {
this.baseUrl = baseUrl;
return this;
} | https://github.com/DaLongZhuaZi/manxia | e6ee1b3787ae36cff9851e5bed52a78283145bed | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setDrawGridBackground | set this to true to draw the grid background, false if not
@param enabled | public setDrawGridBackground(enabled: boolean): void {
this.mDrawGridBackground = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawGridBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | public setDrawGridBackground(enabled: boolean): void {
this.mDrawGridBackground = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d8071305cb6652e9f5d5ec64050ac5a89de808aa | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | removeAt | Remove the key-value pair for the index.
@param index the index of the element to remove
@returns the value of the index, or undefined if the index is not found | public removeAt(index: int): T | undefined {
this.checkIndexType(index);
if (index < 0 || index >= this.length) {
return undefined;
}
const value: T | undefined = this.getValueAt(index);
if (value !== undefined) {
this.buckets.removeAt(index);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeAt 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#Rig... | public removeAt(index: int): T | undefined {
this.checkIndexType(index);
if (index < 0 || index >= this.length) {
return undefined;
}
const value: T | undefined = this.getValueAt(index);
if (value !== undefined) {
this.buckets.removeAt(index);
... | https://gitcode.com/iop123123/arkts-static-skills | 8f1218448e7f624421ade6adb8fbab8839f4acdb | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | hasFrame | 检查帧是否在缓存中 | hasFrame(id: string): boolean {
return this.cache.has(id)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Ri... | hasFrame(id: string): boolean {
return this.cache.has(id)
} | https://github.com/AetheriumSimulator/qemu-hmos | cdc0c0028c69e4f60946ec4837377c4e3d809f54 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getAxisLineWidth | Returns the width of the axis line (line alongside the axis).
@return | public getAxisLineWidth(): number {
return this.mAxisLineWidth;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAxisLineWidth 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 AS... | public getAxisLineWidth(): number {
return this.mAxisLineWidth;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 8dfe502a0e65381667672fa9921064a29926c373 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/RecentFilesService.ets | arkts | checkAndClearExpiredPasswords | 检查并清除过期的密码
@param recentFiles 最近文件列表
@returns 清理后的最近文件列表 | private checkAndClearExpiredPasswords(recentFiles: RecentFile[]): RecentFile[] {
let needUpdate = false;
const now = new Date().getTime();
const maxAge = RecentFilesService.PASSWORD_VALIDITY_DAYS * 24 * 60 * 60 * 1000; // 90天的毫秒数
recentFiles.forEach(file => {
if (file.password && file.passwordS... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkAndClearExpiredPasswords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left recentFiles AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | private checkAndClearExpiredPasswords(recentFiles: RecentFile[]): RecentFile[] {
let needUpdate = false;
const now = new Date().getTime();
const maxAge = RecentFilesService.PASSWORD_VALIDITY_DAYS * 24 * 60 * 60 * 1000; // 90天的毫秒数
recentFiles.forEach(file => {
if (file.password && file.passwordS... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L182-L210 | 6b56fb2eda737529a7e7da74f22453da79a80048 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/DefaultParser.ets | arkts | getLongPrefix | Searches for a prefix that is the long name of an option (-Xmx512m)
@param token | private getLongPrefix(token: string): string{
let t = Util.stripLeadingHyphens(token);
let i: number;
let opt = '';
for (i = t.length - 2; i > 1; i--) {
let prefix = t.substring(0, i);
if (this.options.hasLongOption(prefix)) {
opt = prefix;
break;
}
}
return o... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLongPrefix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private getLongPrefix(token: string): string{
let t = Util.stripLeadingHyphens(token);
let i: number;
let opt = '';
for (i = t.length - 2; i > 1; i--) {
let prefix = t.substring(0, i);
if (this.options.hasLongOption(prefix)) {
opt = prefix;
break;
}
}
return o... | https://gitee.com/openharmony-sig/commons-cli.git | 10c6339cb9415ce34c5bd21f84b68f8f91f67ee6 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | replaceTemplateVariables | 替换模板变量 {{$.xxx}} 或 {{xxx}} 或 @get:{xxx} | private replaceTemplateVariables(template: string): string {
let result = template;
// 处理 @get:{xxx} 变量获取
result = result.replace(/@get:\{([^}]+)\}/gi, (match: string, key: string): string => {
const trimmedKey = key.trim();
return this.variables.get(trimmedKey) || '';
});
//... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left replaceTemplateVariables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left template AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri... | private replaceTemplateVariables(template: string): string {
let result = template;
// 处理 @get:{xxx} 变量获取
result = result.replace(/@get:\{([^}]+)\}/gi, (match: string, key: string): string => {
const trimmedKey = key.trim();
return this.variables.get(trimmedKey) || '';
});
//... | https://github.com/DaLongZhuaZi/manxia | 4616869aa83bb5b7d16bf0268280c03fe974820f | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getMemberById | Get user info by numeric member id. | async getMemberById(memberId: number): Promise<V2exMemberProfile> {
if (memberId <= 0) {
throw ApiErrors.invalidUsername()
}
return this.http.get<V2exMemberProfile>(`${ApiConstants.API_MEMBER_SHOW}?id=${memberId}`)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getMemberById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left memberId AST#identifier#Right A... | async getMemberById(memberId: number): Promise<V2exMemberProfile> {
if (memberId <= 0) {
throw ApiErrors.invalidUsername()
}
return this.http.get<V2exMemberProfile>(`${ApiConstants.API_MEMBER_SHOW}?id=${memberId}`)
} | https://github.com/honjow/Next2V | 3a876f6e874bba5214d38aa851c0b74d75f5e5a5 | github |
axiomaster/bonio | harmonyos/entry/src/main/ets/pages/CanvasTab.ets | arkts | aboutToAppear | No longer attaching in aboutToAppear to avoid association error | aboutToAppear() {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
} | https://github.com/axiomaster/bonio | 2600b88c39a9fa7a466322b967fa835584396e29 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Message.ets | arkts | isEmpty | 判断消息是否为空(所有字段都是默认值)
@returns true 如果所有字段都是默认值
注意:子类应覆盖此方法以检查所有字段 | isEmpty(): boolean {
// 默认实现:只检查未知字段
return this.unknownFields.isEmpty()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b... | isEmpty(): boolean {
// 默认实现:只检查未知字段
return this.unknownFields.isEmpty()
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 001b18449f609744d8c109919efbf93268534db8 | gitcode |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/GoalEditPage.ets | arkts | updateDefaultDirection | 根据目标类型更新默认方向 | updateDefaultDirection() {
switch (this.goalType) {
case GoalType.WEIGHT:
this.goalDirection = GoalDirection.DECREASE; // 默认减重
break;
case GoalType.STEPS:
case GoalType.WATER:
case GoalType.SLEEP:
case GoalType.EXERCISE:
this.goalDirection = GoalDirection.INCR... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateDefaultDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_b... | updateDefaultDirection() {
switch (this.goalType) {
case GoalType.WEIGHT:
this.goalDirection = GoalDirection.DECREASE; // 默认减重
break;
case GoalType.STEPS:
case GoalType.WATER:
case GoalType.SLEEP:
case GoalType.EXERCISE:
this.goalDirection = GoalDirection.INCR... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | b9b89feb4819bec3b0190ad0f53341d7f9f93aaf | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CloudSyncService.ets | arkts | syncOnce | Push deltas + apply server pulls. Returns a structured outcome but
never throws. Callers (BattlePage.aboutToDisappear, etc.) can
fire-and-forget. | async syncOnce(): Promise<CloudSyncResult> {
const out: CloudSyncResult = new CloudSyncResult();
if (this.inFlight) {
out.status = 'no_changes';
return out;
}
this.inFlight = true;
try {
return await this.runSync(out);
} finally {
this.inFlight = false;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left syncOnce AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async syncOnce(): Promise<CloudSyncResult> {
const out: CloudSyncResult = new CloudSyncResult();
if (this.inFlight) {
out.status = 'no_changes';
return out;
}
this.inFlight = true;
try {
return await this.runSync(out);
} finally {
this.inFlight = false;
}
} | https://github.com/terryma2024/happyword | aab0aec32fd09345ab2e4d67342aa9c8b0a464ba | github |
Explore-In-HMOS-Wearable/music-player | entry/src/main/ets/utils/MediaController.ets | arkts | resume | Resume music | public async resume() {
if (!this.player) {
return;
}
try {
this.player.play()
.then(() => {
this.updateIsPlay(true);
BackgroundUtil.startContinuousTask(this.context);
hilog.info(audioDomain, audioPrefix, 'resume success');
})
.catch((err: ... | 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 resume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Rig... | public async resume() {
if (!this.player) {
return;
}
try {
this.player.play()
.then(() => {
this.updateIsPlay(true);
BackgroundUtil.startContinuousTask(this.context);
hilog.info(audioDomain, audioPrefix, 'resume success');
})
.catch((err: ... | https://github.com/Explore-In-HMOS-Wearable/music-player | 0dbcfbe1b4832727d5582818c133bd6c8a8dabad | github |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/FilterKeywordSettings.ets | arkts | reset | 重置关键词列表与 manager | reset(): void {
this.manager = new FilterListManager<FilterKeyword>()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset 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#Left A... | reset(): void {
this.manager = new FilterListManager<FilterKeyword>()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/FilterKeywordSettings.ets#L70-L72 | 520ffc5878672b38b968e7303f52a38a15f74cae | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/PermissionManager.ets | arkts | canAcknowledgeAlert | 检查是否可以确认告警 | public canAcknowledgeAlert(alertRoomId: string): boolean {
if (!this.currentUser) {
console.warn('PermissionManager: No current user');
return false;
}
const role = this.currentUser.role;
// 护士长可以确认所有告警
if (role === UserRole.HEAD_NURSE) {
return true;
}
// 护士只能确认负责房间的告... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left canAcknowledgeAlert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left alertRoomId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | public canAcknowledgeAlert(alertRoomId: string): boolean {
if (!this.currentUser) {
console.warn('PermissionManager: No current user');
return false;
}
const role = this.currentUser.role;
// 护士长可以确认所有告警
if (role === UserRole.HEAD_NURSE) {
return true;
}
// 护士只能确认负责房间的告... | https://github.com/LJ666-ui/harmony-health-care | 25fad5000ec2783f03a92e9a751ae130d1534280 | github |
fbinba3955/Flymby | main/src/main/ets/pages/player/ReportUtil.ets | arkts | doReportProgress | 上报播放中进度 | async function doReportProgress(playbackInfo: PlaybackResponse, itemId: string, currentTime: number,
playerStatus: PlayerStatus) {
const firstMediaSource: MediaSource = playbackInfo?.MediaSources[0]
LogUtil.debug("报告播放进度成功 - itemId:", itemId, "playSessionId:", playbackInfo?.PlaySessionId,
"mediaSourceId:", fi... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left doReportProgress AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left playbackInfo AST#identifier#Righ... | async function doReportProgress(playbackInfo: PlaybackResponse, itemId: string, currentTime: number,
playerStatus: PlayerStatus) {
const firstMediaSource: MediaSource = playbackInfo?.MediaSources[0]
LogUtil.debug("报告播放进度成功 - itemId:", itemId, "playSessionId:", playbackInfo?.PlaySessionId,
"mediaSourceId:", fi... | https://github.com/fbinba3955/Flymby | dc03c3a6b7f19a4fa815ac463550d93281de52d5 | github |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | logInfo | 记录信息日志
在 INFO 及以上级别记录
@param infoMessage 信息内容 | logInfo(infoMessage: string): void {
if (!this.shouldLog(LogLevel.INFO)) {
return
}
const message = this.formatMessage('INFO', '-', infoMessage)
this.recordToHistory(message)
hilog.info(this.domain, this.tag, message)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left infoMessage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | logInfo(infoMessage: string): void {
if (!this.shouldLog(LogLevel.INFO)) {
return
}
const message = this.formatMessage('INFO', '-', infoMessage)
this.recordToHistory(message)
hilog.info(this.domain, this.tag, message)
} | https://github.com/offlinecat-dev/OCNetORM | 1d6d7c7ee1ddac8d381ba2a3877dbdad2d364310 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DependencyContainer.ets | arkts | createScope | 创建作用域 | public createScope(scopeId: string): void {
if (!this.scoped.has(scopeId)) {
this.scoped.set(scopeId, new Map());
logger.debug('DI', `创建作用域: ${scopeId}`);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createScope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scopeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | public createScope(scopeId: string): void {
if (!this.scoped.has(scopeId)) {
this.scoped.set(scopeId, new Map());
logger.debug('DI', `创建作用域: ${scopeId}`);
}
} | https://github.com/DaLongZhuaZi/manxia | 3f2396fc48b3e5098fc1abf0a786f33fcf191dd2 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets | arkts | getAppName | 获取应用名
@param bundleName 包名
return 应用名 | public getAppName(bundleName: string): string {
let resourceFlag: bundleResourceManager.ResourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
let appName: string = '';
try {
let resourceInfo: bundleResourceManager.BundleResourceInfo =
bundleResourceManager.getBundleResourc... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAppName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left bundleName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | public getAppName(bundleName: string): string {
let resourceFlag: bundleResourceManager.ResourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
let appName: string = '';
try {
let resourceInfo: bundleResourceManager.BundleResourceInfo =
bundleResourceManager.getBundleResourc... | https://gitee.com/openharmony/applications_permission_manager.git | ee1fc82f813a4516d5b0132f3ff8cfce8b135df1 | gitee |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/WantProcessUtil.ets | arkts | hasWant | 处理拉起链接 | static async hasWant(context: Context, pathStack: NavPathStack) {
if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) {
let avMetadataExtractor: media.AVMetadataExtractor | undefined
let file: fs.File | undefined
try {
avMetadataExtractor = await media.createAVMetadataE... | 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 hasWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#... | static async hasWant(context: Context, pathStack: NavPathStack) {
if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) {
let avMetadataExtractor: media.AVMetadataExtractor | undefined
let file: fs.File | undefined
try {
avMetadataExtractor = await media.createAVMetadataE... | https://github.com/Yebingiscn/SweetVideo | a0d11a3e7465a02f460c721673aeec6288fb0ca8 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | getInstanceId | Returns the native instanceId | public getInstanceId(): number {
return this._surfaceBridge.instanceId;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInstanceId 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#n... | public getInstanceId(): number {
return this._surfaceBridge.instanceId;
} | https://github.com/AGenUI/AGenUI | fd6b5618340e3cc318dd56347526eb810324e06c | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFMpegUtils.ets | arkts | convertVideo | 便捷方法:视频格式转换
@param inputPath 输入文件路径或URL
@param outputPath 输出文件路径
@param onProgress 进度回调
@returns Promise | static convertVideo(
inputPath: string,
outputPath: string,
onProgress?: (progress: number) => void
): Promise<number> {
return FFMpegUtils.executeFFmpegCommand({
cmds: ['-i', inputPath, '-c:v', 'libx264', '-c:a', 'aac', outputPath],
onFFmpegProgress: onProgress || ((progress) => {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left convertVideo AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left inputPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Rig... | static convertVideo(
inputPath: string,
outputPath: string,
onProgress?: (progress: number) => void
): Promise<number> {
return FFMpegUtils.executeFFmpegCommand({
cmds: ['-i', inputPath, '-c:v', 'libx264', '-c:a', 'aac', outputPath],
onFFmpegProgress: onProgress || ((progress) => {
... | https://github.com/jjjjjjava/ffmpeg_tools | b3f7023369f4d520965349cda937d9d20c2b4f2b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | constructor | constructor
@param {RuntimeTypeDescriptor} td type descriptor
@param {RuntimeLinker} contextLinker runtime linker context
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | protected constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) {
this.td = td
this.contextLinker = contextLinker
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#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#Le... | protected constructor(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker) {
this.td = td
this.contextLinker = contextLinker
} | https://gitcode.com/iop123123/arkts-static-skills | 2983bf51b6895b8191fa082fefc4d9c1b3d75540 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | hasLogged | 判断当前是否已登录
@returns | hasLogged(): boolean {
return this.loginInfo !== null;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasLogged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | hasLogged(): boolean {
return this.loginInfo !== null;
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 7910396ebdde9528d7de96f99570ea0b56c8eda6 | github |
the-wwyang/kids-learning-app | src/main/ets/services/AchievementService.ets | arkts | checkAccuracyAchievements | 检查正确率成就
@param totalQuestions 总题数
@param correctCount 正确数
@returns 新解锁的成就列表 | static checkAccuracyAchievements(totalQuestions: number, correctCount: number): string[] {
const unlockedIds: string[] = [];
if (totalQuestions < 50) return unlockedIds; // 至少需要50题才能判断
const accuracyRate = Math.round((correctCount / totalQuestions) * 100);
const accuracyAchievements = AchievementSer... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkAccuracyAchievements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left totalQuestions AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left ... | static checkAccuracyAchievements(totalQuestions: number, correctCount: number): string[] {
const unlockedIds: string[] = [];
if (totalQuestions < 50) return unlockedIds; // 至少需要50题才能判断
const accuracyRate = Math.round((correctCount / totalQuestions) * 100);
const accuracyAchievements = AchievementSer... | https://github.com/the-wwyang/kids-learning-app | 2bc42b712d4803755066857694cbbcd3f7c5baaa | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/subtraction/subtraction_float.ets | arkts | main | ---
desc: check subtraction of two floats
--- | function main(): void {
const a: float = {{v.left}} as float
const b: float = {{v.right}} as float
const v: float = {{v.result}} as float
const r: float = a - b
if (Float.isNaN(v)) {
assert(Float.isNaN(r))
} else {
assert r == v
}
} | 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: float = {{v.left}} as float
const b: float = {{v.right}} as float
const v: float = {{v.result}} as float
const r: float = a - b
if (Float.isNaN(v)) {
assert(Float.isNaN(r))
} else {
assert r == v
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 203629b5bb675415eac3b5da39e795ad022ee384 | gitee |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | userSummary | 获取用户摘要 | static userSummary(username: string): string {
return `/u/${username}/summary.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left userSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | static userSummary(username: string): string {
return `/u/${username}/summary.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | ccb6880759be28f9ac18929640163c24149ed5df | github |
openharmony/vendor_unionman | unionpi_tiger/sample_api10/app/metartc_app/entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | aboutToAppear和aboutToDisappear也可以放在入口组件中,后者表示程序被sha死时调用的函数
组件即将出现时回调该接⼝ | aboutToAppear(){
console.log('This Page is 入口aboutToAppear')
this.loadParam();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear(){
console.log('This Page is 入口aboutToAppear')
this.loadParam();
} | https://gitee.com/openharmony/vendor_unionman.git | be937ba3b11710250e05a127a66196d7ea0bea26 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets | arkts | convertToPages | 批量转换页面 | static convertToPages(legacyPages: LegacyPageInfo[]): PageInfo[] {
return legacyPages.map(p => this.convertToPageInfo(p));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left legacyPages AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | static convertToPages(legacyPages: LegacyPageInfo[]): PageInfo[] {
return legacyPages.map(p => this.convertToPageInfo(p));
} | https://github.com/DaLongZhuaZi/manxia | 67671296cdaf7f618afb6dce7de8e9b3070f850f | github |
erosTeam/NextE | shared/src/main/ets/network/EhApiService.ets | arkts | getPreviewImages | Fetch one preview page (?p=) of image-page links for the reader. | async getPreviewImages(
gid: string,
token: string,
isEx: boolean,
p: number,
): Promise<EhGalleryImage[]> {
const url: string = `${EhConstants.baseUrl(isEx)}/g/${gid}/${token}/?p=${p}`
const resp = await this.fetch(url, isEx, 'detail')
return EhGalleryImageParser.parse(resp.body)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPreviewImages AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left gid AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async getPreviewImages(
gid: string,
token: string,
isEx: boolean,
p: number,
): Promise<EhGalleryImage[]> {
const url: string = `${EhConstants.baseUrl(isEx)}/g/${gid}/${token}/?p=${p}`
const resp = await this.fetch(url, isEx, 'detail')
return EhGalleryImageParser.parse(resp.body)
} | https://github.com/erosTeam/NextE | 0390cf2ffc320ac3a106b5d6fd3f744b7a4d9c60 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Error.ets | arkts | constructor | Constructs a new error instance with provided message and cause
@param msg message of the error
@param cause cause of the error | constructor(msg: String, cause: Object) {
this.message = msg;
this.cause = cause;
this.name = "Error";
this.provisionStackTrace();
} | 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 msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST#identifier#Right AS... | constructor(msg: String, cause: Object) {
this.message = msg;
this.cause = cause;
this.name = "Error";
this.provisionStackTrace();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 883e6e8da20aca10407510a911473e9e7708e07d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | isObject | 检查值是否为对象(非null、非数组)
@param value - 要检查的值
@returns 是否为对象 | static isObject(value: Object): boolean {
return value !== null && typeof value === 'object' && !Array.isArray(value);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object... | static isObject(value: Object): boolean {
return value !== null && typeof value === 'object' && !Array.isArray(value);
} | https://github.com/DaLongZhuaZi/manxia | 1d47db10c79f806c0de95cb4fda1453da62f27cb | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/setting.ets | arkts | delOwnChatMessage | 删除一条"我"和某个人的聊天记录 | async delOwnChatMessage(userId: string, messId: string) {
const store = this.getStore()
const list = this.getChatMessage(userId) //拿到所有的所有的聊天记录
const index = list.findIndex(item => item.id === messId)
list.splice(index, 1) //删除
// 写入list
store.putSync(`${UserRecord_KEY}_${userId}`, JSON.string... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delOwnChatMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async delOwnChatMessage(userId: string, messId: string) {
const store = this.getStore()
const list = this.getChatMessage(userId) //拿到所有的所有的聊天记录
const index = list.findIndex(item => item.id === messId)
list.splice(index, 1) //删除
// 写入list
store.putSync(`${UserRecord_KEY}_${userId}`, JSON.string... | https://github.com/SMAT-Lab/PhantomRendering | eee9a9f426f347f59fed2cc8f852e537cac001d3 | github |
openharmony-sig/ohos_checksum | library/src/main/ets/md5.ets | arkts | md5_cmn | These functions implement the four basic operations the algorithm uses. | md5_cmn(q: number, a: number, b: number, x: number, s: number, t: number) :number {
return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left md5_cmn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left q AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#Righ... | md5_cmn(q: number, a: number, b: number, x: number, s: number, t: number) :number {
return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b);
} | https://gitee.com/openharmony-sig/ohos_checksum.git | f8ab7074762b6a839ddba4cead96fbd65cb7fc8c | gitee |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | addSmallEndFileCache | @brief 添加小端文件缓存,并进行初始化
添加一个小端文件缓存实例至默认的文件缓存拦截器中, 不同的缓存实例之前不会相互LRU
@param cacheName 小端文件缓存名称,不能为空,不能与其他的小端文件缓存名称一样
@param context 上下文
@param filePath 设置小端文件缓存的子目录,最终的缓存目录不能与大端缓存目录或其他小端目录一样
@returns 返回缓存错误码 | async addSmallEndFileCache(cacheName:string, context:Context, filePath:string,
maxSize: number = 256, maxDiskUsage: number = 256 * 1024 * 1024) : Promise<CacheErrorCode> {
return await nativeNode.addSmallEndFileCache(cacheName, context.filesDir, filePath, maxSize, maxDiskUsage);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addSmallEndFileCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cacheName AST#identifier#Right AST#type_annotation#Left AS... | async addSmallEndFileCache(cacheName:string, context:Context, filePath:string,
maxSize: number = 256, maxDiskUsage: number = 256 * 1024 * 1024) : Promise<CacheErrorCode> {
return await nativeNode.addSmallEndFileCache(cacheName, context.filesDir, filePath, maxSize, maxDiskUsage);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L157-L160 | 83a660fccaab2e89eff69ebc0f875928eec02a43 | gitcode |
openharmony/codelabs | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | getStarringData | Get starring data.
@return {starring} return starring Resource. | getStarringData(): Resource[] {
let starring: Resource[] = [];
STARRING_DATA.forEach((starringItem: Resource) => {
starring.push(starringItem);
});
return starring;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getStarringData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Resource AST#ide... | getStarringData(): Resource[] {
let starring: Resource[] = [];
STARRING_DATA.forEach((starringItem: Resource) => {
starring.push(starringItem);
});
return starring;
} | https://gitee.com/openharmony/codelabs.git | d02771c6a5f182276e079b1edfaa58895bce45fd | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<int> } items - a set of elements to include in the new array object.
@returns { Int16Array } - a new Int16Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<int>): Int16Array {
let res = new Int16Array(items.length.toInt())
res.ofInt(stub.toValueArray(items))
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<int>): Int16Array {
let res = new Int16Array(items.length.toInt())
res.ofInt(stub.toValueArray(items))
return res
} | https://gitcode.com/iop123123/arkts-static-skills | e6f7348d051a67cfc7fc7a9c145421acba65290f | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/guide/index.type.ets | arkts | getCenterY | 获取中心点Y轴坐标
@returns Y坐标 | public getCenterY(): number {
return this.top + (this.bottom - this.top) / 2
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCenterY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | public getCenterY(): number {
return this.top + (this.bottom - this.top) / 2
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/guide/index.type.ets#L35-L37 | 24a2258a0c2cfcc7f157bfaeeede0a48b7c9ec77 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | lastIndexOf | Moves backwards starting at fromIndex to 0 and search val.
@param val a value to search
@param fromIndex the first index to search val at, i.e. fromIndex is included in search space
@returns right-most index of val. It must be less or equal than fromIndex. -1 if val not found
@link https://developer.mozilla.org/en-US/d... | public lastIndexOf(val: number, fromIndex: number): number {
return this.lastIndexOf(val as double as int as byte, fromIndex as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | public lastIndexOf(val: number, fromIndex: number): number {
return this.lastIndexOf(val as double as int as byte, fromIndex as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9b2658085dd8dd3a0e25466dd4449991e4d3934f | gitee |
ZestBox-18/kitebook-frontend | commons/base/src/main/ets/entities/BillBean.ets | arkts | getTimeString | 获取时间字符串 | getTimeString(): string {
const date = new Date(this.date);
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
return `${hours}:${minutes}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTimeString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statemen... | getTimeString(): string {
const date = new Date(this.date);
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
return `${hours}:${minutes}`;
} | https://github.com/ZestBox-18/kitebook-frontend | 73c9e9f91cc71e7e30d9907e3b479fbbd616072f | github |
openharmony-sig/ohos_checksum | library/src/main/ets/md5.ets | arkts | hex_md5 | base-64 pad character. "=" for strict RFC compliance
These are the functions you'll usually want to call
They take string arguments and return either hex or base-64 encoded strings | hex_md5(s: string) :string {
return this.rstr2hex(this.rstr_md5(this.str2rstr_utf8(s)));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hex_md5 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Righ... | hex_md5(s: string) :string {
return this.rstr2hex(this.rstr_md5(this.str2rstr_utf8(s)));
} | https://gitee.com/openharmony-sig/ohos_checksum.git | ff80f2a98a0f68525a46689987614ae35ea853e3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DownloadSyncManager.ets | arkts | isConfigured | 检查Download同步目录是否已配置 | isConfigured(): boolean {
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
return !!downloadDirPath;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isConfigured AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem... | isConfigured(): boolean {
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
return !!downloadDirPath;
} | https://github.com/DaLongZhuaZi/manxia | bcc8c5b18545eba2a88a4620ba6a2ee7641e62c7 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/CleanerManager.ets | arkts | getLargeSizeList | 获取大尺寸图片,用于压缩 | async getLargeSizeList() {
// 获取所有图片/视频
const photoAssets = await this.getAssets() as photoAccessHelper.PhotoAsset[]
// 过滤出 超过 200 kb,根据情况进行调整,模拟器只能截图,图片尺寸都比较小,如果是真机,可以设置为超过 2M
const largeSize = 200 * KILO_BYTE
return photoAssets.filter(item => {
try {
if (canIUse('SystemCapability.F... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLargeSizeList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST... | async getLargeSizeList() {
// 获取所有图片/视频
const photoAssets = await this.getAssets() as photoAccessHelper.PhotoAsset[]
// 过滤出 超过 200 kb,根据情况进行调整,模拟器只能截图,图片尺寸都比较小,如果是真机,可以设置为超过 2M
const largeSize = 200 * KILO_BYTE
return photoAssets.filter(item => {
try {
if (canIUse('SystemCapability.F... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | a582f5b61065ab1771c56c27b39d2308fb5c4a59 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts boolean to JSON format
@param d: boolean - boolean to be converted to a JSON as a Boolean literal
@returns String - JSON representation of boolean | public static stringify(d: boolean): String {
if (d) {
return 'true'
}
return 'false'
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: boolean): String {
if (d) {
return 'true'
}
return 'false'
} | https://gitcode.com/iop123123/arkts-static-skills | 3accccbc5b3d4be0478be8a344d03a585ee8fe55 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/GameManager.ets | arkts | saveMetadataCache | 保存元数据缓存 | private async saveMetadataCache(): Promise<void> {
if (!this.dataPreferences) return;
try {
const data: Record<string, CachedMetadata> = {};
this.metadataCache.forEach((value, key) => {
data[key] = value;
});
await this.dataPreferences.put(KEY_GAME_METADATA, JSON.stringify(dat... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveMetadataCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async saveMetadataCache(): Promise<void> {
if (!this.dataPreferences) return;
try {
const data: Record<string, CachedMetadata> = {};
this.metadataCache.forEach((value, key) => {
data[key] = value;
});
await this.dataPreferences.put(KEY_GAME_METADATA, JSON.stringify(dat... | https://github.com/richshaw2015/nds | ade51ded5b3e492b7382e25aa8ba8cf44d7cfa8b | github |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/component/WoDe/PatientManager.ets | arkts | addPatient | 添加就诊人 (跳转到添加页面或弹出对话框) | addPatient() {
router.pushUrl({ url: 'pages/component/WoDe/PatientAdd' })
.then(() => {
// 跳转成功
})
.catch((err: Error) => {
console.error('跳转失败', err);
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addPatient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | addPatient() {
router.pushUrl({ url: 'pages/component/WoDe/PatientAdd' })
.then(() => {
// 跳转成功
})
.catch((err: Error) => {
console.error('跳转失败', err);
});
} | https://github.com/luojiang001/Pulse | f65a69d84b24f1cf4774d84d5cf03a6eca966aae | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | setFdSrc | 用于设置播放的文件描述符源。
@param url - 文件描述符源。 | async setFdSrc(url: media.AVFileDescriptor) {
const avPlayer = await this.init();
avPlayer.fdSrc = url;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setFdSrc 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#:#R... | async setFdSrc(url: media.AVFileDescriptor) {
const avPlayer = await this.init();
avPlayer.fdSrc = url;
} | https://github.com/yangyongzhen/hmmovie | 8a13689cb88ccf943e81c9db5bbb8071cbc31fff | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | test_10param2 | 测试 10 param2 | function test_10param2() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let arri8: byte[] = [1, 2, 3];
let arri16: short[] = [1, 2, 3, 4];
let arri32: int[] = [1, 2, 3, 4, 5];
let arrbool: boolean[] = [true, false];
let arrf32: float[] = [1.1f, 2.2f];
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_10param2 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_decla... | function test_10param2() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let arri8: byte[] = [1, 2, 3];
let arri16: short[] = [1, 2, 3, 4];
let arri32: int[] = [1, 2, 3, 4, 5];
let arrbool: boolean[] = [true, false];
let arrf32: float[] = [1.1f, 2.2f];
... | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 27b9a6e8d63710e58da1622ceac5cb9a56b7a537 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveClient.ets | arkts | parseTokenResponse | 解析令牌响应
@param response 响应数据
@returns OAuth2Token 令牌信息 | private parseTokenResponse(response: Record<string, Object>): OAuth2Token {
const accessToken = this.extractStringFromObject(response, 'access_token');
const tokenType = this.extractStringFromObject(response, 'token_type', 'Bearer');
const refreshToken = this.extractOptionalStringFromObject(response, 'ref... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseTokenResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | private parseTokenResponse(response: Record<string, Object>): OAuth2Token {
const accessToken = this.extractStringFromObject(response, 'access_token');
const tokenType = this.extractStringFromObject(response, 'token_type', 'Bearer');
const refreshToken = this.extractOptionalStringFromObject(response, 'ref... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L728-L754 | b70606a28774f0e1b87bc5339c48cf11c4ad667f | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets | arkts | getAddressPage | 分页获取地址列表
@param {PageRequest} params - 分页参数
@returns {Promise<NetworkResponse<NetworkPageData<Address>>>} 地址分页数据 | async getAddressPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Address>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Address>>> =
await NetworkClient.http.post("user/address/page", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAddressPage 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 ... | async getAddressPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Address>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Address>>> =
await NetworkClient.http.post("user/address/page", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 87b142021607d1fe2d5f91b37f05b1fccb4bd510 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets | arkts | toBoolean | Returns the primitive as boolean value
@param { boolean } value value to cast
@returns { boolean } Returns the input boolean value unchanged.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static toBoolean(value: boolean): boolean {
return 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 toBoolean AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:... | public static toBoolean(value: boolean): boolean {
return value;
} | https://gitcode.com/iop123123/arkts-static-skills | f10d8249612ffd041190a80fd485fa9a1cace30c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets | arkts | setChapterList | 设置章节列表缓存 | setChapterList(sourceId: number, mangaId: string, data: ChapterInfo[]): void {
const key = this.generateKey(sourceId, mangaId);
const now = Date.now();
this.chapterListCache.set(key, {
data,
timestamp: now,
expireTime: now + this.config.chapterListTTL
});
logger.info(TA... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setChapterList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | setChapterList(sourceId: number, mangaId: string, data: ChapterInfo[]): void {
const key = this.generateKey(sourceId, mangaId);
const now = Date.now();
this.chapterListCache.set(key, {
data,
timestamp: now,
expireTime: now + this.config.chapterListTTL
});
logger.info(TA... | https://github.com/DaLongZhuaZi/manxia | 4fbbbde9ad0212a97c74781d2578b9c44e361ac6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadTypes.ets | arkts | fromDeviceName | 根据设备名称推断控制器类型(用于 GCK 模式,无 VID/PID 信息时) | static fromDeviceName(name: string): number {
const lower = name.toLowerCase();
if (lower.includes('dualsense') || lower.includes('dualshock') ||
lower.includes('playstation') || lower.includes('ps5') || lower.includes('ps4')) {
return MoonlightControllerType.PS;
}
if (lower.includes('sw... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromDeviceName 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 s... | static fromDeviceName(name: string): number {
const lower = name.toLowerCase();
if (lower.includes('dualsense') || lower.includes('dualshock') ||
lower.includes('playstation') || lower.includes('ps5') || lower.includes('ps4')) {
return MoonlightControllerType.PS;
}
if (lower.includes('sw... | https://github.com/AlkaidLab/moonlight-harmony | fcd6c8f00277cb7e1f61a1b5c6b87ef73a9fc4c0 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets | arkts | decodingOptionPictGetAux | 获取解码参数 | decodingOptionPictGetAux(): string {
let message = ndkTest.getDesiredAuxiliaryPictures();
return this.logger.check_result(`getDesiredAuxiliaryPictures`, message);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decodingOptionPictGetAux AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A... | decodingOptionPictGetAux(): string {
let message = ndkTest.getDesiredAuxiliaryPictures();
return this.logger.check_result(`getDesiredAuxiliaryPictures`, message);
} | https://github.com/openharmony/applications_app_samples | 3bb0d07685f098d5f04f79dcccbeddaf2cd1b3ee | github |
honjow/Next2V | shared/src/main/ets/settings/AccountSessionCoordinator.ets | arkts | restoreActiveAccount | Restore the active account's cookie and session from AccountStore into
CookieJarSettings, AuthSessionSettings, and WebCookieManager.
Call this during SettingsBootstrap/startup before any HTTP requests.
Returns the restored AccountRecord, or null if no active account exists. | static async restoreActiveAccount(context: common.UIAbilityContext): Promise<AccountRecord | null> {
// First restore active ID from persisted preferences
const activeId = await AccountStore.restoreActiveId(context)
if (!activeId) {
console.info('AccountSessionCoordinator: restoreActiveAccount no ac... | 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 restoreActiveAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#... | static async restoreActiveAccount(context: common.UIAbilityContext): Promise<AccountRecord | null> {
// First restore active ID from persisted preferences
const activeId = await AccountStore.restoreActiveId(context)
if (!activeId) {
console.info('AccountSessionCoordinator: restoreActiveAccount no ac... | https://github.com/honjow/Next2V | 458ef85df149cdafead48fdec29332fd7bf34bd8 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | zoomOut | Zooms out by 0.7f, from the charts center. | public zoomOut(): void {
let center: MPPointF = this.mViewPortHandler.getContentCenter();
this.mViewPortHandler.zoomOut(center.x, -center.y, this.mZoomMatrixBuffer);
this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false);
MPPointF.recycleInstance(center);
// Range might have change... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left zoomOut AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta... | public zoomOut(): void {
let center: MPPointF = this.mViewPortHandler.getContentCenter();
this.mViewPortHandler.zoomOut(center.x, -center.y, this.mZoomMatrixBuffer);
this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false);
MPPointF.recycleInstance(center);
// Range might have change... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fd41e1dea531bdb24e5f1f8965d7a3a341033124 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | applyStickDeadzone | 径向死区处理(对齐 Android handleDeadZone)
当摇杆矢量长度小于死区半径时归零
@param x 水平轴值 (-1.0 ~ 1.0)
@param y 垂直轴值 (-1.0 ~ 1.0)
@returns [x, y] 处理后的值 | private applyStickDeadzone(x: number, y: number): number[] {
const magnitude = Math.sqrt(x * x + y * y);
if (magnitude <= this.stickDeadzone) {
return [0, 0];
}
return [x, y];
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyStickDeadzone 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#Le... | private applyStickDeadzone(x: number, y: number): number[] {
const magnitude = Math.sqrt(x * x + y * y);
if (magnitude <= this.stickDeadzone) {
return [0, 0];
}
return [x, y];
} | https://github.com/AlkaidLab/moonlight-harmony | 066475027b3ebc1065372b0348f0e84a785a65fa | github |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/DSiWareManager.ets | arkts | hasPrivateSavFile | 判断标题是否有 private.sav - 对齐 Android DSiWareTitle.hasPrivateSavFile() | function hasPrivateSavFile(title: DSiWareTitleNative): boolean {
return (title.privateSavSize ?? 0) !== 0;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hasPrivateSavFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function hasPrivateSavFile(title: DSiWareTitleNative): boolean {
return (title.privateSavSize ?? 0) !== 0;
} | https://github.com/richshaw2015/nds | e10fdeb176a9bd12176e3d9fc884706e2c5afc68 | github |
HarmonyOS_Samples/BestPracticeSnippets | JSCrash/entry/src/main/ets/pages/utils.ets | arkts | showError | Outputs error-level logs.
@param tag Identifies the log tag.
@param format Indicates the log format string.
@param args Indicates the log parameters.
@since 7 | static showError(tag: string): void {
if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) {
hilog.error(DOMAIN, TAG, tag + SYMBOL);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static showError(tag: string): void {
if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) {
hilog.error(DOMAIN, TAG, tag + SYMBOL);
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 290cdaf91274446ffaa00c71b9edf8c1785ccff5 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheConstants.ets | arkts | isEnableLocalCache | 是否开启本地缓存
@returns | static isEnableLocalCache(): boolean {
return SettingsService.getSync(SettingsService.KEY_APP_ENABLE_LOCAL_CACHE, SettingsService.KEY_APP_ENABLE_LOCAL_CACHE_DEFAULT);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEnableLocalCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolea... | static isEnableLocalCache(): boolean {
return SettingsService.getSync(SettingsService.KEY_APP_ENABLE_LOCAL_CACHE, SettingsService.KEY_APP_ENABLE_LOCAL_CACHE_DEFAULT);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L195-L197 | 80fbb2d3064c135feffbac093cb8e202752d6cb9 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets | arkts | isEnabled | Returns true if this comonent is enabled (should be drawn), false if not.
@return | public isEnabled(): boolean {
return this.mEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boo... | public isEnabled(): boolean {
return this.mEnabled;
} | https://gitee.com/openharmony/developtools_profiler.git | d94912eef69d89e1bb1e3e9a29f32df97f04ee7f | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/pages/SettingsPage.ets | arkts | confirmEnableNotification | 确认启用通知 | confirmEnableNotification(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('允许', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'启用通知',
'开启通知后,应用将会在后台推送播客更新、下载完成等消息。\n\n是否允许启用通知功能?',
buttons
)).then((index: number) =>... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmEnableNotification 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#st... | confirmEnableNotification(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('允许', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'启用通知',
'开启通知后,应用将会在后台推送播客更新、下载完成等消息。\n\n是否允许启用通知功能?',
buttons
)).then((index: number) =>... | https://github.com/pangpang20/antennaPodHM | 3b2acdd2ddf25106074bc99a23da71e2edf0b248 | github |
Eklps/harmony-mall-perf | entry/src/main/ets/viewmodel/CartModel.ets | arkts | updateQuantity | 更新购物车商品数量 | static updateQuantity(itemId: string, quantity: number) {
let cartList = AppStorage.get<CartItemType[]>('cartList') || [];
const index = cartList.findIndex(cartItem => cartItem.goods.id === itemId);
if (index >= 0) {
if (quantity <= 0) {
// 数量为0,移除商品
cartList.splice(index, 1);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left updateQuantity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static updateQuantity(itemId: string, quantity: number) {
let cartList = AppStorage.get<CartItemType[]>('cartList') || [];
const index = cartList.findIndex(cartItem => cartItem.goods.id === itemId);
if (index >= 0) {
if (quantity <= 0) {
// 数量为0,移除商品
cartList.splice(index, 1);
... | https://github.com/Eklps/harmony-mall-perf | ff7a4e99a1ebf6adc985d257469215bde7cf410b | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/view/StateManagementPage.ets | arkts | build | 构建状态管理示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_state_management_title"),
viewModel: this.vm
}) {
this.StateManagementContent();
}
} | 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#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.demo_state_management_title"),
viewModel: this.vm
}) {
this.StateManagementContent();
}
} | https://github.com/Joker-x-dev/HarmonyKit | 3c740ae2e699a18d86d73168129bb15c2bb6e229 | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/allowPass.ets | arkts | fn22 | Works because HTMLElement is from the default librar | function fn22(arg: Symbol) {} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fn22 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ty... | function fn22(arg: Symbol) {} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | e664fa6bcd1bb2c3256986e7e4af348428c3c707 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | getDefaultTitleForType | 根据面板类型获取默认标题 | function getDefaultTitleForType(type: ContentPanelType): string {
switch (type) {
case ContentPanelType.HELP:
return '帮助';
case ContentPanelType.CHANGELOG:
return '更新日志';
case ContentPanelType.EFFECTS:
return '特效展示';
case ContentPanelType.INFO:
return '信息';
default:
r... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getDefaultTitleForType AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left type AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | function getDefaultTitleForType(type: ContentPanelType): string {
switch (type) {
case ContentPanelType.HELP:
return '帮助';
case ContentPanelType.CHANGELOG:
return '更新日志';
case ContentPanelType.EFFECTS:
return '特效展示';
case ContentPanelType.INFO:
return '信息';
default:
r... | https://github.com/DaLongZhuaZi/manxia | a04af414724048709712bd8454527031f3e66f71 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Double.ets | arkts | compareTo | Compares this instance to other Double object
The result is less than 0 if this instance lesser than provided object
0 if they are equal
and greater than 0 otherwise.
@param other Double object to compare with
@returns result of the comparison | public override compareTo(other: Double): int {
return (this.value - other.unboxed()) as int;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST... | public override compareTo(other: Double): int {
return (this.value - other.unboxed()) as int;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 521427af95166d6d27b5e4ddfa3bb4e81619841c | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | splitEqually | 按成员数量平均分摊 | splitEqually(members: SplitMemberInfo[]): void {
if (members.length === 0) {
return;
}
const amountPerPerson = Math.round((this.amount / members.length) * 100) / 100;
const percentagePerPerson = Math.round((100 / members.length) * 100) / 100;
const details: BillSplitDetail[] = [];
for ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left splitEqually AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left members AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left SplitMembe... | splitEqually(members: SplitMemberInfo[]): void {
if (members.length === 0) {
return;
}
const amountPerPerson = Math.round((this.amount / members.length) * 100) / 100;
const percentagePerPerson = Math.round((100 / members.length) * 100) / 100;
const details: BillSplitDetail[] = [];
for ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e96a5f35bdbee2ce49d44b873a0799a0a0afdadf | github |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets | arkts | startDeviceDiscovery | Start discovering devices. | startDeviceDiscovery(): void {
this.discoverList = [];
this.initDeviceList();
if (this.myDeviceManager === undefined) {
Logger.error('RemoteDeviceModel', 'startDeviceDiscovery deviceManager has not initialized');
return;
}
try {
this.myDeviceManager.on('deviceFound', (data) => {... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startDeviceDiscovery 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... | startDeviceDiscovery(): void {
this.discoverList = [];
this.initDeviceList();
if (this.myDeviceManager === undefined) {
Logger.error('RemoteDeviceModel', 'startDeviceDiscovery deviceManager has not initialized');
return;
}
try {
this.myDeviceManager.on('deviceFound', (data) => {... | https://gitee.com/openharmony/codelabs.git | 5765cf711ad0338fc4657e1900c4d34aec709254 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | calculateChecksum | 计算校验和 | private async calculateChecksum(data: ArrayBuffer): Promise<string> {
// 模拟计算校验和的逻辑
return 'mock_checksum';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateChecksum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Lef... | private async calculateChecksum(data: ArrayBuffer): Promise<string> {
// 模拟计算校验和的逻辑
return 'mock_checksum';
} | https://github.com/DaLongZhuaZi/manxia | 730afe483430584c7b3ccf169f09f4fb1233cfd5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/EBookDataManager.ets | arkts | saveReadingSettings | 保存阅读设置(包含纯文本阅读器专用设置)
串行合并同一本书的连续保存,避免并发写入触发唯一约束冲突。 | public async saveReadingSettings(bookId: string, settings: EBookReadingSettings): Promise<void> {
const saveKey = `${bookId}|default_user`;
let state = this.readingSettingsSaveStates.get(saveKey);
if (!state) {
state = {
latestSettings: null,
runningPromise: null
};
this.... | 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 saveReadingSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Le... | public async saveReadingSettings(bookId: string, settings: EBookReadingSettings): Promise<void> {
const saveKey = `${bookId}|default_user`;
let state = this.readingSettingsSaveStates.get(saveKey);
if (!state) {
state = {
latestSettings: null,
runningPromise: null
};
this.... | https://github.com/DaLongZhuaZi/manxia | 47e49a9cdd73bb602a1f96463563037379b6c74f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsService.ets | arkts | parseAudioConfig | 解析音频配置字符串 | private parseAudioConfig(configStr: string): AudioConfiguration {
switch (configStr) {
case '立体声':
return AudioConfiguration.STEREO;
case '5.1 环绕声':
return AudioConfiguration.SURROUND_51;
case '7.1 环绕声':
return AudioConfiguration.SURROUND_71;
default:
return... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseAudioConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left configStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private parseAudioConfig(configStr: string): AudioConfiguration {
switch (configStr) {
case '立体声':
return AudioConfiguration.STEREO;
case '5.1 环绕声':
return AudioConfiguration.SURROUND_51;
case '7.1 环绕声':
return AudioConfiguration.SURROUND_71;
default:
return... | https://github.com/AlkaidLab/moonlight-harmony | e15677b019299aea7283c019b3769c239063d5e0 | github |
ibestservices/ibest-ui | library/src/main/ets/components/uploader/index.ets | arkts | select | 选择器触发 | select(){
if(this.selectType == "image"){
this.selectImg()
}else{
this.selectFile()
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left select AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left ... | select(){
if(this.selectType == "image"){
this.selectImg()
}else{
this.selectFile()
}
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/uploader/index.ets#L136-L142 | 9839fca39bf803a903f706a35e885d49d87ac5ae | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets | arkts | getAllRecordings | 获取所有录音(已保存 + 新添加) | getAllRecordings(): Recording[] {
return [...this.recordings, ...this.newRecordings]
} | AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllRecordings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Recording AST#identifier#Right AST#ERROR#Right ... | getAllRecordings(): Recording[] {
return [...this.recordings, ...this.newRecordings]
} | https://gitcode.com/openharmony/codelabs | e3802785178dc7cde538932e69e8a83fcad2edec | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | unSubscribeDetail | Unsubscribe | unSubscribeDetail() {
if (this.commonEventData != null) {
commonEvent.unsubscribe(this.commonEventData, () => {
HiLog.i(TAG, 'unSubscribeDetail, unsubscribe');
});
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unSubscribeDetail 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#... | unSubscribeDetail() {
if (this.commonEventData != null) {
commonEvent.unsubscribe(this.commonEventData, () => {
HiLog.i(TAG, 'unSubscribeDetail, unsubscribe');
});
}
} | https://gitee.com/openharmony/applications_mms.git | 599354b96d8b169dd237684fd203c62af82f83d9 | gitee |
XXYoLoong/FortuneBet | entry/src/main/ets/pages/history/HistoryPage.ets | arkts | onPageShow | 关键:页面显示时重新加载,实现实时更新 | onPageShow(): void {
this.loadHistory();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow 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#L... | onPageShow(): void {
this.loadHistory();
} | https://github.com/XXYoLoong/FortuneBet | a5f23cd43cda5f51c9a07325522c30ef8a7ebcde | github |
zcg741/chengyu-game | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | getSession | 获取游戏会话 | getSession(): GameSession {
return {
mode: this.session.mode,
score: this.session.score,
correctCount: this.session.correctCount,
wrongCount: this.session.wrongCount,
consecutiveCorrect: this.session.consecutiveCorrect,
currentLevel: this.session.currentLevel,
remainingTi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSession 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 GameSession AST#identifier#Right AST#ERROR#Right AS... | getSession(): GameSession {
return {
mode: this.session.mode,
score: this.session.score,
correctCount: this.session.correctCount,
wrongCount: this.session.wrongCount,
consecutiveCorrect: this.session.consecutiveCorrect,
currentLevel: this.session.currentLevel,
remainingTi... | https://github.com/zcg741/chengyu-game | d55eb8a6eaf31f9ce62fbbc5f9ea13ff13d735ba | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/ComputerViewModel.ets | arkts | getData | 获取指定索引的数据 | getData(index: number): ObservableComputer {
return this.dataArray[index];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#... | getData(index: number): ObservableComputer {
return this.dataArray[index];
} | https://github.com/AlkaidLab/moonlight-harmony | b91ac53bf59815220466d159e371cd825d560cd8 | github |
aimilin6688/KeePassHO | entry/src/main/ets/components/loading/LoadingDialogUtils.ets | arkts | showToast | 显示 toast hud
@param value | async showToast(value: ResourceStr | LoadingSettings = ''): Promise<void> {
await this.showDialog(new LoadingActionOptions(LoadingState.TOAST, value))
this.hideDialogDelay(LoadingState.TOAST, value)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left showToast AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async showToast(value: ResourceStr | LoadingSettings = ''): Promise<void> {
await this.showDialog(new LoadingActionOptions(LoadingState.TOAST, value))
this.hideDialogDelay(LoadingState.TOAST, value)
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/loading/LoadingDialogUtils.ets#L92-L95 | a6705dd07cd6baf005415d87d13c306b7d1c4106 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/components/topBar.ets | arkts | clickSearch | 进入搜索页 | clickSearch() {
router.pushUrl({
url: 'pages/Search/SearchPage',
params: {
name: "搜你想看的"
}
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickSearch 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 A... | clickSearch() {
router.pushUrl({
url: 'pages/Search/SearchPage',
params: {
name: "搜你想看的"
}
})
} | https://github.com/SMAT-Lab/PhantomRendering | b9f41f1347251eb591036194b727ca2eba5fd945 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/CategoryDao.ets | arkts | queryAll | 查询所有分类
@returns Promise<Array<Record<string, any>>> 分类记录数组 | async queryAll(): Promise<Array<Record<string, number | string>>> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return [];
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
const resultSet... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async queryAll(): Promise<Array<Record<string, number | string>>> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return [];
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
const resultSet... | https://github.com/Kira-Yagami-Light/Kira-Projects | 71511faa95fd9974cbef17a01d3225b299abd89c | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showError | 显示失败提示
@param {string | ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showError(message: string | ResourceStr): void {
IBestToast.show({
type: "fail",
message: message
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#L... | static showError(message: string | ResourceStr): void {
IBestToast.show({
type: "fail",
message: message
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | c9f5dac07f6841a66ce1d6d33dd7a6d972bcedb1 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.