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 |
|---|---|---|---|---|---|---|---|---|---|---|
xblLab/HarmonyProjectTemplate | features/mine/src/main/ets/utils/NumberUtil.ets | arkts | getCurrentDateString | 获取时分格式化。
格式为 年-月-日 时:分:秒
@param seconds 秒
@returns | public static getCurrentDateString(): string {
let timestamp = Date.now();
let date = new Date(timestamp);
const hour = ('0' + date.getHours()).slice(-2);
const min = ('0' + date.getMinutes()).slice(-2);
const sec = ('0' + date.getSeconds()).slice(-2);
const year = date.getFullYear();
cons... | 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 getCurrentDateString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public static getCurrentDateString(): string {
let timestamp = Date.now();
let date = new Date(timestamp);
const hour = ('0' + date.getHours()).slice(-2);
const min = ('0' + date.getMinutes()).slice(-2);
const sec = ('0' + date.getSeconds()).slice(-2);
const year = date.getFullYear();
cons... | https://github.com/xblLab/HarmonyProjectTemplate | eec4f10e00df8a39974ab2829f7e7bfbe825a0b0 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/config/RouteConfigManager.ets | arkts | normalizePath | 标准化路由路径
@param path 原始路径
@returns 标准化后的路径 | private normalizePath(path: string): string {
let normalizedPath = path;
// 移除文件扩展名
if (normalizedPath.endsWith('.ets')) {
normalizedPath = normalizedPath.replace('.ets', '');
}
// 确保以 pages/ 开头
if (!normalizedPath.startsWith('pages/')) {
normalizedPath = 'pages/' + normalizedPat... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private normalizePath(path: string): string {
let normalizedPath = path;
// 移除文件扩展名
if (normalizedPath.endsWith('.ets')) {
normalizedPath = normalizedPath.replace('.ets', '');
}
// 确保以 pages/ 开头
if (!normalizedPath.startsWith('pages/')) {
normalizedPath = 'pages/' + normalizedPat... | https://github.com/LJ666-ui/harmony-health-care | abf9edc885d84d8d4a1f927a0fc3aaff208073bf | github |
HarmonyOS_Samples/guide-snippets | Ability/StartOptions/SetBackgroundColor/src/main/ets/setbackgroundcolorability/SetBackgroundColorAbility.ets | arkts | onForeground | [EndExclude startOptions_bgColor_and_windowParam] | async onForeground(): Promise<void> {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
let want: Want = {
deviceId: '', // deviceId为空表示本设备
bundleName: 'com.example.startoptions',
abilityName: 'EntryAbility',
parameters: {
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onForeground 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 AS... | async onForeground(): Promise<void> {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
let want: Want = {
deviceId: '', // deviceId为空表示本设备
bundleName: 'com.example.startoptions',
abilityName: 'EntryAbility',
parameters: {
... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | d1750d4002f21def31e83fd181c6cdaa8cc72fbf | gitcode |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/ui/widget/DanmakuView.ets | arkts | getCurrentTime | for getting the accurate play-time. use this method instead of parser.getTimer().currMillisecond
@return | getCurrentTime(): number{
return this.delegate.getCurrentTime()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentTime 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#stateme... | getCurrentTime(): number{
return this.delegate.getCurrentTime()
} | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | a222be8d268705d953f56b9df25158d40f36d124 | gitee |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/Options.ets | arkts | getOptions | Gets a read-only list of options in this set
@return read-only Collection of {@link Option} objects in this descriptor | public getOptions(): JList<CliOption> {
return this.helpOptions();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOptions 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_... | public getOptions(): JList<CliOption> {
return this.helpOptions();
} | https://gitee.com/openharmony-sig/commons-cli.git | 5c60f102608ce0b64301e660ad77315e249455bb | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/settings/classes/meowManagedSettings.ets | arkts | toString | Saving
Converts the settings data to a JSON string.
@param sort Whether to sort the entries by key before converting to JSON. By default is true.
@returns The JSON string representation of the settings data. | toString(sort: boolean = true) {
const lines: string[] = [];
for (const settingsEntry of this.settingsData) {
lines.push(`${settingsEntry.toString()}`);
}
if (sort) {
lines.sort();
}
const jsonResult = '{\n' + lines.join(',\n') + '\n}';
this.prebuiltReadOnly = jsonResult;
r... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left b... | toString(sort: boolean = true) {
const lines: string[] = [];
for (const settingsEntry of this.settingsData) {
lines.push(`${settingsEntry.toString()}`);
}
if (sort) {
lines.sort();
}
const jsonResult = '{\n' + lines.join(',\n') + '\n}';
this.prebuiltReadOnly = jsonResult;
r... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 82f5010298f25e594f9b9d3164df4996fb4fcc09 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/WatchHistoryManager.ets | arkts | getTodayWatchCount | 获取今天观看的视频数量 | getTodayWatchCount(): number {
const historyList = this.getAllWatchHistory()
const today = new Date()
today.setHours(0, 0, 0, 0)
return historyList.filter(item => {
const watchDate = new Date(item.watchTime)
watchDate.setHours(0, 0, 0, 0)
return watchDate.getTime() === today.get... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTodayWatchCount 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#sta... | getTodayWatchCount(): number {
const historyList = this.getAllWatchHistory()
const today = new Date()
today.setHours(0, 0, 0, 0)
return historyList.filter(item => {
const watchDate = new Date(item.watchTime)
watchDate.setHours(0, 0, 0, 0)
return watchDate.getTime() === today.get... | https://github.com/SMAT-Lab/PhantomRendering | 6c619a452113a0028c66945687f7b71a826ee39c | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | videoCropCenter | 视频居中裁剪(crop + 硬编码)
自动计算居中位置进行裁剪
@param input 输入视频路径
@param output 输出视频路径
@param width 裁剪宽度
@param height 裁剪高度
@param bitrate 可选码率参数,如 '1M', '500k'。不设置则使用编码器默认质量 | public static videoCropCenter(
input: string,
output: string,
width: number,
height: number,
bitrate?: string
): string[] {
const cmd: string[] = [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:(in_w-${width})/2:(in_h-${height})/2`,
'-c:v', FFmpegFactory.HW_C... | 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 videoCropCenter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left :... | public static videoCropCenter(
input: string,
output: string,
width: number,
height: number,
bitrate?: string
): string[] {
const cmd: string[] = [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:(in_w-${width})/2:(in_h-${height})/2`,
'-c:v', FFmpegFactory.HW_C... | https://github.com/jjjjjjava/ffmpeg_tools | 75f49cb360de5778381c3a28ba297468112ab674 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/LearningRecorder.ets | arkts | allStats | V0.6.4: cloud-sync read accessor. Mirrors `statsForTest` but
exposed under a non-test name so production code (CloudSyncService)
can call it without an obvious smell. | allStats(): WordStat[] {
return this.snapshot.stats.slice();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left allStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST... | allStats(): WordStat[] {
return this.snapshot.stats.slice();
} | https://github.com/terryma2024/happyword | ebf91cc4f4c78bec2370ede98b73f08730855ff5 | github |
LZZLHY/hlib | entry/src/main/ets/utils/PublicDownloadDir.ets | arkts | isPersistSupported | fileShare 持久化授权能力是否可用(syscap)。 | static isPersistSupported(): boolean {
return canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isPersistSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolea... | static isPersistSupported(): boolean {
return canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization');
} | https://github.com/LZZLHY/hlib | 360908e37c818e1e75443efcc3fda2eba92cdf95 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/JMap.ets | arkts | put | 向MAP中增加元素(key, value) | put(_key:T1, _value:T2):void {
this.elements.push(new Node<T1, T2>(_key, _value));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T1 AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST... | put(_key:T1, _value:T2):void {
this.elements.push(new Node<T1, T2>(_key, _value));
} | https://gitee.com/openharmony-sig/commons-cli.git | a95e1cb049fb190e5ecf24056f673041bb9ed8b9 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/GamepadManager.ets | arkts | handleButtonEvent | 处理手柄按键事件 | private handleButtonEvent(buttonCode: number, isDown: boolean): void {
const result: ProcessResult | null = this.inputProcessor.processGamepadButton(buttonCode, isDown)
if (result) {
this.dispatchResult(result)
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleButtonEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buttonCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS... | private handleButtonEvent(buttonCode: number, isDown: boolean): void {
const result: ProcessResult | null = this.inputProcessor.processGamepadButton(buttonCode, isDown)
if (result) {
this.dispatchResult(result)
}
} | https://github.com/richshaw2015/nds | 3588a4f3f660f1a0789d6e364df76e549ab3ddd6 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/TimeUtils.ets | arkts | parseUtcTime | 解析 UTC 时间字符串并转换为本地时间
Discourse API 返回的时间是 UTC 格式 | static parseUtcTime(timeString: string | null): Date | null {
if (timeString === null || timeString.length === 0) {
return null;
}
try {
const timestamp: number = Date.parse(timeString);
if (isNaN(timestamp)) {
return null;
}
return new Date(timestamp);
} catch (e... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseUtcTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left timeString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#st... | static parseUtcTime(timeString: string | null): Date | null {
if (timeString === null || timeString.length === 0) {
return null;
}
try {
const timestamp: number = Date.parse(timeString);
if (isNaN(timestamp)) {
return null;
}
return new Date(timestamp);
} catch (e... | https://github.com/Amaz1ny/HarmonyDO-public | edb34bea34a52d3e74bb8c96ed7792437d50793c | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Stack.ets | arkts | constructor | Creates a new instance of Stack. | public constructor() {
this.buffer = new Array<T>();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.buffer = new Array<T>();
} | https://gitcode.com/iop123123/arkts-static-skills | 4cf3b14dad2ea07b7c50da6110c4d8e49d89b913 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/beans/LocationParam.ets | arkts | getFileName | 获取文件名
@return string | public static getFileName(): string {
return LocationParam.getInstance().fileName || DateUtils.getCurrentDate();
} | 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 getFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getFileName(): string {
return LocationParam.getInstance().fileName || DateUtils.getCurrentDate();
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/beans/LocationParam.ets#L165-L167 | 4b9b4730e9935ac4e9c8c673443c7295cf9d1288 | github |
apap6628114/nga_oh | entry/src/main/ets/store/HistoryStore.ets | arkts | addFromThreadResult | 从帖子详情结果构造浏览历史并写入。
转换逻辑(threadInfo 优先、posts[0] 兜底、subject 空则不记录)逐字外迁自
ThreadPanel.recordBrowseHistory,行为保持等价。
@param uid - 当前用户 uid
@param result - getThread 返回的帖子详情结果
@param tid - 主题 tid | async addFromThreadResult(uid: string, result: ThreadResult, tid: string): Promise<void> {
const entry: BrowseHistoryEntry = new BrowseHistoryEntry()
entry.tid = tid
entry.board = result.forumName
if (result.threadInfo) {
const info: ThreadInfo = result.threadInfo
entry.subject = info.subj... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addFromThreadResult AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uid AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async addFromThreadResult(uid: string, result: ThreadResult, tid: string): Promise<void> {
const entry: BrowseHistoryEntry = new BrowseHistoryEntry()
entry.tid = tid
entry.board = result.forumName
if (result.threadInfo) {
const info: ThreadInfo = result.threadInfo
entry.subject = info.subj... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/HistoryStore.ets#L90-L110 | 1c8c4acaeba0c9294d89f1b17a654eb5c8a2c82b | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CloudCredentials.ets | arkts | load | Read the full snapshot. Empty fields when unbound. | async load(): Promise<CloudCredentialsSnapshot> {
const out: CloudCredentialsSnapshot = new CloudCredentialsSnapshot();
if (!this.ready || this.prefs === undefined) {
return out;
}
out.deviceToken = await this.prefs.getString(KEY_DEVICE_TOKEN);
out.bindingId = await this.prefs.getString(KEY_... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left load AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Le... | async load(): Promise<CloudCredentialsSnapshot> {
const out: CloudCredentialsSnapshot = new CloudCredentialsSnapshot();
if (!this.ready || this.prefs === undefined) {
return out;
}
out.deviceToken = await this.prefs.getString(KEY_DEVICE_TOKEN);
out.bindingId = await this.prefs.getString(KEY_... | https://github.com/terryma2024/happyword | 994805038553626a1a6ef0051438086e75e5de88 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | UTC | Returns the number of milliseconds elapsed since the epoch,
which is defined as the midnight at the beginning of January 1, 1970, UTC.
@param year to be converted to milliseconds.
@param month to be converted to milliseconds.
@returns A number representing the number of milliseconds elapsed since the epoch,
which is de... | public static UTC(year: long, month: long): long {
return ecmaMakeDate(ecmaMakeDay(year, month, 1 as long), ecmaMakeTime(0 as long, 0 as long, 0 as long, 0 as long))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left UTC AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#ide... | public static UTC(year: long, month: long): long {
return ecmaMakeDate(ecmaMakeDay(year, month, 1 as long), ecmaMakeTime(0 as long, 0 as long, 0 as long, 0 as long))
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 89749c627e70fdf6c12e95aaaa77e02df98bf7e8 | gitee |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | importStates | 导入用户状态数据 | importStates(states: Record<string, UserWordProgress>): void {
this.clearAllStates();
const keys: string[] = Object.keys(states);
for (let i: number = 0; i < keys.length; i++) {
const wordId: string = keys[i];
const progress: UserWordProgress = states[wordId];
if (this.isValidProgress(p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left importStates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left states AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record ... | importStates(states: Record<string, UserWordProgress>): void {
this.clearAllStates();
const keys: string[] = Object.keys(states);
for (let i: number = 0; i < keys.length; i++) {
const wordId: string = keys[i];
const progress: UserWordProgress = states[wordId];
if (this.isValidProgress(p... | https://github.com/CLMC2025/Vignette | 7e0c7eea848b1c293b534656e25a2c63bf1a5014 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | finishSideBarScroll | 结束侧边栏联动滚动
@returns {void} 无返回值 | finishSideBarScroll(): void {
this.isSideBarScrolling = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left finishSideBarScroll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statemen... | finishSideBarScroll(): void {
this.isSideBarScrolling = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS | d3d4eafbcab54999ddd17da97f4eeca4d10d2321 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/StringUtils.ets | arkts | snakeToCamel | snake_case 转 camelCase | static snakeToCamel(value: string): string {
if (value.length === 0) {
return value;
}
let result = '';
let capitalizeNext = false;
for (let i = 0; i < value.length; i++) {
const ch = value.charAt(i);
if (ch === '_') {
capitalizeNext = true;
} else if (capitalizeNex... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left snakeToCamel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static snakeToCamel(value: string): string {
if (value.length === 0) {
return value;
}
let result = '';
let capitalizeNext = false;
for (let i = 0; i < value.length; i++) {
const ch = value.charAt(i);
if (ch === '_') {
capitalizeNext = true;
} else if (capitalizeNex... | https://github.com/DaLongZhuaZi/NGF | 6d2830d3c1dcc32fb7c2dc842b6af3c00450caaa | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | addSourceToPinnedList | 添加图源到置顶列表 | async addSourceToPinnedList(sourceId: number): Promise<void> {
const pinnedList = await this.getSourcePinnedList();
if (!pinnedList.includes(sourceId)) {
pinnedList.unshift(sourceId); // 添加到开头
await this.setSourcePinnedList(pinnedList);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addSourceToPinnedList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AS... | async addSourceToPinnedList(sourceId: number): Promise<void> {
const pinnedList = await this.getSourcePinnedList();
if (!pinnedList.includes(sourceId)) {
pinnedList.unshift(sourceId); // 添加到开头
await this.setSourcePinnedList(pinnedList);
}
} | https://github.com/DaLongZhuaZi/manxia | 417b43928c040b6a4e9291f3daef54de99fc5bd7 | github |
daugf2527/harmonyos-libretro-emulator | entry/src/main/ets/common/RuntimeSessionController.ets | arkts | saveStateAsync | Async versions — offload heavy serialization/deserialization to
napi_async_work so the main thread is never blocked >500ms. | async saveStateAsync(): Promise<ArrayBuffer> {
if (!testNapi) {
LogHelper.warn('RuntimeSession', 'Save', '异步存档跳过: engine not ready')
throw new Error('engine not ready')
}
return nativeApi.refactoredSaveStateAsync()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveStateAsync AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ... | async saveStateAsync(): Promise<ArrayBuffer> {
if (!testNapi) {
LogHelper.warn('RuntimeSession', 'Save', '异步存档跳过: engine not ready')
throw new Error('engine not ready')
}
return nativeApi.refactoredSaveStateAsync()
} | https://github.com/daugf2527/harmonyos-libretro-emulator | 9c190c845f113248343a8f499e55a2e6b6d54582 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | getLatestLatency | 获取最近的延迟值 | getLatestLatency(): number {
if (this.latencyHistory.length === 0) return 0
return this.latencyHistory[this.latencyHistory.length - 1]
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLatestLatency 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#state... | getLatestLatency(): number {
if (this.latencyHistory.length === 0) return 0
return this.latencyHistory[this.latencyHistory.length - 1]
} | https://github.com/AetheriumSimulator/qemu-hmos | 37d7b364a09bae6dbde5bba1294e00e084288702 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/ui/SystemBarDemo.ets | arkts | disableImmersiveMode | 非沉浸式效果 | disableImmersiveMode() {
this.windowClass.setImmersiveModeEnabledState(false)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left disableImmersiveMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | disableImmersiveMode() {
this.windowClass.setImmersiveModeEnabledState(false)
} | https://github.com/webabcd/HarmonyDemo | b8fe6b7a634a233b1060fd29e04a9bff433e2e50 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getLightModeGlassBackgroundColor | 获取浅色主题下玻璃背景颜色(带透明度),统一全局风格 | public getLightModeGlassBackgroundColor(): string {
return this.getGlassBackgroundColorForLevel(GlassLevel.CARD);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLightModeGlassBackgroundColor 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#strin... | public getLightModeGlassBackgroundColor(): string {
return this.getGlassBackgroundColorForLevel(GlassLevel.CARD);
} | https://github.com/DaLongZhuaZi/manxia | 5b96325592ae9567a73031ef5aacd1ebefdf8d2a | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/managers/QemuVMManager.ets | arkts | pauseVM | 暂停虚拟机 | async pauseVM(vmId: string): Promise<PauseVMResult> {
try {
const response = await this.sendCommand({
command: 'pause_vm',
vmId: vmId
})
const result: PauseVMResult = { success: response.success, message: response.message }
return result
} catch (error) {
const re... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pauseVM AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left vmId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async pauseVM(vmId: string): Promise<PauseVMResult> {
try {
const response = await this.sendCommand({
command: 'pause_vm',
vmId: vmId
})
const result: PauseVMResult = { success: response.success, message: response.message }
return result
} catch (error) {
const re... | https://github.com/AetheriumSimulator/qemu-hmos | 36d5a3f58b34c25421a6ecec398fed60b21bd3eb | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_files_manager_old.ets | arkts | make_songs_cache | 建立歌曲缓存 // | async make_songs_cache() {
// 防重入:如果正在扫描中则直接忽略
if (this.is_scanning) {
log('make_songs_cache 已在运行中,忽略重复调用', 'warn')
return
}
this.is_scanning = true
try {
// 初始化数据库
log('初始化数据库...')
notice('初始化数据库...')
try {fs.rmdirSync(files_manager_path)} catch {}
fs.mkdirSync(... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left make_songs_cache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST... | async make_songs_cache() {
// 防重入:如果正在扫描中则直接忽略
if (this.is_scanning) {
log('make_songs_cache 已在运行中,忽略重复调用', 'warn')
return
}
this.is_scanning = true
try {
// 初始化数据库
log('初始化数据库...')
notice('初始化数据库...')
try {fs.rmdirSync(files_manager_path)} catch {}
fs.mkdirSync(... | https://github.com/Nekofox-POT/LinMusic | 77a915017fb40c78f9ba52f267896167cabb0e17 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/services/ExportService.ets | arkts | exportUserData | 导出用户数据
@param userId 用户ID
@param options 导出选项
@returns 导出文件路径 | static async exportUserData(userId: number, options: ExportOptions): Promise<string> {
try {
ExportService.logInfo(`开始导出用户数据: userId=${userId}, format=${options.format}, encrypt=${options.encrypt}`);
// 1. 收集用户数据
const dataContent = await ExportService.collectUserData(userId);
// 2. 生成导出... | 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 exportUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ... | static async exportUserData(userId: number, options: ExportOptions): Promise<string> {
try {
ExportService.logInfo(`开始导出用户数据: userId=${userId}, format=${options.format}, encrypt=${options.encrypt}`);
// 1. 收集用户数据
const dataContent = await ExportService.collectUserData(userId);
// 2. 生成导出... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 98b435653a29922336bf9533e490410b8758d187 | github |
harmonyos/codelabs | HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/GlobalInfoApi.ets | arkts | query | Query globalInfo.
@param callback | query(callback: Function): void {
let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count === 0) {
Logger.info('Glob... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#)#Left ) AST... | query(callback: Function): void {
let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count === 0) {
Logger.info('Glob... | https://gitee.com/harmonyos/codelabs.git | bdfc38e4ca3895cd7bb6204c5f96884646743096 | gitee |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/PreferenceDao.ets | arkts | get | 获取偏好设置
@param key 键
@param defaultValue 默认值
@returns Promise<string | number | boolean> 值 | async get(key: string, defaultValue: string | number | boolean = ''): Promise<string | number | boolean> {
await this.ensureInitialized();
try {
const value = await this.preference!.get(key, defaultValue);
Logger.debug(this.LOG_TAG, `Preference retrieved: ${key}`);
// 处理 bigint 类型
if... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | async get(key: string, defaultValue: string | number | boolean = ''): Promise<string | number | boolean> {
await this.ensureInitialized();
try {
const value = await this.preference!.get(key, defaultValue);
Logger.debug(this.LOG_TAG, `Preference retrieved: ${key}`);
// 处理 bigint 类型
if... | https://github.com/Kira-Yagami-Light/Kira-Projects | 47cabc9b0f4fcd0c64d7b32e26cda25484347e99 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/PackLibrary.ets | arkts | allPacks | Union the three layers, family-priority, with scene fallback. | allPacks(): Pack[] {
const builtinById: Map<string, Pack> = new Map<string, Pack>();
for (let i = 0; i < this.builtins.length; i++) {
builtinById.set(this.builtins[i].id, this.builtins[i]);
}
const out: Map<string, Pack> = new Map<string, Pack>();
for (let i = 0; i < this.builtins.length; i+... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left allPacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Pack AST#identifier#Rig... | allPacks(): Pack[] {
const builtinById: Map<string, Pack> = new Map<string, Pack>();
for (let i = 0; i < this.builtins.length; i++) {
builtinById.set(this.builtins[i].id, this.builtins[i]);
}
const out: Map<string, Pack> = new Map<string, Pack>();
for (let i = 0; i < this.builtins.length; i+... | https://github.com/terryma2024/happyword | c6bb12beccb24eab12283480e4ae4ad4df945aef | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getPrimaryTitleColor | 获取主标题颜色 | static getPrimaryTitleColor(): string {
return '#2C3E50';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPrimaryTitleColor 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 strin... | static getPrimaryTitleColor(): string {
return '#2C3E50';
} | https://github.com/chendi126/harmonyOS-TCP | 0a467255b0f1adcd34c1950c879ce2671d9c2eaf | github |
CLMC2025/Vignette | entry/src/main/ets/manager/SessionPlanner.ets | arkts | generateReinforcementTasks | 生成强化任务(遗忘后插入) | generateReinforcementTasks(word: WordItem, rating: Rating, allowOnPass: boolean = false): TaskItem[] {
const tasks: TaskItem[] = [];
// 只有 AGAIN 或 HARD 才生成强化任务
if (!allowOnPass && (rating === Rating.GOOD || rating === Rating.EASY)) {
return tasks;
}
// V1: 仅保留语境阅读强化任务
tasks.push(new Ta... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left generateReinforcementTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WordItem AST#i... | generateReinforcementTasks(word: WordItem, rating: Rating, allowOnPass: boolean = false): TaskItem[] {
const tasks: TaskItem[] = [];
// 只有 AGAIN 或 HARD 才生成强化任务
if (!allowOnPass && (rating === Rating.GOOD || rating === Rating.EASY)) {
return tasks;
}
// V1: 仅保留语境阅读强化任务
tasks.push(new Ta... | https://github.com/CLMC2025/Vignette | 5cd020a409a527e071be2ef61a1dbc563a792a0a | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/PlaylistManager.ets | arkts | togglePlayMode | 切换播放模式 | togglePlayMode(): PlayMode {
const modes = [PlayMode.SEQUENCE, PlayMode.LOOP_ONE, PlayMode.RANDOM];
const currentModeIndex = modes.indexOf(this.playMode);
this.playMode = modes[(currentModeIndex + 1) % modes.length];
this.saveData();
return this.playMode;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left togglePlayMode 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 PlayMode AST#identifier#Right AST#ERROR#Right A... | togglePlayMode(): PlayMode {
const modes = [PlayMode.SEQUENCE, PlayMode.LOOP_ONE, PlayMode.RANDOM];
const currentModeIndex = modes.indexOf(this.playMode);
this.playMode = modes[(currentModeIndex + 1) % modes.length];
this.saveData();
return this.playMode;
} | https://github.com/cpdd5201314/harmonyOS-music-app | 4973d907d4acbccc81aae5db0506827f222003b3 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/network/ApiService.ets | arkts | undislikeComment | 取消踩评论 | static async undislikeComment(commentId: number): Promise<ApiResponse> {
const response = await httpClient.delete(`/comments/${commentId}/dislike`);
const result = parseJsonSafe(response.data);
if (result) {
const data = result as Record<string, Object>;
const apiResponse = new ApiRespons... | 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 undislikeComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#Le... | static async undislikeComment(commentId: number): Promise<ApiResponse> {
const response = await httpClient.delete(`/comments/${commentId}/dislike`);
const result = parseJsonSafe(response.data);
if (result) {
const data = result as Record<string, Object>;
const apiResponse = new ApiRespons... | https://github.com/Harrisonls2004/WaterFlow | a20f9cecf5f95960c4fb5116104347f2cad56b5a | github |
YANGZX22/Voot | entry/src/main/ets/storage/OnboardingStorage.ets | arkts | clearVerifiedPhone | 清除已验证的手机号码
@param ctx UI Ability Context | static async clearVerifiedPhone(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_VERIFIED_PHONE, '');
await prefs.flush();
} | 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 clearVerifiedPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left :... | static async clearVerifiedPhone(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_VERIFIED_PHONE, '');
await prefs.flush();
} | https://github.com/YANGZX22/Voot | ae71a269cbe16d7b6b88d1777a2922a50b0b4ac7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | tryAsDouble | Attempts to get a double value from an object by key.
Returns undefined if the key is not found or if the value is not a double.
@param {string} key - The key to look up
@returns {double} The double value if found, undefined otherwise | tryAsDouble(): double | undefined {
if (this.jsonType != JsonType.JsonNumber) {
return undefined
}
let doubleValue = this.maybeDoubleValue
if (doubleValue != undefined) {
return doubleValue
}
let longValue = ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left tryAsDouble 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#identifie... | tryAsDouble(): double | undefined {
if (this.jsonType != JsonType.JsonNumber) {
return undefined
}
let doubleValue = this.maybeDoubleValue
if (doubleValue != undefined) {
return doubleValue
}
let longValue = ... | https://gitcode.com/iop123123/arkts-static-skills | e9cb48c6b6f9cbf6483a78b80a58f02a4bccbe24 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/data/RegionData.ets | arkts | getRegionValuePath | 根据省市区名称匹配级联值路径
@param {string} province - 省
@param {string} city - 市
@param {string} district - 区
@returns {Array<string>} 级联值路径 | static getRegionValuePath(province: string, city: string, district: string): Array<string> {
if (!province || !city || !district) {
return [];
}
const provinceNode = RegionData.findByText(REGION_OPTIONS, province);
if (!provinceNode || !provinceNode.children) {
return [];
}
const c... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRegionValuePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left province AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | static getRegionValuePath(province: string, city: string, district: string): Array<string> {
if (!province || !city || !district) {
return [];
}
const provinceNode = RegionData.findByText(REGION_OPTIONS, province);
if (!provinceNode || !provinceNode.children) {
return [];
}
const c... | https://github.com/Joker-x-dev/CoolMallArkTS | 07767d942b5966c0af64be6739008a805037c012 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | requestRepository | 重写请求方法来实现网络请求
@return 商品分类 | protected requestRepository(): Promise<NetworkResponse<Category[]>> {
return this.goodsRepository.getGoodsTypeList();
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestRepository 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... | protected requestRepository(): Promise<NetworkResponse<Category[]>> {
return this.goodsRepository.getGoodsTypeList();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 9ca1f5ca43bc3ad0d76bf2b6b6f1885fc942269e | github |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/request/GoodsCommentSubmitRequest.ets | arkts | constructor | @param {GoodsCommentSubmitRequest} init - 初始化数据 | constructor(init: GoodsCommentSubmitRequest) {
this.orderId = init.orderId;
this.data = new Comment(init.data);
} | 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 init AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GoodsCommentSubmitRequest AST... | constructor(init: GoodsCommentSubmitRequest) {
this.orderId = init.orderId;
this.data = new Comment(init.data);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 8bbd7c7b83e897dd4ae76a573cf24042bbb4f141 | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/SafeAreaUtils.ets | arkts | getTopSafeAreaInset | 获取安全区域顶部内边距 | public static getTopSafeAreaInset(): number {
return statusBarHeight;
} | 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 getTopSafeAreaInset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public static getTopSafeAreaInset(): number {
return statusBarHeight;
} | https://github.com/chendi126/harmonyOS-TCP | b9cc3d6a4d878fe165bdcbc8f03c388a089287c2 | github |
openharmony-sig/mars | entry/src/main/ets/pages/sample/SettingsActivity.ets | arkts | isXLargeTablet | Helper method to determine if the device has an extra-large screen. For
example, 10" tablets are extra-large. | public static isXLargeTablet(): boolean {
return 'tablet' == deviceInfo.deviceType;
} | 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 isXLargeTablet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static isXLargeTablet(): boolean {
return 'tablet' == deviceInfo.deviceType;
} | https://gitee.com/openharmony-sig/mars.git | b28b7af8d569f3dbaa247230cfbd772e5017d812 | gitee |
the-wwyang/kids-learning-app | src/main/ets/common/SecurityUtils.ets | arkts | sanitizeInput | 清理敏感字符(防止注入攻击) | static sanitizeInput(input: string): string {
// 移除特殊字符,防止SQL注入等攻击
return input.replace(/[<>'"]/g, '');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sanitizeInput 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#identifier#Left s... | static sanitizeInput(input: string): string {
// 移除特殊字符,防止SQL注入等攻击
return input.replace(/[<>'"]/g, '');
} | https://github.com/the-wwyang/kids-learning-app | 2d530343367a32812ab4cb05aa16b26257b1a35c | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/LoginStateManager.ets | arkts | loadLoginState | 从数据库加载登录状态 | private async loadLoginState(): Promise<void> {
if (!this.rdbStore) return;
const predicates = new relationalStore.RdbPredicates(LOGIN_STATE_KEY);
predicates.equalTo('key_name', LOGIN_STATE_KEY);
const resultSet = await this.rdbStore.query(predicates);
if (resultSet.rowCount > 0) {
resultS... | 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 loadLoginState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async loadLoginState(): Promise<void> {
if (!this.rdbStore) return;
const predicates = new relationalStore.RdbPredicates(LOGIN_STATE_KEY);
predicates.equalTo('key_name', LOGIN_STATE_KEY);
const resultSet = await this.rdbStore.query(predicates);
if (resultSet.rowCount > 0) {
resultS... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 542e13c43a756842db7a08ddf8c686346849933c | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/core/contracts/NGFServiceRegistration.ets | arkts | getMetadata | 获取服务元数据
@returns 服务的元数据信息 | getMetadata(): NGFServiceMetadataResult {
return new NGFServiceMetadataResult(this.token, this.implementationName);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMetadata 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 NGFServiceMetadataResult AST#identifier#Right AST#... | getMetadata(): NGFServiceMetadataResult {
return new NGFServiceMetadataResult(this.token, this.implementationName);
} | https://github.com/DaLongZhuaZi/NGF | 9024d41b4a2f4a7bc40112a06d197639ad84b020 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setArrowDownLeftRadius | 箭头底部左边弧度,单位:vp,气泡弹窗有效
@param arrowDownLeftRadius
@returns | setArrowDownLeftRadius(arrowDownLeftRadius: number): Builder {
this.popupConfig.arrowDownLeftRadius = arrowDownLeftRadius
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setArrowDownLeftRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arrowDownLeftRadius AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Righ... | setArrowDownLeftRadius(arrowDownLeftRadius: number): Builder {
this.popupConfig.arrowDownLeftRadius = arrowDownLeftRadius
return this
} | https://github.com/wuba/omni-ui | 0db852fdf16eef03880fb27ab44ed0dbbb1b4c74 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | updateWebViewController | 更新WebView控制器(修复:页面返回后WebView失效) | updateWebViewController(controller: webview.WebviewController): void {
this.webviewController = controller;
this.antiCrawler.updateWebViewController(controller);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateWebViewController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left controller AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left webview AST#ide... | updateWebViewController(controller: webview.WebviewController): void {
this.webviewController = controller;
this.antiCrawler.updateWebViewController(controller);
} | https://github.com/DaLongZhuaZi/manxia | f68db4a39a2c3d5a274f9ce6f8a19494774220d2 | github |
OpenHarmonyPCDeveloper/GitNext | entry/src/main/ets/utils/DebounceSingletonUtil.ets | arkts | isDebounced | 防抖:限制同名操作在指定时间内只能执行一次 | public isDebounced(operationName: string, milliseconds: number): boolean {
const now = Date.now();
const lastExecutionTime = DebounceSingletonUtil.methodsMap.get(operationName);
if (lastExecutionTime && (now - lastExecutionTime) < milliseconds) {
return true;
} else {
DebounceSingletonUti... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDebounced AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operationName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | public isDebounced(operationName: string, milliseconds: number): boolean {
const now = Date.now();
const lastExecutionTime = DebounceSingletonUtil.methodsMap.get(operationName);
if (lastExecutionTime && (now - lastExecutionTime) < milliseconds) {
return true;
} else {
DebounceSingletonUti... | https://gitcode.com/OpenHarmonyPCDeveloper/GitNext | 0c9b43c27355a9e0369467f11dd2220521735d34 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getConstructor | Returns ith constructor of this class
@param {long} i index
@throws {TypeError} then i greater then number of constructors
@returns {Method} instance representing ith constructor
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getConstructor(i: long): Method {
const td = TypeAPI.getConstructorDescriptor(this.cls, i)
if (td) {
const methodType = Type.resolve(td, this.getContextLinker())! as MethodType
const ownerClass = TypeAPI.getDeclaringClassImpl(methodType)!
const ownerType = ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getConstructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long... | public getConstructor(i: long): Method {
const td = TypeAPI.getConstructorDescriptor(this.cls, i)
if (td) {
const methodType = Type.resolve(td, this.getContextLinker())! as MethodType
const ownerClass = TypeAPI.getDeclaringClassImpl(methodType)!
const ownerType = ... | https://gitcode.com/iop123123/arkts-static-skills | 5ca3b7debc633fc27d3419f155418ce805708f46 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/infomsg/InfoMsgController.ets | arkts | clickToDelete | Delete a single piece of information from a notification. | clickToDelete() {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickToDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | clickToDelete() {
} | https://gitee.com/openharmony/applications_mms.git | 0aef91be147cc40006ea91bfeaed4045d07783a2 | gitee |
arkui-x/samples | CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets | arkts | offCallback | 取消针对eventId为1234565的事件的订阅 | offCallback(): void {
emitter.off(this.callbackEvent.eventId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left offCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#... | offCallback(): void {
emitter.off(this.callbackEvent.eventId);
} | https://gitcode.com/arkui-x/samples | e27a4c61204fbe9c37c2641c4cfbaaf2869d94d5 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/Preferences/entry/src/main/ets/model/PreferenceModel.ets | arkts | putPreference | Save the data to the Preferences.
@param fruit Fruit data. | async putPreference(fruit: Fruit) {
if (!preference) {
await this.getPreferencesFromStorage();
}
// The fruit name and fruit quantity data entered by the user are saved to the cached Preference instance.
try {
await preference.put(CommonConstants.KEY_NAME, JSON.stringify(fruit));
} cat... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left putPreference AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fruit AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async putPreference(fruit: Fruit) {
if (!preference) {
await this.getPreferencesFromStorage();
}
// The fruit name and fruit quantity data entered by the user are saved to the cached Preference instance.
try {
await preference.put(CommonConstants.KEY_NAME, JSON.stringify(fruit));
} cat... | https://gitee.com/harmonyos/codelabs.git | 0fb059375da4f51799741acd4386f0a2ce33887b | gitee |
openharmony-sig/ohos_byte_global_viewpool | byte_global_viewpool/src/main/ets/ViewPoolManager.ets | arkts | preCreateBuilderSplitTask | @description 任务拆帧方式预创建组件节点,下次使用快速复用。
@param uiContext 组件的上下文,与WindowStage绑定,即窗口。
@param builder 组件全局创建Builder入口
@param data 这个需要重点关注,需要构建一个空的ViewModel对象,否则会崩溃
@param type 复用的类型
@param count 预创建的数量,默认为1
@param isMeasure 是否主动调用framenode.measure,默认为false。 | preCreateBuilderSplitTask(uiContext: UIContext, builder: WrappedBuilder<ESObject>, data: ESObject, type: string, count: number = 1, isMeasure: boolean = false) {
if (!this.isEnable) return
if (count > 0) {
let list = new ArrayList<()=>void>()
for (let i = 0; i < count; i++) {
list.add(()=>... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left preCreateBuilderSplitTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIContext ... | preCreateBuilderSplitTask(uiContext: UIContext, builder: WrappedBuilder<ESObject>, data: ESObject, type: string, count: number = 1, isMeasure: boolean = false) {
if (!this.isEnable) return
if (count > 0) {
let list = new ArrayList<()=>void>()
for (let i = 0; i < count; i++) {
list.add(()=>... | https://gitee.com/openharmony-sig/ohos_byte_global_viewpool.git | 5cc2afe2affff4f7bf6b3a9b7a0e29fe9be1320d | gitee |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F002_state_management/entry/src/main/ets/components/CounterCard.ets | arkts | aboutToAppear | 组件即将出现时初始化本地计数 | aboutToAppear(): void {
this.localCount = this.initialCount;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
this.localCount = this.initialCount;
} | https://github.com/mqxu/HarmonyOS_In_Action | 2e865235ba71ee769b3109776680dc7edcf0bfbc | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/products/phone/src/main/ets/pages/SplashPage.ets | arkts | checkIsFirstStart | Check wether is opened for the first time. | checkIsFirstStart(): void {
this.preferenceManager.hasValue('isFirstStart').then((hasResult: boolean) => {
if (hasResult) {
Logger.info(TAG, 'Not first startup.');
this.firstStart = false;
} else {
Logger.info(TAG, 'First startup.');
this.requestNotification();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkIsFirstStart 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_... | checkIsFirstStart(): void {
this.preferenceManager.hasValue('isFirstStart').then((hasResult: boolean) => {
if (hasResult) {
Logger.info(TAG, 'Not first startup.');
this.firstStart = false;
} else {
Logger.info(TAG, 'First startup.');
this.requestNotification();
... | https://gitcode.com/HarmonyOS_Samples/hmosworld | 3e292a5a777aae99d330b50fd491de426a8480dc | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/workers/DatabaseLoadWorkerParam.ets | arkts | byDbFileParam | 通过 DbFileParam 初始化
@param dbFileParam
@returns | public static byDbFileParam(dbFileParam: DbFileParam): LoadDatabase {
return new LoadDatabase(
dbFileParam.filePath,
dbFileParam.fileName,
dbFileParam.password,
dbFileParam.authType,
dbFileParam.keyLocation,
dbFileParam.storageType,
dbFileParam.storageConfig
);
} | 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 byDbFileParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dbFileParam AST#identifier#Right AST#:#Le... | public static byDbFileParam(dbFileParam: DbFileParam): LoadDatabase {
return new LoadDatabase(
dbFileParam.filePath,
dbFileParam.fileName,
dbFileParam.password,
dbFileParam.authType,
dbFileParam.keyLocation,
dbFileParam.storageType,
dbFileParam.storageConfig
);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/workers/DatabaseLoadWorkerParam.ets#L55-L65 | 973f0b3c11b0e005b8710a512275afb0e10f4a18 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | asin | Return a new Decimal whose value is the arcsine in radians of `n`, rounded to `precision`
significant digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | static asin(n: Value): Decimal {
return new Decimal(n).asin();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left asin AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | static asin(n: Value): Decimal {
return new Decimal(n).asin();
} | https://gitcode.com/iop123123/arkts-static-skills | 3d7ccea36592e9f86e9daf45fe26f94f076e01ee | gitcode |
openharmony-sig/ohos_easyui | entry/src/main/ets/pages/TestContact.ets | arkts | contactListValue | 不可编辑组件属性 | contactListValue(){
this.contactName = this.contactListName
this.contactTel = this.contactListTel
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left contactListValue 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#L... | contactListValue(){
this.contactName = this.contactListName
this.contactTel = this.contactListTel
} | https://gitee.com/openharmony-sig/ohos_easyui.git | a33e8bee4d8cedb68d21bcda667aac43c4534d30 | gitee |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets | arkts | offDataCleared | 移除数据清空监听 | offDataCleared(callback: () => void): void {
const index = this.clearListeners.indexOf(callback);
if (index > -1) {
console.info('ItemStore: 移除数据清空监听器');
this.clearListeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#identifier#Left offDataCleared AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arg... | offDataCleared(callback: () => void): void {
const index = this.clearListeners.indexOf(callback);
if (index > -1) {
console.info('ItemStore: 移除数据清空监听器');
this.clearListeners.splice(index, 1);
}
} | https://gitcode.com/openharmony/codelabs | a4a3b0f7fc01b95e777a8b7d00292bb18ee9f10e | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets | arkts | currentTabSearchLast | Go to last search result on current tab. | currentTabSearchLast() {
if (!this.currentTab) {
meow(`No current tab found!`, 'meowTabBunch][currentTabSearchLast', meowLevel.WARN);
return;
}
this.currentTab.searchLast();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left currentTabSearchLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | currentTabSearchLast() {
if (!this.currentTab) {
meow(`No current tab found!`, 'meowTabBunch][currentTabSearchLast', meowLevel.WARN);
return;
}
this.currentTab.searchLast();
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | c8fc2d1e0024a381b424c3f7247975408da8584a | github |
HarmonyOS_Samples/BestPracticeSnippets | NdkDrawing/entry/src/main/ets/pages/Index.ets | arkts | draw | background image | draw(context: DrawContext): void {
// Call the Native onDraw interface on the native side to draw, and pass in the background image this.pMap and the graphic drawing context as parameters
testNapi.nativeOnDraw(666, context, uiContext?.vp2px(this.size.width), uiContext?.vp2px(this.size.height),
this.draw... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left draw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DrawContext AST#identifier#Right AST#)#Left ) AS... | draw(context: DrawContext): void {
// Call the Native onDraw interface on the native side to draw, and pass in the background image this.pMap and the graphic drawing context as parameters
testNapi.nativeOnDraw(666, context, uiContext?.vp2px(this.size.width), uiContext?.vp2px(this.size.height),
this.draw... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 4fa70cb0f81f26e3f60bd858da478ce7413be70d | gitcode |
openharmony/codelabs | ETSUI/ChatAppDemo/entry/src/main/ets/utils/FriendHandler.ets | arkts | getMyRequests | 获取发给我的所有申请 | async getMyRequests(myPhone: string): Promise<FriendRequestModel[]> {
let predicates = new relationalStore.RdbPredicates('FriendRequest');
predicates.equalTo('toPhone', myPhone);
let list: FriendRequestModel[] = [];
try {
let resultSet = await this.store.query(predicates);
while (resultSe... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getMyRequests AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left myPhone AST#identifier#Right AST#type_annotation#Left AS... | async getMyRequests(myPhone: string): Promise<FriendRequestModel[]> {
let predicates = new relationalStore.RdbPredicates('FriendRequest');
predicates.equalTo('toPhone', myPhone);
let list: FriendRequestModel[] = [];
try {
let resultSet = await this.store.query(predicates);
while (resultSe... | https://gitcode.com/openharmony/codelabs | 9a47df3b5548e020a4a7391c64691013271d2df0 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | sharedArticleList | 自己的分享的文章列表
https://wanandroid.com/user/lg/private_articles/{index}/json
@param index 页码,从1开始 | public sharedArticleList(index: number): Promise<AxiosResponse<IWanCommonResponse<IShareArticleList>>> {
return this.getRequest(
"/user/lg/private_articles/" + index + "/json"
)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sharedArticleList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public sharedArticleList(index: number): Promise<AxiosResponse<IWanCommonResponse<IShareArticleList>>> {
return this.getRequest(
"/user/lg/private_articles/" + index + "/json"
)
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 2228c2ea8e7488c6e44e06951bc44b594958e187 | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/image/Avatar.ets | arkts | build | 构建头像组件
@returns {void} 无返回值 | build(): void {
IBestAvatar({
src: this.src,
shape: "circle",
avatarSize: this.avatarSize,
onAvatarClick: (): void => this.handleAvatarTap()
});
} | 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 {
IBestAvatar({
src: this.src,
shape: "circle",
avatarSize: this.avatarSize,
onAvatarClick: (): void => this.handleAvatarTap()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | b810732b704254180bc9a67312519024977fa48a | github |
the-wwyang/kids-learning-app | src/main/ets/services/StatisticsService.ets | arkts | generateWeeklyReport | 生成周报告
@param dailyRecords 每日记录
@param typeStats 题型统计
@param difficultyStats 难度统计
@returns 学习报告 | static generateWeeklyReport(
dailyRecords: DailyRecord[],
typeStats: QuestionTypeStats[],
difficultyStats: DifficultyStats[]
): LearningReport {
const now = new Date();
const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
const endDate = now.toISOString().split('T')[0];
co... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateWeeklyReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dailyRecords AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#sub... | static generateWeeklyReport(
dailyRecords: DailyRecord[],
typeStats: QuestionTypeStats[],
difficultyStats: DifficultyStats[]
): LearningReport {
const now = new Date();
const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
const endDate = now.toISOString().split('T')[0];
co... | https://github.com/the-wwyang/kids-learning-app | 6ff21bb189cd71e2d69a0f3724c2bc5ea7d53bd6 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setKeepPositionOnRotation | Sets whether the chart should keep its position (zoom / scroll) after a rotation (orientation change) | public setKeepPositionOnRotation(keepPositionOnRotation: boolean): void {
this.mKeepPositionOnRotation = keepPositionOnRotation;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setKeepPositionOnRotation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keepPositionOnRotation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#bool... | public setKeepPositionOnRotation(keepPositionOnRotation: boolean): void {
this.mKeepPositionOnRotation = keepPositionOnRotation;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e8d15f885a4879ac62b4d8b21e0f45c6404122b0 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test50_original_index.ets | arkts | digitSum | --- Digit sum with loop --- | function digitSum(n: number): number {
let sum: number = 0;
let num: number = n;
while (num > 0) {
sum = sum + (num % 10);
num = Math.floor(num / 10);
}
return sum;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left digitSum AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function digitSum(n: number): number {
let sum: number = 0;
let num: number = n;
while (num > 0) {
sum = sum + (num % 10);
num = Math.floor(num / 10);
}
return sum;
} | https://github.com/miaochiahao/ark-ghidra | b7e950af16257da3a052cc5151460a9995655afa | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | password | Sets the password portion of the URL.
@param { string } input - The password portion of the URL. | set password(input: string) {
if (this.cHost == null || this.cHost == '' || this.cProtocol == 'file:') {
return;
}
this.urlInner.setPassword(fixIllegalString(input));
this.cPassword = this.urlInner.getPassword();
this.setHref();
... | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left password 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#identifier#Left string AST#iden... | set password(input: string) {
if (this.cHost == null || this.cHost == '' || this.cProtocol == 'file:') {
return;
}
this.urlInner.setPassword(fixIllegalString(input));
this.cPassword = this.urlInner.getPassword();
this.setHref();
... | https://gitcode.com/iop123123/arkts-static-skills | 08793462702df9887067f5fb1ceea79ed10e4b4d | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | findLast | Iterates the array in reverse order and returns the value of the first element
that satisfies the provided testing function
@param fn testing function
@param thisArg an Array to search
@returns found element or null otherwise | public static findLast<T>(fn: (elem: T) => boolean, thisArg: Array<T>): T | null {
for (let i = thisArg.data.length - 1; i >= 0; i--) {
if (fn(thisArg.data[i])) {
return thisArg.data[i];
}
}
return null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AS... | public static findLast<T>(fn: (elem: T) => boolean, thisArg: Array<T>): T | null {
for (let i = thisArg.data.length - 1; i >= 0; i--) {
if (fn(thisArg.data[i])) {
return thisArg.data[i];
}
}
return null;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 57074d8534c3435a03504f2de2d523207e3ffef1 | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/DataManager.ets | arkts | init | 初始化数据存储 | async init(context: Context): Promise<void> {
try {
this.dataPreferences = await preferences.getPreferences(context, PREFERENCES_NAME);
} catch (error) {
console.error('初始化Preferences失败:', JSON.stringify(error));
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async init(context: Context): Promise<void> {
try {
this.dataPreferences = await preferences.getPreferences(context, PREFERENCES_NAME);
} catch (error) {
console.error('初始化Preferences失败:', JSON.stringify(error));
}
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 72606ce930e996c458b304ba89077561603e7fda | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | createQueryBuilder | 创建查询构建器
@returns QueryBuilder 实例 | createQueryBuilder(): QueryBuilder {
return new QueryBuilder(this.entityName)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createQueryBuilder 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 QueryBuilder AST#identifier#Right AST#ERROR... | createQueryBuilder(): QueryBuilder {
return new QueryBuilder(this.entityName)
} | https://github.com/offlinecat-dev/OCNetORM | 5a9d70960e6b3701039a4149d00875e0d3d78046 | github |
openharmony/communication_wifi | wifi/test/wifi_testapp/entry/src/main/ets/pages/subAppTest/wifiCandidateTest.ets | arkts | saveTask | Save the progress value and update time after you click OK in the dialog box.
@param context context from view.
@param value Latest Progress Value. | saveTask(wifiCandidateConfig: wifiManager.WifiDeviceConfig) {
if ( wifiCandidateConfig.ssid === '' ) {
promptAction.showToast({
message : $r('app.string.cannot_input_empty') ,
duration : CommonConstants.TOAST_TIME ,
bottom : CommonConstants.TOAST_MARGIN_BOTTOM
});
return;... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left wifiCandidateConfig AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left wifiMa... | saveTask(wifiCandidateConfig: wifiManager.WifiDeviceConfig) {
if ( wifiCandidateConfig.ssid === '' ) {
promptAction.showToast({
message : $r('app.string.cannot_input_empty') ,
duration : CommonConstants.TOAST_TIME ,
bottom : CommonConstants.TOAST_MARGIN_BOTTOM
});
return;... | https://gitee.com/openharmony/communication_wifi.git | 4d45028f01fdb99d87583f7d4bc1e89979c93e1c | gitee |
openharmony/applications_calendar_data | dataprovider/src/main/ets/DataShareAbilityAuthenticateProxy.ets | arkts | dataOperateSelectorByHighAuthority | Perform database operations corresponding to high-level permissions
@Param uri indicates user's input uri
@Param dataParameter indicates database operation information to be performed | async function dataOperateSelectorByHighAuthority(uri: string, dataParameter: DataParameter) {
let operationName = dataParameter.operationName;
let columns = dataParameter.columns;
let predicates = dataParameter.predicates;
let value = dataParameter.value;
let callback = dataParameter.callback;
switch (oper... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left dataOperateSelectorByHighAuthority AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uri AST#identi... | async function dataOperateSelectorByHighAuthority(uri: string, dataParameter: DataParameter) {
let operationName = dataParameter.operationName;
let columns = dataParameter.columns;
let predicates = dataParameter.predicates;
let value = dataParameter.value;
let callback = dataParameter.callback;
switch (oper... | https://gitee.com/openharmony/applications_calendar_data.git | 236aff984ef695e3fda49f53f570e5a263418e68 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/RegExp.ets | arkts | get | Returns result string by index
@param index
@returns resulting string | public get(index: number): String {
return this.get(index as int);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public get(index: number): String {
return this.get(index as int);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 35179172e2201178471950fbb72c77b00ee438d2 | gitee |
openharmony/vendor_unionman | unionpi_tiger/sample_api10/app/i2c_app/entry/src/main/ets/pages/second.ets | arkts | ButtonStyle | 自定义按钮组件 | @Extend(Button)
function ButtonStyle() {
.fontSize(15)
.fontWeight(FontWeight.Bold)
.fontStyle(FontStyle.Italic)
.type(ButtonType.Capsule)
.backgroundColor('#0D9FFB')
} | 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 Button AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | @Extend(Button)
function ButtonStyle() {
.fontSize(15)
.fontWeight(FontWeight.Bold)
.fontStyle(FontStyle.Italic)
.type(ButtonType.Capsule)
.backgroundColor('#0D9FFB')
} | https://gitee.com/openharmony/vendor_unionman.git | 669368201790575ce1dce5cdc725255762d290d8 | gitee |
openharmony-sig/qr-code-generator | library/src/main/ets/components/MainPage/qrcodegen.ets | arkts | getNumRawDataModules | Returns the number of data bits that can be stored in a QR Code of the given version number, after
all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table. | private static getNumRawDataModules(ver: int): int {
if (ver < QrCode.MIN_VERSION || ver > QrCode.MAX_VERSION)
throw new Error("Version number out of range");
let result: int = (16 * ver + 128) * ver + 64;
if (ver >= 2) {
const numAlign: int = Math.floor(ver / 7) + 2;
result ... | 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 getNumRawDataModules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ver AST#identifier#Right AST#:#... | private static getNumRawDataModules(ver: int): int {
if (ver < QrCode.MIN_VERSION || ver > QrCode.MAX_VERSION)
throw new Error("Version number out of range");
let result: int = (16 * ver + 128) * ver + 64;
if (ver >= 2) {
const numAlign: int = Math.floor(ver / 7) + 2;
result ... | https://gitee.com/openharmony-sig/qr-code-generator.git | 1cc3fe58d70d433785a3a83bb765ebad4fc008e2 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheConstants.ets | arkts | getForceRefresh | 获取强制刷新标志
@returns 是否强制刷新 | static getForceRefresh(): boolean {
return AppStorage.get<boolean>(CacheConstants.FORCE_REFRESH_KEY) ?? false;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getForceRefresh 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 A... | static getForceRefresh(): boolean {
return AppStorage.get<boolean>(CacheConstants.FORCE_REFRESH_KEY) ?? false;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L179-L181 | e7120007c66b6a92222fc25bcee827a0d3d3355f | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test46_original_index.ets | arkts | testSetFromArray | --- Set from array --- | function testSetFromArray(): string {
let nums: number[] = [1, 2, 3, 2, 1, 4, 3, 5];
let unique: Set<number> = new Set(nums);
let result: number[] = [];
unique.forEach((v: number): void => {
result.push(v);
});
return String(unique.size) + ',' + String(result.length);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSetFromArray 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... | function testSetFromArray(): string {
let nums: number[] = [1, 2, 3, 2, 1, 4, 3, 5];
let unique: Set<number> = new Set(nums);
let result: number[] = [];
unique.forEach((v: number): void => {
result.push(v);
});
return String(unique.size) + ',' + String(result.length);
} | https://github.com/miaochiahao/ark-ghidra | a8be028493d1ccba229f9bd141c10dca588f546e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportMangaLibrary | 导出漫画库
[修复] 从favorite表获取收藏状态和阅读进度,从read_history获取章节阅读状态 | private async exportMangaLibrary(): Promise<MangaBackupItem[]> {
try {
const sql = 'SELECT * FROM comic_info';
const results = await this.dbManager.querySql(sql);
const backupItems: MangaBackupItem[] = [];
for (const record of results) {
const manga = record as Record<string... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left exportMangaLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async exportMangaLibrary(): Promise<MangaBackupItem[]> {
try {
const sql = 'SELECT * FROM comic_info';
const results = await this.dbManager.querySql(sql);
const backupItems: MangaBackupItem[] = [];
for (const record of results) {
const manga = record as Record<string... | https://github.com/DaLongZhuaZi/manxia | d8023efcbd6b9590d8eb4c81c2485dddfa4b4530 | github |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/manager/WorldClockManager.ets | arkts | getWorldClockListFromResultSet | get world clock list from result set
@param the result set returned from querying database
@return world clock object array | async getWorldClockListFromResultSet(resultSet: rdb.ResultSet): Promise<WorldClockInfo[]> {
const worldClockList: WorldClockInfo[] = [];
while (resultSet.goToNextRow()) {
const worldClockInfo: WorldClockInfo = {
id: resultSet.getString(resultSet.getColumnIndex('ID')),
sortOrder: resultSe... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getWorldClockListFromResultSet AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resultSet AST#identifier#Right AST#type_annotati... | async getWorldClockListFromResultSet(resultSet: rdb.ResultSet): Promise<WorldClockInfo[]> {
const worldClockList: WorldClockInfo[] = [];
while (resultSet.goToNextRow()) {
const worldClockInfo: WorldClockInfo = {
id: resultSet.getString(resultSet.getColumnIndex('ID')),
sortOrder: resultSe... | https://gitee.com/openharmony-sig/applications_clock.git | a4629aa613348a3a3162818b4d0c8806502deb2b | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | calculateArrowDirection | 计算箭头方向 | private calculateArrowDirection(from: Position3D, to: Position3D): number {
const dx = to.x - from.x;
const dz = to.z - from.z;
const angle = Math.atan2(dx, dz) * (180 / Math.PI);
return (angle + 360) % 360;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateArrowDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private calculateArrowDirection(from: Position3D, to: Position3D): number {
const dx = to.x - from.x;
const dz = to.z - from.z;
const angle = Math.atan2(dx, dz) * (180 / Math.PI);
return (angle + 360) % 360;
} | https://github.com/LJ666-ui/harmony-health-care | 6abea649d0ca57f1f0ee34a505f8a2dd8ffb9e30 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | map | Creates a new Float32Array using fn(arr[i]) over all elements of current Float32Array
@param fn a function to apply for each element of current Float32Array
@returns a new Float32Array where for each element from current Float32Array fn was applied | public map(fn: (val: float) => float): Float32Array {
let newF: (val: float, index: int) => float =
(val: float, index: int): float => { return fn(val) }
return this.map(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: float) => float): Float32Array {
let newF: (val: float, index: int) => float =
(val: float, index: int): float => { return fn(val) }
return this.map(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 058efc257544a37bf58f22c135bbfb6709a4baea | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/pages/MainPage.ets | arkts | formatSleepTimer | 格式化睡眠定时器剩余时间 | formatSleepTimer(seconds: number): string {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
if (mins > 0) {
return `${mins}:${secs.toString().padStart(2, '0')}`;
} else {
return `${secs}s`;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatSleepTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST... | formatSleepTimer(seconds: number): string {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
if (mins > 0) {
return `${mins}:${secs.toString().padStart(2, '0')}`;
} else {
return `${secs}s`;
}
} | https://github.com/pangpang20/antennaPodHM | acfedf6b00be57feb9dd6085e5f37b220ccafe7f | github |
offlinecat-dev/OCNetORM | src/main/ets/core/MetadataStorage.ets | arkts | registerInstanceMapping | 注册实例与实体名的映射关系
用于通过实例获取元数据
@param instanceId 实例标识符
@param entityName 实体类名 | registerInstanceMapping(instanceId: string, entityName: string): void {
this.getEntityOrThrow(entityName)
this.instanceEntityMap.set(instanceId, entityName)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerInstanceMapping AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left instanceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#... | registerInstanceMapping(instanceId: string, entityName: string): void {
this.getEntityOrThrow(entityName)
this.instanceEntityMap.set(instanceId, entityName)
} | https://github.com/offlinecat-dev/OCNetORM | 62e40ad6f544e56c435e81b41977693403970c1a | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test16_original_index.ets | arkts | testMatrixTranspose | --- Matrix transpose --- | function testMatrixTranspose(): string {
let matrix: number[][] = [[1, 2, 3], [4, 5, 6]];
let rows: number = 2;
let cols: number = 3;
let transposed: number[][] = [];
for (let i: number = 0; i < cols; i++) {
let newRow: number[] = [];
for (let j: number = 0; j < rows; j++) {
newRow.push(matrix[j... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMatrixTranspose AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefi... | function testMatrixTranspose(): string {
let matrix: number[][] = [[1, 2, 3], [4, 5, 6]];
let rows: number = 2;
let cols: number = 3;
let transposed: number[][] = [];
for (let i: number = 0; i < cols; i++) {
let newRow: number[] = [];
for (let j: number = 0; j < rows; j++) {
newRow.push(matrix[j... | https://github.com/miaochiahao/ark-ghidra | 0083c27f752d362ee2b22c13110556bdbc5f6e3e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | disable | 禁用性能数据收集 | public disable(): void {
if (!this.isEnabled) {
return;
}
this.isEnabled = false;
this.stopAutoCollection();
logger.info(HIDEBUG_COLLECTOR_TAG, '性能数据收集已禁用');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left disable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta... | public disable(): void {
if (!this.isEnabled) {
return;
}
this.isEnabled = false;
this.stopAutoCollection();
logger.info(HIDEBUG_COLLECTOR_TAG, '性能数据收集已禁用');
} | https://github.com/DaLongZhuaZi/manxia | bf9443f692b3269122a6ebeab5ea919c25040330 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/subtraction/subtraction_ushort.ets | arkts | main | ---
desc: check subtraction of two unsigned short integers
--- | function main(): void {
const a: ushort = {{v.left}}
const b: ushort = {{v.right}}
assert (a - b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ushort = {{v.left}}
const b: ushort = {{v.right}}
assert (a - b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 120403e264bc5d680dca6c2582bdeb4a753423d7 | gitee |
openharmony/arkui_ace_engine | examples/Animation/entry/src/main/ets/pages/transition/transition3.ets | arkts | <arrow> | 结束回调设置在消失的第一层节点上,确保能有消失的结束回调 | (transitionIn: boolean) => {
console.info("transition finish, transitionIn:" + transitionIn);
} | AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left transitionIn AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#boolean#Left boolean AST#boolean#Rig... | (transitionIn: boolean) => {
console.info("transition finish, transitionIn:" + transitionIn);
} | https://gitcode.com/openharmony/arkui_ace_engine | 7e927ee269eb4d29ff91f29607fd34a2936a8bd7 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/pages/IntroductionPage.ets | arkts | scrollToTop | Click the up arrow scroll to the beginning. | scrollToTop() {
if (this.listPosition !== Const.LIST_POSITION_BEGIN) {
this.scrollerForList.scrollTo({
xOffset: 0,
yOffset: Const.SCROLL_UP_TOP_THRESHOLD,
animation: {
duration: this.offsetSum / Const.OFFSET_DIVIDE_RATIO,
curve: Curve.Linear,
}
})
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left scrollToTop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | scrollToTop() {
if (this.listPosition !== Const.LIST_POSITION_BEGIN) {
this.scrollerForList.scrollTo({
xOffset: 0,
yOffset: Const.SCROLL_UP_TOP_THRESHOLD,
animation: {
duration: this.offsetSum / Const.OFFSET_DIVIDE_RATIO,
curve: Curve.Linear,
}
})
... | https://gitee.com/harmonyos/codelabs.git | 1745efe909265893e86cf2dc1d6f0d4cfc0be612 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | isLoggedIn | 检查书源是否已登录 | isLoggedIn(sourceId: string): boolean {
const status = this.loginStatus.get(sourceId);
return status?.isLoggedIn ?? false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLoggedIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | isLoggedIn(sourceId: string): boolean {
const status = this.loginStatus.get(sourceId);
return status?.isLoggedIn ?? false;
} | https://github.com/DaLongZhuaZi/manxia | 98d375ff28b205ab9d12a435808a68ccd81c465e | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | isDeviated | 检查是否偏航 | private isDeviated(currentPosition: Position3D): boolean {
if (!this.navigationState.currentPath) return false;
// 计算到路径的距离
const distanceToPath = this.calculateDistanceToPath(currentPosition);
return distanceToPath > this.deviationThreshold;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isDeviated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPosition AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Positio... | private isDeviated(currentPosition: Position3D): boolean {
if (!this.navigationState.currentPath) return false;
// 计算到路径的距离
const distanceToPath = this.calculateDistanceToPath(currentPosition);
return distanceToPath > this.deviationThreshold;
} | https://github.com/LJ666-ui/harmony-health-care | 0bd7112dc66aa4dd0aa30aa00f091cd70ba3c584 | github |
openharmony/update_update_app | feature/ota/src/main/ets/OtaPage.ets | arkts | getNewVersionPageInfo | 取新版本数据
@param versionComponents 升级包
@param componentDescriptions 更新日志
@return Promise<VersionPageInfo> 具体的新版本数据 | public async getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions?: Array<update.ComponentDescription>): Promise<VersionPageInfo> {
let component: update.VersionComponent = versionComponents.filter((component: update.VersionComponent) => {
return component.compo... | 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 getNewVersionPageInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left versionComponen... | public async getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions?: Array<update.ComponentDescription>): Promise<VersionPageInfo> {
let component: update.VersionComponent = versionComponents.filter((component: update.VersionComponent) => {
return component.compo... | https://gitee.com/openharmony/update_update_app.git | 215dc2bef043cfddc54744997d709ac6004c9f46 | gitee |
openharmony-sig/applications_inputmethod | entry/src/main/ets/model/InputHandler.ets | arkts | constructor | 记录分词剩余的拼音 | private constructor() {
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() {
} | https://gitee.com/openharmony-sig/applications_inputmethod.git | a0608fb0322960909031d9d4b62d4d6417c499f6 | gitee |
XHXYT/Pixark | entry/src/main/ets/entryability/EntryAbility.ets | arkts | backgroundSyncData | 后台静默同步数据 (Token刷新、用户详情、首页数据)
不阻塞 UI 渲染,已经加载主界面 | private async backgroundSyncData() {
try {
// 后台静默刷新当前激活账号的 Token
const activeAccount = pixiv.getActiveAccount();
if (activeAccount?.refreshToken) {
try {
logger.info('BackgroundSync', 'Silently refreshing active token in background...');
const updatedAccount = await ... | 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 backgroundSyncData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async backgroundSyncData() {
try {
// 后台静默刷新当前激活账号的 Token
const activeAccount = pixiv.getActiveAccount();
if (activeAccount?.refreshToken) {
try {
logger.info('BackgroundSync', 'Silently refreshing active token in background...');
const updatedAccount = await ... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/entryability/EntryAbility.ets#L264-L305 | fa9a4b85b8670eafe14305f389d62861c668197b | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleContent.ets | arkts | onContentClosedByUser | Called by the overlay component when the user dismisses it (e.g.
SDK-drawn close button for placed overlays) or when a load timeout fires.
Idempotent, subsequent calls after close are no-ops. | public onContentClosedByUser(status: ContentStatus, data: Record<string, Object>): void {
if (!this.isInContentZone) return;
this.isInContentZone = false;
this.shouldFetchContents = true;
this.waitTicks = WAIT_TICKS_AFTER_CLOSE;
OverlayStore.hideContent();
WindowImmersive.setContent(false, thi... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onContentClosedByUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public onContentClosedByUser(status: ContentStatus, data: Record<string, Object>): void {
if (!this.isInContentZone) return;
this.isInContentZone = false;
this.shouldFetchContents = true;
this.waitTicks = WAIT_TICKS_AFTER_CLOSE;
OverlayStore.hideContent();
WindowImmersive.setContent(false, thi... | https://github.com/Countly/countly-sdk-hos | 6c8e86c44c200ff0b69a30065be47f986ae51b0f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.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): BigInt64Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let cou... | 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): BigInt64Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let cou... | https://gitcode.com/iop123123/arkts-static-skills | 8df9c65f19831df170c5bb07e997aeb6f2b14452 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | registerMangaProgressCallback | 注册漫画进度回调 | private registerMangaProgressCallback(taskId: string): void {
this.mangaDownloadManager.registerProgressCallback(
`unified_${taskId}`,
(id: string, chapterId: string, progress: number, downloaded: number, total: number) => {
const task = this.unifiedTasks.get(id);
if (task) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerMangaProgressCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right A... | private registerMangaProgressCallback(taskId: string): void {
this.mangaDownloadManager.registerProgressCallback(
`unified_${taskId}`,
(id: string, chapterId: string, progress: number, downloaded: number, total: number) => {
const task = this.unifiedTasks.get(id);
if (task) {
... | https://github.com/DaLongZhuaZi/manxia | 22a6b8b65ef246e4047b197a713344660f52c71c | github |
LongLiveY96/chatcube | entry/src/main/ets/services/WebDAVService.ets | arkts | buildAuthHeader | 构造 Authorization: Basic 头 | private buildAuthHeader(username: string, password: string): string {
const helper = new util.Base64Helper()
const encoded = helper.encodeToStringSync(this.stringToBytes(`${username}:${password}`))
return `Basic ${encoded}`
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildAuthHeader 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#st... | private buildAuthHeader(username: string, password: string): string {
const helper = new util.Base64Helper()
const encoded = helper.encodeToStringSync(this.stringToBytes(`${username}:${password}`))
return `Basic ${encoded}`
} | https://github.com/LongLiveY96/chatcube | 1e12c877bf219f49a7a6e48d4b7cc25728712e38 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WordPackCache.ets | arkts | write | Bare-body write retained for tests and any caller that hasn't
been moved to writeRecord. Validates body shape before persist. | async write(packJson: string): Promise<void> {
if (this.prefs === undefined) {
return;
}
if (!WordPackCache.looksValidBody(packJson)) {
return;
}
await this.prefs.putString(PACK_KEY, packJson);
await this.prefs.flush();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left write AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left packJson AST#identifier#Right AST#type_... | async write(packJson: string): Promise<void> {
if (this.prefs === undefined) {
return;
}
if (!WordPackCache.looksValidBody(packJson)) {
return;
}
await this.prefs.putString(PACK_KEY, packJson);
await this.prefs.flush();
} | https://github.com/terryma2024/happyword | 9973f734966fe6a5681ca7c33c69fb56fbbcf531 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.