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 |
|---|---|---|---|---|---|---|---|---|---|---|
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | generateInvitationCode | 生成邀请码 | generateInvitationCode(): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let code = '';
for (let i = 0; i < 8; i++) {
code += chars.charAt(Math.floor(Math.random() * chars.length));
}
this.invitationCode = code;
return code;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateInvitationCode 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... | generateInvitationCode(): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let code = '';
for (let i = 0; i < 8; i++) {
code += chars.charAt(Math.floor(Math.random() * chars.length));
}
this.invitationCode = code;
return code;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 13058f77148f336e7bc2f7d1a32d09f3af90c9db | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/TotpService.ets | arkts | truncateHmac | 截断HMAC并生成OTP(RFC6238标准方法)
@param hmac HMAC字节数组
@param digits 令牌位数
@returns 生成的令牌 | private truncateHmac(hmac: Uint8Array, digits: number): string {
// 获取偏移量(最后一个字节的低4位)
const offset = hmac[hmac.length - 1] & 0x0f;
// 从偏移量开始提取4个字节并转换为整数
const binary = ((hmac[offset] & 0x7f) << 24) |
((hmac[offset + 1] & 0xff) << 16) |
((hmac[offset + 2] & 0xff) << 8) |
(hmac[offset... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left truncateHmac AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hmac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private truncateHmac(hmac: Uint8Array, digits: number): string {
// 获取偏移量(最后一个字节的低4位)
const offset = hmac[hmac.length - 1] & 0x0f;
// 从偏移量开始提取4个字节并转换为整数
const binary = ((hmac[offset] & 0x7f) << 24) |
((hmac[offset + 1] & 0xff) << 16) |
((hmac[offset + 2] & 0xff) << 8) |
(hmac[offset... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L233-L251 | 760285b7578a8883ddd5fdcf92df300303a5dda1 | github |
LZZLHY/hlib | entry/src/main/ets/api/HttpClient.ets | arkts | get | ─── 请求 ─────────────────────────────────────────── | async get<T>(path: string, query?: QueryParams, options?: HttpRequestOptions): Promise<T> {
const url: string = UrlUtils.joinUrl(this.domain, path) + UrlUtils.buildQuery(query);
return await this.request<T>(url, http.RequestMethod.GET, undefined, options);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#ERROR#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#Right AST#type_par... | async get<T>(path: string, query?: QueryParams, options?: HttpRequestOptions): Promise<T> {
const url: string = UrlUtils.joinUrl(this.domain, path) + UrlUtils.buildQuery(query);
return await this.request<T>(url, http.RequestMethod.GET, undefined, options);
} | https://github.com/LZZLHY/hlib | c2f254cb77dedbea5d193a9ff06a5e6834a76a47 | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/clog/Clog.ets | arkts | setPrefix | 设置日志前缀
@param prefix 日志前缀字符串,默认为'[Charactech]' | public static setPrefix(prefix: string): void {
Clog.CHARACTECH_PREFIX = prefix;
} | 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 setPrefix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#... | public static setPrefix(prefix: string): void {
Clog.CHARACTECH_PREFIX = prefix;
} | https://github.com/ZestBox-18/kitebook-frontend | e0963d2d054194963fb203ea7c005575e61a0783 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets | arkts | toggleText | 切换自定义文字开关
@param value 新的开关状态 | toggleText(value: boolean): void {
this.switchText = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleText 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 boolean AST#identifier#Right AST#)#Left ) AS... | toggleText(value: boolean): void {
this.switchText = value;
} | https://github.com/codelably/tuniao-ui | a43686da637ad5d315586233cc917ff93d652164 | github |
openharmony/applications_print_spooler | entry/src/main/ets/pages/component/PreviewComponent.ets | arkts | onPageDirectionChange | 纸张方向修改 | onPageDirectionChange() {
Log.info(TAG, 'onPageDirectionChange enter');
this.parseImageSize(true)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageDirectionChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl... | onPageDirectionChange() {
Log.info(TAG, 'onPageDirectionChange enter');
this.parseImageSize(true)
} | https://gitee.com/openharmony/applications_print_spooler.git | 73d285451307dde61b835ecd16149d682e8b076d | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CartManager.ets | arkts | updateQuantity | Update item quantity. | static async updateQuantity(cartId: number, newQuantity: number): Promise<void> {
let newCartList: ICartItemData[] = [];
for (let i = 0; i < cachedCartList.length; i++) {
if (cachedCartList[i].cartId === cartId) {
let newItem: ICartItemData = {
cartId: cachedCartList[i].cartId,
... | 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 updateQuantity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cartId AST#identifier#Right AST#:#Left : ... | static async updateQuantity(cartId: number, newQuantity: number): Promise<void> {
let newCartList: ICartItemData[] = [];
for (let i = 0; i < cachedCartList.length; i++) {
if (cachedCartList[i].cartId === cartId) {
let newItem: ICartItemData = {
cartId: cachedCartList[i].cartId,
... | https://github.com/Harrisonls2004/WaterFlow | a137b93277c665b723427537dfd108a78f39eb44 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | fractionalSecondDigits | NOTE(cheezzario) 'number' literal types are not supported #23963
fractionalSecondDigits?: 1 | 2 | 3 | set fractionalSecondDigits(val: int | undefined) {this.fractionalSecondDigits_ = val} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left fractionalSecondDigits 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#binary_expression#L... | set fractionalSecondDigits(val: int | undefined) {this.fractionalSecondDigits_ = val} | https://gitcode.com/iop123123/arkts-static-skills | 2c4588df3404555ac4b369d95303d58fa2af22ce | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/UserCalendarManager.ets | arkts | deleteEvents | 批量删除日程 | async deleteEvents(ids: number[]) {
try {
if (canIUse('SystemCapability.Applications.CalendarData')) {
const calendar = await this.getDefaultCalendar() as calendarManager.Calendar
return await calendar.deleteEvents(ids)
} else {
new PromptAction().showToast({ message: '该设备不支持批量... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteEvents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ids AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async deleteEvents(ids: number[]) {
try {
if (canIUse('SystemCapability.Applications.CalendarData')) {
const calendar = await this.getDefaultCalendar() as calendarManager.Calendar
return await calendar.deleteEvents(ids)
} else {
new PromptAction().showToast({ message: '该设备不支持批量... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | fa373cc995841d2904a8b68ae68f8ef7a477c8d0 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/SettingsManager.ets | arkts | getColorTheme | ========== 主题配色相关方法 ==========
获取当前主题配色 | getColorTheme(): ColorTheme {
return getThemeService().getColorTheme()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColorTheme 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 ColorTheme AST#identifier#Right AST#ERROR#Right ... | getColorTheme(): ColorTheme {
return getThemeService().getColorTheme()
} | https://github.com/LongLiveY96/chatcube | c8dd784ccd91c711a1e26ef361752185883914c7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | fillRecordFromResultSet | 从ResultSet填充记录对象 | private async fillRecordFromResultSet(record: DatabaseRecord, resultSet: relationalStore.ResultSet): Promise<void> {
const columnNames = resultSet.columnNames;
for (let i = 0; i < columnNames.length; i++) {
const columnName = columnNames[i];
const columnType = await resultSet.getColumnType(i)... | 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 fillRecordFromResultSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right A... | private async fillRecordFromResultSet(record: DatabaseRecord, resultSet: relationalStore.ResultSet): Promise<void> {
const columnNames = resultSet.columnNames;
for (let i = 0; i < columnNames.length; i++) {
const columnName = columnNames[i];
const columnType = await resultSet.getColumnType(i)... | https://github.com/DaLongZhuaZi/manxia | d1a4c5fb78b4c276630939416fd356e6e123ec7b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets | arkts | getRoot | 获取解析后的根元素 | getRoot(): HTMLElement | null {
return this.root;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRoot 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#binary_expression#Left AST#identifier#Left HTMLElement AST#identifier#... | getRoot(): HTMLElement | null {
return this.root;
} | https://github.com/DaLongZhuaZi/manxia | 5c077595e7c327d06a5009b61fde18a0dfa9664e | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showTop | 显示顶部 Toast
@param {string | ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showTop(message: string | ResourceStr): void {
IBestToast.show({
position: "top",
offsetY: "20%",
message: message
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showTop 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#Lef... | static showTop(message: string | ResourceStr): void {
IBestToast.show({
position: "top",
offsetY: "20%",
message: message
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | fcfed29ebd7b9cce034f9631b7b5eeb25a2747ba | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getArtists | 查询艺术家列表
@returns | public async getArtists(): Promise<Array<BaseItemDto>> {
return this.requireApi().getArtists(this.currentLibrary?.Id)
} | 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 getArtists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public async getArtists(): Promise<Array<BaseItemDto>> {
return this.requireApi().getArtists(this.currentLibrary?.Id)
} | https://github.com/OHPG/FinMusic | 6dc3b958cd474530561aace2d52300d9730b0f31 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | constructor | Creates a new `BigInt` instance by copying another BigInt.
@param { BigInt } d The BigInt object to copy.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(d: BigInt) {
this(d.bytes, d.sign)
} | 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 d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BigInt AST#identifier#Right AST#... | constructor(d: BigInt) {
this(d.bytes, d.sign)
} | https://gitcode.com/iop123123/arkts-static-skills | 3daa42acba438a7c5d748478c3e52cb30e3ac534 | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/TrickPlayApi.ets | arkts | getTrickPlayHlsPlaylistUrl | getTrickPlayHlsPlaylistUrl
@summary Gets an image tiles playlist for trickplay.
@param {TrickPlayApiGetTrickPlayHlsPlaylistRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof TrickPlayApi | public async getTrickPlayHlsPlaylistUrl(requestParameters: TrickPlayApiGetTrickPlayHlsPlaylistRequest): Promise<string> {
this.assertParam(requestParameters.itemId)
this.assertParam(requestParameters.width)
return this.apiClient.createUrl({ path: `/Videos/${requestParameters.itemId}/Trickplay/${requestPar... | 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 getTrickPlayHlsPlaylistUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identif... | public async getTrickPlayHlsPlaylistUrl(requestParameters: TrickPlayApiGetTrickPlayHlsPlaylistRequest): Promise<string> {
this.assertParam(requestParameters.itemId)
this.assertParam(requestParameters.width)
return this.apiClient.createUrl({ path: `/Videos/${requestParameters.itemId}/Trickplay/${requestPar... | https://github.com/OHPG/FinSdk | d5fc59784bfa7d2c2aa25adb0afbf24026f86460 | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | handleContentOverlayUrl | -- Overlay callbacks (invoked by CountlyContentOverlay / CountlyFeedbackOverlay) --
All overlay handlers are no-op'd while the content + feedback modules are
disabled. Returning `false` from the URL handlers tells the WebView to
continue with default navigation; in practice the overlay components
never render because t... | public handleContentOverlayUrl(url: string): boolean {
this.config.logger.w('handleContentOverlayUrl, content module is disabled, no-op');
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleContentOverlayUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public handleContentOverlayUrl(url: string): boolean {
this.config.logger.w('handleContentOverlayUrl, content module is disabled, no-op');
return false;
} | https://github.com/Countly/countly-sdk-hos | 48880c8cca4506338665429b89e7b9ee4ca0e4a4 | github |
openharmony/arkui_ace_engine | examples/Image_C/entry/src/main/ets/pages/Index.ets | arkts | build | controller: TextInputController = new TextInputController() | build() {
Column() {
Stack() {
TextInput({placeholder: 'test', text: 'text'})
.fontStyle(this.fontStyle).showUnderline(this.inputType).padding(20)
}
Button('click').onClick((event: ClickEvent) => {
this.inputType = !this.inputType;
})
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
Stack() {
TextInput({placeholder: 'test', text: 'text'})
.fontStyle(this.fontStyle).showUnderline(this.inputType).padding(20)
}
Button('click').onClick((event: ClickEvent) => {
this.inputType = !this.inputType;
})
}
} | https://gitee.com/openharmony/arkui_ace_engine.git | 662853453f9c89bf5137e830e21aaf5b26c066ae | gitee |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/common/PreferencesUtil.ets | arkts | putNumber | 存储数字数据(如整型计数等)
@param context 应用上下文
@param key 键
@param value 值 | static async putNumber(context: common.UIAbilityContext, key: string, value: number): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Pref... | 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 putNumber 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 putNumber(context: common.UIAbilityContext, key: string, value: number): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Pref... | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | d2fe6790bd0828ca10be3973e8307f534038e4e6 | gitcode |
apap6628114/nga_oh | entry/src/main/ets/common/datasource/BaseLazyDataSource.ets | arkts | notifyReload | 通知所有监听器整体数据已刷新。 | protected notifyReload(): void {
for (let i = 0; i < this.listeners.length; i++) {
this.listeners[i].onDataReloaded()
}
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left notifyReload 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 A... | protected notifyReload(): void {
for (let i = 0; i < this.listeners.length; i++) {
this.listeners[i].onDataReloaded()
}
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L118-L122 | 004d24d9c7e32635fe3ff049b78db018777eeb4c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/YAxisRenderer.ets | arkts | getTransformedPositions | Transforms the values contained in the axis entries to screen pixels and returns them in form of a float array
of x- and y-coordinates.
@return | protected getTransformedPositions(): number[] {
if (!this.mYAxis) {
return [];
}
if (this.mGetTransformedPositionsBuffer.length != this.mYAxis.mEntryCount * 2) {
this.mGetTransformedPositionsBuffer = new Array<number>(this.mYAxis.mEntryCount * 2);
}
let positions: number[] = this.mGetT... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getTransformedPositions 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... | protected getTransformedPositions(): number[] {
if (!this.mYAxis) {
return [];
}
if (this.mGetTransformedPositionsBuffer.length != this.mYAxis.mEntryCount * 2) {
this.mGetTransformedPositionsBuffer = new Array<number>(this.mYAxis.mEntryCount * 2);
}
let positions: number[] = this.mGetT... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | b39fb2ec127a9320a7e9e1ea148be5e3f8480dbb | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | resolvedOptions | Retrieves the resolved options for the current Segmenter instance
@returns The fully resolved segmentation options | public resolvedOptions(): ResolvedSegmenterOptions {
return {
locale: this._locale,
granularity: this._granularity
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resolvedOptions 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 Resolv... | public resolvedOptions(): ResolvedSegmenterOptions {
return {
locale: this._locale,
granularity: this._granularity
}
} | https://gitcode.com/iop123123/arkts-static-skills | 7c6b39e384cc1b58f10c359b63dad459d5e89ce4 | gitcode |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/model/PlanModel.ets | arkts | isExpired | 检查计划是否已过期 | isExpired(): boolean {
const today = new Date();
today.setHours(0, 0, 0, 0);
const end = new Date(this.endDate);
end.setHours(23, 59, 59, 999);
return today > end;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isExpired 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... | isExpired(): boolean {
const today = new Date();
today.setHours(0, 0, 0, 0);
const end = new Date(this.endDate);
end.setHours(23, 59, 59, 999);
return today > end;
} | https://gitcode.com/openharmony/codelabs | 882b5ad3a41285e369f5de15eb7b44fbf122b96c | gitcode |
Vsolon0401/MallShopping | common/src/main/ets/service/ShoppingCartService.ets | arkts | updateItemQuantity | 更新购物车商品数量
@param id
@param quantity
@returns | async updateItemQuantity(id: number, quantity: number) {
return Request.get(`/cart/update/quantity`, {
params: { id: id, quantity: quantity }
})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateItemQuantity AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async updateItemQuantity(id: number, quantity: number) {
return Request.get(`/cart/update/quantity`, {
params: { id: id, quantity: quantity }
})
} | https://github.com/Vsolon0401/MallShopping | 06f0e36d53b7608b79175426185faa4684434983 | github |
eclipse-oniro4openharmony/f-oh | entry/src/main/ets/components/InfoRow.ets | arkts | build | constructor(title: string | Resource) {
super()
this.title = title
} | build() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween,
alignItems: ItemAlign.Center
}) {
Image(this.icon).width(26).height(26).borderRadius(13)
.flexShrink(0)
Column() {
Text(this.title).fontSize(16).fontColor('#FF182431').alignSel... | 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() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween,
alignItems: ItemAlign.Center
}) {
Image(this.icon).width(26).height(26).borderRadius(13)
.flexShrink(0)
Column() {
Text(this.title).fontSize(16).fontColor('#FF182431').alignSel... | https://github.com/eclipse-oniro4openharmony/f-oh | cfe159ebc04ae98b08efa23806a91a53965d93de | github |
CLMC2025/Vignette | entry/src/main/ets/manager/ReviewTimeManager.ets | arkts | resetSessionStats | 重置会话统计 | resetSessionStats(): void {
this.sessionStats = {
totalWordsReviewed: 0,
totalTimeSpent: 0,
averageTimePerWord: 0,
currentSessionStartTime: Date.now(),
currentSessionDuration: 0
};
// 清理活动复习记录
this.activeReviews.clear();
console.log('[ReviewTimeManager] Sess... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetSessionStats 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_... | resetSessionStats(): void {
this.sessionStats = {
totalWordsReviewed: 0,
totalTimeSpent: 0,
averageTimePerWord: 0,
currentSessionStartTime: Date.now(),
currentSessionDuration: 0
};
// 清理活动复习记录
this.activeReviews.clear();
console.log('[ReviewTimeManager] Sess... | https://github.com/CLMC2025/Vignette | 5d89f8fe6d889fd1727475d379154df548f93960 | github |
codelably/HCompass | entry/src/main/ets/entryability/AppInterceptors.ets | arkts | logResponseError | 打印响应错误日志 | private logResponseError(error: AxiosError): void {
const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined;
const response: AxiosResponse | undefined = error.response as AxiosResponse | undefined;
const url: string = response ? this.buildRequestUrl(re... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left logResponseError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private logResponseError(error: AxiosError): void {
const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined;
const response: AxiosResponse | undefined = error.response as AxiosResponse | undefined;
const url: string = response ? this.buildRequestUrl(re... | https://github.com/codelably/HCompass | 5f65007c4a04e39b0c83c1d05b937a50b920d1d6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | parseSearchResultAsync | 解析搜索结果(异步版本,支持JS规则) | private async parseSearchResultAsync(
html: string,
baseUrl: string,
parseOptions?: SearchParseOptions
): Promise<LegadoSearchBook[]> {
const results: LegadoSearchBook[] = [];
const rule = this.source.ruleSearch;
if (!rule || !rule.bookList) {
this.searchParseTrace((): string => `... | 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 parseSearchResultAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#... | private async parseSearchResultAsync(
html: string,
baseUrl: string,
parseOptions?: SearchParseOptions
): Promise<LegadoSearchBook[]> {
const results: LegadoSearchBook[] = [];
const rule = this.source.ruleSearch;
if (!rule || !rule.bookList) {
this.searchParseTrace((): string => `... | https://github.com/DaLongZhuaZi/manxia | b9f484b515a84f0b5e6e71f62ccb0b79ecef8883 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | testLogicalInReturn | --- Logical AND / OR in return --- | function testLogicalInReturn(): string {
let x: number = 5;
let y: number = 10;
if (x > 0 && y > 0) {
return 'both positive';
}
return 'not both positive';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testLogicalInReturn AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefi... | function testLogicalInReturn(): string {
let x: number = 5;
let y: number = 10;
if (x > 0 && y > 0) {
return 'both positive';
}
return 'not both positive';
} | https://github.com/miaochiahao/ark-ghidra | a5800d3223ad06b6832a579c3d1f42debb74b401 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | webView | ==================== WebView操作 ====================
使用WebView访问网络
@param html 直接用webView载入的html, 如果html为空直接访问url
@param url html内如果有相对路径的资源不传入url访问不了
@param js 用来取返回值的js语句, 没有就返回整个源代码
@returns 返回js获取的内容 | async webView(html: string | null, url: string | null, js: string | null): Promise<string> {
const executor = getWebViewExecutor();
return executor.webView(html, url, js);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left webView AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async webView(html: string | null, url: string | null, js: string | null): Promise<string> {
const executor = getWebViewExecutor();
return executor.webView(html, url, js);
} | https://github.com/DaLongZhuaZi/manxia | 122777c8390865a70c0b54b5e99ed57338281159 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/network/ApiService.ets | arkts | getOrders | 获取订单列表 | static async getOrders(status: string = '', page: number = 1, limit: number = 10): Promise<OrderListResponse> {
let path = '/orders?page=' + page + '&limit=' + limit;
if (status.length > 0) {
path = path + '&status=' + status;
}
const response = await httpClient.get(path);
const result ... | 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 getOrders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:... | static async getOrders(status: string = '', page: number = 1, limit: number = 10): Promise<OrderListResponse> {
let path = '/orders?page=' + page + '&limit=' + limit;
if (status.length > 0) {
path = path + '&status=' + status;
}
const response = await httpClient.get(path);
const result ... | https://github.com/Harrisonls2004/WaterFlow | 56aae18705acbde038cd92d5726e9cb8a45a5a16 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | streamChatRequest | 流式发送聊天请求 | streamChatRequest(
config: AIApiConfig,
messages: RequestMessage[],
model: string,
onData: (content: string) => void,
onComplete: () => void,
onError: (error: string) => void,
temperature?: number,
maxTokens?: number,
onReasoningData?: (content: string) => void,
onImageData?: (... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left streamChatRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | streamChatRequest(
config: AIApiConfig,
messages: RequestMessage[],
model: string,
onData: (content: string) => void,
onComplete: () => void,
onError: (error: string) => void,
temperature?: number,
maxTokens?: number,
onReasoningData?: (content: string) => void,
onImageData?: (... | https://github.com/LongLiveY96/chatcube | 4ba39b954e3ac0d36c8045f206b94c5a0f2c17dd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewAuthManager.ets | arkts | clearCookies | 清空Cookie | async clearCookies(sourceId: number): Promise<void> {
await this.dataManager.clearComicSourceCookies(sourceId);
logger.info(TAG, `已清空Cookie: sourceId=${sourceId}`);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearCookies AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async clearCookies(sourceId: number): Promise<void> {
await this.dataManager.clearComicSourceCookies(sourceId);
logger.info(TAG, `已清空Cookie: sourceId=${sourceId}`);
} | https://github.com/DaLongZhuaZi/manxia | d8b1debd72fdba8cd8be8fed1ab933c6e7d45137 | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets | arkts | triggerSportStartReminder | 触发运动开始提醒 | triggerSportStartReminder(): void {
const config = this.settings.getReminderConfig(ReminderType.SPORT_START);
if (config && config.enabled) {
this.triggerReminder(ReminderType.SPORT_START, config.message);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left triggerSportStartReminder 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... | triggerSportStartReminder(): void {
const config = this.settings.getReminderConfig(ReminderType.SPORT_START);
if (config && config.enabled) {
this.triggerReminder(ReminderType.SPORT_START, config.message);
}
} | https://gitcode.com/openharmony/codelabs | 0b11e6cde35c058ec430dc47340c2bfe08d048fb | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | addListener | 添加设备变化监听器 | public addListener(listener: DeviceChangeListener): void {
this.listeners.add(listener);
logger.debug(TAG, `添加监听器,当前监听器数量: ${this.listeners.size}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public addListener(listener: DeviceChangeListener): void {
this.listeners.add(listener);
logger.debug(TAG, `添加监听器,当前监听器数量: ${this.listeners.size}`);
} | https://github.com/DaLongZhuaZi/manxia | 26a8e97ccf16f8d7e52433e1ad0f2caf8c6ba11c | github |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/setting/setting_player.ets | arkts | switch_player | 切换播放器 // | switch_player(mode: boolean) {
this.audio_player.set_player_mode(mode)
this.exiting = true
this.show_icon = false
this.show_button = false
setTimeout(() => { this.page = 2 }, 560)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switch_player AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Righ... | switch_player(mode: boolean) {
this.audio_player.set_player_mode(mode)
this.exiting = true
this.show_icon = false
this.show_button = false
setTimeout(() => { this.page = 2 }, 560)
} | https://github.com/Nekofox-POT/LinMusic | 37caca1682ec01d8ebc902aefda6129554b22861 | github |
the-wwyang/kids-learning-app | src/main/ets/common/SecurityUtils.ets | arkts | generateSalt | 生成随机盐值(用于密码加密) | static generateSalt(): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let salt = '';
for (let i = 0; i < 16; i++) {
salt += chars.charAt(Math.floor(Math.random() * chars.length));
}
return salt;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateSalt 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#st... | static generateSalt(): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let salt = '';
for (let i = 0; i < 16; i++) {
salt += chars.charAt(Math.floor(Math.random() * chars.length));
}
return salt;
} | https://github.com/the-wwyang/kids-learning-app | 779e22248a632030c18513c67e83e1a164c6b591 | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | getAssistantById | 根据 ID 查找内存中的 assistant;未命中返回 null(不触发回源) | getAssistantById(assistantId: string): Assistant | null {
const list = this.getAssistants()
for (let i = 0; i < list.length; i++) {
if (list[i].id === assistantId) {
return list[i]
}
}
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getAssistantById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left assistantId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | getAssistantById(assistantId: string): Assistant | null {
const list = this.getAssistants()
for (let i = 0; i < list.length; i++) {
if (list[i].id === assistantId) {
return list[i]
}
}
return null
} | https://github.com/LongLiveY96/chatcube | 837fee57510b9114b738772cd6fc72510b2e67a0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | cleanExpiredCache | 清理过期缓存(基于文件修改时间)
默认清理30天未访问的缓存 | async cleanExpiredCache(maxAgeDays: number = 30): Promise<number> {
try {
await this.ensureInitialized();
const expireTime = Date.now() - maxAgeDays * 24 * 60 * 60 * 1000;
let count = 0;
// 检查novels目录是否存在
if (!await this.sandboxManager.exists(this.novelsCacheDir)) {
re... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cleanExpiredCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left maxAgeDays AST#identifier#Right AST#type_annotation#Left AST#... | async cleanExpiredCache(maxAgeDays: number = 30): Promise<number> {
try {
await this.ensureInitialized();
const expireTime = Date.now() - maxAgeDays * 24 * 60 * 60 * 1000;
let count = 0;
// 检查novels目录是否存在
if (!await this.sandboxManager.exists(this.novelsCacheDir)) {
re... | https://github.com/DaLongZhuaZi/manxia | 41e18b136d9cf80d8a870b301f5ccf0d7bde62f6 | github |
HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts | entry/src/main/ets/utils/ImageUtil.ets | arkts | getNetworkPicture | load network URL image | public static async getNetworkPicture(url: string, defaultPath: string): Promise<image.PixelMap | string> {
if (url) {
let httpRequest = http.createHttp();
try {
const data = await httpRequest.request(url);
const buffer = data.result as ArrayBuffer;
const imageSourceApi: image.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getNetworkPicture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | public static async getNetworkPicture(url: string, defaultPath: string): Promise<image.PixelMap | string> {
if (url) {
let httpRequest = http.createHttp();
try {
const data = await httpRequest.request(url);
const buffer = data.result as ArrayBuffer;
const imageSourceApi: image.... | https://gitcode.com/HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts | 2fd30b079f0a417c7129430170ee98e9301c0f8f | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | find | Finds the first element in the Int16Array that satisfies the condition
@param fn the condition to apply for each element
@returns the first element that satisfies fn
TODO: return short | undefined as in JS | public find(fn: (val: short, index: int, array: Int16Array) => boolean): short {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return val
}
}
throw new Error("Int16Array.find: not implemented if elemen... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public find(fn: (val: short, index: int, array: Int16Array) => boolean): short {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return val
}
}
throw new Error("Int16Array.find: not implemented if elemen... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8245c6b9f59e91fc8af4fa85d724bf66660bbc68 | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | getCurrentUser | Get current logged in user. | static async getCurrentUser(): Promise<CurrentUser | null> {
try {
if (!UserManager.dataPreferences) {
return null;
}
const currentUserJson = await UserManager.dataPreferences.get(UserManager.KEY_CURRENT_USER, '') as string;
if (currentUserJson === '') {
return null;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCurrentUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | static async getCurrentUser(): Promise<CurrentUser | null> {
try {
if (!UserManager.dataPreferences) {
return null;
}
const currentUserJson = await UserManager.dataPreferences.get(UserManager.KEY_CURRENT_USER, '') as string;
if (currentUserJson === '') {
return null;
... | https://github.com/Harrisonls2004/WaterFlow | 0b4e0c10400eda8dc0b09ece63d8850ee4e726cc | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/idea/components/ActivityHeatmap.ets | arkts | aboutToAppear | 显示 16 周数据 | aboutToAppear(): void {
// 初始加载时从数据库获取最新数据
this.loadStats();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
// 初始加载时从数据库获取最新数据
this.loadStats();
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/idea/components/ActivityHeatmap.ets#L35-L38 | 03e28b3180c7cd7b6a7d42a8ec67ce94ff01865b | github |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/BreakpointState.ets | arkts | isSM | 是否为小断点
@returns {boolean} 是否小断点 | isSM(): boolean {
return this.current === BreakpointType.SM;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSM 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_bloc... | isSM(): boolean {
return this.current === BreakpointType.SM;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 26346901dff6e4f6b8f740d475f2726238a99168 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | setMaxWidth | Sets the maximum width that the axis can take (in dp).
@param maxWidth | public setMaxWidth(maxWidth: number): void {
this.mMaxWidth = maxWidth;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaxWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | public setMaxWidth(maxWidth: number): void {
this.mMaxWidth = maxWidth;
} | https://gitee.com/openharmony/developtools_profiler.git | 405c5553e8c3cd5f4afd133835f33e52fd5afbc4 | gitee |
HarmonyOS_Samples/MusicHome | products/tv/src/main/ets/tvability/TvAbility.ets | arkts | onForeground | Logs foreground transition. | onForeground(): void {
Logger.info('TvAbility: Ability onForeground');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground 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... | onForeground(): void {
Logger.info('TvAbility: Ability onForeground');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 74b4710a99de27ae18f60e579be305055f910fcc | gitcode |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets | arkts | getYMax | returns the maximum y-value this DataSet holds
@return | getYMax(): number {
return 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getYMax AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_bloc... | getYMax(): number {
return 0;
} | https://gitee.com/openharmony/developtools_profiler.git | daf7fbefea690cd0f407126b234bd5d4eeaa06e0 | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/StatisticsService.ets | arkts | calculateWeeklyStatistics | 计算本周统计数据 | async calculateWeeklyStatistics(): Promise<WeeklyStatistics> {
const weekStats = new WeeklyStatistics();
const records = await this.historyService.getSportRecords();
console.log('[周统计调试] 总记录数:', records.length);
const now = new Date();
const dayOfWeek = now.getDay();
const mondayOffset = day... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left calculateWeeklyStatistics 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#:#Righ... | async calculateWeeklyStatistics(): Promise<WeeklyStatistics> {
const weekStats = new WeeklyStatistics();
const records = await this.historyService.getSportRecords();
console.log('[周统计调试] 总记录数:', records.length);
const now = new Date();
const dayOfWeek = now.getDay();
const mondayOffset = day... | https://gitcode.com/openharmony/codelabs | 05da16ca79c1ae7e7543c7870231408bfdceea6c | gitcode |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/ThemeManager.ets | arkts | getCurrentColors | 获取当前主题的颜色配置
@returns 当前主题的颜色配置 | getCurrentColors(): ThemeColors {
return ThemeConfig.getColors(this.currentTheme);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentColors 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 ThemeColors AST#identifier#Right AST#ERROR#Ri... | getCurrentColors(): ThemeColors {
return ThemeConfig.getColors(this.currentTheme);
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 52f142d48ff9a265365a3f8bdbe74dcd4202dfd7 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/MessageManager.ets | arkts | getUnreadCount | Get total unread message count for a user. | static async getUnreadCount(currentUsername: string): Promise<number> {
try {
// 优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await MessageApi.getUnreadCount();
if (response.code === 200 && response.data !== null) {
return response.data.count;
... | 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 getUnreadCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentUsername AST#identifier#Right AST#ERROR#Left AST#... | static async getUnreadCount(currentUsername: string): Promise<number> {
try {
// 优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await MessageApi.getUnreadCount();
if (response.code === 200 && response.data !== null) {
return response.data.count;
... | https://github.com/Harrisonls2004/WaterFlow | e5601533116b43ad24c29f3835339d43f9d4980f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | slice | Creates a slice of current Uint8Array using range [begin, end]
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice}
@param { int } [begin] start - index to be taken into slice
@param { int } [end] - last index to be taken into slice
@returns { Uint8Array } - a new Ui... | public slice(begin?: int, end?: int): Uint8Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#... | public slice(begin?: int, end?: int): Uint8Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | 5c5b533d11c86a77adb1a56d71cd2eee9e7c8ff4 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets | arkts | constructor | Create a LongTask instance
@param { string } name The name of long task
@param { Function } func Concurrent function to execute in the taskpool | constructor(name: string, func: Function, ...args: FixedArray<Any>) {
super(name, func, ...args);
} | 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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | constructor(name: string, func: Function, ...args: FixedArray<Any>) {
super(name, func, ...args);
} | https://gitcode.com/iop123123/arkts-static-skills | d239c99fb282c8e28edea8aff3d722a0dd3014dd | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | getMinLogLevel | @returns The currently configured minimum log level. | static getMinLogLevel(): number {
return AGenUILogger.getInstance().getMinLogLevel();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMinLogLevel 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#... | static getMinLogLevel(): number {
return AGenUILogger.getInstance().getMinLogLevel();
} | https://github.com/AGenUI/AGenUI | 8c772e7715f95f6bd05b2c5ae3f3f2ddc0bfff1d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | dividerColor | 快捷方法:获取分割线颜色 | public static get dividerColor(): string {
return AppColors.divider;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left dividerColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right A... | public static get dividerColor(): string {
return AppColors.divider;
} | https://github.com/DaLongZhuaZi/manxia | 68b74d82367cc67f3bbbbe790eb8c235bddcb50e | github |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets | arkts | onContinueAbilityClick | Click the transfer button to display nearby devices and open the pop-up window. | onContinueAbilityClick(): void {
remoteDeviceModel.startDeviceDiscovery();
this.dialogController.open();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onContinueAbilityClick 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#state... | onContinueAbilityClick(): void {
remoteDeviceModel.startDeviceDiscovery();
this.dialogController.open();
} | https://gitee.com/openharmony/codelabs.git | e73a633467af61adc6bc0c51185e4d1998853c1b | gitee |
SMAT-Lab/HapRepair | arkts_files/152.ets | arkts | onActive | The callback when current page is in the foreground | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
this.groupDataSource.dataRemove();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
this.groupDataSource.dataRemove();
} | https://github.com/SMAT-Lab/HapRepair | eed471b0a2e11395682535d58240b3e8c33cbaaa | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets | arkts | forEach | Execute a provided function once per each value in the TreeSet
@param callbackfn: the function to apply, the key is always same as the value | forEach(callbackfn: TreeSetForEachCb<T>): void {
this.treeMap.forEach((value: T, key: T) => {
callbackfn(value, key, this);
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left TreeSetF... | forEach(callbackfn: TreeSetForEachCb<T>): void {
this.treeMap.forEach((value: T, key: T) => {
callbackfn(value, key, this);
})
} | https://gitcode.com/iop123123/arkts-static-skills | f7b42f2717fa8b5f45f1c9b214d2e75eea1913dd | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/model/NavDestBuilder.ets | arkts | popToNameWithResult | 携带结果返回指定路由名称的页面,会关闭中间页面,可以替代popNavWithResult
可在onPopListener回调函数内监听
@param name
@param result 返回携带的数据,如果不传,默认是一个空对象
@param animated
@returns | public popToNameWithResult<T = ObjectOrNull>(name: string, result: T | undefined = undefined, animated: boolean = true): number {
this.updateCurrentStackName()
return this.routerMgr.popToNameWithResult<T>(name, result, animated)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left popToNameWithResult AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left T AST#identifier#Right AST#=#Left = AS... | public popToNameWithResult<T = ObjectOrNull>(name: string, result: T | undefined = undefined, animated: boolean = true): number {
this.updateCurrentStackName()
return this.routerMgr.popToNameWithResult<T>(name, result, animated)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L292-L295 | 53d4753ba7d328c0ecb5c8365f3bbc7a4b63bfe7 | github |
buqiuz/game-puzzle | entry/src/main/ets/model/PuzzleSolver.ets | arkts | manhattanDistance | 计算曼哈顿距离 | manhattanDistance(state: number[], goalPos: Map<number, [number, number]>): number {
let distance = 0;
for (let index = 0; index < state.length; index++) {
const value = state[index];
if (value !== 0) { // 空白块不计算距离
const goalPosition = goalPos.get(value)!;
const goalX = goalPositio... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left manhattanDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left number ... | manhattanDistance(state: number[], goalPos: Map<number, [number, number]>): number {
let distance = 0;
for (let index = 0; index < state.length; index++) {
const value = state[index];
if (value !== 0) { // 空白块不计算距离
const goalPosition = goalPos.get(value)!;
const goalX = goalPositio... | https://github.com/buqiuz/game-puzzle | efd047f32d536f1fd61ab3a066196f0adcf10955 | github |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityInteraction/entry/src/main/ets/specifiedability/HotStartAbility.ets | arkts | onWindowStageCreate | [EndExclude HotAbility] | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(DOMAIN_NUMBER, TAG, '%{public}s', 'Ability onWindowStageCreate');
let url = 'pages/Index';
windowStage.loadContent(url, (err, data) => {
if (err.code) {
retur... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(DOMAIN_NUMBER, TAG, '%{public}s', 'Ability onWindowStageCreate');
let url = 'pages/Index';
windowStage.loadContent(url, (err, data) => {
if (err.code) {
retur... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 40fd10217d255a1aea9a72a8ab0b1fa43c8694d1 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/ParentalControlService.ets | arkts | getCurrentSessionMinutes | 获取当前会话时长(分钟) | public getCurrentSessionMinutes(): number {
if (this.sessionStartTime === 0) return 0;
return Math.floor((Date.now() - this.sessionStartTime) / 60000);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentSessionMinutes 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 n... | public getCurrentSessionMinutes(): number {
if (this.sessionStartTime === 0) return 0;
return Math.floor((Date.now() - this.sessionStartTime) / 60000);
} | https://github.com/the-wwyang/kids-learning-app | d67b23732329f71232fa8b90d1d320fb49349fdf | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitSfixed32 | 访问 sfixed32 字段
JSON: number | visitSfixed32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitSfixed32 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 number AST#identifier#Right AST#,#Left , ... | visitSfixed32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | ea854489676d9427820fac31eb0434b000c7cbb6 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectConstructor.ets | arkts | constructor | Private constructor, direct instantiation of the Constructor class is prohibited.
@throws { Error } Throws when attempting to directly instantiate the Constructor class. | private constructor() { throw new Error("Constructor constructor called") } | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor 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 ... | private constructor() { throw new Error("Constructor constructor called") } | https://gitcode.com/iop123123/arkts-static-skills | adf97726c2551a4a10ed0bb5eef596f4c0569e30 | gitcode |
kumaleap/ArkLuban | library/src/main/ets/luban/Luban.ets | arkts | compress | 快速压缩单张图片
@param sourcePath 源图片路径
@param targetPath 目标路径(可选)
@param options 压缩选项(可选)
@returns 压缩结果 | static async compress(
sourcePath: string,
targetPath?: string,
options?: CompressOptions
): Promise<CompressResult> {
let processedSourcePath = sourcePath;
let shouldCleanTemp = false;
const slashIndex = targetPath ? targetPath.lastIndexOf('/') : -1;
const targetDir = targetPath && sla... | 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 compress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | static async compress(
sourcePath: string,
targetPath?: string,
options?: CompressOptions
): Promise<CompressResult> {
let processedSourcePath = sourcePath;
let shouldCleanTemp = false;
const slashIndex = targetPath ? targetPath.lastIndexOf('/') : -1;
const targetDir = targetPath && sla... | https://github.com/kumaleap/ArkLuban | a72523130631d8d5eb9b637b9da156acaa23aafe | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | getCustomIcon | 获取图标资源
@param customIcon 自定义图标ID
@param kdbxMeta kdbx元数据
@returns 图标资源 | public static getCustomIcon(customIcon: KdbxUuid | undefined | string, kdbxMeta: KdbxMeta | undefined): ResourceStr | null {
if (customIcon == undefined || kdbxMeta == undefined) {
return null;
}
let value = KdbxUtils.customIconMap.get(customIcon.toString());
if (value != undefined) {
retu... | 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 getCustomIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left cu... | public static getCustomIcon(customIcon: KdbxUuid | undefined | string, kdbxMeta: KdbxMeta | undefined): ResourceStr | null {
if (customIcon == undefined || kdbxMeta == undefined) {
return null;
}
let value = KdbxUtils.customIconMap.get(customIcon.toString());
if (value != undefined) {
retu... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L282-L299 | 484faebda1d63e9833b823c8e0414ffa000d3857 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | batchUpdateWordStates | 批量更新单词状态 | batchUpdateWordStates(updates: Array<WordStateUpdate>): void {
for (let i: number = 0; i < updates.length; i++) {
const update: WordStateUpdate = updates[i];
this.updateWordState(update.wordId, update.state, update.userBookId || '');
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left batchUpdateWordStates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left updates AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AST#ide... | batchUpdateWordStates(updates: Array<WordStateUpdate>): void {
for (let i: number = 0; i < updates.length; i++) {
const update: WordStateUpdate = updates[i];
this.updateWordState(update.wordId, update.state, update.userBookId || '');
}
} | https://github.com/CLMC2025/Vignette | be1f5a6057a0c67ffae3676adf81b23852d89f68 | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | queryAlarmsTasker | Refresh alarm task.
@param callback (alarms: Array<AlarmItem>) => void | public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) {
let that = this;
that.queryDatabaseAlarms(callback);
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.addPreferencesListener({
onDataChanged() {
that.queryDatabas... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left queryAlarmsTasker AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( A... | public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) {
let that = this;
that.queryDatabaseAlarms(callback);
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.addPreferencesListener({
onDataChanged() {
that.queryDatabas... | https://gitee.com/harmonyos/codelabs.git | 31df36314e499a4e1882ce2e9b08d53dc5b16673 | gitee |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/user/UserNavigator.ets | arkts | toProfile | 跳转到个人中心
@returns {void} 无返回值 | static toProfile(): void {
navigateTo(UserRoutes.Profile);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_s... | static toProfile(): void {
navigateTo(UserRoutes.Profile);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 6609e92c3f7e121bdd82c6ccd561ef6e36b2f229 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/DatabaseConfigOptimizer.ets | arkts | checkpoint | 执行 WAL checkpoint(将 WAL 文件合并到主数据库)
建议:
- 定期执行(如应用退出时)
- 避免 WAL 文件过大 | static async checkpoint(): Promise<void> {
try {
const store = DatabaseManager.getDatabase();
await store.executeSql('PRAGMA wal_checkpoint(TRUNCATE);');
console.log('[DatabaseConfigOptimizer] ✓ WAL checkpoint 已执行');
} catch (error) {
console.warn('[DatabaseConfigOptimizer] ⚠ WAL check... | 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 checkpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | static async checkpoint(): Promise<void> {
try {
const store = DatabaseManager.getDatabase();
await store.executeSql('PRAGMA wal_checkpoint(TRUNCATE);');
console.log('[DatabaseConfigOptimizer] ✓ WAL checkpoint 已执行');
} catch (error) {
console.warn('[DatabaseConfigOptimizer] ⚠ WAL check... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7f86d7505f739c9cbf8e9f882318dd65a26efc7b | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/debug/EventAlgoTestCase.ets | arkts | checkConflict | 辅助函数:冲突检查算法 | private checkConflict(baseStart: number, baseEnd: number, testStart: number, testEnd: number, expected: boolean,
tag: string) {
// 核心算法:Max(start1, start2) < Min(end1, end2)
const overlapStart = Math.max(baseStart, testStart);
const overlapEnd = Math.min(baseEnd, testEnd);
const isConflict = overl... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkConflict AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseStart AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | private checkConflict(baseStart: number, baseEnd: number, testStart: number, testEnd: number, expected: boolean,
tag: string) {
// 核心算法:Max(start1, start2) < Min(end1, end2)
const overlapStart = Math.max(baseStart, testStart);
const overlapEnd = Math.min(baseEnd, testEnd);
const isConflict = overl... | https://gitcode.com/openharmony/codelabs | 046a726dabd64204bb847cf797081d58c0cd84e0 | gitcode |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/FocusTimerEngine.ets | arkts | setRelatedTodo | 设置/切换关联的待办任务 | setRelatedTodo(newTodoId: number, newTodoTitle: string = ''): void {
if (this.todoId === newTodoId) {
if (`${newTodoTitle}`.trim().length > 0 && this.todoTitle !== newTodoTitle) {
this.todoTitle = `${newTodoTitle}`.trim();
this.syncLiveView();
}
return;
}
// 如果在专注期间切换任务,... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRelatedTodo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newTodoId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST... | setRelatedTodo(newTodoId: number, newTodoTitle: string = ''): void {
if (this.todoId === newTodoId) {
if (`${newTodoTitle}`.trim().length > 0 && this.todoTitle !== newTodoTitle) {
this.todoTitle = `${newTodoTitle}`.trim();
this.syncLiveView();
}
return;
}
// 如果在专注期间切换任务,... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L348-L367 | 2e0989ce76d81fc132e7b710eef9f6a77741493c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | getSearchHistory | ==================== 搜索历史 ====================
获取搜索历史 | getSearchHistory(): string[] {
return this.searchHistory.slice();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | getSearchHistory(): string[] {
return this.searchHistory.slice();
} | https://github.com/DaLongZhuaZi/manxia | 9a4a86ed58a12abd7accb4d3699f283cd28f179f | github |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | 应用创建时调用
初始化应用上下文、设置颜色模式、注册路由
@param {Want} want - 启动意图
@param {AbilityConstant.LaunchParam} launchParam - 启动参数
@returns {void} 无返回值 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
this.registerRouter();
ContextUtil.init(this.context)
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Fail... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
this.registerRouter();
ContextUtil.init(this.context)
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Fail... | https://github.com/Joker-x-dev/CoolMallArkTS | 44a4b13d168fa67fb8ae89132de2994694f8fb2a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | getTxtInFolder | 获取文件夹内所有文本文件读取 | async getTxtInFolder(path: string): Promise<string> {
if (!path) return '';
try {
const fullPath = this.resolvePath(path);
const contents: string[] = [];
// 列出目录下的文件
const files = SafeFileUtils.listFileSync(fullPath);
for (const fileName of files) {
const file... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getTxtInFolder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation... | async getTxtInFolder(path: string): Promise<string> {
if (!path) return '';
try {
const fullPath = this.resolvePath(path);
const contents: string[] = [];
// 列出目录下的文件
const files = SafeFileUtils.listFileSync(fullPath);
for (const fileName of files) {
const file... | https://github.com/DaLongZhuaZi/manxia | 8f1ca4f55f5f8464f6d977fb7333075738707dea | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t17_charsetSentinel | T17: charsetSentinel | t17_charsetSentinel(): void {
const obj: Record<string, Object> = {} as Record<string, Object>;
obj['a'] = '1';
const sopts: StringifyOptions = { charsetSentinel: true, charset: 'utf-8' };
const result: string = stringify(obj, sopts);
const hasSentinel: boolean = result.indexOf('utf8=%E2%9C%93') =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t17_charsetSentinel 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#statemen... | t17_charsetSentinel(): void {
const obj: Record<string, Object> = {} as Record<string, Object>;
obj['a'] = '1';
const sopts: StringifyOptions = { charsetSentinel: true, charset: 'utf-8' };
const result: string = stringify(obj, sopts);
const hasSentinel: boolean = result.indexOf('utf8=%E2%9C%93') =... | https://github.com/wgli-collab/qs-arkts | 8e4a131935a262c173b0baf22f0166c588a17aff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | isDirectory | 判断路径是否为目录
@param path 路径
@returns 是否为目录 | private async isDirectory(path: string): Promise<boolean> {
try {
// 使用底层stat检查目录属性,避免通过列目录判断造成误判与日志污染
const stat = await fileIo.stat(path);
return stat.isDirectory();
} catch (error) {
return false;
}
} | 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 isDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AS... | private async isDirectory(path: string): Promise<boolean> {
try {
// 使用底层stat检查目录属性,避免通过列目录判断造成误判与日志污染
const stat = await fileIo.stat(path);
return stat.isDirectory();
} catch (error) {
return false;
}
} | https://github.com/DaLongZhuaZi/manxia | 62d749f6e09f1e222b48ec6051a18c571d196e0d | github |
openharmony/applications_settings | product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets | arkts | getStringSync | 同步返回字符串string值 | static getStringSync(resource: ResourceStr | undefined): string {
if (!resource) {
return '';
}
if (typeof resource === 'string') {
return resource;
}
let context = getContext() as common.UIAbilityContext;
if (!context.resourceManager) {
return '';
}
return context.re... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStringSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_express... | static getStringSync(resource: ResourceStr | undefined): string {
if (!resource) {
return '';
}
if (typeof resource === 'string') {
return resource;
}
let context = getContext() as common.UIAbilityContext;
if (!context.resourceManager) {
return '';
}
return context.re... | https://gitee.com/openharmony/applications_settings.git | 29c6d4b609338481e07deb1a14709c25df675c98 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates a copy of BigUint64Array.
@param { BigUint64Array } other - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(other: BigUint64Array) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLengthInt = other.byteLength
this.lengthInt = other.length
this.byteOffsetInt = 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Big... | public constructor(other: BigUint64Array) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLengthInt = other.byteLength
this.lengthInt = other.length
this.byteOffsetInt = 0
} | https://gitcode.com/iop123123/arkts-static-skills | 3488e7b4e1e5dba8399d6c02327658e908db0725 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | addError | 添加错误信息 | addError(error: string): void {
this.errors.push(error);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | addError(error: string): void {
this.errors.push(error);
} | https://github.com/CLMC2025/Vignette | fd9dbb3ae0cc4a1315ec504f80ff58389da11f0b | github |
openharmony-sig/flutter_sqflite | sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/DatabaseHelper.ets | arkts | deleteDatabase | / 删除一个数据库 | public static async deleteDatabase(context: common.Context, databaseName: string): Promise<boolean> {
let result: boolean = false;
let dbNameList: string[] = databaseName.split('/');
let dbName: string = dbNameList[dbNameList.length - 1];
let endWithDb: boolean = Tools.stringEndWith(dbName, '.db');
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left deleteDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left con... | public static async deleteDatabase(context: common.Context, databaseName: string): Promise<boolean> {
let result: boolean = false;
let dbNameList: string[] = databaseName.split('/');
let dbName: string = dbNameList[dbNameList.length - 1];
let endWithDb: boolean = Tools.stringEndWith(dbName, '.db');
... | https://gitee.com/openharmony-sig/flutter_sqflite.git | 7e6dee047da915748af703a64946b2240721ef71 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/stepper/index.ets | arkts | handleClickStepperBtn | 当点击加减按钮时 | handleClickStepperBtn(btnType: STEPPER_BTN_TYPE) {
if (this.disabled) {
return
}
let nextValue = '0'
if (btnType === STEPPER_BTN_TYPE.PLUS) {
if (this.disablePlus) {
return
}
nextValue = String(accAdd(Number(this.inputNumValue), this.step))
this.onPlus()
} else {
if (this.disableMinus) ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleClickStepperBtn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left btnType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left STEPPER_BTN_TYPE... | handleClickStepperBtn(btnType: STEPPER_BTN_TYPE) {
if (this.disabled) {
return
}
let nextValue = '0'
if (btnType === STEPPER_BTN_TYPE.PLUS) {
if (this.disablePlus) {
return
}
nextValue = String(accAdd(Number(this.inputNumValue), this.step))
this.onPlus()
} else {
if (this.disableMinus) ... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/stepper/index.ets#L241-L260 | 98e60546628d137f60ef5b58d08ae9f3e4976295 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | getCurrentSession | 获取当前会话 | getCurrentSession(): ChatSession | null {
this.currentSession = this.sessionStore.getCurrentSession()
return this.currentSession
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentSession 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#ide... | getCurrentSession(): ChatSession | null {
this.currentSession = this.sessionStore.getCurrentSession()
return this.currentSession
} | https://github.com/LongLiveY96/chatcube | 9fdbd10e30edd6ec503677ca3dd72b97a6f5387e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | generateDefaultEBook | 生成默认的电子书对象 | protected generateDefaultEBook(filePath: string, format: EBookFormat, metadata: EBookMetadata): EBook {
const now = Date.now();
const bookId = `ebook_${format.toLowerCase()}_${now}_${Math.random().toString(36).substring(2, 9)}`;
return new EBook(
bookId,
format,
filePath,
0, // fi... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left generateDefaultEBook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st... | protected generateDefaultEBook(filePath: string, format: EBookFormat, metadata: EBookMetadata): EBook {
const now = Date.now();
const bookId = `ebook_${format.toLowerCase()}_${now}_${Math.random().toString(36).substring(2, 9)}`;
return new EBook(
bookId,
format,
filePath,
0, // fi... | https://github.com/DaLongZhuaZi/manxia | 5aa8d35c775dcfe8541a472e178dfcc8d34fb346 | github |
openharmony/codelabs | Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | getDisAbsX | 计算移动距离的绝对值 | getDisAbsX() {
var disAbsX = Math.abs(this.smallPosX - this.startPosX);
console.log("[demo4]disAbsX:" + disAbsX);
if (disAbsX < 10) {
return 1;
}
return disAbsX;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDisAbsX 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... | getDisAbsX() {
var disAbsX = Math.abs(this.smallPosX - this.startPosX);
console.log("[demo4]disAbsX:" + disAbsX);
if (disAbsX < 10) {
return 1;
}
return disAbsX;
} | https://gitee.com/openharmony/codelabs.git | 2b76b34966b1abd21047bf2f8d5c3b4e3ad81764 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ErrorHandler.ets | arkts | constructor | Constructs a ProcessErrorHandler instance with the provided uncaught error listener.
@param { UncaughtErrorListener } cb - The callback function for handling uncaught errors.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(cb: UncaughtErrorListener) {
this.callback = cb;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cb AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uncaug... | public constructor(cb: UncaughtErrorListener) {
this.callback = cb;
} | https://gitcode.com/iop123123/arkts-static-skills | e7c0bf35865694aba7530206a0a801a6e31fbe5b | gitcode |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/Logger.ets | arkts | setLogLevel | 设置文件日志写入级别 | static setLogLevel(level: LogLevel) {
Logger.fileLogLevel = level;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setLogLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Log... | static setLogLevel(level: LogLevel) {
Logger.fileLogLevel = level;
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | c69067872b717d0b17e434fd503c9c95b28573a3 | github |
codelably/HCompass | core/di/src/main/ets/ServiceContainer.ets | arkts | tryResolve | 尝试解析服务实例
@template T 服务类型
@param key 服务标识符
@returns 服务实例,未注册时返回 undefined | tryResolve<T>(key: ServiceKey): T | undefined {
// 先从当前容器查找
const descriptor = this.services.get(key) as ServiceDescriptor<T> | undefined;
if (descriptor) {
return this.getInstance<T>(descriptor);
}
// 从父容器查找
if (this.parent) {
return this.parent.tryResolve<T>(key);
}
re... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left tryResolve AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#ERROR#Left AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameters#Left AST#(#Left ( AST... | tryResolve<T>(key: ServiceKey): T | undefined {
// 先从当前容器查找
const descriptor = this.services.get(key) as ServiceDescriptor<T> | undefined;
if (descriptor) {
return this.getInstance<T>(descriptor);
}
// 从父容器查找
if (this.parent) {
return this.parent.tryResolve<T>(key);
}
re... | https://github.com/codelably/HCompass | 9fef251d60d7bd9ade8ffe43692c65fffcc810a4 | github |
CLMC2025/Vignette | entry/src/main/ets/model/AnimationModel.ets | arkts | springResponsive | 创建响应式弹簧动画 | static springResponsive(direction: AnimationDirection = AnimationDirection.CENTER): AnimationConfig {
return AnimationConfig.spring(direction, 250, 15, 1);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left springResponsive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left direction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment... | static springResponsive(direction: AnimationDirection = AnimationDirection.CENTER): AnimationConfig {
return AnimationConfig.spring(direction, 250, 15, 1);
} | https://github.com/CLMC2025/Vignette | 2eacd36c13a3d9cc3049df0a59a8693a689e30cc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectProxy.ets | arkts | createClass | Creates a new proxy `Class` that implements the specified interfaces and extends `Proxy` class.
@returns A `Class` object representing the dynamically generated proxy class. | private static createClass(linker: RuntimeLinker, interfaces: FixedArray<Class>): Class {
let proxyName: string = Proxy.createUniqueName()
return Proxy.generateProxy(linker, proxyName, interfaces)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left createClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left linker AST#identifier#Right AST#:#Left :... | private static createClass(linker: RuntimeLinker, interfaces: FixedArray<Class>): Class {
let proxyName: string = Proxy.createUniqueName()
return Proxy.generateProxy(linker, proxyName, interfaces)
} | https://gitcode.com/iop123123/arkts-static-skills | 304de2a7806362320079b8cdaa3e549559ed17f4 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleRemoteConfig.ets | arkts | getValue | -- Public read API -- | public getValue(key: string): RCData | null {
const entry: CacheEntry | undefined = this.cache[key];
if (entry === undefined) return null;
return new RCData(entry.v, entry.c === 1);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | public getValue(key: string): RCData | null {
const entry: CacheEntry | undefined = this.cache[key];
if (entry === undefined) return null;
return new RCData(entry.v, entry.c === 1);
} | https://github.com/Countly/countly-sdk-hos | 06f40839768ef3ec7942de29e05a2ae8855ef69c | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | writeInt16LE | Writes a signed 16-bit integer to the buffer at the specified offset using little-endian format
@param {long} value - Value to write
@param {int} [offset=0] - Number of bytes to skip before writing
@returns {int} Offset plus the number of bytes written | public writeInt16LE(value: long, offset: int = 0): int {
this.checkOffset(offset, 2);
this.checkValue(value, (-Math.pow(2, 15).toLong()), (Math.pow(2, 15).toLong() - 1), (-Math.pow(2, 15)).toString(), (Math.pow(2, 15) - 1).toString());
this.getDataView().setInt16(offset, valu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeInt16LE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifie... | public writeInt16LE(value: long, offset: int = 0): int {
this.checkOffset(offset, 2);
this.checkValue(value, (-Math.pow(2, 15).toLong()), (Math.pow(2, 15).toLong() - 1), (-Math.pow(2, 15)).toString(), (Math.pow(2, 15) - 1).toString());
this.getDataView().setInt16(offset, valu... | https://gitcode.com/iop123123/arkts-static-skills | 56c2a8f827c2f356ad4fd7071106cc6a9167e120 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/FTP/FTPNativeClient.ets | arkts | checkNativeModule | 检查Native模块 | function checkNativeModule(): void {
if (moduleChecked) return;
moduleChecked = true;
try {
if (webdavNativeModuleImport) {
const mod = webdavNativeModuleImport as NativeModule;
// 检查是否有FTP专用方法
if (typeof mod.ftpInit === 'function') {
nativeModule = mod;
logger.info(TAG, '... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkNativeModule 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#predefine... | function checkNativeModule(): void {
if (moduleChecked) return;
moduleChecked = true;
try {
if (webdavNativeModuleImport) {
const mod = webdavNativeModuleImport as NativeModule;
// 检查是否有FTP专用方法
if (typeof mod.ftpInit === 'function') {
nativeModule = mod;
logger.info(TAG, '... | https://github.com/DaLongZhuaZi/manxia | 02951f76946c1b7ff2f6540cc5155238d028da64 | github |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/SubWindowManager.ets | arkts | detach | Must be called from `onWindowStageDestroy`. | detach(): void {
RouterManager.bindRouteListener(null);
this.applyRoute(CallRoute.none);
this._windowStage = null;
Logger.info('SubWindowManager.detach: success');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left detach 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 ... | detach(): void {
RouterManager.bindRouteListener(null);
this.applyRoute(CallRoute.none);
this._windowStage = null;
Logger.info('SubWindowManager.detach: success');
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 40517011e5ea9a7b2ff809a56b4aa4a690481b63 | github |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/GetSelfBundleInfoUtils.ets | arkts | getVersionName | Obtains the version name of SecurityPrivacyCenter
@returns Promise<string> versionName | getVersionName(): Promise<string> {
return new Promise<string>(async (resolve) => {
if (this.versionName !== '') {
Logger.info(TAG, `get versionName from object variable : ${this.versionName}`);
resolve(this.versionName)
} else {
try {
await bundleManager.getBundleInf... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getVersionName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Le... | getVersionName(): Promise<string> {
return new Promise<string>(async (resolve) => {
if (this.versionName !== '') {
Logger.info(TAG, `get versionName from object variable : ${this.versionName}`);
resolve(this.versionName)
} else {
try {
await bundleManager.getBundleInf... | https://gitee.com/openharmony/security_privacy_center.git | 91cf69a9615297b4ce7c305f2e3a2c2f21fcd53c | gitee |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/common/utils/Logger.ets | arkts | info | 打印信息日志 | static info(tag: string, format: string, ...args: string[]): void {
hilog.info(Logger.domain, Logger.prefix, `[${tag}] ${format}`, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | static info(tag: string, format: string, ...args: string[]): void {
hilog.info(Logger.domain, Logger.prefix, `[${tag}] ${format}`, args);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 03f2e2e3e66a5b93d8dfaef444858be5e0795f78 | github |
YANGZX22/Voot | entry/src/main/ets/services/PipSubtitleManager.ets | arkts | handleStateChange | Handle PiP state change | private handleStateChange(state: PiPWindow.PiPState, reason: string): void {
let stateStr = '';
switch (state) {
case PiPWindow.PiPState.ABOUT_TO_START:
stateStr = 'ABOUT_TO_START';
break;
case PiPWindow.PiPState.STARTED:
stateStr = 'STARTED';
this.isPipRunning = tr... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleStateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_exp... | private handleStateChange(state: PiPWindow.PiPState, reason: string): void {
let stateStr = '';
switch (state) {
case PiPWindow.PiPState.ABOUT_TO_START:
stateStr = 'ABOUT_TO_START';
break;
case PiPWindow.PiPState.STARTED:
stateStr = 'STARTED';
this.isPipRunning = tr... | https://github.com/YANGZX22/Voot | 7a994c0beeaea4985ad88f6451b9ab43a67ffd77 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets | arkts | getNextSortState | 获取排序状态的下一个状态
@param {SortState[]} stateFlow - 状态流
@param {SortState} currentState - 当前状态
@returns {SortState} 下一个状态 | private getNextSortState(stateFlow: SortState[], currentState: SortState): SortState {
const index: number = stateFlow.indexOf(currentState);
if (index < 0) {
return stateFlow[0] ?? SortState.NONE;
}
return stateFlow[(index + 1) % stateFlow.length];
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNextSortState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stateFlow AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri... | private getNextSortState(stateFlow: SortState[], currentState: SortState): SortState {
const index: number = stateFlow.indexOf(currentState);
if (index < 0) {
return stateFlow[0] ?? SortState.NONE;
}
return stateFlow[(index + 1) % stateFlow.length];
} | https://github.com/Joker-x-dev/CoolMallArkTS | 9b64d33aa595fae3baf0f8a6f4a92e3a8f5b2d57 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/AdbKeyManager.ets | arkts | importCustomKey | 导入自定义密钥 | async importCustomKey(privateKeyStr: string, publicKeyStr: string): Promise<void> {
try {
if (!privateKeyStr || !publicKeyStr) {
throw new Error('Keys cannot be empty');
}
LoggerAdbKeyManager.info('ADB: Importing custom key...');
const base64Helper = new util.Base64Helper()... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importCustomKey AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left privateKeyStr AST#identifier#Right AST#type_annotation#Left AST... | async importCustomKey(privateKeyStr: string, publicKeyStr: string): Promise<void> {
try {
if (!privateKeyStr || !publicKeyStr) {
throw new Error('Keys cannot be empty');
}
LoggerAdbKeyManager.info('ADB: Importing custom key...');
const base64Helper = new util.Base64Helper()... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 7e8555a4e75043023f9b90319e817955bb8d9432 | github |
arkui-x/samples | CodeLab/Cases/feature/danmakuplayer/src/main/ets/model/DanmakuVideoPlayer.ets | arkts | danmakuInit | TODO: 知识点:初始化弹幕,设置弹幕相关参数 | danmakuInit() {
const maxLinesPair: Map<number, number> = new Map();
// 滚动弹幕最大显示5行
maxLinesPair.set(BaseDanmaku.TYPE_SCROLL_RL, Constants.MAX_DANMAKU_LINES);
// 设置是否禁止重叠
const overlappingEnablePair: Map<number, boolean> = new Map();
overlappingEnablePair.set(BaseDanmaku.TYPE_SCROLL_RL, true);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left danmakuInit 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... | danmakuInit() {
const maxLinesPair: Map<number, number> = new Map();
// 滚动弹幕最大显示5行
maxLinesPair.set(BaseDanmaku.TYPE_SCROLL_RL, Constants.MAX_DANMAKU_LINES);
// 设置是否禁止重叠
const overlappingEnablePair: Map<number, boolean> = new Map();
overlappingEnablePair.set(BaseDanmaku.TYPE_SCROLL_RL, true);
... | https://gitcode.com/arkui-x/samples | eaefda203ba3b6acb6242ab603f61460e096739e | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentSourceViewModel.ets | arkts | totalCount | 统计总数
@returns number | public totalCount(): number {
return this.cardComponentModels.length
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left totalCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | public totalCount(): number {
return this.cardComponentModels.length
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 4503165b7959e34eec78c7992c029170bcf20455 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.