nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/EntryOhos.ets | arkts | setX | Sets the x-value of this Entry object.
@param x | public setX(x: number): void {
this.x = x;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left setX AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | public setX(x: number): void {
this.x = x;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | b6024fa229fdcab41e07bda9dab6b646fc1c2ec7 | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/viewmodel/AIChatModel.ets | arkts | sendMessage | Send message to AI
@param text User input
@returns Promise<ChatMessage> | public static async sendMessage(text: string): Promise<ChatMessage> {
const chatMessage: ChatMessage = {
content: '',
isUser: false,
recommendations: undefined
};
// 1. Local Keyword Matching for Recommendations (Hybrid Approach)
// We do this locally because the AI API returns text... | 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 sendMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text A... | public static async sendMessage(text: string): Promise<ChatMessage> {
const chatMessage: ChatMessage = {
content: '',
isUser: false,
recommendations: undefined
};
// 1. Local Keyword Matching for Recommendations (Hybrid Approach)
// We do this locally because the AI API returns text... | https://github.com/Harrisonls2004/WaterFlow | 51161cda770176ae66c976840053d5fefa35b23e | github |
LongLiveY96/chatcube | entry/src/main/ets/utils/ProviderIconUtils.ets | arkts | resolveModelIconPathInternal | 解析模型图标路径
优先本地正则匹配(rawfile 路径),回退 models.dev 网络 URL | function resolveModelIconPathInternal(modelId: string): string {
// 优先本地正则匹配(确定性强,离线可用)
const localPath = matchModelIconPath(modelId)
if (localPath !== '') {
return localPath
}
// 回退 models.dev 缓存
return ModelCapabilityMatcher.getInstance().getLogoUrl(modelId)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left resolveModelIconPathInternal AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modelId AST#identifier#Right AST#type_annotation#Left AST... | function resolveModelIconPathInternal(modelId: string): string {
// 优先本地正则匹配(确定性强,离线可用)
const localPath = matchModelIconPath(modelId)
if (localPath !== '') {
return localPath
}
// 回退 models.dev 缓存
return ModelCapabilityMatcher.getInstance().getLogoUrl(modelId)
} | https://github.com/LongLiveY96/chatcube | 114e172f4b0922c96fca4742f693fff9f7793c54 | github |
erosTeam/NextE | feature/gallery/src/main/ets/components/GalleryTagsCard.ets | arkts | chipText | Member chip text color. The user's per-gallery tag VOTE wins first (eros_fe colors the tag text
green when upvoted / red when downvoted, ahead of any custom colour); then the user's own EH-chosen
tag text colour; then neutral secondary. Read-only — tapping a chip searches, it does not vote. | chipText(t: SimpleTag, ns: string): ResourceColor {
if (t.vote > 0) {
return $r('app.color.tag_vote_up')
}
if (t.vote < 0) {
return $r('app.color.tag_vote_down')
}
const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(ns, t.text)
if (u !== undefined && u.textColor.leng... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left chipText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SimpleTag AST#identifier#Right AST#,#Left , AST#,#... | chipText(t: SimpleTag, ns: string): ResourceColor {
if (t.vote > 0) {
return $r('app.color.tag_vote_up')
}
if (t.vote < 0) {
return $r('app.color.tag_vote_down')
}
const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(ns, t.text)
if (u !== undefined && u.textColor.leng... | https://github.com/erosTeam/NextE | 996e2b957a0c58055e3b4d4ff13e951f9be2760b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/HtmlFormatter.ets | arkts | unescapeHtml | 处理HTML实体
参考Apache Commons Text的StringEscapeUtils.unescapeHtml4 | static unescapeHtml(html: string): string {
if (!html || html.indexOf('&') === -1) return html;
let result = html;
// 常见HTML实体
const entities: Record<string, string> = {
' ': ' ',
'<': '<',
'>': '>',
'&': '&',
'"': '"',
''': "'",
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unescapeHtml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | static unescapeHtml(html: string): string {
if (!html || html.indexOf('&') === -1) return html;
let result = html;
// 常见HTML实体
const entities: Record<string, string> = {
' ': ' ',
'<': '<',
'>': '>',
'&': '&',
'"': '"',
''': "'",
... | https://github.com/DaLongZhuaZi/manxia | c01c81bdaf3ac656bd99f5a852c05058b4d52426 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | includes | Determines whether BigUint64Array includes a certain element, returning true or false as appropriate
@param { long } searchElement - The element to search for
@param { int } fromIndex - The position in this array at which to begin searching for searchElement
@returns { boolean } - true if searchElement is in BigUint64A... | public includes(searchElement: long, fromIndex: int): boolean {
if (searchElement < 0) {
return false;
}
return this.indexOf(searchElement.toInt(), fromIndex) != -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#ident... | public includes(searchElement: long, fromIndex: int): boolean {
if (searchElement < 0) {
return false;
}
return this.indexOf(searchElement.toInt(), fromIndex) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | fc325bcc14105cc418f413cbfc35fdcb179c396c | gitcode |
heeh02/superconnect | harmony/entry/src/main/ets/input/InputRouter.ets | arkts | constructor | drop fingers this long after pen activity (drawing mode) | constructor(sender: InputSender, surfaceW: () => number, surfaceH: () => number, drawing: () => boolean) {
this.sender = sender;
this.surfaceWFn = surfaceW;
this.surfaceHFn = surfaceH;
this.drawingFn = drawing;
// One wire-seam owner: handlers emit through this closure, which frames onto the INPUT... | 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 sender AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InputSender AST#identifier#... | constructor(sender: InputSender, surfaceW: () => number, surfaceH: () => number, drawing: () => boolean) {
this.sender = sender;
this.surfaceWFn = surfaceW;
this.surfaceHFn = surfaceH;
this.drawingFn = drawing;
// One wire-seam owner: handlers emit through this closure, which frames onto the INPUT... | https://github.com/heeh02/superconnect | 2c9f1f6b95361639b4bb3dab31a2cd329b006277 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionGenerator.ets | arkts | generate | 根据题型和难度生成题目
@param type 题目类型
@param difficulty 难度等级
@returns 生成的题目对象 | static generate(type: QuestionType, difficulty: Difficulty): MathQuestion {
switch (type) {
case QuestionType.CALCULATION:
return QuestionGenerator.generateCalculation(difficulty);
case QuestionType.COMPARISON:
return QuestionGenerator.generateComparison(difficulty);
case Questio... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Questio... | static generate(type: QuestionType, difficulty: Difficulty): MathQuestion {
switch (type) {
case QuestionType.CALCULATION:
return QuestionGenerator.generateCalculation(difficulty);
case QuestionType.COMPARISON:
return QuestionGenerator.generateComparison(difficulty);
case Questio... | https://github.com/the-wwyang/kids-learning-app | 7bac41515d8543df6e24c5e72dc0c49bbca4af34 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/network/HttpClient.ets | arkts | getToken | 获取当前 Token | getToken(): string {
return this.authToken;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | getToken(): string {
return this.authToken;
} | https://github.com/Harrisonls2004/WaterFlow | 80f425c1bdcee4298256a33b40dafc93ce4d2de4 | github |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/util/RecommendDataUtil.ets | arkts | mapRecommendCardDtoToUi | Maps a recommendation card API DTO to {@link RecommendCardUi}.
@param dto - Source playlist/card DTO.
@returns Populated UI model. | private static mapRecommendCardDtoToUi(dto: RecommendCardApiDto): RecommendCardUi {
const ui = new RecommendCardUi();
ui.title = dto.title;
ui.playCountLabel = dto.playCountLabel;
ui.paletteIndex = dto.paletteIndex;
ui.backgroundImage = dto.backgroundImage;
return ui;
} | 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 mapRecommendCardDtoToUi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dto AST#identifier#Right AST... | private static mapRecommendCardDtoToUi(dto: RecommendCardApiDto): RecommendCardUi {
const ui = new RecommendCardUi();
ui.title = dto.title;
ui.playCountLabel = dto.playCountLabel;
ui.paletteIndex = dto.paletteIndex;
ui.backgroundImage = dto.backgroundImage;
return ui;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | f8554160f30c937cda9f35573fadf2623e42706c | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Console.ets | arkts | println | Prints a boolean to the console
@param i value to print | public println(i: boolean): void {
this.print(i);
this.println();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST... | public println(i: boolean): void {
this.print(i);
this.println();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 751f6843b105168d3cce8754cdf7d1045482b883 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/dialog/dialog.ets | arkts | getConfirmBtnBgColor | 确认按钮背景色 | getConfirmBtnBgColor() {
return this.confirmButtonBgColor || (this.theme == 'round-button' ? this.baseStyle.primary : "transparent")
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getConfirmBtnBgColor 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_blo... | getConfirmBtnBgColor() {
return this.confirmButtonBgColor || (this.theme == 'round-button' ? this.baseStyle.primary : "transparent")
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dialog/dialog.ets#L251-L253 | 3427ba779236e0b823e4a2fd7b8a7f26f5b85aec | github |
darcycui/DarcyHarmonyNext | entry/src/main/ets/pages/entry/custom/styles/ExtendPage.ets | arkts | fancyText | TODO 设置Text组件的样式 可以传递参数 | @Extend(Text)
function fancyText(size: number, fontWeight: number, fontColor: Color, onclick: () => void) {
.fontSize(size)
.fontWeight(fontWeight)
.fontColor(fontColor)
.onClick(onclick) // TODO 参数可以是function
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function fancyText(size: number, fontWeight: number, fontColor: Color, onclick: () => void) {
.fontSize(size)
.fontWeight(fontWeight)
.fontColor(fontColor)
.onClick(onclick) // TODO 参数可以是function
} | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/custom/styles/ExtendPage.ets#L34-L40 | d19d8737d2f7b37665be69717ac99c7bba0db141 | github |
LZZLHY/hlib | entry/src/main/ets/utils/PublicDownloadDir.ets | arkts | resolveDir | 同步返回“当前已确立”的公共下载目录路径;未确立返回空串。不弹 UI。
平板:实时由 Environment 解析;手机:返回缓存的 picker 目录路径。 | static resolveDir(): string {
if (!PublicDownloadDir.isTabletSilent()) {
return AppStorage.get<string>(AppStorageKeys.PUBLIC_DOWNLOAD_DIR) ?? '';
}
try {
const base: string = Environment.getUserDownloadDir();
if (base !== undefined && base !== null && base.length > 0) {
const bun... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resolveDir 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#stri... | static resolveDir(): string {
if (!PublicDownloadDir.isTabletSilent()) {
return AppStorage.get<string>(AppStorageKeys.PUBLIC_DOWNLOAD_DIR) ?? '';
}
try {
const base: string = Environment.getUserDownloadDir();
if (base !== undefined && base !== null && base.length > 0) {
const bun... | https://github.com/LZZLHY/hlib | d9a8e2b9eb77999765f0fda5bfc8e79411e9e365 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/DownloadDirManager.ets | arkts | getMangaArchiveDirectoryPath | 获取在线漫画归档章节目录
格式: Download/包名/manga/{sourceName}/{mangaTitle}/{chapterTitle}/ | public getMangaArchiveDirectoryPath(sourceName: string, mangaTitle: string, chapterTitle: string): string {
const sanitizedSourceName = this.sanitizeFolderName(sourceName.length > 0 ? sourceName : 'unknown_source');
const sanitizedMangaTitle = this.sanitizeFolderName(mangaTitle.length > 0 ? mangaTitle : 'unkn... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMangaArchiveDirectoryPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left s... | public getMangaArchiveDirectoryPath(sourceName: string, mangaTitle: string, chapterTitle: string): string {
const sanitizedSourceName = this.sanitizeFolderName(sourceName.length > 0 ? sourceName : 'unknown_source');
const sanitizedMangaTitle = this.sanitizeFolderName(mangaTitle.length > 0 ? mangaTitle : 'unkn... | https://github.com/DaLongZhuaZi/manxia | b4dd41ca08a13a605b1e6cfb7a8e0fbd3a1f374c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets | arkts | convertFromManga | 将新的Manga类型转换回旧的ComicInfo(用于数据库保存) | static convertFromManga(manga: Manga): LegacyComicInfo {
const base: LegacyComicInfo = {
id: manga.id,
title: manga.title,
author: manga.author,
description: manga.description,
coverUrl: manga.coverUrl,
coverLocalPath: manga.coverLocalPath,
tags: manga.tags ? JSON.stringi... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertFromManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static convertFromManga(manga: Manga): LegacyComicInfo {
const base: LegacyComicInfo = {
id: manga.id,
title: manga.title,
author: manga.author,
description: manga.description,
coverUrl: manga.coverUrl,
coverLocalPath: manga.coverLocalPath,
tags: manga.tags ? JSON.stringi... | https://github.com/DaLongZhuaZi/manxia | 3bb5f2bc9a356b50e969aaefbe57aaf60c78380b | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/FilenameUtils.ets | arkts | replaceExt | 替换文件名后缀
@param fileName 文件名
@param ext 后缀
@returns 文件名 | public static replaceExt(fileName: string, ext: string): string {
if (!fileName) {
return "";
}
// 如果文件名中没有后缀,或者最后一个字符是点,则去掉最后一个点并添加新后缀
if (!fileName.includes('.') || fileName.endsWith('.')) {
const trimmedFileName = fileName.endsWith('.') ? fileName.slice(0, -1) : fileName;
return `... | 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 replaceExt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public static replaceExt(fileName: string, ext: string): string {
if (!fileName) {
return "";
}
// 如果文件名中没有后缀,或者最后一个字符是点,则去掉最后一个点并添加新后缀
if (!fileName.includes('.') || fileName.endsWith('.')) {
const trimmedFileName = fileName.endsWith('.') ? fileName.slice(0, -1) : fileName;
return `... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FilenameUtils.ets#L40-L51 | d83506d1ea1732a9d8301b7543c921db9df35941 | github |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | initImmersiveWindow | 初始化沉浸式窗口
@param {window.Window} windowClass - 当前窗口
@returns {void} 无返回值 | private initImmersiveWindow(windowClass: window.Window): void {
const isLayoutFullScreen: boolean = true;
windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => {
console.info("Succeeded in setting the window layout to full-screen mode.");
}).catch((err: BusinessError) => {
conso... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initImmersiveWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowClass AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | private initImmersiveWindow(windowClass: window.Window): void {
const isLayoutFullScreen: boolean = true;
windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => {
console.info("Succeeded in setting the window layout to full-screen mode.");
}).catch((err: BusinessError) => {
conso... | https://github.com/Joker-x-dev/CoolMallArkTS | 35cb35dd6a4509a6589de0bf83dfd2df9f043802 | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/count-down/TnCountDown.ets | arkts | getMinsText | 获取分钟显示文本 | getMinsText(): string {
return padZero(Math.floor((this.getTotalSec() % HOUR_S) / MINUTE_S));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMinsText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_... | getMinsText(): string {
return padZero(Math.floor((this.getTotalSec() % HOUR_S) / MINUTE_S));
} | https://github.com/codelably/tuniao-ui | 75a212436aa77b40c2004919c56e38d8c8522412 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new CharBox instance with the specified initial value.
@param { char } value - The initial char value to be wrapped
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(value: char) {
this.value = value;
} | 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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left char AST#identifier... | public constructor(value: char) {
this.value = value;
} | https://gitcode.com/iop123123/arkts-static-skills | a142fbd3f370be383f1f435d7c92193218f41ebe | gitcode |
honjow/Next2V | feature/feed/src/main/ets/model/FeedModels.ets | arkts | setData | Replace all data | setData(data: V2exTopic[]): void {
this.dataArray = data
this.listeners.forEach(listener => listener.onDataReloaded())
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left V2exTopic AST#iden... | setData(data: V2exTopic[]): void {
this.dataArray = data
this.listeners.forEach(listener => listener.onDataReloaded())
} | https://github.com/honjow/Next2V | d91a0722ddf562fb15177724199f17bc6d2a7dc6 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | getSettings | 获取账本设置 | getSettings(): LedgerSettings {
try {
const parsed = JSON.parse(this.settingsJson) as LedgerSettings;
return parsed;
} catch (e) {
return SharedLedgerUtils.getDefaultSettings();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSettings 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 LedgerSettings AST#identifier#Right AST#ERROR#Righ... | getSettings(): LedgerSettings {
try {
const parsed = JSON.parse(this.settingsJson) as LedgerSettings;
return parsed;
} catch (e) {
return SharedLedgerUtils.getDefaultSettings();
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | fdea08ac01b9eab0918e6d7bf9efe205fc8992f9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/ScraperManager.ets | arkts | resetInstance | 重置实例(用于测试或重新配置) | public static resetInstance(): void {
ScraperManager.instance = null;
} | 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 resetInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public static resetInstance(): void {
ScraperManager.instance = null;
} | https://github.com/DaLongZhuaZi/manxia | a4bffc8617ddc5dacc5f7b7a2ac43065a175ece9 | github |
CLMC2025/Vignette | entry/src/main/ets/database/DBManager.ets | arkts | cacheDefinition | ==================== DEFINITION CACHE OPERATIONS ==================== | async cacheDefinition(word: string, definition: WordDefinition): Promise<void> {
return this.wordRepo.cacheDefinition(word, definition);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cacheDefinition AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left word AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async cacheDefinition(word: string, definition: WordDefinition): Promise<void> {
return this.wordRepo.cacheDefinition(word, definition);
} | https://github.com/CLMC2025/Vignette | 7174705475052f1bfc68309d9cb9615a5f0eb734 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | buildVariableVars | 构建自定义变量代码 | private buildVariableVars(context: JsContext): string {
if (!context.variables) {
return '';
}
const vars: string[] = [];
const entries = Object.entries(context.variables);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
const key = entry[0];
const... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildVariableVars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private buildVariableVars(context: JsContext): string {
if (!context.variables) {
return '';
}
const vars: string[] = [];
const entries = Object.entries(context.variables);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
const key = entry[0];
const... | https://github.com/DaLongZhuaZi/manxia | a7fc5f719c7f86c751cb1672ec0254ffae69b145 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | readIntLE | Reads a signed integer from the buffer at the specified offset using little-endian format
@param {int} offset - Number of bytes to skip before reading
@param {int} byteLength - Number of bytes to read (maximum 6)
@returns {long} The read value
@throws {Error} If byteLength is greater than 6 | public readIntLE(offset: int, byteLength: int): long {
let lengthOffset: int = this.length - byteLength;
Buffer.checkOffsetConstraint(offset, lengthOffset);
Buffer.checkByteLengthConstraint(byteLength);
let val = this.readBytes(this.getDataView(), offset, byteLeng... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readIntLE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R... | public readIntLE(offset: int, byteLength: int): long {
let lengthOffset: int = this.length - byteLength;
Buffer.checkOffsetConstraint(offset, lengthOffset);
Buffer.checkByteLengthConstraint(byteLength);
let val = this.readBytes(this.getDataView(), offset, byteLeng... | https://gitcode.com/iop123123/arkts-static-skills | f68c4c53cae84cdcc5e73d7f0db8d5e7fc247ab2 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/utils/LunarCalendarUtils.ets | arkts | getMonthDays | 获取某年某月的天数 | function getMonthDays(year: number, month: number): number {
const index = year - 1900
if (index < 0 || index >= LUNAR_INFO.length) {
return 29
}
return (LUNAR_INFO[index] & (0x10000 >> month)) !== 0 ? 30 : 29
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getMonthDays AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function getMonthDays(year: number, month: number): number {
const index = year - 1900
if (index < 0 || index >= LUNAR_INFO.length) {
return 29
}
return (LUNAR_INFO[index] & (0x10000 >> month)) !== 0 ? 30 : 29
} | https://github.com/LongLiveY96/chatcube | 3847e0d4078e24ed79ea32a20f55170ce2f6cc8b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | getUTCDate | Returns the day of the month (from 1 to 31) in the specified date according to universal time.
@returns { int }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getUTCDate(): int {
let localTime = this.ms;
let day: int = ecmaDayFromTime(localTime) - ecmaDayFromYear(ecmaYearFromTime(localTime));
let inLeapYear = ecmaInLeapYear(this.getUTCFullYear());
let firstDay: int = getFirstDayInMonth(inLeapYear, ecmaMonthFromTime(localTime));
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#ide... | public getUTCDate(): int {
let localTime = this.ms;
let day: int = ecmaDayFromTime(localTime) - ecmaDayFromYear(ecmaYearFromTime(localTime));
let inLeapYear = ecmaInLeapYear(this.getUTCFullYear());
let firstDay: int = getFirstDayInMonth(inLeapYear, ecmaMonthFromTime(localTime));
... | https://gitcode.com/iop123123/arkts-static-skills | 98e117e0f61218dc390ce24d6bb32d233597bee1 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/launch/src/main/ets/view/GuidePage.ets | arkts | build | 构建引导页
@returns {void} 无返回值 | build() {
AppNavDestination({
viewModel: this.vm,
hideTitleBar: true,
pageBackgroundColor: $r("app.color.bg_white")
}) {
this.GuideContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
viewModel: this.vm,
hideTitleBar: true,
pageBackgroundColor: $r("app.color.bg_white")
}) {
this.GuideContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | b0f1b26134c45b71ec82aacee4bd7abe3f211f15 | github |
offlinecat-dev/OCNetORM | src/main/ets/core/HooksProcessor.ets | arkts | executeBeforeSave | 执行 beforeSave 钩子
在保存实体数据到数据库之前调用
@param entityName 实体名称
@param data 实体数据
@throws HookExecutionError 如果钩子执行失败 | async executeBeforeSave(entityName: string, data: EntityData): Promise<void> {
await this.executeHook(entityName, data, 'beforeSave')
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeBeforeSave AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entityName AST#identifier#Right AST#type_annotation#Left AST#... | async executeBeforeSave(entityName: string, data: EntityData): Promise<void> {
await this.executeHook(entityName, data, 'beforeSave')
} | https://github.com/offlinecat-dev/OCNetORM | 7197caa423b0d6d825d85cc04d4c53658272f1fb | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | normalize | Normalize the path of this URI, It is not safe to call the normalize interface with URI.
@returns { URI } URI Used to normalize the path of this URI and return a URI object whose path has been normalized. | normalize(): URI {
let uriStr: string = this.uriEntry.normalize();
return new URI(uriStr);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left normalize 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 URI AST#identifier#Right AST#ERROR#Right AST#stateme... | normalize(): URI {
let uriStr: string = this.uriEntry.normalize();
return new URI(uriStr);
} | https://gitcode.com/iop123123/arkts-static-skills | 142708768bacdf92126f6d9a3080472d9bf71760 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Network/ProxyManager.ets | arkts | getConfig | 获取当前代理配置 | getConfig(): ProxyConfig {
return this.copyProxyConfig(this.config);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfig 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 ProxyConfig AST#identifier#Right AST#ERROR#Right AST... | getConfig(): ProxyConfig {
return this.copyProxyConfig(this.config);
} | https://github.com/DaLongZhuaZi/manxia | a0885d72574c691fff29b96f482768722e70fe1c | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/BaseEventUtil.ets | arkts | emit | 发布事件
@param eventName 事件名称
@param data 事件数据 | emit(eventName: string, data: T): void {
const listeners = this.dataEvents.get(eventName)
if (!listeners || listeners.length === 0) {
return
}
const listenersToExecute = [...listeners]
listenersToExecute.forEach(listener => {
try {
(listener.callback as EventCallback<T>)(data... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left emit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Right A... | emit(eventName: string, data: T): void {
const listeners = this.dataEvents.get(eventName)
if (!listeners || listeners.length === 0) {
return
}
const listenersToExecute = [...listeners]
listenersToExecute.forEach(listener => {
try {
(listener.callback as EventCallback<T>)(data... | https://github.com/Yebingiscn/SweetVideo | 2ab0069835273bb3b6887422fe44edffec77a797 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/AppNav.ets | arkts | currentTab | 根据当前主路由反查选中标签。 | currentTab(): AppTab {
if (this.mainRouteName === AppRoute.TODO) {
return AppTab.TODO;
}
if (this.mainRouteName === AppRoute.IDEA) {
return AppTab.IDEA;
}
if (this.mainRouteName === AppRoute.USER) {
return AppTab.USER;
}
return AppTab.PLAN;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left currentTab 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 AppTab AST#identifier#Right AST#ERROR#Right AST#sta... | currentTab(): AppTab {
if (this.mainRouteName === AppRoute.TODO) {
return AppTab.TODO;
}
if (this.mainRouteName === AppRoute.IDEA) {
return AppTab.IDEA;
}
if (this.mainRouteName === AppRoute.USER) {
return AppTab.USER;
}
return AppTab.PLAN;
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L105-L116 | be49b0466b7e20d4cde8827e489913c973e43580 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | setBigUint64 | Sets an unsigned long.
@param byteOffset The byte offset.
@param value The value.
@param littleEndian If the value is little endian. | setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void {
this.dataView?.setBigUint64(byteOffset, value, littleEndian)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBigUint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void {
this.dataView?.setBigUint64(byteOffset, value, littleEndian)
} | https://gitee.com/openharmony-sig/flutter_engine.git | 355abba7d99a9a3ed51ca5158db82fecf168584e | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/IconUtils.ets | arkts | getAllIcons | 获取所有图标
@returns 所有图标的ID和资源路径 | public static getAllIcons(onlyCustom?: boolean): Array<IconResource> {
onlyCustom = onlyCustom || false;
const icons: Array<IconResource> = [];
// 遍历所有系统图标ID
if (!onlyCustom) {
for (let i = 0; i <= 68; i++) {
icons.push({
id: i,
resource: IconUtils.getIconResourcePath... | 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 getAllIcons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left onlyCustom AST#identifier#Right AST#ERROR#Left AST#?#Left ... | public static getAllIcons(onlyCustom?: boolean): Array<IconResource> {
onlyCustom = onlyCustom || false;
const icons: Array<IconResource> = [];
// 遍历所有系统图标ID
if (!onlyCustom) {
for (let i = 0; i <= 68; i++) {
icons.push({
id: i,
resource: IconUtils.getIconResourcePath... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/IconUtils.ets#L250-L279 | 57c90a4328f78be29f973be42e6bcfeb45f7c550 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/InteractionManager.ets | arkts | setVibrationIntensity | 设置震动强度 | public async setVibrationIntensity(intensity: VibrationIntensity): Promise<void> {
this.settings.vibrationIntensity = intensity;
await this.saveSettings();
} | 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 setVibrationIntensity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left intensity AST#identifier#Right AST... | public async setVibrationIntensity(intensity: VibrationIntensity): Promise<void> {
this.settings.vibrationIntensity = intensity;
await this.saveSettings();
} | https://github.com/DaLongZhuaZi/manxia | 23545854101a6105c67433bb9eadd15c009119f2 | github |
openharmony-tpc/openharmony_tpc_samples | LibphoneNumber/entry/src/main/ets/util/Log.ets | arkts | showError | print error level log
@param {string} log - Log needs to be printed | static showError(log: string, ...ms: string[]) {
console.error(log, ms);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static showError(log: string, ...ms: string[]) {
console.error(log, ms);
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 93403fb82763966ca59ca14d35a0887934d4ca0f | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | getLoginUi | 获取登录UI配置 | getLoginUi(source: LegadoBookSource): LoginUiItem[] {
if (!source.loginUi) {
// 默认登录UI
return [
{ type: 'text', name: 'username', hint: '用户名' },
{ type: 'password', name: 'password', hint: '密码' },
{ type: 'button', name: 'login', hint: '登录', action: 'login(true)' }
];
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLoginUi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LegadoBookSource AST#identifier#Right AST#)... | getLoginUi(source: LegadoBookSource): LoginUiItem[] {
if (!source.loginUi) {
// 默认登录UI
return [
{ type: 'text', name: 'username', hint: '用户名' },
{ type: 'password', name: 'password', hint: '密码' },
{ type: 'button', name: 'login', hint: '登录', action: 'login(true)' }
];
... | https://github.com/DaLongZhuaZi/manxia | 8c1ea59c9d16e36d2b8e56a3ddfbdfbc294318cb | github |
HarmonyOS_Samples/component-collection | entry/src/main/ets/pages/components/textAndInput/richTextSample/RichTextSample.ets | arkts | leftTitleStyle | Inorder to better reflect the rich text effect, this constant content includes Chinese characters | @Extend(Text)
function leftTitleStyle() {
.fontColor($r('app.color.sub_title_color'))
.fontSize(14)
.height(22)
.alignSelf(ItemAlign.Start)
.margin({ left: 12, top: 12 })
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function leftTitleStyle() {
.fontColor($r('app.color.sub_title_color'))
.fontSize(14)
.height(22)
.alignSelf(ItemAlign.Start)
.margin({ left: 12, top: 12 })
} | https://gitcode.com/HarmonyOS_Samples/component-collection | 28e51bf92b4c6babc3173e2d1142e43c4796a246 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/NdsRomCache.ets | arkts | megabytes | 创建 MB 单位 | static megabytes(value: number): SizeUnit {
return new SizeUnit(value * 1024 * 1024);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left megabytes 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 numbe... | static megabytes(value: number): SizeUnit {
return new SizeUnit(value * 1024 * 1024);
} | https://github.com/richshaw2015/nds | 06737555f360c0f0c3a0aac69e649a47e8677855 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | setInterceptor | 添加拦截器,可设置多次
@deprecated
@param interceptor
@param stackName | public static setInterceptor<T extends IInterceptor>(interceptor: T, stackName: string = DEFAULT_STACK_NAME) {
ZRouter.getRouterMgr().setInterceptor<T>(interceptor, stackName)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left setInterceptor AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#type... | public static setInterceptor<T extends IInterceptor>(interceptor: T, stackName: string = DEFAULT_STACK_NAME) {
ZRouter.getRouterMgr().setInterceptor<T>(interceptor, stackName)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L289-L291 | 0e2934a667da30fd37afd752d205c5778a16c417 | github |
yuyu5333/Healthy_life | entry/src/main/ets/view/home/TaskCardComponent.ets | arkts | build | 首页的任务列表 | build() {
Row() {
Column() {
Column() {
Row({ space: Const.DEFAULT_6 }) {
// 首页的任务列表的小卡片的字体、图标
Image(TaskMapById[this.taskInfo.taskID - 1].icon)
.width($r('app.float.default_36')).height($r('app.float.default_36'))
.objectFit(ImageFit.Contain)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Row() {
Column() {
Column() {
Row({ space: Const.DEFAULT_6 }) {
// 首页的任务列表的小卡片的字体、图标
Image(TaskMapById[this.taskInfo.taskID - 1].icon)
.width($r('app.float.default_36')).height($r('app.float.default_36'))
.objectFit(ImageFit.Contain)
... | https://github.com/yuyu5333/Healthy_life | 754df8a4351b06f57c299896ce76578034b52fb1 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/videorecorder/components/VideoRecorder.ets | arkts | takePhoto | Launch camera for photo capture only | async takePhoto(
config: TakePhotoConfig = {},
listener: RecordListener,
context?: common.UIAbilityContext
): Promise<void> {
const takeVideoConfig: TakeVideoConfig = {
recordMode: RecordMode.PHOTO_ONLY,
primaryColor: config.primaryColor,
defaultFrontCamera: config.defaultFrontCame... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left takePhoto AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async takePhoto(
config: TakePhotoConfig = {},
listener: RecordListener,
context?: common.UIAbilityContext
): Promise<void> {
const takeVideoConfig: TakeVideoConfig = {
recordMode: RecordMode.PHOTO_ONLY,
primaryColor: config.primaryColor,
defaultFrontCamera: config.defaultFrontCame... | https://github.com/Tencent-RTC/TUIKit_Harmony | 5d84d9a8d13b82e2887c4fb7a105a9bbac79b123 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/subtraction/subtraction_short.ets | arkts | main | ---
desc: check subtraction of two short integers
--- | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a - b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a - b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d67e0a70ee1bb69373f52ff5256cf7bf4fb35309 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets | arkts | setFloatingBallCallback | 设置悬浮球更新回调 | public setFloatingBallCallback(callback: FloatingBallUpdateCallback | null): void {
this.floatingBallUpdateCallback = callback;
if (callback) {
callback(this.getActiveTasks());
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFloatingBallCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#bina... | public setFloatingBallCallback(callback: FloatingBallUpdateCallback | null): void {
this.floatingBallUpdateCallback = callback;
if (callback) {
callback(this.getActiveTasks());
}
} | https://github.com/DaLongZhuaZi/manxia | 269d00b3b2a9b663a8a3fa62ba73598d80b9a79f | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | exportSettings | 导出设置到文件
Requirements: 1.11, 1.12
@param fileUri 导出文件的 URI
@returns 操作结果 | public async exportSettings(fileUri: string): Promise<SettingsResult<void>> {
try {
// 构建导出数据结构
const exportData: SettingsExportData = {
magic: SettingsManager.EXPORT_MAGIC,
version: SettingsManager.EXPORT_VERSION,
schemaVersion: CURRENT_SCHEMA_VERSION,
exportTime: Date... | 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 exportSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileUri AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public async exportSettings(fileUri: string): Promise<SettingsResult<void>> {
try {
// 构建导出数据结构
const exportData: SettingsExportData = {
magic: SettingsManager.EXPORT_MAGIC,
version: SettingsManager.EXPORT_VERSION,
schemaVersion: CURRENT_SCHEMA_VERSION,
exportTime: Date... | https://github.com/richshaw2015/nds | a2e4408173a254dace9b9235726aa2ccb55c9641 | github |
chenchl/GMLogger-HarmonyOS | gmlogger/src/main/ets/components/security/logger/Logger.ets | arkts | warn | 记录警告级别的日志。
@param message - 要记录的消息内容,可以是字符串或对象。
@param tag - 可选的日志标签,用于标识日志的来源或类别。 | warn(message: string | object, tag?: string) {
this.logLevel(hilog.LogLevel.WARN, tag, message)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left warn 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#Left AST#identifier#Left string... | warn(message: string | object, tag?: string) {
this.logLevel(hilog.LogLevel.WARN, tag, message)
} | https://github.com/chenchl/GMLogger-HarmonyOS | 682b429a436da622cf4807898cf193c4293f147e | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AnomalyDetection.ets | arkts | calculateSeverity | 计算严重程度 | static calculateSeverity(score: number): string {
if (score < 2) {
return '';
}
if (score < 3) {
return SEVERITY_LOW;
}
if (score < 4) {
return SEVERITY_MEDIUM;
}
if (score < 5) {
return SEVERITY_HIGH;
}
return SEVERITY_CRITICAL;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateSeverity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left score AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static calculateSeverity(score: number): string {
if (score < 2) {
return '';
}
if (score < 3) {
return SEVERITY_LOW;
}
if (score < 4) {
return SEVERITY_MEDIUM;
}
if (score < 5) {
return SEVERITY_HIGH;
}
return SEVERITY_CRITICAL;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3e29b89a5a1dcf61d954de1bf25e62718473590b | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | setPlayOptions | 用于设置播放选项。
@param options - 播放选项对象。 | setPlayOptions(options: EFPlayOptions = {}) {
// this.efPlayOptions = options;
if (options.immediately !== undefined) {
this.efPlayOptions.immediately = options.immediately
}
if (options.loop !== undefined) {
this.efPlayOptions.loop = options.loop
this.loop = options.loop
}
i... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPlayOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifi... | setPlayOptions(options: EFPlayOptions = {}) {
// this.efPlayOptions = options;
if (options.immediately !== undefined) {
this.efPlayOptions.immediately = options.immediately
}
if (options.loop !== undefined) {
this.efPlayOptions.loop = options.loop
this.loop = options.loop
}
i... | https://github.com/yangyongzhen/hmmovie | ecd98c9b8b31d0aaccc35b8f01ca437a39da153d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | handleGCButton2313Action | 处理 2313 兼容键自定义动作
@returns true 如果动作已处理(不需要发送按键),false 如果需要正常发送按键 | private handleGCButton2313Action(): boolean {
switch (this.gcButton2313Action) {
case 'toggle_mouse':
this.toggleMouseEmulation();
this.gcButton2313ActionCallback?.onToggleMouse?.();
return true;
case 'toggle_perf':
this.gcButton2313ActionCallback?.onTogglePerf?.();
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleGCButton2313Action 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#Le... | private handleGCButton2313Action(): boolean {
switch (this.gcButton2313Action) {
case 'toggle_mouse':
this.toggleMouseEmulation();
this.gcButton2313ActionCallback?.onToggleMouse?.();
return true;
case 'toggle_perf':
this.gcButton2313ActionCallback?.onTogglePerf?.();
... | https://github.com/AlkaidLab/moonlight-harmony | afedf34d67405feb796644112c356241a8f04445 | github |
openharmony/applications_settings | product/phone/src/main/ets/pages/passwordCheck.ets | arkts | getRouterParam | Get the params from router | getRouterParam() {
let param = Router.getParams();
if (!param) {
return;
}
this.pageRequestCode = param.pageRequestCode as number;
this.prevPageUri = param.prevPageUri as string;
this.pinChallenge = param.pinChallenge as string;
this.passwordType = param.passwordType as number;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRouterParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | getRouterParam() {
let param = Router.getParams();
if (!param) {
return;
}
this.pageRequestCode = param.pageRequestCode as number;
this.prevPageUri = param.prevPageUri as string;
this.pinChallenge = param.pinChallenge as string;
this.passwordType = param.passwordType as number;
} | https://gitee.com/openharmony/applications_settings.git | c747e647c4181b70f787217df6f3cb77a084942b | gitee |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | isEmpty | 购物车是否为空
@returns {boolean} 是否为空 | get isEmpty(): boolean {
return this.cartList.length === 0;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right ... | get isEmpty(): boolean {
return this.cartList.length === 0;
} | https://github.com/Joker-x-dev/CoolMallArkTS | eaf1309fe9d075d6af99a5b045a960a32435c672 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | isHoldActive | 是否处于激活状态 | isHoldActive(): boolean {
return this.holdActive;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isHoldActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem... | isHoldActive(): boolean {
return this.holdActive;
} | https://github.com/AlkaidLab/moonlight-harmony | 15376108384904cf6cdcadf36d64e757fc154caf | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/BiometricAccessUtil.ets | arkts | checkUserAuthSupport | 5.查询认证能力是否支持 | static checkUserAuthSupport() {
if (canIUse('SystemCapability.UserIAM.UserAuth.Core')) {
BiometricAccessUtil.authType = [userAuth.UserAuthType.PIN, // PIN密码(模拟器支持)
userAuth.UserAuthType.FINGERPRINT, // 指纹
userAuth.UserAuthType.FACE// 面容ID
]
BiometricAccessUtil.authTrustLevel = us... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkUserAuthSupport 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#{... | static checkUserAuthSupport() {
if (canIUse('SystemCapability.UserIAM.UserAuth.Core')) {
BiometricAccessUtil.authType = [userAuth.UserAuthType.PIN, // PIN密码(模拟器支持)
userAuth.UserAuthType.FINGERPRINT, // 指纹
userAuth.UserAuthType.FACE// 面容ID
]
BiometricAccessUtil.authTrustLevel = us... | https://github.com/Yebingiscn/SweetVideo | 9be8f582d43d862b069968629387b4954bce3872 | github |
HarmonyOS_Samples/guide-snippets | ArkData/DataObject/CrossDeviceCollaboration/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets | arkts | getRemoteDeviceId | 获取可信组网中的设备 | function getRemoteDeviceId() {
let deviceId = '';
try {
let deviceManager = distributedDeviceManager.createDeviceManager('com.example.collaboration');
let devices = deviceManager.getAvailableDeviceListSync();
if (devices[0] && devices[0].networkId) {
deviceId = devices[0].networkId;
}
} catc... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getRemoteDeviceId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_d... | function getRemoteDeviceId() {
let deviceId = '';
try {
let deviceManager = distributedDeviceManager.createDeviceManager('com.example.collaboration');
let devices = deviceManager.getAvailableDeviceListSync();
if (devices[0] && devices[0].networkId) {
deviceId = devices[0].networkId;
}
} catc... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 5619a97770fbec8b9f3e833d0a78311fc1d25fc1 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceManager.ets | arkts | getPinnedSourceIds | 获取置顶图源ID列表 | async getPinnedSourceIds(): Promise<number[]> {
return await this.dataManager.getSourcePinnedList();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPinnedSourceIds AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g... | async getPinnedSourceIds(): Promise<number[]> {
return await this.dataManager.getSourcePinnedList();
} | https://github.com/DaLongZhuaZi/manxia | 6711899ff35da35b627d28a022b08d6dd3d92ffd | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets | arkts | receiveTabFromMyAppTunnel | Receives a tabInfo from the dedicated MyApp tunnel
and moves it from its original window to here. | receiveTabFromMyAppTunnel() {
const tabInfo = getCreateMyApp().dataTunnelForTabs;
if (!tabInfo) {
meow(`No tab info`, 'meowTabsBunch][receiveTabFromMyAppTunnel', meowLevel.WARN);
return;
}
meow(`Received tab info from MyApp tunnel`, 'meowTabsBunch][receiveTabFromMyAppTunnel', meowLevel.WA... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left receiveTabFromMyAppTunnel 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#statemen... | receiveTabFromMyAppTunnel() {
const tabInfo = getCreateMyApp().dataTunnelForTabs;
if (!tabInfo) {
meow(`No tab info`, 'meowTabsBunch][receiveTabFromMyAppTunnel', meowLevel.WARN);
return;
}
meow(`Received tab info from MyApp tunnel`, 'meowTabsBunch][receiveTabFromMyAppTunnel', meowLevel.WA... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 8e3a5d92b1cb97a570457fb3cada7cbe49b68be7 | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F003_list_rendering/entry/src/main/ets/utils/MockData.ets | arkts | generateLargeDataset | 生成大量数据用于性能测试 | static generateLargeDataset(count: number): LargeDataItem[] {
const data: LargeDataItem[] = [];
for (let i = 0; i < count; i++) {
data.push({
id: `item_${i}`,
title: `标题 ${i + 1}`,
subtitle: `这是第 ${i + 1} 条数据的副标题`,
value: Math.floor(Math.random() * 1000),
timestam... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateLargeDataset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static generateLargeDataset(count: number): LargeDataItem[] {
const data: LargeDataItem[] = [];
for (let i = 0; i < count; i++) {
data.push({
id: `item_${i}`,
title: `标题 ${i + 1}`,
subtitle: `这是第 ${i + 1} 条数据的副标题`,
value: Math.floor(Math.random() * 1000),
timestam... | https://github.com/mqxu/HarmonyOS_In_Action | b1f399bfab5be80c84f579af06862b59fb2e9c02 | github |
StarHeartY/CalculatorX | entry/src/main/ets/components/ScientificCalc.ets | arkts | onShiftChange | @Watch 监听器 | onShiftChange() {
getContext(this).eventHub.emit('event_shift_change', this.isShift);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onShiftChange 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... | onShiftChange() {
getContext(this).eventHub.emit('event_shift_change', this.isShift);
} | https://github.com/StarHeartY/CalculatorX | 535b566f8d37a7f71aec15292cce057d63707da6 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/viewmodel/DiffSessionViewModel.ets | arkts | canRedo | 判断当前是否有可重做的操作 | get canRedo(): boolean {
return this.redoStack.length > 0;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left canRedo 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 ... | get canRedo(): boolean {
return this.redoStack.length > 0;
} | https://github.com/XJTUWYD/ArkDiff | 0d157a69672155cb25e15d34cc81f860774257a7 | github |
openharmony-tpc/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | setMaxRequests | 设置taskpool默认并发数量
@param concurrency 默认并发数量,默认为8 | setMaxRequests(concurrency: number): void {
this.dispatcher.setMaxRequests(concurrency)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMaxRequests AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left concurrency AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A... | setMaxRequests(concurrency: number): void {
this.dispatcher.setMaxRequests(concurrency)
} | https://gitee.com/openharmony-tpc/ImageKnife.git | f662bd2bfcef9b515e6520177c3d9536515148f1 | gitee |
cduestc-course/ArkLearn | entry/src/main/ets/pages/03/3.2.1.ets | arkts | build | 先构思,后布局 | build(){
Column(){
Text('小说简介')
.width('100%')
.height(40)
.fontSize(20)
.fontWeight(FontWeight.Bolder)
Row(){
Text('都市')
.width(50)
.height(30)
.backgroundColor(Color.Orange)//"#ffffff"->"1111111111"
Text('生活')
.w... | 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(){
Column(){
Text('小说简介')
.width('100%')
.height(40)
.fontSize(20)
.fontWeight(FontWeight.Bolder)
Row(){
Text('都市')
.width(50)
.height(30)
.backgroundColor(Color.Orange)//"#ffffff"->"1111111111"
Text('生活')
.w... | https://github.com/cduestc-course/ArkLearn | 269512f20e959f6b9a8454e1cc51cba2a8ef62e7 | github |
openharmony/codelabs | ETSUI/ChatAppDemo/entry/src/main/ets/pages/NewFriends.ets | arkts | onPageShow | 页面每次显示时都刷新列表(比 aboutToAppear 更稳妥,因为从添加页返回时也需要刷新) | onPageShow() {
this.loadRequests();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
this.loadRequests();
} | https://gitcode.com/openharmony/codelabs | e046c172aed7cd96e960e4fe46eae81380fd5c3b | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/dialogs/settings/WoofCookies/WoofCookies.ets | arkts | search | Search! | search() {
webview.WebCookieManager.fetchCookie(this.searchKey)
.then((cookies) => {
if (isBlank(cookies)) {
this.cookies = [];
} else {
this.cookies = cookies.split(' ');
}
meow(`webview.WebCookieManager.fetchCookie("${this.searchKey}") succeeded: ${cooki... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#... | search() {
webview.WebCookieManager.fetchCookie(this.searchKey)
.then((cookies) => {
if (isBlank(cookies)) {
this.cookies = [];
} else {
this.cookies = cookies.split(' ');
}
meow(`webview.WebCookieManager.fetchCookie("${this.searchKey}") succeeded: ${cooki... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 8468872801541771c1a7e360b6837733026ae638 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/AppViewModel.ets | arkts | filteredCount | 获取过滤后的数量 | get filteredCount(): number {
return this.filteredApps.length;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left filteredCount 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#Rig... | get filteredCount(): number {
return this.filteredApps.length;
} | https://github.com/AlkaidLab/moonlight-harmony | 6ee61235b4d42aaeb546b4cfa70bce625241c79e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TouchInputHandler.ets | arkts | setCoordinateTransform | 设置坐标变换函数(用于画面缩放/平移状态下的坐标修正)
传入 null 清除变换 | setCoordinateTransform(transform: ((x: number, y: number) => PointXY) | null): void {
this.coordinateTransform = transform;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCoordinateTransform AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left transform AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Ri... | setCoordinateTransform(transform: ((x: number, y: number) => PointXY) | null): void {
this.coordinateTransform = transform;
} | https://github.com/AlkaidLab/moonlight-harmony | 91414c1fe314e2411bf4ae733de09fedd2bf29c3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts ints array to JSON format
@param d: FixedArray<int> - ints array to be converted to a JSON as an Array of Numbers
@returns String - JSON representation of ints array | public static stringify(d: FixedArray<int>): String {
let s = new StringBuilder('[')
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(d[i])
s.append(',')
}
if (d.length > 0) {
s.append(d[last_elem])
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: FixedArray<int>): String {
let s = new StringBuilder('[')
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(d[i])
s.append(',')
}
if (d.length > 0) {
s.append(d[last_elem])
}
... | https://gitcode.com/iop123123/arkts-static-skills | 8cb59211ee976b1031a06d6abb6580028cc41b43 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/SimpleCalculator/entry/src/main/ets/common/util/CalculateUtil.ets | arkts | containScientificNotation | Whether the operand contains scientific notation
@param arg Number.
@return Whether scientific notation is included | containScientificNotation(arg: string) {
return (arg.indexOf(CommonConstants.E) !== -1);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left containScientificNotation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#ident... | containScientificNotation(arg: string) {
return (arg.indexOf(CommonConstants.E) !== -1);
} | https://gitee.com/harmonyos/codelabs.git | 469375ad3b73734b23845d4147870e00c0693a01 | gitee |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGManager.ets | arkts | _writeFile | 向path写入content数据,覆盖旧数据
@param path 文件路径
@param content 文件内容 | private _writeFile(path: string, content: ArrayBuffer | string): void{
try {
let fd = fileio.openSync(path, 0o102, 0o666);
fileio.ftruncateSync(fd);
fileio.writeSync(fd, content);
fileio.fsyncSync(fd);
fileio.closeSync(fd);
} catch (e) {
consoleInfo('SVGManager writeFile ',... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _writeFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | private _writeFile(path: string, content: ArrayBuffer | string): void{
try {
let fd = fileio.openSync(path, 0o102, 0o666);
fileio.ftruncateSync(fd);
fileio.writeSync(fd, content);
fileio.fsyncSync(fd);
fileio.closeSync(fd);
} catch (e) {
consoleInfo('SVGManager writeFile ',... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 29f8756e2af28f529617fd9ede55f5c5b8596b00 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ReportGenerator.ets | arkts | formatDuration | 格式化时长
@param ms 毫秒数
@returns 格式化字符串 | private formatDuration(ms: number): string {
if (ms < 1000) {
return `${ms}ms`;
} else if (ms < 60000) {
return `${(ms / 1000).toFixed(2)}s`;
} else {
const minutes = Math.floor(ms / 60000);
const seconds = ((ms % 60000) / 1000).toFixed(2);
return `${minutes}m ${seconds}s`;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private formatDuration(ms: number): string {
if (ms < 1000) {
return `${ms}ms`;
} else if (ms < 60000) {
return `${(ms / 1000).toFixed(2)}s`;
} else {
const minutes = Math.floor(ms / 60000);
const seconds = ((ms % 60000) / 1000).toFixed(2);
return `${minutes}m ${seconds}s`;
... | https://github.com/LJ666-ui/harmony-health-care | a153510b9a3213c6b2fe4d5a2ef7a5f72043771b | github |
openharmony-sig/ohos_circle_indicator | library/src/main/ets/components/TitleIndicator.ets | arkts | refreshOffsetForFling | 通过定时更新index, 补全松手后indicator区域的fling动画 | refreshOffsetForFling(originalIndex: number, originalOffset:number, nextIndex: number) {
if (nextIndex === originalIndex) {
if (Math.abs(originalOffset) <= FLING_OFFSET_PER_FRAME) {
this.originalOffset = 0
clearTimeout(this.timeoutId)
} else {
this.originalOffset = ((Math.abs(t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshOffsetForFling AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ER... | refreshOffsetForFling(originalIndex: number, originalOffset:number, nextIndex: number) {
if (nextIndex === originalIndex) {
if (Math.abs(originalOffset) <= FLING_OFFSET_PER_FRAME) {
this.originalOffset = 0
clearTimeout(this.timeoutId)
} else {
this.originalOffset = ((Math.abs(t... | https://gitee.com/openharmony-sig/ohos_circle_indicator.git | 5edf2958dba228fd92caa312ef10c4d5e2917402 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/06.conversions_and_contexts/02.assignment_contexts/identity.ets | arkts | main | ---
desc: Assignment contexts allow the use of the identity conversion.
--- | function main(): int {
{%- for t in case['types'] %}
let src_{{loop.index}}: {{t.type}} = {{t.expr|safe}};
let dst_{{loop.index}}: {{t.type}} = src_{{loop.index}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left i... | function main(): int {
{%- for t in case['types'] %}
let src_{{loop.index}}: {{t.type}} = {{t.expr|safe}};
let dst_{{loop.index}}: {{t.type}} = src_{{loop.index}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f716406400b467f8479a9d6a4c81e71ea1c885c5 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | resetZoom | Zooms out to original size.
@param outputMatrix | public resetZoom(outputMatrix: Matrix): void {
outputMatrix.reset();
outputMatrix.set(this.mMatrixTouch);
outputMatrix.postScale(1.0, 1.0, 0.0, 0.0);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetZoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left outputMatrix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Matrix AST#ide... | public resetZoom(outputMatrix: Matrix): void {
outputMatrix.reset();
outputMatrix.set(this.mMatrixTouch);
outputMatrix.postScale(1.0, 1.0, 0.0, 0.0);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 32a696942b5fc84307f5cbf810c8fd8122b47b7c | gitee |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/pages/AccountInputPage.ets | arkts | checkStrength | 【新增】核心算法:检测密码强度 | checkStrength(pwd: string) {
if (pwd.length === 0) {
this.strengthLevel = 0;
this.strengthText = '';
return;
}
// 1. 强制拦截:不足8位直接由 UI 处理(红字提示),这里设为最低级
if (pwd.length < 8) {
this.strengthLevel = 1;
this.strengthColor = Color.Red;
this.strengthText = '密码太短 (需至少8位)';
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkStrength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pwd AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ... | checkStrength(pwd: string) {
if (pwd.length === 0) {
this.strengthLevel = 0;
this.strengthText = '';
return;
}
// 1. 强制拦截:不足8位直接由 UI 处理(红字提示),这里设为最低级
if (pwd.length < 8) {
this.strengthLevel = 1;
this.strengthColor = Color.Red;
this.strengthText = '密码太短 (需至少8位)';
... | https://gitcode.com/openharmony/codelabs | 2e8ad7383faee01366aaa5221bc8a7d18d256212 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | mul | Performs floating point multiplication of this instance with provided one, returns the result as new instance
@param other Right hand side of the multiplication
@returns Result of the multiplication | public mul(other: Float): Float {
return new Float((this.value * other.toFloat()) as float)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public mul(other: Float): Float {
return new Float((this.value * other.toFloat()) as float)
} | https://gitcode.com/iop123123/arkts-static-skills | 92f8d9ec72331c1244f42a44ac44dc00bcc7438e | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets | arkts | prevMonth | 切换到上个月 | prevMonth() {
this.currentDate = new Date(this.currentYear, this.currentMonth - 1, 1)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left prevMonth 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 AST... | prevMonth() {
this.currentDate = new Date(this.currentYear, this.currentMonth - 1, 1)
} | https://gitcode.com/openharmony/codelabs | 3af2febc94f1f6ec0ae9b65f574dd0c44cc1a535 | gitcode |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/HistoryManager.ets | arkts | saveAdvancedHistory | 保存高级评估器历史记录 | static async saveAdvancedHistory(context: Context, item: AdvancedHistoryItem): Promise<void> {
try {
const prefs = await HistoryManager.getPreferences(context);
// 读取现有历史记录
const historyStr = await prefs.get(HistoryManager.ADVANCED_HISTORY_KEY, '[]') as string;
let history: Advanced... | 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 saveAdvancedHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L... | static async saveAdvancedHistory(context: Context, item: AdvancedHistoryItem): Promise<void> {
try {
const prefs = await HistoryManager.getPreferences(context);
// 读取现有历史记录
const historyStr = await prefs.get(HistoryManager.ADVANCED_HISTORY_KEY, '[]') as string;
let history: Advanced... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 8f53fb7ef4a78454f408c27ea8086e01335b9551 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | suggestCategoryId | 根据票据类型推荐分类ID | static suggestCategoryId(receiptType: string): CategorySuggestion {
if (receiptType === RECEIPT_TYPE_SUPERMARKET) {
const result: CategorySuggestion = { categoryId: 1, categoryName: '日常购物' };
return result;
} else if (receiptType === RECEIPT_TYPE_RESTAURANT) {
const result: CategorySuggestio... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left suggestCategoryId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left receiptType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | static suggestCategoryId(receiptType: string): CategorySuggestion {
if (receiptType === RECEIPT_TYPE_SUPERMARKET) {
const result: CategorySuggestion = { categoryId: 1, categoryName: '日常购物' };
return result;
} else if (receiptType === RECEIPT_TYPE_RESTAURANT) {
const result: CategorySuggestio... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 2a088b3b32a2686e6f5840a40e9def49f5481924 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | getTask | 获取单个任务 | public getTask(taskId: string): UnifiedDownloadTask | undefined {
return this.unifiedTasks.get(taskId);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | public getTask(taskId: string): UnifiedDownloadTask | undefined {
return this.unifiedTasks.get(taskId);
} | https://github.com/DaLongZhuaZi/manxia | dad31055ea568b42a1e2c8a719f0d3494e7d626f | github |
arkui-x/samples | CodeLab/Cases/common/routermodule/src/main/ets/router/DynamicsRouter.ets | arkts | pushUri | 根据路由信息跳转到对应的页面 | public static pushUri(name: string, param?: ESObject) {
// 如果路由表中没有该路由信息,直接中断执行
if (!DynamicsRouter.routerMap.has(name)) {
return;
}
// 根据路由名获取路由信息
let routerInfo: AppRouterInfo = DynamicsRouter.routerMap.get(name)!;
// 如果是第一次跳转,则需要动态引入模块
if (!DynamicsRouter.builderMap.has(name)) {
... | 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 pushUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Ri... | public static pushUri(name: string, param?: ESObject) {
// 如果路由表中没有该路由信息,直接中断执行
if (!DynamicsRouter.routerMap.has(name)) {
return;
}
// 根据路由名获取路由信息
let routerInfo: AppRouterInfo = DynamicsRouter.routerMap.get(name)!;
// 如果是第一次跳转,则需要动态引入模块
if (!DynamicsRouter.builderMap.has(name)) {
... | https://gitcode.com/arkui-x/samples | e82b0654c80732a6b3ed08d92b084c7480d51911 | gitcode |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityUsage/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | [EndExclude onWindowStageCreate] | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
windowStage.loadContent('pages/Index', (err) => {
// [StartExclude onWindowStageCreate]
if (err.code) {
hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: ... | 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
windowStage.loadContent('pages/Index', (err) => {
// [StartExclude onWindowStageCreate]
if (err.code) {
hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: ... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 741b3df6c517d80232ebb6d6050bc381034851fe | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/HttpService.ets | arkts | registerCancelable | 注册任意可取消任务(如 RCP session.cancel(request)) | registerCancelable(task: CancelableTask): string {
if (this.cancelled) {
try {
task()
} catch (_error) {}
return ''
}
this.seq += 1
const cancelId = `cancel_${Date.now()}_${this.seq}`
this.cancelableMap.set(cancelId, task)
return cancelId
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerCancelable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CancelableTask AST#identifier#Right A... | registerCancelable(task: CancelableTask): string {
if (this.cancelled) {
try {
task()
} catch (_error) {}
return ''
}
this.seq += 1
const cancelId = `cancel_${Date.now()}_${this.seq}`
this.cancelableMap.set(cancelId, task)
return cancelId
} | https://github.com/LongLiveY96/chatcube | 77aaf579f58abde5522c61ca6ef9e7599bedc544 | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | searchWords | 模糊搜索单词(大小写不敏感)
@param query 搜索关键词
@param limit 返回结果数量限制
@returns 匹配的单词列表 | async searchWords(query: string, limit: number = 10): Promise<WordItem[]> {
this.ensureInitialized();
const queryLower = query.toLowerCase();
// 获取所有单词,然后在应用层进行大小写不敏感的过滤
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.orderByAsc(WordColumns.WORD);
const resultS... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left searchWords AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query ... | async searchWords(query: string, limit: number = 10): Promise<WordItem[]> {
this.ensureInitialized();
const queryLower = query.toLowerCase();
// 获取所有单词,然后在应用层进行大小写不敏感的过滤
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.orderByAsc(WordColumns.WORD);
const resultS... | https://github.com/CLMC2025/Vignette | 40c1de56e437a99ce99d74bdbc50b91c7d4c1052 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | addReadHistory | ==================== 阅读历史管理 ====================
添加阅读历史 | public async addReadHistory(history: ReadHistoryInput): Promise<number> {
try {
const historyData: ReadHistory = {
id: this.generateId(),
comicId: history.comicId,
chapterId: history.chapterId,
pageIndex: history.pageIndex,
userId: history.userId,
readTime: hi... | 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 addReadHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left history AST#identifier#Right AST#:#Left :... | public async addReadHistory(history: ReadHistoryInput): Promise<number> {
try {
const historyData: ReadHistory = {
id: this.generateId(),
comicId: history.comicId,
chapterId: history.chapterId,
pageIndex: history.pageIndex,
userId: history.userId,
readTime: hi... | https://github.com/DaLongZhuaZi/manxia | a3c85bd44ede5f72a762122bb201f8ff4303e0cb | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets | arkts | checkNameNull | Check whether the name is empty. | checkNameNull(): boolean {
if (this.isLoading) {
return false;
}
if (this.homeTabModel.name.trim() === '') {
prompt.showToast({
duration: HomeConstants.DURATION,
message: $r('app.string.place_holder_name')
});
return false;
}
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkNameNull 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#state... | checkNameNull(): boolean {
if (this.isLoading) {
return false;
}
if (this.homeTabModel.name.trim() === '') {
prompt.showToast({
duration: HomeConstants.DURATION,
message: $r('app.string.place_holder_name')
});
return false;
}
return true;
} | https://gitee.com/openharmony/codelabs.git | feae47fefdf24c0855b28830135d5d8b25324279 | gitee |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationListController.ets | arkts | statisticalData | statistical data | statisticalData() {
let that = this;
ConversationListService.getInstance().statisticalData(result => {
if (result.code == common.int.SUCCESS) {
// Total number of lists
that.unreadTotal = result.response.totalListCount;
// Unreading of noti... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left statisticalData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | statisticalData() {
let that = this;
ConversationListService.getInstance().statisticalData(result => {
if (result.code == common.int.SUCCESS) {
// Total number of lists
that.unreadTotal = result.response.totalListCount;
// Unreading of noti... | https://gitee.com/openharmony/applications_mms.git | 62c8877ae1e4ecb059125ea710530eb6c154ae0b | gitee |
openharmony/codelabs | ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets | arkts | addGoal | ==================== 目标模块方法 ==================== | async addGoal(goal: Goal): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
title: goal.title,
description: goal.description || '',
category: goal.category,
priori... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addGoal AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left goal AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async addGoal(goal: Goal): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
title: goal.title,
description: goal.description || '',
category: goal.category,
priori... | https://gitcode.com/openharmony/codelabs | 215a06bfff55e389d3a3e0c85f011460d95a3b5c | gitcode |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/defaultError.ets | arkts | array3 | array element is not readonly | function array3(arg: [string, number]) {} // tuple is not readonly | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left array3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function array3(arg: [string, number]) {} // tuple is not readonly | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 9e4947b5b34137a33cc6695fd42409e3b72ed227 | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/utils/StorageUtils.ets | arkts | getArrayStringValueSync | 适用于普通函数获取
@param key
@param defaultValue
@returns Array<string> | getArrayStringValueSync(key: string, defaultValue: Array<string>) {
return this.preferences?.getSync(key, defaultValue) as Array<string>
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getArrayStringValueSync 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 AST#identif... | getArrayStringValueSync(key: string, defaultValue: Array<string>) {
return this.preferences?.getSync(key, defaultValue) as Array<string>
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 90ef0af5344fd3feaa5b0a0d8c1601505fb75b74 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/AnomalyDetectionService.ets | arkts | updateUserBaseline | 更新用户消费基线 | static async updateUserBaseline(userId: number): Promise<UserSpendingBaseline> {
try {
// 获取最近30天的账单
const endDate = new Date();
const startDate = new Date();
startDate.setDate(startDate.getDate() - 30);
const bills = await BillDAO.getByTimeRange(
userId,
startDate.t... | 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 updateUserBaseline AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef... | static async updateUserBaseline(userId: number): Promise<UserSpendingBaseline> {
try {
// 获取最近30天的账单
const endDate = new Date();
const startDate = new Date();
startDate.setDate(startDate.getDate() - 30);
const bills = await BillDAO.getByTimeRange(
userId,
startDate.t... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3eb12abfc5311da73d55c3be82a60770de39a865 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | createActionContext | 创建操作上下文 | private createActionContext(): ActionContext {
const variables: Record<string, string> = {};
// 从配置中初始化基础变量
if (this.config) {
variables['baseUrl'] = this.config.metadata.baseUrl;
logger.debug(TAG, `初始化baseUrl变量: ${variables['baseUrl']}`);
// [优化] 使用缓存的 parsed config
const ra... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createActionContext 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... | private createActionContext(): ActionContext {
const variables: Record<string, string> = {};
// 从配置中初始化基础变量
if (this.config) {
variables['baseUrl'] = this.config.metadata.baseUrl;
logger.debug(TAG, `初始化baseUrl变量: ${variables['baseUrl']}`);
// [优化] 使用缓存的 parsed config
const ra... | https://github.com/DaLongZhuaZi/manxia | fcad04c78da7ebddbbba0a7f524d9936e5917c6b | github |
somnio-software/my-bot-pal | entry/src/main/ets/features/chat/repository/ChatRepository.ets | arkts | getBotResponseFromApi | Get bot response from API based on conversation history
@param conversation - Array of previous chat messages
@param requestParams - Optional parameters for the request
@returns Promise with array of ChatMessage objects | async getBotResponseFromApi(
conversation: ChatMessage[],
requestParams: ChatRequestParams = {}
): Promise<ChatMessage[]> {
try {
console.log(`[requestBody]:`);
const requestBody = this.createRequestBody(conversation);
const params = this.buildRequestParams(requestParams);
conso... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getBotResponseFromApi AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversation AST#identifier#Right AST#type_annot... | async getBotResponseFromApi(
conversation: ChatMessage[],
requestParams: ChatRequestParams = {}
): Promise<ChatMessage[]> {
try {
console.log(`[requestBody]:`);
const requestBody = this.createRequestBody(conversation);
const params = this.buildRequestParams(requestParams);
conso... | https://github.com/somnio-software/my-bot-pal | 73ef7d27ce8b139694207a5382a160a5eca8eae6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/19.multiplicative_expressions/01.multiplication_operator/inf.ets | arkts | main | ---
desc: Multiplications with INF
params: {{ni.x}} * {{ni.y}} == {{ni.result}}
--- | function main(): void {
let res = {{ni.x}} * {{ni.y}}; | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let res = {{ni.x}} * {{ni.y}}; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 27c158b6bc60c60bbc8d93527c9610ee5a18f268 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toDecimalPlaces | Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces`
decimal places.
@param { double } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive.
@returns { Decimal } the Decimal type | public toDecimalPlaces(decimalPlaces: double): Decimal {
return this.toDecimalPlaces(decimalPlaces, Decimal.rounding);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toDecimalPlaces AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left decimalPlaces AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left double ... | public toDecimalPlaces(decimalPlaces: double): Decimal {
return this.toDecimalPlaces(decimalPlaces, Decimal.rounding);
} | https://gitcode.com/iop123123/arkts-static-skills | 53defdd9940a4db9548bb1d36dc46ae49ad9de67 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | getTokenModelRanking | 获取 Token 消耗模型排行(账本求和,按 model_name 分组,口径同模型调用排行;total_tokens 降序) | async getTokenModelRanking(rangeStartMs: number = 0, limit: number = 10): Promise<TokenModelRankingItem[]> {
await this.waitForInitialization()
const items: TokenModelRankingItem[] = []
if (this.rdbStore === null) {
return items
}
const safeLimit = limit > 0 ? limit : 10
try {
cons... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTokenModelRanking AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rangeStartMs AST#identifier#Right AST#type_annotation#Left... | async getTokenModelRanking(rangeStartMs: number = 0, limit: number = 10): Promise<TokenModelRankingItem[]> {
await this.waitForInitialization()
const items: TokenModelRankingItem[] = []
if (this.rdbStore === null) {
return items
}
const safeLimit = limit > 0 ? limit : 10
try {
cons... | https://github.com/LongLiveY96/chatcube | dfa7cd6b2a329e66937977383db7ce5426f6061f | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnFormViewModel.ets | arkts | submitDynamicForm | 提交动态表单 | submitDynamicForm(): void {
this.dynamicController.validate().then((res): void => {
if (res.valid) {
this.validateResultMsg = "动态表单验证全部通过";
} else {
const labels: Array<string> = res.fields.map((item): string => item.message);
this.validateResultMsg = labels.join("; ");
}... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left submitDynamicForm 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_... | submitDynamicForm(): void {
this.dynamicController.validate().then((res): void => {
if (res.valid) {
this.validateResultMsg = "动态表单验证全部通过";
} else {
const labels: Array<string> = res.fields.map((item): string => item.message);
this.validateResultMsg = labels.join("; ");
}... | https://github.com/codelably/tuniao-ui | ae9c42b39b4613883548002dcd30e080f9ce74ef | github |
honjow/Next2V | shared/src/main/ets/utils/ReplyFingerprint.ets | arkts | matches | True when the two texts describe the same reply. Uses bidirectional containment so a
trailing image placeholder on one side (e.g. notification "…能力了图片" vs reply
"…能力了") still matches on the shared body. Very short fingerprints require equality
to avoid a stray token matching everything. | static matches(a: string, b: string): boolean {
const na = ReplyFingerprint.normalize(a)
const nb = ReplyFingerprint.normalize(b)
if (!na || !nb) {
return false
}
if (
na.length < ReplyFingerprint.MIN_FINGERPRINT_LENGTH ||
nb.length < ReplyFingerprint.MIN_FINGERPRINT_LENGTH
)... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left matches AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#... | static matches(a: string, b: string): boolean {
const na = ReplyFingerprint.normalize(a)
const nb = ReplyFingerprint.normalize(b)
if (!na || !nb) {
return false
}
if (
na.length < ReplyFingerprint.MIN_FINGERPRINT_LENGTH ||
nb.length < ReplyFingerprint.MIN_FINGERPRINT_LENGTH
)... | https://github.com/honjow/Next2V | 82c191b9d4d83e027c51d18e648e4e058ded112e | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets | arkts | updateTotalTime | 更新播放歌曲总时间
@returns {void} | updateTotalTime(): void {
if (!this.curMusicModelRaw) {
return;
}
const totalTime = this.curMusicModelRaw.totalTime;
this.totalTimeStrRaw = this.genTimeStr(totalTime);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateTotalTime 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_bl... | updateTotalTime(): void {
if (!this.curMusicModelRaw) {
return;
}
const totalTime = this.curMusicModelRaw.totalTime;
this.totalTimeStrRaw = this.genTimeStr(totalTime);
} | https://gitcode.com/arkui-x/samples | e431970762ff17b40fb2b4051987f77eb04b9193 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/addition/addition_ubyte.ets | arkts | main | ---
desc: check addition of two unsigned bytes
--- | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{v.right}}
assert (a + b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{v.right}}
assert (a + b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f1f91102a32757195412a0adcf653ffb76f545aa | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.