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 |
|---|---|---|---|---|---|---|---|---|---|---|
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/CategoryRepository.ets | arkts | getCategoryById | 根据 ID 获取分类
@param id 分类 ID
@returns Promise<TaskCategoryData | null> 分类模型或 null | async getCategoryById(id: number): Promise<TaskCategoryData | null> {
try {
const record = await this.dao.queryById(id);
return record ? this.recordToModel(record) : null;
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get category by ID: ${JSON.stringify(err)}`);
return null;
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCategoryById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async getCategoryById(id: number): Promise<TaskCategoryData | null> {
try {
const record = await this.dao.queryById(id);
return record ? this.recordToModel(record) : null;
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get category by ID: ${JSON.stringify(err)}`);
return null;
... | https://github.com/Kira-Yagami-Light/Kira-Projects | 7e7d5b038678eda4312b9327cfedbb5e85163fed | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/DefaultParser.ets | arkts | handleLongOptionWithoutEqual | Handles the following tokens:
--L -L --l -l
@param token the command line token to handle | private handleLongOptionWithoutEqual(token: string): void {
let matchingOpts: JList<string> = this.getMatchingLongOptions(token);
if (matchingOpts.length() == 0) {
this.handleUnknownToken(this.currentToken);
} else if (matchingOpts.length() > 1 && !this.options.hasLongOption(token)) {
throw n... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleLongOptionWithoutEqual AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | private handleLongOptionWithoutEqual(token: string): void {
let matchingOpts: JList<string> = this.getMatchingLongOptions(token);
if (matchingOpts.length() == 0) {
this.handleUnknownToken(this.currentToken);
} else if (matchingOpts.length() > 1 && !this.options.hasLongOption(token)) {
throw n... | https://gitee.com/openharmony-sig/commons-cli.git | 3a7be28d507f8fc45cf9cfdaa06c81d526891fea | gitee |
the-wwyang/kids-learning-app | src/main/ets/common/MathPageStrings.ets | arkts | getUserAnswer | 用户答案显示
@param answer 用户答案
@returns 完整消息 | static getUserAnswer(answer: string): string {
return `${MathPageStrings.YOUR_ANSWER_PREFIX}${answer}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getUserAnswer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left answer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static getUserAnswer(answer: string): string {
return `${MathPageStrings.YOUR_ANSWER_PREFIX}${answer}`;
} | https://github.com/the-wwyang/kids-learning-app | 4df791b5698701b555ad73e2afb6dc6a6a99dd65 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setMaskRect | 弹窗遮蔽层区域,在遮蔽层区域内的事件不透传,在遮蔽层区域外的事件透传。大小不能超过主窗口
@param maskRect
@returns | setMaskRect(maskRect?: Rectangle): Builder {
this.dialogOptions.maskRect = maskRect
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMaskRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left maskRect AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Rectangle AST#i... | setMaskRect(maskRect?: Rectangle): Builder {
this.dialogOptions.maskRect = maskRect
return this
} | https://github.com/wuba/omni-ui | 33eca7daa4cf4fa66d5a99459c1f70750d91f9ca | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/NoteUtil.ets | arkts | autoDeleteNote | Automatically delete notes in the deleted folder more than 30 days
@param allNoteDataArray | autoDeleteNote(allNoteDataArray: NoteData[]) {
for (let index = 0; index < allNoteDataArray.length; ) {
if (allNoteDataArray[index].is_deleted == Delete.Yes && new Date().getTime() - allNoteDataArray[index].deleted_time > StyleConstants.DELETE_DEADLINE) {
LogUtil.info(TAG, "Delete Note, uuid " + all... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left autoDeleteNote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left allNoteDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Right ... | autoDeleteNote(allNoteDataArray: NoteData[]) {
for (let index = 0; index < allNoteDataArray.length; ) {
if (allNoteDataArray[index].is_deleted == Delete.Yes && new Date().getTime() - allNoteDataArray[index].deleted_time > StyleConstants.DELETE_DEADLINE) {
LogUtil.info(TAG, "Delete Note, uuid " + all... | https://gitee.com/openharmony/applications_notes.git | 1c5c71f19958f4ca475fc6cf60d8a7a5a6326d1e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | searchById | 通过ID搜索/获取单个作品
@param illustId 作品ID
@returns 搜索结果(单个作品包装为列表) | async searchById(illustId: string): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法执行ID搜索');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_NOT_LOADED,
'配置未加载'
);
}
const startTime = Date.now();
logger.info(TAG, `开始ID直达搜... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left searchById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left illustId AST#identifier#Right AST#... | async searchById(illustId: string): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法执行ID搜索');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_NOT_LOADED,
'配置未加载'
);
}
const startTime = Date.now();
logger.info(TAG, `开始ID直达搜... | https://github.com/DaLongZhuaZi/manxia | 961de719db785c0bfdd13e2ab69f6a5528ada442 | github |
dingzhilin1990/zhilinclaw | src/agents/AgentBase.ets | arkts | getStatus | 获取 Agent 状态 | public getStatus(): Record<string, any> {
return {
name: this.config.name,
role: this.config.role,
layer: this.config.layer,
isActive: !!this.context
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#i... | public getStatus(): Record<string, any> {
return {
name: this.config.name,
role: this.config.role,
layer: this.config.layer,
isActive: !!this.context
};
} | https://github.com/dingzhilin1990/zhilinclaw | bf061945b8ca630d536f6aba4f7b736767079def | github |
openharmony/applications_contacts | feature/contact/src/main/ets/entity/Contact.ets | arkts | shareContactByType | type:
1: 二维码
2:vCard
3:文本 | shareContactByType(type: number) {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left shareContactByType 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 number AST#identifier#... | shareContactByType(type: number) {
} | https://gitee.com/openharmony/applications_contacts.git | 17e5b38c6796fc487c9361d3ad19a16f12937dcd | gitee |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | isPastePressed | isPastePressed
type类型是否剪切 | public static isPastePressed(value: string, type: string) :boolean {
if (type === 'cut' && value.length > 0) {
return true;
} else {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isPastePressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : ... | public static isPastePressed(value: string, type: string) :boolean {
if (type === 'cut' && value.length > 0) {
return true;
} else {
return false;
}
} | https://gitee.com/openharmony-sig/applications_calculator.git | c0ddba0f0bc3b0637c6512b9c1124355bfec7d4d | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/model/ReminderModel.ets | arkts | initializeDefaultSettings | 初始化默认提醒设置 | private initializeDefaultSettings(): void {
this.settings.set(ReminderType.SPORT_START, {
type: ReminderType.SPORT_START,
enabled: true,
message: '运动即将开始,请做好准备',
soundEnabled: true,
vibrationEnabled: true
});
this.settings.set(ReminderType.SPORT_DURATION, {
type: Remin... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializeDefaultSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | private initializeDefaultSettings(): void {
this.settings.set(ReminderType.SPORT_START, {
type: ReminderType.SPORT_START,
enabled: true,
message: '运动即将开始,请做好准备',
soundEnabled: true,
vibrationEnabled: true
});
this.settings.set(ReminderType.SPORT_DURATION, {
type: Remin... | https://gitcode.com/openharmony/codelabs | 3474547e63af0bfc74cb320b159cad981bf8c14b | gitcode |
LZZLHY/hlib | entry/src/main/ets/api/ZLibraryClient.ets | arkts | getRecently | 近期上传(全站统计,同上不按语言过滤)。
建议使用 `getRecentByLanguage` 替代。 | async getRecently(languages?: string[]): Promise<Book[]> {
const query: QueryParams = {};
if (languages !== undefined && languages.length > 0) {
query['languages'] = languages;
}
const json = await this.http.get<BooksEnvelope>('/eapi/book/recently', query);
ZLibraryClient.assertOk(json);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecently AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left languages AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_an... | async getRecently(languages?: string[]): Promise<Book[]> {
const query: QueryParams = {};
if (languages !== undefined && languages.length > 0) {
query['languages'] = languages;
}
const json = await this.http.get<BooksEnvelope>('/eapi/book/recently', query);
ZLibraryClient.assertOk(json);
... | https://github.com/LZZLHY/hlib | 1e5aa61e51297f8210b23b53c97885c1a8d78027 | github |
apap6628114/nga_oh | entry/src/main/ets/store/AppStore.ets | arkts | unreadNotiCount | ---------- Facade: Notifications ---------- | get unreadNotiCount(): number {
return this.notificationStore.unreadNotiCount
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left unreadNotiCount 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#R... | get unreadNotiCount(): number {
return this.notificationStore.unreadNotiCount
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AppStore.ets#L215-L217 | 0f9f4a8fa32ef47363cc3c87556ec753056ca060 | github |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/view/CustomDialogComponent.ets | arkts | getDeviceTypeIcon | Obtains the device type icon.
@param deviceType Device type.
@returns Icon resource. | getDeviceTypeIcon(deviceType: deviceManager.DeviceType): Resource {
if ((deviceType === deviceManager.DeviceType.PHONE) || (deviceType === deviceManager.DeviceType.UNKNOWN_TYPE)) {
return $r('app.media.ic_public_devices_phone');
} else if (deviceType === deviceManager.DeviceType.TV) {
return $r('a... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDeviceTypeIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deviceType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left devic... | getDeviceTypeIcon(deviceType: deviceManager.DeviceType): Resource {
if ((deviceType === deviceManager.DeviceType.PHONE) || (deviceType === deviceManager.DeviceType.UNKNOWN_TYPE)) {
return $r('app.media.ic_public_devices_phone');
} else if (deviceType === deviceManager.DeviceType.TV) {
return $r('a... | https://gitee.com/openharmony/codelabs.git | 5bb3ed297084c9c34dd926686429a159b054207d | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | trim | Trims all specified characters from the beginning and
end of this String.
@param remove that contains the characters to trim
@throws NullPointerException if remove param is null
@returns new trimmed string | public trim(remove: char[]): String {
return this.trimLeft(remove).trimRight(remove);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left trim AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remove AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public trim(remove: char[]): String {
return this.trimLeft(remove).trimRight(remove);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 364cc96d816d9260fe3764750195840af6de4327 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | getRelatedPropertyNames | 获取所有关联数据的属性名
@returns 属性名数组 | getRelatedPropertyNames(): Array<string> {
const names: Array<string> = []
this.relatedData.forEach((_, key) => {
names.push(key)
})
return names
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getRelatedPropertyNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left... | getRelatedPropertyNames(): Array<string> {
const names: Array<string> = []
this.relatedData.forEach((_, key) => {
names.push(key)
})
return names
} | https://github.com/offlinecat-dev/OCNetORM | 54ab9f7cdc908de6b7b553f8fdf71835de3c8a57 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets | arkts | checkAndExecuteBackup | 检查并执行备份 | async checkAndExecuteBackup(): Promise<boolean> {
if (!this.context) {
logger.warn(TAG, '调度器未初始化');
return false;
}
if (this.isRunning) {
logger.info(TAG, '备份任务正在执行中,跳过');
return false;
}
try {
// 加载WebDAV设置
const settings = await this.loadWebDAVSettin... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left checkAndExecuteBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotatio... | async checkAndExecuteBackup(): Promise<boolean> {
if (!this.context) {
logger.warn(TAG, '调度器未初始化');
return false;
}
if (this.isRunning) {
logger.info(TAG, '备份任务正在执行中,跳过');
return false;
}
try {
// 加载WebDAV设置
const settings = await this.loadWebDAVSettin... | https://github.com/DaLongZhuaZi/manxia | cdeaf4aa40fadbf8e4aded6717323207f57f5fe4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates an Uint16Array with respect to buf.
@param buf data initializer | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / Uint16Array.BYTES_PER_ELEMENT)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right 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 buf AST#identifier#Right AST#:#Left : AST#:#R... | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / Uint16Array.BYTES_PER_ELEMENT)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d557b3685100bc26601e0d851a6ff194d374e3d4 | gitee |
ccccjiemo/gles | src/main/ets/globjects/GLFrameBuffer.ets | arkts | constructor | GL_FRAMEBUFFER/GL_READ_FRAMEBUFFER/GL_WRITE_FRAMEBUFFER
@param type | constructor(type?: number) {
this.handle = glGenFramebuffers(1)[0];
this.type = GL_FRAMEBUFFER
} | 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#type#Left type AST#type#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#ident... | constructor(type?: number) {
this.handle = glGenFramebuffers(1)[0];
this.type = GL_FRAMEBUFFER
} | https://github.com/ccccjiemo/gles | 6c491c6d179cf975b8f542345056ba92ae850f3a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLast | Finds the last element in the BigInt64Array that satisfies the condition
@param { function } fn - condition
@returns { long } - the last element that satisfies fn
@throws { Error } - If the element cannot be found, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: BigInt, index: int, array: BigInt64Array) => boolean): long {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn(new BigInt(val), i, this)) {
return val
}
}
throw new Error("BigInt64... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public findLast(fn: (val: BigInt, index: int, array: BigInt64Array) => boolean): long {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn(new BigInt(val), i, this)) {
return val
}
}
throw new Error("BigInt64... | https://gitcode.com/iop123123/arkts-static-skills | d0a1fa7569af03dcb05b152dd73ab2580fe85b5e | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/managers/QemuVMManager.ets | arkts | mountSharedDir | ============================================================
文件共享
============================================================
挂载共享目录 | async mountSharedDir(vmName: string, hostPath: string, guestPath?: string): Promise<MountSharedDirResult> {
try {
const response = await this.sendCommand({
command: 'mount_shared_dir',
vmName: vmName,
hostPath: hostPath,
guestPath: guestPath
})
const result: Mount... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left mountSharedDir AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left vmName AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async mountSharedDir(vmName: string, hostPath: string, guestPath?: string): Promise<MountSharedDirResult> {
try {
const response = await this.sendCommand({
command: 'mount_shared_dir',
vmName: vmName,
hostPath: hostPath,
guestPath: guestPath
})
const result: Mount... | https://github.com/AetheriumSimulator/qemu-hmos | 5ee424de6941690ff40266e8f3be63e99a16babf | github |
openharmony/arkui_ace_engine | advanced_ui_component/dialog/source/dialog.ets | arkts | getCheckTipsAccessibilityText | 获取checkTips无障碍文本
@param resource 资源
@param selected select state
@returns string | function getCheckTipsAccessibilityText(context: UIContext, resource: ResourceStr | null | undefined,
selected?: boolean): string {
try {
// 'sys.string.slider_accessibility_selected'
let selectText: string = context?.getHostContext()?.resourceManager.getStringSync(125833934) ?? '';
// 'sys.string.slider... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getCheckTipsAccessibilityText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AS... | function getCheckTipsAccessibilityText(context: UIContext, resource: ResourceStr | null | undefined,
selected?: boolean): string {
try {
// 'sys.string.slider_accessibility_selected'
let selectText: string = context?.getHostContext()?.resourceManager.getStringSync(125833934) ?? '';
// 'sys.string.slider... | https://gitcode.com/openharmony/arkui_ace_engine | 6ae8b15b1431005e27061bc9af37c486d9c648e7 | gitcode |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/FocusTimerEngine.ets | arkts | elapsedSeconds | 获取当前阶段已经过去的时长(秒) | get elapsedSeconds(): number {
return this.totalSeconds - this.remainingSeconds;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left elapsedSeconds 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#Ri... | get elapsedSeconds(): number {
return this.totalSeconds - this.remainingSeconds;
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L241-L243 | 1e8dce076c72defd5f66f9edfcefb23de81e253c | github |
StarHeartY/CalculatorX | entry/src/main/ets/utils/EngineService.ets | arkts | generateInjectJs | 2. 生成用于 Webview 注入的 JavaScript 脚本,用于将 LaTeX 转为 MathJSON (AST) | public static generateInjectJs(cleanedLatex: string): string {
// 给反斜杠和引号加上双重转义,防止破坏 JS 边界
let safeLatex = cleanedLatex.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/\n/g, "\\n");
// 内存静默转换 JSON
return `
(function() {
try {
let tempMf = document.createElement('math-fiel... | 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 generateInjectJs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cleanedLatex AST#identifier#Right AST#ERROR#Left AST#... | public static generateInjectJs(cleanedLatex: string): string {
// 给反斜杠和引号加上双重转义,防止破坏 JS 边界
let safeLatex = cleanedLatex.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/\n/g, "\\n");
// 内存静默转换 JSON
return `
(function() {
try {
let tempMf = document.createElement('math-fiel... | https://github.com/StarHeartY/CalculatorX | 25502fd9ba9efa732147692ab67e095c948f711f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getSuwayomiCacheRoot | ==================== 封面图片缓存 ====================
获取Suwayomi缓存根目录 | private getSuwayomiCacheRoot(): string {
if (!DownloadDirManager.isReady()) {
throw new Error('Download目录未初始化');
}
return DownloadDirManager.ensureDirectory('suwayomi');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSuwayomiCacheRoot 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 st... | private getSuwayomiCacheRoot(): string {
if (!DownloadDirManager.isReady()) {
throw new Error('Download目录未初始化');
}
return DownloadDirManager.ensureDirectory('suwayomi');
} | https://github.com/DaLongZhuaZi/manxia | c91d25325d577a2778349b30be068f48cb7c56df | github |
harmonyos/codelabs | HarmonyOS_NEXT/PixelConversion/entry/src/main/ets/viewmodel/ConversionViewModel.ets | arkts | getConversionList | Get conversion list data on the left.
@return {Array<ConversionItem>} conversionItems | getConversionList() {
let conversionItems = CONVERSION_LIST;
return conversionItems;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getConversionList 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#... | getConversionList() {
let conversionItems = CONVERSION_LIST;
return conversionItems;
} | https://gitee.com/harmonyos/codelabs.git | c651c9a0cdfc28e1420a32374ad2cfee3a78edd1 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentSet.ets | arkts | constructor | Constructs a ConcurrentSet from iterator
@param { Iterable<T> } iterable initial iterable | constructor(iterable: Iterable<T>) {
const it = (iterable as Iterable<T>).$_iterator();
const entriesIter = new MappingIterator<T, [T, T]>(it, (element: T): [T, T] => [element, element]);
this.elements = new ConcurrentHashMap<T, T>(entriesIter);
} | 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 iterable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identif... | constructor(iterable: Iterable<T>) {
const it = (iterable as Iterable<T>).$_iterator();
const entriesIter = new MappingIterator<T, [T, T]>(it, (element: T): [T, T] => [element, element]);
this.elements = new ConcurrentHashMap<T, T>(entriesIter);
} | https://gitcode.com/iop123123/arkts-static-skills | c0aca7830c554c26f023b18b5d871645d9407b32 | gitcode |
erosTeam/NextE | shared/src/main/ets/settings/ActionAlignmentSettings.ets | arkts | effectiveMode | The mode actually in force: unset → default; smartGrip on an unsupported device → followOperation. | static effectiveMode(mode: string, smartGripSupported: boolean): ActionAlignmentMode {
const normalized: ActionAlignmentMode = ActionAlignmentSettings.normalizeMode(mode)
if (normalized === ActionAlignmentSettings.MODE_UNSET) {
return ActionAlignmentSettings.defaultMode(smartGripSupported)
}
if ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left effectiveMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static effectiveMode(mode: string, smartGripSupported: boolean): ActionAlignmentMode {
const normalized: ActionAlignmentMode = ActionAlignmentSettings.normalizeMode(mode)
if (normalized === ActionAlignmentSettings.MODE_UNSET) {
return ActionAlignmentSettings.defaultMode(smartGripSupported)
}
if ... | https://github.com/erosTeam/NextE | 4ee9454fbf6d66b8f85d9359857496412aed5560 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Array.ets | arkts | lastIndexOf | lastIndexOf(arr: long[], key: long, fromIndex: int) tries to find entry of key into arr which is not greater than fromIndex
@param arr array to find a key
@param key a value to find
@param fromIndex an index of arr to begin search with (including, search is performed backwards)
@returns last index of key if found in ar... | function lastIndexOf(arr: long[], key: long, fromIndex: int): int throws {
return lastIndexOf(arr, key, -1, fromIndex)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lastIndexOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function lastIndexOf(arr: long[], key: long, fromIndex: int): int throws {
return lastIndexOf(arr, key, -1, fromIndex)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 58ad2e5d04e81352b080bcf4fbe2f40e0895213f | gitee |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets | arkts | getWifiStatus | 查询WLAN是否已使能,可以帮助用户快速了解自己是否可以使用Wi-Fi网络进行连接。
当Wi-Fi跟蜂窝同时存在时,有助于实现网络连接的无缝切换。
@returns true:已使能, false:未使能 | getWifiStatus(): boolean {
try {
let isWifiActive: boolean = wifiManager.isWifiActive();
return isWifiActive;
} catch (error) {
logger.error('failed:' + JSON.stringify(error));
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWifiStatus 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... | getWifiStatus(): boolean {
try {
let isWifiActive: boolean = wifiManager.isWifiActive();
return isWifiActive;
} catch (error) {
logger.error('failed:' + JSON.stringify(error));
}
return false;
} | https://github.com/openharmony/applications_app_samples | a74c5747b891bfa4c5f9bc3b74069ac52faedca7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorLessThan | Checks if this BigInt is less than another.
@param { BigInt } other The value to compare with.
@returns { boolean } True if this is less than other, false otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorLessThan(other: BigInt): boolean {
return other > this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorLessThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public operatorLessThan(other: BigInt): boolean {
return other > this
} | https://gitcode.com/iop123123/arkts-static-skills | 9452b6abb553d7cc569c6d1a736199e6a94ba8a8 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | updateSelectedAddress | 更新已选择的地址
@param {Address} address - 选择的地址
@returns {void} 无返回值 | private updateSelectedAddress(address: Address): void {
const currentData: ConfirmOrder = this.data ? new ConfirmOrder(this.data) : new ConfirmOrder();
currentData.defaultAddress = address;
this.data = currentData;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateSelectedAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left address AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private updateSelectedAddress(address: Address): void {
const currentData: ConfirmOrder = this.data ? new ConfirmOrder(this.data) : new ConfirmOrder();
currentData.defaultAddress = address;
this.data = currentData;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 71cd251366e798350744e46c2f231eeab6cc5ed9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelDetailPage.ets | arkts | cancelSourceSearch | 取消换源搜索 | cancelSourceSearch(): void {
if (this.searchTaskHandle) {
this.searchTaskHandle.cancel();
this.searchTaskHandle = null;
}
this.isSearchingSource = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelSourceSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_express... | cancelSourceSearch(): void {
if (this.searchTaskHandle) {
this.searchTaskHandle.cancel();
this.searchTaskHandle = null;
}
this.isSearchingSource = false;
} | https://github.com/DaLongZhuaZi/manxia | 7cb4dc1742c809da02be67fd328877d25ac3a87f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | sendGamepadState | 发送物理手柄完整状态 | sendGamepadState(
controllerIndex: number,
buttons: number,
leftStickX: number, leftStickY: number,
rightStickX: number, rightStickY: number,
leftTrigger: number, rightTrigger: number,
controllerType: number = CONTROLLER_TYPE_XBOX
): void {
if (!this.isRunning) return;
if (controlle... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left sendGamepadState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | sendGamepadState(
controllerIndex: number,
buttons: number,
leftStickX: number, leftStickY: number,
rightStickX: number, rightStickY: number,
leftTrigger: number, rightTrigger: number,
controllerType: number = CONTROLLER_TYPE_XBOX
): void {
if (!this.isRunning) return;
if (controlle... | https://github.com/AlkaidLab/moonlight-harmony | 5c909f06acda56dc916cb1f0772206f96442d34f | github |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/pages/Index.ets | arkts | checkNetworkAndLocate | --- 检查网络状态并定位 --- | checkNetworkAndLocate() {
this.cityName = "定位中...";
this.isNetworkError = false;
connection.hasDefaultNet().then((hasNet: boolean) => {
if (hasNet) {
this.getLocationByIP();
} else {
setTimeout(() => {
this.setLocateError();
}, 3000);
}
}).catch((err... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkNetworkAndLocate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl... | checkNetworkAndLocate() {
this.cityName = "定位中...";
this.isNetworkError = false;
connection.hasDefaultNet().then((hasNet: boolean) => {
if (hasNet) {
this.getLocationByIP();
} else {
setTimeout(() => {
this.setLocateError();
}, 3000);
}
}).catch((err... | https://github.com/OnceWeWere/Weather_HarmonyOS | 218e16611efbac8ce05d8b9368004cf5bd0f4961 | github |
OHPG/FinVideo | entry/src/main/ets/data/Repository.ets | arkts | getResumeItems | 获取恢复播放媒体列表
@returns | public getResumeItems(): Promise<Array<FinItem>> {
return this.requireApi().getResumeItems()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getResumeItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express... | public getResumeItems(): Promise<Array<FinItem>> {
return this.requireApi().getResumeItems()
} | https://github.com/OHPG/FinVideo | 3348229030bb5cca54484eb1e9e9d9edc7e73451 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | initialize | 初始化登录管理器,加载持久化的Cookie | async initialize(context: Context): Promise<void> {
if (this.initialized) {
return;
}
try {
this.dataPreferences = await preferences.getPreferences(context, 'novel_login_data');
await this.loadPersistedData();
this.initialized = true;
logger.info(TAG, 'NovelLoginManager 初始化完... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#t... | async initialize(context: Context): Promise<void> {
if (this.initialized) {
return;
}
try {
this.dataPreferences = await preferences.getPreferences(context, 'novel_login_data');
await this.loadPersistedData();
this.initialized = true;
logger.info(TAG, 'NovelLoginManager 初始化完... | https://github.com/DaLongZhuaZi/manxia | 42f60aadd5f21687c18d5e50794bd76427b0a921 | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/utils/CryptoUtil.ets | arkts | getRandomInstance | Internal private method: retrieves singleton Random instance
Implements lazy initialization - created only on first access
@returns cryptoFramework.Random Random instance
@throws Error When failed to create Random instance
@private | private static getRandomInstance(): cryptoFramework.Random {
if (!CryptoUtil.rand) {
try {
CryptoUtil.rand = cryptoFramework.createRandom();
} catch (error) {
Logger.error(`CryptoFramework createRandom failed: ${JSON.stringify(error)}`);
throw new Error('Failed to create Random... | 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 getRandomInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private static getRandomInstance(): cryptoFramework.Random {
if (!CryptoUtil.rand) {
try {
CryptoUtil.rand = cryptoFramework.createRandom();
} catch (error) {
Logger.error(`CryptoFramework createRandom failed: ${JSON.stringify(error)}`);
throw new Error('Failed to create Random... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 256afceddd4c664bc9bbe1fa5700e1c7a6961c25 | gitcode |
youyeyejie/ZhiXing_ActHub | entry/src/test/TodoTestDataHelper.ets | arkts | clearTestTodos | 清除所有测试待办数据
@returns Promise<number> 删除的数量 | async clearTestTodos(): Promise<number> {
try {
const allTodos = await this.repository.findAll();
let deletedCount = 0;
for (const todo of allTodos) {
try {
await this.repository.removeById(todo.id);
deletedCount++;
console.log(`已删除测试待办: ${todo.content... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearTestTodos 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#gener... | async clearTestTodos(): Promise<number> {
try {
const allTodos = await this.repository.findAll();
let deletedCount = 0;
for (const todo of allTodos) {
try {
await this.repository.removeById(todo.id);
deletedCount++;
console.log(`已删除测试待办: ${todo.content... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/test/TodoTestDataHelper.ets#L116-L136 | 79e89eb5c6f6e50f150a6d02a7ea52ac2bad9198 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | getCriticReviews | @summary Gets critic review for an item.
@param {LibraryApiGetCriticReviewsRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@deprecated
@throws {RequiredError}
@memberof LibraryApi | public getCriticReviews(requestParameters: LibraryApiGetCriticReviewsRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/CriticReviews`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCriticReviews AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | public getCriticReviews(requestParameters: LibraryApiGetCriticReviewsRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/CriticReviews`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | f069da7c476081da299bccdfc660555036c37376 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationErrorHandler.ets | arkts | createPermissionDeniedError | 创建权限拒绝错误
@param url 路由路径
@returns NavigationError | public static createPermissionDeniedError(url: string): NavigationError {
return new NavigationError(
`Permission denied for route: ${url}`,
NavigationErrorType.PERMISSION_DENIED,
url
);
} | 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 createPermissionDeniedError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AS... | public static createPermissionDeniedError(url: string): NavigationError {
return new NavigationError(
`Permission denied for route: ${url}`,
NavigationErrorType.PERMISSION_DENIED,
url
);
} | https://github.com/LJ666-ui/harmony-health-care | 4659684861db99e2a1da45e71659301a2d673a0c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/LabelUtils.ets | arkts | isTranslatedContent | 判断标题是否包含汉化/翻译相关的关键字
用于给图源详情页和统一详情页的封面添加"汉化"标签
支持中英日韩四种语言的常见表述 | static isTranslatedContent(title: string | undefined | null): boolean {
if (!title) {
return false;
}
const lowerTitle = title.toLowerCase();
// 关键字列表
const keywords = [
'汉化', // 简体
'漢化', // 繁体
'汉化组', // 汉化组
'漢化組',
'翻译', // 翻译
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isTranslatedContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expr... | static isTranslatedContent(title: string | undefined | null): boolean {
if (!title) {
return false;
}
const lowerTitle = title.toLowerCase();
// 关键字列表
const keywords = [
'汉化', // 简体
'漢化', // 繁体
'汉化组', // 汉化组
'漢化組',
'翻译', // 翻译
... | https://github.com/DaLongZhuaZi/manxia | a0f10fcecdc1ba61e19cb6b8af3d7f80694b82c0 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/view/GoodsSearchPage.ets | arkts | build | 构建商品搜索页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
viewModel: this.vm,
hideTitleBar: true
}) {
SearchTopAppBar({
value: this.vm.searchValue,
autoFocus: true,
onValueChange: (value: string): void => this.vm.onSearchValueChange(value),
onSearch: (value: string): void => {
... | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
AppNavDestination({
viewModel: this.vm,
hideTitleBar: true
}) {
SearchTopAppBar({
value: this.vm.searchValue,
autoFocus: true,
onValueChange: (value: string): void => this.vm.onSearchValueChange(value),
onSearch: (value: string): void => {
... | https://github.com/Joker-x-dev/CoolMallArkTS | fa0de3db91b60f47728fe0771224460feeefe56b | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/component/PictureListCard.ets | arkts | getColorFromImg | 获取图片颜色 | getColorFromImg() {
Logger.info("[PictureListCard]", this.cardComponentModel?.cardImage as string)
ImageUtil.getColorFromImgUrl(this.cardComponentModel?.cardImage || '', false)
.then((colorArr: number[]) => {
this.buttonColor = `rgba(${colorArr[0]},${colorArr[1]},${colorArr[2]},1)`
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getColorFromImg 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... | getColorFromImg() {
Logger.info("[PictureListCard]", this.cardComponentModel?.cardImage as string)
ImageUtil.getColorFromImgUrl(this.cardComponentModel?.cardImage || '', false)
.then((colorArr: number[]) => {
this.buttonColor = `rgba(${colorArr[0]},${colorArr[1]},${colorArr[2]},1)`
})
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | e88b9fedb2f228ed9661fe7bd3c153852628bcd7 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | skipCurrentPhase | 跳过当前阶段 | private skipCurrentPhase(): RecoveryResult {
const phaseDetail = this.phases.get(this.currentPhase);
if (!phaseDetail || !phaseDetail.skippable) {
return {
success: false,
strategy: RecoveryStrategy.SKIP,
message: '当前阶段不可跳过',
duration: 0
};
}
phaseDetai... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left skipCurrentPhase 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 Re... | private skipCurrentPhase(): RecoveryResult {
const phaseDetail = this.phases.get(this.currentPhase);
if (!phaseDetail || !phaseDetail.skippable) {
return {
success: false,
strategy: RecoveryStrategy.SKIP,
message: '当前阶段不可跳过',
duration: 0
};
}
phaseDetai... | https://github.com/DaLongZhuaZi/manxia | 0b4fff509a7348eacbedbfd3a0f5937973d44d36 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new AssertionError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super("AssertionError", message, options)
console.error(message ?? "Assertion failed.");
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super("AssertionError", message, options)
console.error(message ?? "Assertion failed.");
} | https://gitcode.com/iop123123/arkts-static-skills | 52ef2720c0ee5e11912ba380b2931ef86390a900 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets | arkts | getInitError | 获取初始化错误 | getInitError(): string | null {
return this.initError;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getInitError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#L... | getInitError(): string | null {
return this.initError;
} | https://github.com/DaLongZhuaZi/manxia | c2b3973cbdae0c0e564fe1451d065ebe72b1a22b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_short.ets | arkts | main | ---
desc: check bitwise XOR 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 | ef80b107e45b431d3ae20816f5709b62c58a29ee | gitee |
HarmonyOS_Samples/MultiPictureBeautification | multipicturecommon/src/main/ets/utils/BreakpointType.ets | arkts | getValue | Get appropriate value based on current width breakpoint
XS falls back to SM value for consistency | getValue(widthBp: WidthBreakpoint): T {
let value: T;
switch (widthBp) {
case WidthBreakpoint.WIDTH_XS:
case WidthBreakpoint.WIDTH_SM:
value = this.sm;
break;
case WidthBreakpoint.WIDTH_MD:
value = this.md;
break;
case WidthBreakpoint.WIDTH_LG:
v... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left widthBp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WidthBreakpoint AST#identifier#Right AST#)#L... | getValue(widthBp: WidthBreakpoint): T {
let value: T;
switch (widthBp) {
case WidthBreakpoint.WIDTH_XS:
case WidthBreakpoint.WIDTH_SM:
value = this.sm;
break;
case WidthBreakpoint.WIDTH_MD:
value = this.md;
break;
case WidthBreakpoint.WIDTH_LG:
v... | https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification | 7b2152179683b7262f7e73e0af0f9b5a8764e765 | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/api/RouterMgr.ets | arkts | getParam | 获取页面携带的参数
@returns | public getParam(): ObjectOrNull {
let name = this.getTopPathName()
if (!name) {
const state = this.getCurrentState()
name = state.stackTopInfo?.metadata?.name ?? ""
}
if (name) {
try {
let params = this.getParamByName(name)
return params[params.length-1]
} catch... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getParam 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 ObjectOrNull ... | public getParam(): ObjectOrNull {
let name = this.getTopPathName()
if (!name) {
const state = this.getCurrentState()
name = state.stackTopInfo?.metadata?.name ?? ""
}
if (name) {
try {
let params = this.getParamByName(name)
return params[params.length-1]
} catch... | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L697-L715 | 23f8ef9fa4cd6619afa1a0dba203939e6197535b | github |
who7708/harmonyos-codelabs | HmosWorld/commons/common/src/main/ets/service/repository/UserResourcesRepository.ets | arkts | getCollectedResources | Access the network to obtain the data collected by the user
@returns LearningResource[] | getCollectedResources(): Promise<LearningResource[]> {
return this.service.getCollectResources();
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getCollectedResources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | getCollectedResources(): Promise<LearningResource[]> {
return this.service.getCollectResources();
} | https://github.com/who7708/harmonyos-codelabs | 0903596119dabdf402af20ac3a58abd504bebca9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | getImageExtension | 获取图片扩展名 | private static getImageExtension(originalName: string, imageData: ArrayBuffer): string {
const detectedExt = EBookCoverExtractor.detectImageExtensionFromData(imageData);
if (detectedExt.length > 0) {
return detectedExt;
}
// 从原始文件名获取扩展名
const match = originalName.match(/\.(jpg|jpeg|png|gif|... | 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 getImageExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalName AST#identifier#Right AST#ERROR#Left ... | private static getImageExtension(originalName: string, imageData: ArrayBuffer): string {
const detectedExt = EBookCoverExtractor.detectImageExtensionFromData(imageData);
if (detectedExt.length > 0) {
return detectedExt;
}
// 从原始文件名获取扩展名
const match = originalName.match(/\.(jpg|jpeg|png|gif|... | https://github.com/DaLongZhuaZi/manxia | e49dcfa68368b7a387ce28af2c0fa26b7d19224a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInternals.ets | arkts | isFloatType | Checks if the given Class object represents a float type (including boxed and primitive types).
@static
@param { Class } type The Class object to be checked.
@returns { boolean } Returns true if it's a float type; otherwise returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isFloatType(type: Class): boolean {
return type === Types.BOXED_FLOAT || type === Class.PRIMITIVE_FLOAT
} | 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 isFloatType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#... | public static isFloatType(type: Class): boolean {
return type === Types.BOXED_FLOAT || type === Class.PRIMITIVE_FLOAT
} | https://gitcode.com/iop123123/arkts-static-skills | 98198b7f536525d1f7b902379b710b15b698b16e | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | getLabelXOffset | returns the horizontal offset of the y-label | public getLabelXOffset(): number {
return this.mXLabelOffset;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabelXOffset 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... | public getLabelXOffset(): number {
return this.mXLabelOffset;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 32bfb31ef2a1dc473708e1ff254831b1f67991ba | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxLoadService.ets | arkts | handleErrorMessage | 处理来自线程的错误消息
@param data
@param onErrorMessage | private static handleErrorMessage(data: WorkerMessage, onErrorMessage?: (message: LoadMessage) => void) {
let errorMessage = data as LoadMessage;
hilog.error(DOMAIN, TAG, 'Received error message: %{public}s', errorMessage.message);
if (onErrorMessage) {
onErrorMessage(errorMessage);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left handleErrorMessage AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private static handleErrorMessage(data: WorkerMessage, onErrorMessage?: (message: LoadMessage) => void) {
let errorMessage = data as LoadMessage;
hilog.error(DOMAIN, TAG, 'Received error message: %{public}s', errorMessage.message);
if (onErrorMessage) {
onErrorMessage(errorMessage);
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxLoadService.ets#L121-L127 | 762f993049e69233da43e8d1b10a0114e83ee21a | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/AIService.ets | arkts | resolveNetworkError | 根据网络错误类型返回分类提示。 | private resolveNetworkError(error: Error): string {
const msg: string = error.message;
if (msg.includes('SSL') || msg.includes('certificate')) {
return '网络错误:SSL 证书验证失败';
}
if (msg.includes('timeout') || msg.includes('Timed out')) {
return '网络错误:请求超时,请检查网络连接';
}
if (msg.includes('E... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveNetworkError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private resolveNetworkError(error: Error): string {
const msg: string = error.message;
if (msg.includes('SSL') || msg.includes('certificate')) {
return '网络错误:SSL 证书验证失败';
}
if (msg.includes('timeout') || msg.includes('Timed out')) {
return '网络错误:请求超时,请检查网络连接';
}
if (msg.includes('E... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/AIService.ets#L348-L363 | 78b32335e6e201336a989e5f8e16473fa8cbd712 | github |
LYM15/FireflyCompanion | entry/src/main/ets/components/ImgActionTips.ets | arkts | constructor | 默认 success | constructor(text: ResourceStr, text2: ResourceStr, type?: 'success' | 'warning' | 'error' | 'normal') {
this.text = text;
this.text2 = text2;
if (type) this.type = type;
} | 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 text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ResourceStr AST#identifier#Ri... | constructor(text: ResourceStr, text2: ResourceStr, type?: 'success' | 'warning' | 'error' | 'normal') {
this.text = text;
this.text2 = text2;
if (type) this.type = type;
} | https://github.com/LYM15/FireflyCompanion | 3978af05b00959fd2d2a65164bdd02f620e56f30 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies all elements of arr to the current BigInt64Array.
@param { FixedArray<long> } arr - array to copy data from
@throws { RangeError } - If the number of assigned elements exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(arr: FixedArray<long>): void {
this.set(arr, 0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: FixedArray<long>): void {
this.set(arr, 0)
} | https://gitcode.com/iop123123/arkts-static-skills | 0c5c246550b6c98d4b6999b491805bd26de7f666 | gitcode |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | getCacheImage | 从内存或文件缓存中获取图片数据,若没有对应缓存,则去加载图片
如果需要加载本地图片,请在imageKnifeOption.context上设置对应的页面context,默认的context在此接口中不可用
@param loadSrc 图片地址url 或图片加载详细参数ImageKnifeOption
@param cacheType : 缓存策略
值为CacheStrategy::DEFAULT时尝试从内存,文件缓存中获取数据
值为CacheStrategy::MEMORY时仅从内存缓存中取数据
值为CacheStrategy::FILE时仅从文件缓存中取数据
值为CacheStrategy::NONE时不使用缓存,直接去加载图片... | getCacheImage(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2, cacheType: CacheStrategy = CacheStrategy.DEFAULT,
signature: string = "", animator: boolean = false): Promise<ImageKnifeData | undefined> {
let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2;
if (typeof loadSrc ===... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCacheImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loadSrc AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | getCacheImage(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2, cacheType: CacheStrategy = CacheStrategy.DEFAULT,
signature: string = "", animator: boolean = false): Promise<ImageKnifeData | undefined> {
let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2;
if (typeof loadSrc ===... | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L258-L269 | 8ba7bac250fc7187d65bc3a0f658a011337270bf | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | copyWithin | Makes a copy of internal elements to targetPos from startPos to endPos.
See rules of parameters normalization on
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin | MDN}
@param { int } target - insert index to place copied elements
@param { int } start - start inde... | public copyWithin(target: int, start: int, end?: int): Uint32Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let count... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public copyWithin(target: int, start: int, end?: int): Uint32Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let count... | https://gitcode.com/iop123123/arkts-static-skills | fc6d682676fb3bc0bdb633ebf77d39913e0ca5df | gitcode |
yang-kun-long/HarmonyAccounting | entry/src/main/ets/view/DialogComponent.ets | arkts | selectAccount | 选择账户类型
该方法用于在给定的账户项中选择一个账户类型,并将该类型的相关信息赋值给新账户对象
主要用于在用户选择了一个特定的账户类型后,更新新账户对象的类型信息
@param item 被选中的账户项,包含账户类型和类型文本 | selectAccount(item: AccountItem) {
// 将选中项的账户类型赋值给新账户的账户类型
this.newAccount.accountType = item.accountType;
// 将选中项的类型文本赋值给新账户的类型文本
this.newAccount.typeText = item.typeText;
// 更新当前选择的类型文本
this.curType = item.typeText;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AccountItem AST#identifier#... | selectAccount(item: AccountItem) {
// 将选中项的账户类型赋值给新账户的账户类型
this.newAccount.accountType = item.accountType;
// 将选中项的类型文本赋值给新账户的类型文本
this.newAccount.typeText = item.typeText;
// 更新当前选择的类型文本
this.curType = item.typeText;
} | https://github.com/yang-kun-long/HarmonyAccounting | 3c68aaf0f7ba7dbd4db74162a77dfef2fb12e84d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | safeSubstring | 安全截取内容,避免处理过大的HTML | static safeSubstring(content: string, maxSize: number = PerformanceConfig.MAX_CONTENT_SIZE): string {
if (content.length <= maxSize) {
return content;
}
// 尝试在标签边界截断,避免截断标签中间
const truncated = content.substring(0, maxSize);
const lastTagEnd = truncated.lastIndexOf('>');
if (lastTagEnd > ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left safeSubstring AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | static safeSubstring(content: string, maxSize: number = PerformanceConfig.MAX_CONTENT_SIZE): string {
if (content.length <= maxSize) {
return content;
}
// 尝试在标签边界截断,避免截断标签中间
const truncated = content.substring(0, maxSize);
const lastTagEnd = truncated.lastIndexOf('>');
if (lastTagEnd > ... | https://github.com/DaLongZhuaZi/manxia | a8e70d05c9ef3b103be8f8d24ab67b37211deed5 | github |
GrassyUnknown/Health-Life-HarmonyOS-Next | entry/src/main/ets/view/task/TaskDetailComponent.ets | arkts | finishTaskEdit | 确认编辑完成任务 | finishTaskEdit() {
if (this.isChanged) {
let context: Context = getContext(this) as common.Context;
let taskInfo: TaskInfo = new TaskInfo(Const.ZERO, Const.GLOBAL_KEY, this.settingParams.taskID,
this.settingParams.targetValue, this.settingParams.isAlarm, this.settingParams.startTime,
t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left finishTaskEdit 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... | finishTaskEdit() {
if (this.isChanged) {
let context: Context = getContext(this) as common.Context;
let taskInfo: TaskInfo = new TaskInfo(Const.ZERO, Const.GLOBAL_KEY, this.settingParams.taskID,
this.settingParams.targetValue, this.settingParams.isAlarm, this.settingParams.startTime,
t... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | 5b3810c7f7e543f7f54a72ee70f27d0342962140 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | set | Sets the double value wrapped in this DoubleBox.
@param { double } value - The new double value to set
@returns { double } The newly set double value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(value: double): double {
return (this.value = value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(value: double): double {
return (this.value = value);
} | https://gitcode.com/iop123123/arkts-static-skills | b57a0f3732470bc5036a1bcb1f046e7a60d680a8 | gitcode |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | logRequestError | 打印请求错误日志
@param {AxiosError} error - 请求错误
@returns {void} 无返回值 | function logRequestError(error: AxiosError): void {
const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined;
const method: string = config ? normalizeMethod(config.method) : "UNKNOWN";
const url: string = config ? buildRequestUrl(config) : "unknown";
const m... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left logRequestError AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left error AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function logRequestError(error: AxiosError): void {
const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined;
const method: string = config ? normalizeMethod(config.method) : "UNKNOWN";
const url: string = config ? buildRequestUrl(config) : "unknown";
const m... | https://github.com/Joker-x-dev/CoolMallArkTS | 4484d7873ab699fefac8ae5bc2c4bb52c9f3dd3d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Byte.ets | arkts | toString | Converts this object to a string
@returns result of the conversion | public override toString(): String {
// Check for zero, log10 would go inf otherwise
if (this.value == 0) {
return "0";
}
let val = this.value;
let negative: boolean = (val < 0);
let digitsNum = (log10(abs(this.value)) + 1) as int;
if (negative) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toString(): String {
// Check for zero, log10 would go inf otherwise
if (this.value == 0) {
return "0";
}
let val = this.value;
let negative: boolean = (val < 0);
let digitsNum = (log10(abs(this.value)) + 1) as int;
if (negative) {
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3755a3e4df2cd78437df83098a33c9f72f27c1f2 | gitee |
HarmonyOS_Samples/guide-snippets | Ability/InsightIntentConfigDevelopment/entry/src/main/ets/insightintents/DownloadExecutor.ets | arkts | onExecuteInServiceExtensionAbility | 由于意图配置了serviceExtension,故需要实现该接口 | async onExecuteInServiceExtensionAbility(name: string,
param: Record<string, Object>): Promise<insightIntent.ExecuteResult> {
const result: insightIntent.ExecuteResult = {
code: 0
};
return Promise.resolve(result);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onExecuteInServiceExtensionAbility AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotatio... | async onExecuteInServiceExtensionAbility(name: string,
param: Record<string, Object>): Promise<insightIntent.ExecuteResult> {
const result: insightIntent.ExecuteResult = {
code: 0
};
return Promise.resolve(result);
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 18d90dbefb6bfd6db6d22aa6351e2dd81ed8f33b | gitcode |
Cool_foolisher1/ArkTSRepository | RandomNumberSimulator/entry/src/main/ets/components/random/RandomNumber.ets | arkts | styleExternalRow | 设置外部Row的样式 | @Extend(Row)
function styleExternalRow() {
.justifyContent(FlexAlign.SpaceAround)
.width('100%')
} | 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 Row AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | @Extend(Row)
function styleExternalRow() {
.justifyContent(FlexAlign.SpaceAround)
.width('100%')
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | f3959b30fcc1eb3d709974da62f6a4faba80b19f | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getMaxSimCount | 获取卡槽数量。
@returns | static getMaxSimCount(): number {
return sim.getMaxSimCount();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMaxSimCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | static getMaxSimCount(): number {
return sim.getMaxSimCount();
} | https://github.com/tdcare/tdwebrtc | 6887b10db0c944d9c4f0116a3d227aecd0b1653e | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/swiper/TnSwiper.ets | arkts | lerp | 线性插值
@param start 起始值
@param end 结束值
@param fraction 插值进度 (0~1)
@returns 插值后的值 | function lerp(start: number, end: number, fraction: number): number {
return start + (end - start) * fraction;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lerp AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left start AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function lerp(start: number, end: number, fraction: number): number {
return start + (end - start) * fraction;
} | https://github.com/codelably/tuniao-ui | 67e05c22bbc26c60c0134aed68f75fe3fa18582e | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test32_original_index.ets | arkts | testNestedMap | --- Nested Map iteration --- | function testNestedMap(): string {
let outer: Map<string, Map<string, number>> = new Map();
let inner1: Map<string, number> = new Map();
inner1.set('x', 10);
inner1.set('y', 20);
let inner2: Map<string, number> = new Map();
inner2.set('x', 30);
inner2.set('y', 40);
outer.set('first', inner1);
outer.se... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedMap 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_ty... | function testNestedMap(): string {
let outer: Map<string, Map<string, number>> = new Map();
let inner1: Map<string, number> = new Map();
inner1.set('x', 10);
inner1.set('y', 20);
let inner2: Map<string, number> = new Map();
inner2.set('x', 30);
inner2.set('y', 40);
outer.set('first', inner1);
outer.se... | https://github.com/miaochiahao/ark-ghidra | bbe31284d5a070889365bd67f69775d8952d5c61 | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets | arkts | onSubmitComment | 提交评论点击事件
@returns {void} 无返回值 | onSubmitComment(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSubmitComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression... | onSubmitComment(): void {
} | https://github.com/Joker-x-dev/CoolMallArkTS | 9be5a576637444ad84b478696712dd430ebf158c | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ShareService.ets | arkts | convertToPlainText | 将消息列表转换为纯文本格式 | convertToPlainText(messages: ChatMessage[], sessionTitle: string = ''): string {
return this.exportService.toPlainText(this.exportService.buildModel(messages, sessionTitle))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left convertToPlainText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left messages AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Cha... | convertToPlainText(messages: ChatMessage[], sessionTitle: string = ''): string {
return this.exportService.toPlainText(this.exportService.buildModel(messages, sessionTitle))
} | https://github.com/LongLiveY96/chatcube | ac54c4d1495d18942205710cf4703afbd03192ba | github |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/pages/DiyCacheCountPage.ets | arkts | setOffCallback | 注销回调函数接口 | setOffCallback(): void {
this.avPlayer?.off('volumeChange');
this.avPlayer?.off('endOfStream');
this.avPlayer?.off('seekDone');
this.avPlayer?.off('durationUpdate');
this.avPlayer?.off('speedDone');
this.avPlayer?.off('bitrateDone');
this.avPlayer?.off('bufferingUpdate');
this.avPlayer... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOffCallback 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_blo... | setOffCallback(): void {
this.avPlayer?.off('volumeChange');
this.avPlayer?.off('endOfStream');
this.avPlayer?.off('seekDone');
this.avPlayer?.off('durationUpdate');
this.avPlayer?.off('speedDone');
this.avPlayer?.off('bitrateDone');
this.avPlayer?.off('bufferingUpdate');
this.avPlayer... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | de3136da76f964071b2d2eafa3f78fd2d3deb7f4 | gitee |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/ExportService.ets | arkts | exportCourse | 把某门课在沙箱里的目录导出到目标目录下的同名子目录。
@param context UIAbility 上下文
@param sandboxCourseDir 沙箱内该课程目录的真实路径(Rust 写入处)
@param courseName 课程名(用作目标子目录名)
@param exportUri 用户选定的导出目录 URI;空串=用默认「下载」目录
@returns 成功导出的用户可见路径描述;失败/留在沙箱返回 null | static async exportCourse(context: common.UIAbilityContext, sandboxCourseDir: string,
courseName: string, exportUri: string): Promise<string | null> {
const srcUri = fileUri.getUriFromPath(sandboxCourseDir);
// 目标子目录 URI
let destUri: string;
let display: string;
if (exportUri && exportUri.len... | 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 exportCourse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : A... | static async exportCourse(context: common.UIAbilityContext, sandboxCourseDir: string,
courseName: string, exportUri: string): Promise<string | null> {
const srcUri = fileUri.getUriFromPath(sandboxCourseDir);
// 目标子目录 URI
let destUri: string;
let display: string;
if (exportUri && exportUri.len... | https://github.com/picklerick422/zju-learning-assistant-OH | 4e2fd9e35af424f40f3d955fbb8e77820da53aae | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/progress/GaugeDemo.ets | arkts | applyContent | 返回指定的自定义 Gauge | applyContent(): WrappedBuilder<[GaugeConfiguration]> {
return wrapBuilder(buildGauge)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#L... | applyContent(): WrappedBuilder<[GaugeConfiguration]> {
return wrapBuilder(buildGauge)
} | https://github.com/webabcd/HarmonyDemo | 25dcfcfde265a6e473e2f294e356162e4a17edc1 | github |
silence17/harmonydemo | entry/src/main/ets/view/refresh/Home.ets | arkts | build | 创建一个滚动控制器 | build() {
Column() {
Text($r("app.string.title_food_list"))
.width('100%')
.height(56)
.padding({ left: 20 })
.backgroundColor('#FF1f3f5')
.fontSize(20)
Scroll(this.scroller) {
if(this.refreshStatus) {
this.DownRefreshBuilder('正在刷新', 'down')
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
Text($r("app.string.title_food_list"))
.width('100%')
.height(56)
.padding({ left: 20 })
.backgroundColor('#FF1f3f5')
.fontSize(20)
Scroll(this.scroller) {
if(this.refreshStatus) {
this.DownRefreshBuilder('正在刷新', 'down')
... | https://github.com/silence17/harmonydemo | e086cdd5a99a06f7d889674153c0a660b7adb5de | github |
YDYm233/EasyRandom_HarmonyNextApp | product/default/src/main/ets/pages/SettingPage/Options.ets | arkts | indexToColorMode | 将 Select 组件 index 映射为 ConfigurationConstant.ColorMode | function indexToColorMode(index: number): ConfigurationConstant.ColorMode {
switch (index) {
case 0:
return ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET // 跟随系统
case 1:
return ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT // 亮色
case 2:
return ConfigurationConstant.ColorMode.... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left indexToColorMode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function indexToColorMode(index: number): ConfigurationConstant.ColorMode {
switch (index) {
case 0:
return ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET // 跟随系统
case 1:
return ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT // 亮色
case 2:
return ConfigurationConstant.ColorMode.... | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | ce853c50d28bac44f0ec43fd53d82970ee8b6fae | github |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | endsWith | 判断字符串是否以给定的字符串结尾
@param str 要检索的字符串
@param target 要检索字符
@param position 检索的位置
@returns | static endsWith(str: string = '', target: string, position: number = str.length): boolean {
return str.endsWith(target, position);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left endsWith AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Le... | static endsWith(str: string = '', target: string, position: number = str.length): boolean {
return str.endsWith(target, position);
} | https://github.com/tdcare/tdwebrtc | d114ecc3b8356818d46649d6f3d2c91bc9e2b557 | github |
openharmony/communication_wifi | wifi/test/wifi_testapp/entry/src/main/ets/pages/newApi/AllInOneView.ets | arkts | constructor | 是否为群主
isGo: boolean
群主设备信息
ownerInfo: P2PDevice
密钥
passphrase: string
接口名称
interface: string
网络id
networkId: number
群组频率
frequency: number
接入设备列表
clientDevices: P2PDevice[]
群主ip地址
goIpAddress: string | constructor(group: wifiManager.WifiP2pGroupInfo) {
this.name = group.groupName
this.networkId = group.networkId
/*this.isGo = group.isP2pGo
this.ownerInfo = P2PDevice.from(group.ownerInfo)
this.passphrase = group.passphrase
this.interface = group.interface
this.networkId = group.networkId
... | 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 group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left w... | constructor(group: wifiManager.WifiP2pGroupInfo) {
this.name = group.groupName
this.networkId = group.networkId
/*this.isGo = group.isP2pGo
this.ownerInfo = P2PDevice.from(group.ownerInfo)
this.passphrase = group.passphrase
this.interface = group.interface
this.networkId = group.networkId
... | https://gitee.com/openharmony/communication_wifi.git | 87c206dfc6b6fbef5d263d6aa500bef556965d85 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityDataInput.ets | arkts | size | 获取键值对数量
@returns 数量 | size(): number {
return this.data.size
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left size AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block#L... | size(): number {
return this.data.size
} | https://github.com/offlinecat-dev/OCNetORM | fdb3f759b21bd55048c468efc01e16acc659671b | github |
HarmonyOS_Samples/sample_in_harmonyos | features/abilitycommon/src/main/ets/intentframework/InsightIntentExecutorImpl.ets | arkts | jumpToDesignatedPage | By setting @StorageProp(StorageKey.WANT_PARAMETERS) @Watch('jumpPage') wantParams,
which is over-watched by main_page, will trigger page-jumping defined in its VM | private jumpToDesignatedPage(pageInfo: IntentJsonEnumDetail): void {
let wantParameters: WantParams = pageInfo.param as WantParams;
wantParameters.fromIntent = true;
if (pageInfo.types === 'ComponentInstruction') {
wantParameters.moduleType = CardTypeEnum.COMPONENT;
} else if (pageInfo.types ===... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left jumpToDesignatedPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private jumpToDesignatedPage(pageInfo: IntentJsonEnumDetail): void {
let wantParameters: WantParams = pageInfo.param as WantParams;
wantParameters.fromIntent = true;
if (pageInfo.types === 'ComponentInstruction') {
wantParameters.moduleType = CardTypeEnum.COMPONENT;
} else if (pageInfo.types ===... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | d197fc26f521c86b5bfcb4900cc7f52369574430 | gitcode |
YANGZX22/Voot | entry/src/main/ets/storage/ApiConfigStorage.ets | arkts | migrateKeySlots | 迁移旧版本单密钥到多密钥槽位 | private static migrateKeySlots(
newSlots: MultiKeySlots | undefined,
oldUrl: string | undefined,
oldKey: string | undefined,
oldModel: string | undefined,
defaults: MultiKeySlots
): MultiKeySlots {
// 如果已有新格式数据,直接使用
if (newSlots && newSlots.slots && newSlots.slots.length > 0) {
// ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left migrateKeySlots AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newSlots AST#identifier#Right AST#:#... | private static migrateKeySlots(
newSlots: MultiKeySlots | undefined,
oldUrl: string | undefined,
oldKey: string | undefined,
oldModel: string | undefined,
defaults: MultiKeySlots
): MultiKeySlots {
// 如果已有新格式数据,直接使用
if (newSlots && newSlots.slots && newSlots.slots.length > 0) {
// ... | https://github.com/YANGZX22/Voot | e33e69719674df1bdfd7334e6e0747ae894d22bf | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/entryability/EntryAbility.ets | arkts | initDatabaseAndGenerateRecurringBills | 初始化数据库并生成定期账单 | private async initDatabaseAndGenerateRecurringBills(): Promise<void> {
try {
// 初始化账单数据库
const billDb = BillDatabase.getInstance();
await billDb.init(this.context);
hilog.info(DOMAIN, 'testTag', 'BillDatabase initialized');
// 初始化定期记账数... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initDatabaseAndGenerateRecurringBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#c... | private async initDatabaseAndGenerateRecurringBills(): Promise<void> {
try {
// 初始化账单数据库
const billDb = BillDatabase.getInstance();
await billDb.init(this.context);
hilog.info(DOMAIN, 'testTag', 'BillDatabase initialized');
// 初始化定期记账数... | https://github.com/qiuhaotc/HarmonyOSPlayground | c3cc5eaba626c1780b63a11fd9efa4c25c5e3b1e | github |
pangpang20/antennaPodHM | entry/src/main/ets/pages/PlayerPage.ets | arkts | shareToWeChatMoments | 分享到微信朋友圈 | shareToWeChatMoments(): void {
if (!this.currentEpisode) {
return;
}
// HarmonyOS暂不支持直接调用微信SDK,需要通过系统分享或复制链接
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('复制链接', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'分享到朋友圈... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shareToWeChatMoments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme... | shareToWeChatMoments(): void {
if (!this.currentEpisode) {
return;
}
// HarmonyOS暂不支持直接调用微信SDK,需要通过系统分享或复制链接
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('复制链接', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'分享到朋友圈... | https://github.com/pangpang20/antennaPodHM | c8d30d2cd8f20487578afc3f7f9c675a1e73ea4e | github |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/util/RecommendDataUtil.ets | arkts | mapHeroDtoToUi | Maps a hero card API DTO to {@link RecommendHeroCardUi}.
@param dto - Source hero card DTO.
@returns Populated UI model. | private static mapHeroDtoToUi(dto: HeroCardApiDto): RecommendHeroCardUi {
const ui = new RecommendHeroCardUi();
ui.badge = dto.badge;
ui.title = dto.title;
ui.subLine = dto.subLine;
ui.coverImage = dto.coverImage;
ui.gradientStart = dto.gradientStart;
ui.gradientEnd = dto.gradientEnd;
... | 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 mapHeroDtoToUi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dto AST#identifier#Right AST#:#Left :... | private static mapHeroDtoToUi(dto: HeroCardApiDto): RecommendHeroCardUi {
const ui = new RecommendHeroCardUi();
ui.badge = dto.badge;
ui.title = dto.title;
ui.subLine = dto.subLine;
ui.coverImage = dto.coverImage;
ui.gradientStart = dto.gradientStart;
ui.gradientEnd = dto.gradientEnd;
... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 1a4a8f671e69f1539501a6b44079c6bf15d7c466 | gitcode |
RoooyHe/toona-ohos | toona/src/main/ets/pages/JoinRoomPage.ets | arkts | CreateRoomDialogBuilder | 创建聊天室弹窗 - Builder | @Builder
function CreateRoomDialogBuilder(dialogParams: QuickDialogParams) {
CreateRoomDialogContent({ dialogParams: dialogParams })
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left CreateRoomDialogBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig... | @Builder
function CreateRoomDialogBuilder(dialogParams: QuickDialogParams) {
CreateRoomDialogContent({ dialogParams: dialogParams })
} | https://github.com/RoooyHe/toona-ohos | 2a1dab25f1f9b4319c1d4c8a4f109c5bccc16ea9 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets | arkts | parseQRCodeImageFromCamera | 解析从相机获取的二维码图片
@param cameraService
@param canvasContext | parseQRCodeImageFromCamera(cameraService: CameraService,
imageComponentType?: image.ComponentType): void {
Logger.info("parseQRCodeImageFromCamera start")
this.parseQRCodeImageWithNameFromCamera(cameraService, imageComponentType);
Logger.info("parseQRCodeImageFromCamera end")
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left parseQRCodeImageFromCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cameraService AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CameraService AST#id... | parseQRCodeImageFromCamera(cameraService: CameraService,
imageComponentType?: image.ComponentType): void {
Logger.info("parseQRCodeImageFromCamera start")
this.parseQRCodeImageWithNameFromCamera(cameraService, imageComponentType);
Logger.info("parseQRCodeImageFromCamera end")
... | https://github.com/openharmony/applications_app_samples | c9afe92e2abefaa1c315c662a8091dd14f0d41ad | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | getCurrentItems | 获取当前条目列表 | public getCurrentItems(): T[] {
return this.currentItems.slice();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | public getCurrentItems(): T[] {
return this.currentItems.slice();
} | https://github.com/DaLongZhuaZi/manxia | fd7a52607dfb3ab1b9ef28580663452cc8c4e92e | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/LegendEntry.ets | arkts | constructor | constructor();
constructor(label: string, form: LegendForm, formSize: number, formLineWidth: number,
formLineDashEffect: DashPathEffect, formColor: number);
@param label The legend entry text. A `null` label will start a group.
@param form The form to draw for this entry.
@param formSize Set to NaN to use the legend's ... | constructor(label ?: string | null, form ?: LegendForm | null, formSize ?: number | null, formLineWidth ?: number | null,
formLineDashEffect ?: DashPathEffect | null, formColor ?: number | null) {
this.label = label ? label : '';
this.form = form ? form : LegendForm.DEFAULT;
this.formSize = ... | 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 label AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#L... | constructor(label ?: string | null, form ?: LegendForm | null, formSize ?: number | null, formLineWidth ?: number | null,
formLineDashEffect ?: DashPathEffect | null, formColor ?: number | null) {
this.label = label ? label : '';
this.form = form ? form : LegendForm.DEFAULT;
this.formSize = ... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 29522a5d31c923281f820acd0c2df855fdca088a | gitee |
OHPG/FinSdk | jellyfin/src/main/ets/api/DevicesApi.ets | arkts | getDeviceInfo | getDeviceInfo
@summary Get info for a device.
@param {DevicesApiGetDeviceInfoRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof DevicesApi | public async getDeviceInfo(requestParameters: DevicesApiGetDeviceInfoRequest): Promise<DeviceInfos> {
return this.apiClient.get({path: "/Devices/Info", parameters: requestParameters})
} | 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 getDeviceInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST... | public async getDeviceInfo(requestParameters: DevicesApiGetDeviceInfoRequest): Promise<DeviceInfos> {
return this.apiClient.get({path: "/Devices/Info", parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 15b4fc82a03e74928a36ce51895eaf8a81331fb0 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | read | 读取文件内容
优先从远端加载,完成后异步保存到本地缓存
@param path 文件路径
@returns 文件内容
@throws 如果读取失败则抛出异常 | public async read(path: string): Promise<ArrayBuffer> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.read(path);
}
const cachePath: string = CacheConstants.getCacheFilePath(path);
const onlyUseCache: boolean = CacheConstants.getOnlyCache();
const fo... | 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 read AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right ... | public async read(path: string): Promise<ArrayBuffer> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.read(path);
}
const cachePath: string = CacheConstants.getCacheFilePath(path);
const onlyUseCache: boolean = CacheConstants.getOnlyCache();
const fo... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L47-L75 | 8b080e2b4d0971eb200b89c50a65955b5aaff85b | github |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/viewmodel/ListDataSource.ets | arkts | hasMore | 检查是否还有数据未加载 | public hasMore(): boolean {
return this.listData.length < this.allData.length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasMore 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#boole... | public hasMore(): boolean {
return this.listData.length < this.allData.length;
} | https://github.com/ChangJing01/HarmonyOS-FinalProject | ed7c72afa981a88cfc6f12f214c62171d9f45f43 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Privacy/Auth/AuthPatternLockPage.ets | arkts | onPatternComplete | 密码输入结束时触发该回调 | onPatternComplete(input: number[]) {
// 临时密码,用于更新线条颜色用的(用户体验提升)
this.inputPasswords = input
// 1. 判断输入的长度
if (input.length < 4) {
// 设置错误提示语,更新组件状态为错误
this.setErrorMessage('密码长度不小于4位,请重新输入')
} else {
this.clearErrorMessage()
// 2. 对比密码
// 由于持久化存储的是加密后的密码,所以当前输入的密码也需... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPatternComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifi... | onPatternComplete(input: number[]) {
// 临时密码,用于更新线条颜色用的(用户体验提升)
this.inputPasswords = input
// 1. 判断输入的长度
if (input.length < 4) {
// 设置错误提示语,更新组件状态为错误
this.setErrorMessage('密码长度不小于4位,请重新输入')
} else {
this.clearErrorMessage()
// 2. 对比密码
// 由于持久化存储的是加密后的密码,所以当前输入的密码也需... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 8e1e2fe852d7c5b6d239e1e96c9cd30b919ca07e | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Reader.ets | arkts | float | Read float32 little-endian | float(): number { const v = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 4).getFloat32(0, true); this.pos += 4; return v } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left float AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block#... | float(): number { const v = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 4).getFloat32(0, true); this.pos += 4; return v } | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 33a6dad979c10aec02bb001a33eb80fcf6751c8a | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/KeyMappingSettings.ets | arkts | getButtonItems | 基本按钮 (参考 ppsspp "Standard PSP controls") | function getButtonItems(): MappingItemDef[] {
return [
{ id: 'up', name: I18n.t('dpad_up'), targetType: 'nds_key', targetValue: 6 },
{ id: 'down', name: I18n.t('dpad_down'), targetType: 'nds_key', targetValue: 7 },
{ id: 'left', name: I18n.t('dpad_left'), targetType: 'nds_key', targetValue: 5 },
{ id:... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getButtonItems 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#array_type#L... | function getButtonItems(): MappingItemDef[] {
return [
{ id: 'up', name: I18n.t('dpad_up'), targetType: 'nds_key', targetValue: 6 },
{ id: 'down', name: I18n.t('dpad_down'), targetType: 'nds_key', targetValue: 7 },
{ id: 'left', name: I18n.t('dpad_left'), targetType: 'nds_key', targetValue: 5 },
{ id:... | https://github.com/richshaw2015/nds | 254e19899e090f2402bd2964939b4ea0be8b0e40 | github |
HarmonyOS_Samples/MultiFinancialManagement | commons/financialbase/src/main/ets/utils/WindowUtil.ets | arkts | setWindowOrientation | User the window interface to set window orientation. | setWindowOrientation(orientation: window.Orientation): void {
this.mainWindow.setPreferredOrientation(orientation)
.then(() => {
Logger.info('testLog', `Succeeded in setting window orientation.`);
// Update window orientation.
this.mainWindowInfo.orientation = orientation;
})
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWindowOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left orientation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identi... | setWindowOrientation(orientation: window.Orientation): void {
this.mainWindow.setPreferredOrientation(orientation)
.then(() => {
Logger.info('testLog', `Succeeded in setting window orientation.`);
// Update window orientation.
this.mainWindowInfo.orientation = orientation;
})
... | https://gitcode.com/HarmonyOS_Samples/MultiFinancialManagement | 31148d0d0ae1fda9e4180bbef4446d2690a2e0d0 | gitcode |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/utils/CommonUtils.ets | arkts | isListItemPressed | Check whther the listItem is pressed.
@param event Touch object.
@param itemPressed Pressed state.
@returns {boolean} True if the item is pressed; otherwise, false. | public static isListItemPressed(event: TouchEvent, itemPressed: boolean): boolean {
if (event.type === TouchType.Down) {
return true;
}
if (event.type === TouchType.Up) {
return false;
}
return itemPressed;
} | 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 isListItemPressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left... | public static isListItemPressed(event: TouchEvent, itemPressed: boolean): boolean {
if (event.type === TouchType.Down) {
return true;
}
if (event.type === TouchType.Up) {
return false;
}
return itemPressed;
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 9bd093fdfad706f0743684fe39540922c42e4a73 | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | followUser | 关注/取消关注用户 | static followUser(username: string): string {
return `/follow/${username}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left followUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | static followUser(username: string): string {
return `/follow/${username}`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 0289bfebfa30de79009d573440975c54e023c40a | github |
yang-kun-long/HarmonyAccounting | entry/src/main/ets/view/DialogComponent.ets | arkts | build | 构建方法,用于创建和配置用户界面组件 | build() {
// 定义一个列组件,包含一个图像,并且点击该图像可以关闭当前控制器
Column() {
// 加载并显示一个名为'half.png'的图像
Image($rawfile('half.png'))// 设置图像的宽度
.width($r('app.float.component_size_L'))// 设置图像的高度
.height($r('app.float.component_size_S'))// 当图像被点击时,关闭当前控制器(如果存在)
.onClick(() => {
this.contr... | 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() {
// 加载并显示一个名为'half.png'的图像
Image($rawfile('half.png'))// 设置图像的宽度
.width($r('app.float.component_size_L'))// 设置图像的高度
.height($r('app.float.component_size_S'))// 当图像被点击时,关闭当前控制器(如果存在)
.onClick(() => {
this.contr... | https://github.com/yang-kun-long/HarmonyAccounting | 7adbd6191259d662219c11affabaf9566a9a9c22 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | getType | 获取控制器类型 | getType(): number {
return this.type;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_bloc... | getType(): number {
return this.type;
} | https://github.com/AlkaidLab/moonlight-harmony | d696436ccb3188deefb60441e62bbfbebf25a9e3 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.