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 |
|---|---|---|---|---|---|---|---|---|---|---|
PollenWang6/HiXD | entry/src/main/ets/utils/HttpUtil.ets | arkts | replaceCookiesForDomain | 从 Cookie header 字符串恢复指定域名的 cookie(先清空再设值) | replaceCookiesForDomain(domain: string, cookieHeader: string): void {
this.cookieStore[domain] = {};
if (cookieHeader.length === 0) { return; }
const pairs: string[] = cookieHeader.split(';');
for (let i: number = 0; i < pairs.length; i++) {
const pair: string = pairs[i].trim();
const eq: ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left replaceCookiesForDomain AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AS... | replaceCookiesForDomain(domain: string, cookieHeader: string): void {
this.cookieStore[domain] = {};
if (cookieHeader.length === 0) { return; }
const pairs: string[] = cookieHeader.split(';');
for (let i: number = 0; i < pairs.length; i++) {
const pair: string = pairs[i].trim();
const eq: ... | https://github.com/PollenWang6/HiXD | 7c1a0c00d5a8c054281f16200f00fb658028d34c | github |
honjow/Next2V | shared/src/main/ets/storage/LocalDataCloudSync.ets | arkts | hasDownloads | Sum download.total across the marked tables for this round; >0 means cloud data landed locally. | private static hasDownloads(progress: relationalStore.ProgressDetails): boolean {
const details: Record<string, relationalStore.TableDetails> = progress.details
if (!details) {
return false
}
const tables: string[] = CloudSyncSettings.enabledTables()
let total: number = 0
tables.forEach(... | 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 hasDownloads AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left progress AST#identifier#Right AST#:#Lef... | private static hasDownloads(progress: relationalStore.ProgressDetails): boolean {
const details: Record<string, relationalStore.TableDetails> = progress.details
if (!details) {
return false
}
const tables: string[] = CloudSyncSettings.enabledTables()
let total: number = 0
tables.forEach(... | https://github.com/honjow/Next2V | e23e0503e8251f2ea2c8246b14e4eefab62d3af6 | github |
Joker-x-dev/CoolMallArkTS | core/result/src/main/ets/RequestHelper.ets | arkts | response | 返回完整响应(code / data / message),需手动调用 then 处理
@returns {Promise<NetworkResponse<T>>} 完整响应 Promise | async response(): Promise<NetworkResponse<T>> {
return this.runInternal(true);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left response AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async response(): Promise<NetworkResponse<T>> {
return this.runInternal(true);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 1c2c9634acb25a1cc007340eab0a7189caf4f8e6 | github |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/AVPlayer/MediaService/src/main/ets/controller/AvPlayerController.ets | arkts | setStateChangeCallback | [Start mode_volume] | private setStateChangeCallback(avPlayer: media.AVPlayer) {
avPlayer.on('stateChange', async (state: string) => {
switch (state) {
// [StartExclude mode_volume]
case 'idle':
Logger.info(TAG, 'AVPlayer state idle called.' + ` this.curIndex:${this.curIndex}`);
break;
/... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setStateChangeCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left avPlayer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | private setStateChangeCallback(avPlayer: media.AVPlayer) {
avPlayer.on('stateChange', async (state: string) => {
switch (state) {
// [StartExclude mode_volume]
case 'idle':
Logger.info(TAG, 'AVPlayer state idle called.' + ` this.curIndex:${this.curIndex}`);
break;
/... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 163d407fcdbf0c30662bece8a5b84f179d76edaa | gitcode |
dingzhilin1990/zhilinclaw | src/plugins/PluginManager.ets | arkts | getLoadedPluginsCount | 获取已启用的插件数量 | public getLoadedPluginsCount(): number {
let count = 0;
this.plugins.forEach(wrapper => {
if (wrapper.enabled) count++;
});
return count;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLoadedPluginsCount 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 numb... | public getLoadedPluginsCount(): number {
let count = 0;
this.plugins.forEach(wrapper => {
if (wrapper.enabled) count++;
});
return count;
} | https://github.com/dingzhilin1990/zhilinclaw | 89e73c5d6d8f8d14f4256f207cab2e63f8a7fcb8 | github |
CLMC2025/Vignette | entry/src/main/ets/context/ContextValidator.ets | arkts | getInfoIssues | 获取信息问题 | getInfoIssues(): ValidationIssue[] {
return this.issues.filter((issue: ValidationIssue): boolean =>
issue.severity === IssueSeverity.INFO
);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInfoIssues 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#call_expression#Le... | getInfoIssues(): ValidationIssue[] {
return this.issues.filter((issue: ValidationIssue): boolean =>
issue.severity === IssueSeverity.INFO
);
} | https://github.com/CLMC2025/Vignette | 9e017f1fc5aecd557cd2cb1cb43f7e233027dc41 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSource.ets | arkts | removeFromLibrary | 从库中移除漫画 | public async removeFromLibrary(mangaId: string): Promise<boolean> {
const query = `
mutation RemoveFromLibrary($id: Int!) {
updateManga(input: { id: $id, patch: { inLibrary: false } }) {
manga {
id
inLibrary
}
}
}
`;
const variables: ... | 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 removeFromLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async removeFromLibrary(mangaId: string): Promise<boolean> {
const query = `
mutation RemoveFromLibrary($id: Int!) {
updateManga(input: { id: $id, patch: { inLibrary: false } }) {
manga {
id
inLibrary
}
}
}
`;
const variables: ... | https://github.com/DaLongZhuaZi/manxia | 2975148cbdd743b390dd130dd84abadeadfb994d | github |
azhu0001/localsend-harmony | entry/src/main/ets/utils/FileProvider.ets | arkts | getFileIconRes | 根据文件名后缀和文件类型返回一个图标资源
@param fileName 文件名
@param fileTypes 文件类型 application/xxx
@returns | static getFileIconRes(fileName: string, fileTypes: string): Resource {
const types = fileTypes.split('/')
let type: string = ''
let fileType: string = ''
if (types.length >= 2) {
type = types[0]
fileType = types[1]
}
const suffix: string = FileProvider.getFileSuffixName(fileName)
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFileIconRes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | static getFileIconRes(fileName: string, fileTypes: string): Resource {
const types = fileTypes.split('/')
let type: string = ''
let fileType: string = ''
if (types.length >= 2) {
type = types[0]
fileType = types[1]
}
const suffix: string = FileProvider.getFileSuffixName(fileName)
... | https://gitcode.com/azhu0001/localsend-harmony | b7eaaecb006f071f437184d95f825e87d62ddb38 | gitcode |
m-harmongos/harmongos-projects | AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getTaskTimeContent | 获取任务提醒时间内容 | public getTaskTimeContent(hour: number, minute: number): string {
return this.fillZero(hour > 12 ? hour - 12 : 12) + ':' + this.fillZero(minute);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTaskTimeContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hour AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public getTaskTimeContent(hour: number, minute: number): string {
return this.fillZero(hour > 12 ? hour - 12 : 12) + ':' + this.fillZero(minute);
} | https://github.com/m-harmongos/harmongos-projects | 73bb09c0e863ac279c80274f7ab9fdc33d52e0b7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets | arkts | isEmpty | Checks if ConcurrentHashMap is empty
@returns { boolean } true if ConcurrentHashMap is empty, false otherwise. | public isEmpty(): boolean {
if (this.sizeVal.get() == 0) {
return true;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boole... | public isEmpty(): boolean {
if (this.sizeVal.get() == 0) {
return true;
}
return false;
} | https://gitcode.com/iop123123/arkts-static-skills | 10700f535210419c94a83aa1df42958367e0729c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | getRenderTime | 获取渲染时间 | private getRenderTime(): number {
return 0;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getRenderTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS... | private getRenderTime(): number {
return 0;
} | https://github.com/DaLongZhuaZi/manxia | 40447b32546ec3a37d8c7148433dfbc196664241 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | indexOf | Finds the first occurrence of another String in this String at position >= fromIndex.
Negative fromIndex is equivalent to fromIndex = 0, and fromIndex >= length implies no match.
@param str to find
@param fromIndex to start searching from
@returns index of the str from the beginning of this string, or -1 if not found | public indexOf(str: String, fromIndex: number): number {
return this.indexOf(str, fromIndex)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left indexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AS... | public indexOf(str: String, fromIndex: number): number {
return this.indexOf(str, fromIndex)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d1ad43788093d3ae869ffe2b32091b1cdc444f6c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | loadSourceName | 加载图源名称
优先使用name字段,如果为空则使用pkg字段 | private async loadSourceName(sourceId: number): Promise<void> {
if (sourceId <= 0) {
this.currentSourceName = '';
return;
}
try {
const sources = await this.dataManager.getAllComicSources();
for (let i = 0; i < sources.length; i++) {
const s: ESObject = sources[i] as E... | 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 loadSourceName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Le... | private async loadSourceName(sourceId: number): Promise<void> {
if (sourceId <= 0) {
this.currentSourceName = '';
return;
}
try {
const sources = await this.dataManager.getAllComicSources();
for (let i = 0; i < sources.length; i++) {
const s: ESObject = sources[i] as E... | https://github.com/DaLongZhuaZi/manxia | 457e14169ac459d8c3a6c5c2794a64ebd935ac84 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/MedicalImageUtils.ets | arkts | calculateAspectRatio | 计算宽高比
@param width 宽度
@param height 高度
@returns 宽高比 | static calculateAspectRatio(width: number, height: number): number {
return width / height;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateAspectRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static calculateAspectRatio(width: number, height: number): number {
return width / height;
} | https://github.com/LJ666-ui/harmony-health-care | 469e5c52384a380f13ff9c849318c6771f1a5e4e | github |
silence17/harmonydemo | entry/src/main/ets/view/refresh/DialogUtils.ets | arkts | isEmpty | Check obj is empty
@param {object} obj
@return {boolean} true(empty) | static isEmpty(obj: object | string): boolean {
return obj === undefined || obj === null || obj === '';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AS... | static isEmpty(obj: object | string): boolean {
return obj === undefined || obj === null || obj === '';
} | https://github.com/silence17/harmonydemo | 8060035c21e0866193d28bb15e18d3328f7ec854 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/RectF.ets | arkts | createByRectF | 通过rectF对象创建rectF
@param rectF 对象
@returns | private createByRectF(rectF: RectF): RectF {
this.check(rectF.left, rectF.top, rectF.right, rectF.bottom);
this.left = rectF.left;
this.top = rectF.top;
this.right = rectF.right;
this.bottom = rectF.bottom;
return this;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createByRectF AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rectF AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private createByRectF(rectF: RectF): RectF {
this.check(rectF.left, rectF.top, rectF.right, rectF.bottom);
this.left = rectF.left;
this.top = rectF.top;
this.right = rectF.right;
this.bottom = rectF.bottom;
return this;
} | https://github.com/wuba/omni-ui | 4f628c614a2b74c96e5626893e08dd5a99a06636 | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/HelperUtil.ets | arkts | showToastNet | 提示网络异常信息
@param t | static async showToastNet(t: number = 1000) {
Prompt.showToast({
message: '网络开了点小差,请稍后再试 ~',
duration: 1000
});
} | 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 showToastNet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#R... | static async showToastNet(t: number = 1000) {
Prompt.showToast({
message: '网络开了点小差,请稍后再试 ~',
duration: 1000
});
} | https://github.com/yangyongzhen/hmmovie | a938f5dfe878bebb868b09ac03bdb3ca0867cc0d | github |
openharmony/communication_bluetooth_service | test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/BrInterfaceTest.ets | arkts | pairDevice | Pair device
@param device | pairDevice(deviceId: string) {
this.controller.pair(deviceId , (pinCode: string) => {
LogUtil.info(this.TAG_PAGE + 'pairDevice success callback : pinCode = ' + pinCode);
// show pair pin dialog
this.pairPinCode = pinCode
this.pairingDevice.deviceId = deviceId;
this.pairingDevice.devi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pairDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#... | pairDevice(deviceId: string) {
this.controller.pair(deviceId , (pinCode: string) => {
LogUtil.info(this.TAG_PAGE + 'pairDevice success callback : pinCode = ' + pinCode);
// show pair pin dialog
this.pairPinCode = pinCode
this.pairingDevice.deviceId = deviceId;
this.pairingDevice.devi... | https://gitee.com/openharmony/communication_bluetooth_service.git | 1f430dd5092051cf51e4533ba6fefbcf5aed1067 | gitee |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getTopicFavoriteToggleActionWithCookie | ==================== Cookie account actions (site favorites/follows) ====================
Get the favorite/unfavorite toggle link for a topic (requires Cookie session) | async getTopicFavoriteToggleActionWithCookie(
cookie: string,
topicId: number,
): Promise<V2exToggleAction> {
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
const topicPath = `/t/${topicId}`
const html = await this.g... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getTopicFavoriteToggleActionWithCookie AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie... | async getTopicFavoriteToggleActionWithCookie(
cookie: string,
topicId: number,
): Promise<V2exToggleAction> {
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
const topicPath = `/t/${topicId}`
const html = await this.g... | https://github.com/honjow/Next2V | dd14a75d22fcc46e841934147a2e95c72ba940c6 | github |
lidaixian999/Smart_Car | entry/src/main/ets/model/SmartCommandExecutor.ets | arkts | executeBatchCommands | 批量执行指令
@param commands 指令数组
@returns 执行结果 | async executeBatchCommands(commands: CommandAction[]): Promise<ExecutionResult> {
try {
if (commands.length === 0) {
return { executed: false };
}
const executionResults: string[] = [];
for (const command of commands) {
const success = await this.executeCommand(command);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeBatchCommands AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left commands AST#identifier#Right AST#type_annotation#Left AST... | async executeBatchCommands(commands: CommandAction[]): Promise<ExecutionResult> {
try {
if (commands.length === 0) {
return { executed: false };
}
const executionResults: string[] = [];
for (const command of commands) {
const success = await this.executeCommand(command);
... | https://github.com/lidaixian999/Smart_Car | 4fcacb2ee9b8b369ea39c305852119c49b13f8b3 | github |
openharmony-tpc/mp4parser | library/src/main/ets/mp4parser/MP4Parser.ets | arkts | stopGetFrame | stop get frame | static stopGetFrame() {
mp4parser_napi.stopGetFrame();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left stopGetFrame 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 { ... | static stopGetFrame() {
mp4parser_napi.stopGetFrame();
} | https://gitee.com/openharmony-tpc/mp4parser.git | ab9df72589ccc3e6f49fac99dd75df4f360b7d33 | gitee |
openharmony/xts_dcts | communication/dsoftbus_rpcets/rpcclient/entry/src/main/ets/test/RpcRequestEtsUnit.test.ets | arkts | checkAvailableDevice | 检查当前应用是否有可信的设备 | async function checkAvailableDevice() {
console.info(logTag + "checkAvailableDevice in ");
let dmInstance = deviceManager.createDeviceManager(bundleNameRpc);
let deviceInfoList: Array<deviceManager.DeviceBasicInfo> = dmInstance.getAvailableDeviceListSync();
console.info(logTag + "checkAvailableDevice get devi... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left checkAvailableDevice AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Lef... | async function checkAvailableDevice() {
console.info(logTag + "checkAvailableDevice in ");
let dmInstance = deviceManager.createDeviceManager(bundleNameRpc);
let deviceInfoList: Array<deviceManager.DeviceBasicInfo> = dmInstance.getAvailableDeviceListSync();
console.info(logTag + "checkAvailableDevice get devi... | https://gitee.com/openharmony/xts_dcts.git | b663f0f5de1fcb20a54f1194db910712036de451 | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnRegionPickerViewModel.ets | arkts | toggleRegionPicker | 切换内置数据选择器弹出层显示状态 | toggleRegionPicker(): void {
this.regionOpen = !this.regionOpen;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleRegionPicker 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... | toggleRegionPicker(): void {
this.regionOpen = !this.regionOpen;
} | https://github.com/codelably/tuniao-ui | e8db732c31d7dd354adfc84c603361be58a3f06c | github |
dingzhilin1990/zhilinclaw | src/plugins/PluginManager.ets | arkts | disable | 禁用插件
@param name 插件名称 | public async disable(name: string): Promise<void> {
const wrapper = this.plugins.get(name);
if (!wrapper) {
throw new Error(`插件不存在:${name}`);
}
if (!wrapper.enabled) {
console.log(`[PluginManager] 插件已禁用:${name}`);
return;
}
// 调用插件禁用钩子
if (wrapper.plugin.onDisable) {
... | 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 disable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Rig... | public async disable(name: string): Promise<void> {
const wrapper = this.plugins.get(name);
if (!wrapper) {
throw new Error(`插件不存在:${name}`);
}
if (!wrapper.enabled) {
console.log(`[PluginManager] 插件已禁用:${name}`);
return;
}
// 调用插件禁用钩子
if (wrapper.plugin.onDisable) {
... | https://github.com/dingzhilin1990/zhilinclaw | 52bacc3f545c2f3cec48ba907ebe1baf8642794b | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/AIConsultationSkill.ets | arkts | formatResult | 格式化输出给用户 | static formatResult(result: ConsultationResult): string {
let output = `🩺 **AI智能问诊结果**\n\n`;
// 可能的原因
if (result.possibleCauses.length > 0) {
output += `🔍 **可能原因**:\n`;
result.possibleCauses.forEach((cause, index) => {
output += `${index + 1}. ${cause.cause} (${cause.probability... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left C... | static formatResult(result: ConsultationResult): string {
let output = `🩺 **AI智能问诊结果**\n\n`;
// 可能的原因
if (result.possibleCauses.length > 0) {
output += `🔍 **可能原因**:\n`;
result.possibleCauses.forEach((cause, index) => {
output += `${index + 1}. ${cause.cause} (${cause.probability... | https://github.com/LJ666-ui/harmony-health-care | 0e2f3de2af03e9dfc35fa4e1c075d6e1a5bea34d | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/interceptor/AuthInterceptor.ets | arkts | intercept | Intercept the request and add the authorization header.
@param chain The interceptor chain to proceed with.
@returns A Promise that resolves to the response. | async intercept(chain: Interceptor.Chain): Promise<Response<any>> {
const request = chain.request();
// Get the token from the provider
const token = await this.tokenProvider.getToken();
if (token) {
// Create a copy of the request with the authorization header added
const modifi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left intercept AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left chain AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async intercept(chain: Interceptor.Chain): Promise<Response<any>> {
const request = chain.request();
// Get the token from the provider
const token = await this.tokenProvider.getToken();
if (token) {
// Create a copy of the request with the authorization header added
const modifi... | https://github.com/killetom/ktretrofit | 028e81baac618bbe4eee6af60f21ee53c6626058 | github |
zgzm78/VMALL | entry/src/main/ets/pages/HomePage.ets | arkts | build | 0: 首页, 1: 购物车, 2: 我的 | build() {
Stack({ alignContent: Alignment.Top }) {
Image($r('app.media.ic_app_background'))
.width(Const.FULL_WIDTH)
.height($r('app.float.image_background_height'))
.objectFit(ImageFit.Cover)
Column() {
// 主体内容区域根据底部导航切换
Column() {
if (this.currentTab... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack({ alignContent: Alignment.Top }) {
Image($r('app.media.ic_app_background'))
.width(Const.FULL_WIDTH)
.height($r('app.float.image_background_height'))
.objectFit(ImageFit.Cover)
Column() {
// 主体内容区域根据底部导航切换
Column() {
if (this.currentTab... | https://github.com/zgzm78/VMALL | 1794664798bca1a7911f0b3e858b97519e067269 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int16Array from FixedArray<number>
@param { FixedArray<number> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, Int16Array.doubleToInt(numbers[i]))
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, Int16Array.doubleToInt(numbers[i]))
}
} | https://gitcode.com/iop123123/arkts-static-skills | 5ac7da97073295e9bcff6eae5b3f6cb250eb9822 | gitcode |
popsiclelmlm/Hey | entry/src/main/ets/storage/SubscriptionStore.ets | arkts | saveNodeDelays | 批量落库一组节点的延迟结果:一次 load/save 写完整块,避免逐节点反复读写
preferences(大列表分块测速时每块只写一次)。 | static async saveNodeDelays(context: common.Context, updates: Array<NodeDelayUpdate>): Promise<SubscriptionProfile> {
const profile = await SubscriptionStore.load(context);
const byId = new Map<string, NodeDelayUpdate>();
for (let i = 0; i < updates.length; i++) {
byId.set(updates[i].nodeId, updates... | 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 saveNodeDelays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :... | static async saveNodeDelays(context: common.Context, updates: Array<NodeDelayUpdate>): Promise<SubscriptionProfile> {
const profile = await SubscriptionStore.load(context);
const byId = new Map<string, NodeDelayUpdate>();
for (let i = 0; i < updates.length; i++) {
byId.set(updates[i].nodeId, updates... | https://github.com/popsiclelmlm/Hey | 2bc88b4005f64339040d4dc414bcfbf1bf1e921f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/FinalizationQueue.ets | arkts | unregister | Removes all registered callbacks with the specific token value
@param token all registered callbacks with this token will be removed | public unregister(token: Object | null): void {
let prev = 0;
for (let i = this.idxarr[prev]; i != -1; prev = i, i = this.idxarr[i]) {
if (this.getToken(i) != null) {
let refToken = this.getToken(i);
if (refToken.deref() == token) {
thi... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Le... | public unregister(token: Object | null): void {
let prev = 0;
for (let i = this.idxarr[prev]; i != -1; prev = i, i = this.idxarr[i]) {
if (this.getToken(i) != null) {
let refToken = this.getToken(i);
if (refToken.deref() == token) {
thi... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 62964b1fe31157fbd0fb7dea006d44c09cb9fe5c | gitee |
openharmony-sig/applications_clock | common/src/main/ets/utils/TimeUtil.ets | arkts | getNextAlarmTime | Get Next Alarm Time
@returns the next alarm time in ms | static async getNextAlarmTime(): Promise<number> {
const ringTimeInMs = await TimerManager.getTriggerTime();
return ringTimeInMs;
} | 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 getNextAlarmTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | static async getNextAlarmTime(): Promise<number> {
const ringTimeInMs = await TimerManager.getTriggerTime();
return ringTimeInMs;
} | https://gitee.com/openharmony-sig/applications_clock.git | 0d8383c3ac3064175f1c954e2d764f4dacab473a | gitee |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/DisplaySettings.ets | arkts | setShowSignature | 设置是否显示签名(同步 AppStorage 供 UI 响应式读取,并持久化) | setShowSignature(enabled: boolean): void {
this.ctx.state.showSignature = enabled
AppStorage.setOrCreate(KEY_SHOW_SIGNATURE, enabled)
this.ctx.persist()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setShowSignature AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#L... | setShowSignature(enabled: boolean): void {
this.ctx.state.showSignature = enabled
AppStorage.setOrCreate(KEY_SHOW_SIGNATURE, enabled)
this.ctx.persist()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/DisplaySettings.ets#L38-L42 | fe540b7cb741dad8be23d4fbca7ea8726b8092c1 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | ensurePartsBackfill | 兜底: 流式完成时, 若 parts 仍为空但旧字段有内容, 按保守顺序(reasoning→tools→text)合成 parts。
用于非 tools 路径或流式期间没有调用 push* helper 的边界情况, 保证下游 UI 可走 parts 分支。
无论 parts 是否原本就有内容, 结尾统一把未 finish 的 reasoning 封口, 避免 UI 继续按 Date.now() 刷秒数 | private ensurePartsBackfill(aiMessage: ChatMessage): void {
if (aiMessage.parts.length === 0) {
if (aiMessage.content === '' && aiMessage.reasoningContent === '' &&
aiMessage.toolCalls.length === 0 && aiMessage.toolResults.length === 0) {
return
}
ensureMessageParts(aiMessage, fa... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensurePartsBackfill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private ensurePartsBackfill(aiMessage: ChatMessage): void {
if (aiMessage.parts.length === 0) {
if (aiMessage.content === '' && aiMessage.reasoningContent === '' &&
aiMessage.toolCalls.length === 0 && aiMessage.toolResults.length === 0) {
return
}
ensureMessageParts(aiMessage, fa... | https://github.com/LongLiveY96/chatcube | 9ca9eb234764788b9914c300db3173fced3f354f | github |
tdcare/tdwebrtc | src/main/ets/AudioCapture.ets | arkts | initialize | 初始化采集器 | public async initialize(): Promise<boolean> {
try {
const channelCount: audio.AudioChannel = this.channels === 2
? audio.AudioChannel.CHANNEL_2
: audio.AudioChannel.CHANNEL_1;
const sampleRateEnum: audio.AudioSamplingRate = this.getSampleRateEnum(this.sampleRate);
const streamI... | 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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public async initialize(): Promise<boolean> {
try {
const channelCount: audio.AudioChannel = this.channels === 2
? audio.AudioChannel.CHANNEL_2
: audio.AudioChannel.CHANNEL_1;
const sampleRateEnum: audio.AudioSamplingRate = this.getSampleRateEnum(this.sampleRate);
const streamI... | https://github.com/tdcare/tdwebrtc | 97b2f766285d530b0f32a2c77c5cd693a5979a31 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets | arkts | authenticateWithPassword | 使用密码验证(备用方案) | public async authenticateWithPassword(password: string): Promise<boolean> {
try {
// 从设置中获取保存的密码哈希
const savedPasswordHash: string = this.settingsManager.getString('privacy_password_hash', '');
if (!savedPasswordHash) {
logger.warn(TAG, '未设置隐私密码');
return false;
}
... | 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 authenticateWithPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left A... | public async authenticateWithPassword(password: string): Promise<boolean> {
try {
// 从设置中获取保存的密码哈希
const savedPasswordHash: string = this.settingsManager.getString('privacy_password_hash', '');
if (!savedPasswordHash) {
logger.warn(TAG, '未设置隐私密码');
return false;
}
... | https://github.com/DaLongZhuaZi/manxia | 86ce79b4bc9c3fe57a0f0cd0dfea02c8792a5a07 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | touchInRightThumb | 判断右边滑块滑动 | touchInRightThumb(event?: GestureEvent): boolean {
logger.info(TAG, ' touchInRightThumb');
let pointX: number = this.clearUndefined(event?.fingerList[0].localX)
let pointY: number = this.clearUndefined(event?.fingerList[0].localY)
return this.pointInArea(pointX, pointY, this.rightThumbRect);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left touchInRightThumb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GestureEvent... | touchInRightThumb(event?: GestureEvent): boolean {
logger.info(TAG, ' touchInRightThumb');
let pointX: number = this.clearUndefined(event?.fingerList[0].localX)
let pointY: number = this.clearUndefined(event?.fingerList[0].localY)
return this.pointInArea(pointX, pointY, this.rightThumbRect);
} | https://github.com/openharmony/applications_app_samples | d10a8978b4da5462de017c5f0fb51e553c64a72b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Network/ProxyManager.ets | arkts | testProxy | 测试代理连接
@param testUrl 测试URL | async testProxy(testUrl: string): Promise<ProxyTestResult> {
const startTime = Date.now();
try {
logger.info(TAG, `开始测试代理: ${testUrl}, protocol=${this.config.protocol}`);
await this.applySystemProxy();
const httpRequest = http.createHttp();
const requestOptions: http.HttpRequestOptio... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left testProxy AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left testUrl AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async testProxy(testUrl: string): Promise<ProxyTestResult> {
const startTime = Date.now();
try {
logger.info(TAG, `开始测试代理: ${testUrl}, protocol=${this.config.protocol}`);
await this.applySystemProxy();
const httpRequest = http.createHttp();
const requestOptions: http.HttpRequestOptio... | https://github.com/DaLongZhuaZi/manxia | e922e582469f9bfb4f9c0d691af3cd4c67f7e0ce | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | isCollectorEnabled | 检查是否启用 | public isCollectorEnabled(): boolean {
return this.isEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isCollectorEnabled 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... | public isCollectorEnabled(): boolean {
return this.isEnabled;
} | https://github.com/DaLongZhuaZi/manxia | 5cfc08d6d7df084c5d54ad42e4457917ba6fff62 | github |
LZZLHY/hlib | entry/src/main/ets/utils/AppRouter.ets | arkts | push | 入栈一个路由。 | static push(name: string, param?: object): void {
const s: NavPathStack | null = AppRouter.stack;
if (s === null) {
Logger.w(TAG, `push(${name}) ignored: not bound`);
return;
}
try {
s.pushPathByName(name, param !== undefined ? param : EMPTY_NAV_PARAM);
} catch (e) {
Logger... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left push AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | static push(name: string, param?: object): void {
const s: NavPathStack | null = AppRouter.stack;
if (s === null) {
Logger.w(TAG, `push(${name}) ignored: not bound`);
return;
}
try {
s.pushPathByName(name, param !== undefined ? param : EMPTY_NAV_PARAM);
} catch (e) {
Logger... | https://github.com/LZZLHY/hlib | e81ea1eff7a5daf6fd0cc6c2745bb8e96b59d236 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets | arkts | executeAutoBackup | 执行自动备份 | private async executeAutoBackup(settings: WebDAVSettings): Promise<void> {
this.isRunning = true;
this.lastError = '';
try {
const webdavManager = getWebDAVBackupManager();
const backupManager = getEnhancedBackupManager();
// 检查WebDAV是否已配置
if (!webdavManager.isConfigure... | 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 executeAutoBackup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left settings AST#identifier#Right AST#:... | private async executeAutoBackup(settings: WebDAVSettings): Promise<void> {
this.isRunning = true;
this.lastError = '';
try {
const webdavManager = getWebDAVBackupManager();
const backupManager = getEnhancedBackupManager();
// 检查WebDAV是否已配置
if (!webdavManager.isConfigure... | https://github.com/DaLongZhuaZi/manxia | 3619a3b966c783964a3e86088d3707289dfdc29b | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | isNativeLoaded | Check if native module is loaded | static isNativeLoaded(): boolean {
return ensureNativeLoaded();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNativeLoaded 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 AS... | static isNativeLoaded(): boolean {
return ensureNativeLoaded();
} | https://github.com/tangwengang-del/freerdp-harmonyos | 001e3217b4aaa1ab07cee877b9253c4616664cc2 | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t1_basicParse | T1: Basic key=value parsing | t1_basicParse(): void {
const r: Record<string, Object> = parse('a=1&b=2&c=3');
const expected: string = '{"a":"1","b":"2","c":"3"}';
const actual: string = JSON.stringify(r);
this.record('T1 Basic parse', expected === actual, expected, actual);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t1_basicParse 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... | t1_basicParse(): void {
const r: Record<string, Object> = parse('a=1&b=2&c=3');
const expected: string = '{"a":"1","b":"2","c":"3"}';
const actual: string = JSON.stringify(r);
this.record('T1 Basic parse', expected === actual, expected, actual);
} | https://github.com/wgli-collab/qs-arkts | a9c6f6bdcd70112d0bd07645bd71ce56a22924ef | github |
Joker-x-dev/CoolMallArkTS | core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets | arkts | handleSuccess | 处理成功响应
@param {NetworkPageData<T>} data - 分页数据
@returns {void} 无返回值 | protected handleSuccess(data: NetworkPageData<T> | null): void {
const pageData: NetworkPageData<T> = new NetworkPageData<T>(data ?? undefined);
const list: Array<T> = pageData.list ?? [];
const hasNextPage: boolean = this.calculateHasMore(pageData);
if (this.currentPage === 1) {
this.listData ... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_ex... | protected handleSuccess(data: NetworkPageData<T> | null): void {
const pageData: NetworkPageData<T> = new NetworkPageData<T>(data ?? undefined);
const list: Array<T> = pageData.list ?? [];
const hasNextPage: boolean = this.calculateHasMore(pageData);
if (this.currentPage === 1) {
this.listData ... | https://github.com/Joker-x-dev/CoolMallArkTS | 4b089a9ecdc82afedfe469cfa3831869cf817e73 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test49_original_index.ets | arkts | classify | --- Sequential ternary assignments --- | function classify(n: number): string {
let result: string;
if (n > 0) {
result = 'positive';
} else if (n < 0) {
result = 'negative';
} else {
result = 'zero';
}
return result;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left classify 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 classify(n: number): string {
let result: string;
if (n > 0) {
result = 'positive';
} else if (n < 0) {
result = 'negative';
} else {
result = 'zero';
}
return result;
} | https://github.com/miaochiahao/ark-ghidra | 923caee56a2344b18fc1873994ad8f016a773a8d | github |
LongLiveY96/chatcube | entry/src/main/ets/services/FavoriteModelsService.ets | arkts | getFavoriteIds | 获取收藏模型的 ID 列表
@returns 模型 ID 列表 | getFavoriteIds(): string[] {
return this.favoriteModels.map(f => f.modelId)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getFavoriteIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | getFavoriteIds(): string[] {
return this.favoriteModels.map(f => f.modelId)
} | https://github.com/LongLiveY96/chatcube | bafdae72c6a4b754e6791d2c53544613417316ca | github |
heeh02/superconnect | harmony/entry/src/main/ets/components/BallGeometry.ets | arkts | clamp | Keep the ball on-screen within the margin (was the Math.min(Math.max(...)) pair). | static clamp(x: number, y: number, w: number, h: number): BallPos {
const maxX: number = w - BallGeometry.SIZE - BallGeometry.MARGIN;
const maxY: number = h - BallGeometry.SIZE - BallGeometry.MARGIN;
return {
x: Math.min(Math.max(x, BallGeometry.MARGIN), maxX),
y: Math.min(Math.max(y, BallGeom... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left clamp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | static clamp(x: number, y: number, w: number, h: number): BallPos {
const maxX: number = w - BallGeometry.SIZE - BallGeometry.MARGIN;
const maxY: number = h - BallGeometry.SIZE - BallGeometry.MARGIN;
return {
x: Math.min(Math.max(x, BallGeometry.MARGIN), maxX),
y: Math.min(Math.max(y, BallGeom... | https://github.com/heeh02/superconnect | a6a8e262a8321befb8e47f30ae476ed2ddfd9f1c | github |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/model/User.ets | arkts | toValuesBucket | 将当前对象转换为用于数据库存储的键值对
【修改点】这里将 : any 修改为 : relationalStore.ValuesBucket | public toValuesBucket(): relationalStore.ValuesBucket {
return {
'username': this.username,
'password': this.password,
'phone': this.phone,
'email': this.email,
'avatar': this.avatar,
'create_time': this.createTime
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toValuesBucket 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#member_expression#Left ... | public toValuesBucket(): relationalStore.ValuesBucket {
return {
'username': this.username,
'password': this.password,
'phone': this.phone,
'email': this.email,
'avatar': this.avatar,
'create_time': this.createTime
};
} | https://gitcode.com/openharmony/codelabs | ec6e60c75b09d47c1ef3804eb515ef573c247f31 | gitcode |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue557.ets.audit.ets | arkts | build | @Prop will make the variable deep copied | build() {
Text(`PropChild testNum ${this.testNum.c}`)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Text(`PropChild testNum ${this.testNum.c}`)
} | https://gitee.com/openharmony-sig/earth.git | 0d9fee515ec1413839e521d511809dae8bc6ac4f | gitee |
Your-USTC/DailyNic_HMOS | entry/src/main/ets/utils/tools.ets | arkts | copyFileExtension | 复制(提取)文件扩展名(包含分隔符`.`)
@param filePath 字符串格式的文件路径
@returns 带`.`的扩展名(无扩展名返回空字符串) | function copyFileExtension(filePath: string): string {
const ext = getFileExtension(filePath);
return ext ? `.${ext}` : '';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left copyFileExtension AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | function copyFileExtension(filePath: string): string {
const ext = getFileExtension(filePath);
return ext ? `.${ext}` : '';
} | https://github.com/Your-USTC/DailyNic_HMOS | 48c5474d0e6c7f43e86340a7c12228c7c591176f | github |
fbinba3955/Flymby | common/src/main/ets/video/AvManager.ets | arkts | removeAvSessionListener | 取消播控中心的监听器 | public async removeAvSessionListener() {
if (!this.mCurrentAVSession) {
return;
}
this.mCurrentAVSession.off('play');
this.mCurrentAVSession.off('pause');
this.mCurrentAVSession.off('stop');
this.mCurrentAVSession.off('playNext');
this.mCurrentAVSession.off('playPrevious');
this.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left removeAvSessionListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | public async removeAvSessionListener() {
if (!this.mCurrentAVSession) {
return;
}
this.mCurrentAVSession.off('play');
this.mCurrentAVSession.off('pause');
this.mCurrentAVSession.off('stop');
this.mCurrentAVSession.off('playNext');
this.mCurrentAVSession.off('playPrevious');
this.... | https://github.com/fbinba3955/Flymby | 1ff55d08ef48539f31f5e6593b7b1b4cef12b286 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGLine.ets | arkts | setY1 | 设置起始点Y坐标
@param newY1 起始点Y坐标 | public setY1(newY1: number): void{
this._y1 = newY1;
this._lineResultObj['y1'] = newY1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left setY1 AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newY1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public setY1(newY1: number): void{
this._y1 = newY1;
this._lineResultObj['y1'] = newY1;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 87fdea503ac0458ce10a4e7293afa591198082dd | gitee |
apap6628114/nga_oh | entry/src/main/ets/common/managers/ReplyManager.ets | arkts | draftKey | 草稿保存/恢复 | private draftKey(): string {
if (this.ctx.type === ReplyType.EDIT && this.ctx.targetPost) {
return 'draft_' + String(this.ctx.tid) + '_edit_' + String(this.ctx.targetPost.pid)
}
if (this.ctx.type === ReplyType.COMMENT) {
return 'draft_' + String(this.ctx.tid) + '_comment'
}
if (this.ct... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left draftKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str... | private draftKey(): string {
if (this.ctx.type === ReplyType.EDIT && this.ctx.targetPost) {
return 'draft_' + String(this.ctx.tid) + '_edit_' + String(this.ctx.targetPost.pid)
}
if (this.ctx.type === ReplyType.COMMENT) {
return 'draft_' + String(this.ctx.tid) + '_comment'
}
if (this.ct... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ReplyManager.ets#L375-L386 | 37b3dfc868cd7e644f16235f087c87cacc226b2c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | slice | The slice() method extracts a section of a string and returns it as a new string,
without modifying the original string.
@param { int } [begin] Start index
@param { int } [end] End index
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public slice(begin?: int, end?: int): String {
begin = normalizeIndex(begin ?? 0, this.getLength())
end = normalizeIndex(end ?? this.getLength(), this.getLength())
if (end <= begin) {
return '';
}
return this.substring(begin, end)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#... | public slice(begin?: int, end?: int): String {
begin = normalizeIndex(begin ?? 0, this.getLength())
end = normalizeIndex(end ?? this.getLength(), this.getLength())
if (end <= begin) {
return '';
}
return this.substring(begin, end)
} | https://gitcode.com/iop123123/arkts-static-skills | 9d1b0da59c3dfaee30c44e73d6bb6f3e7e3c75c2 | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/component/TopNavigation.ets | arkts | calculateTitleSize | 计算标题大小 | calculateTitleSize(): void {
const uiContext: UIContext = this.getUIContext()
const maxWidth = this.globalInfoModel.deviceWidth - BACK_ICON_WIDTH - TOTAL_PADDING
let currentFontSize: number = this.fontSize
let titleWidth: number = Math.ceil(uiContext.px2vp(uiContext.getMeasureUtils().measureText({
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateTitleSize 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... | calculateTitleSize(): void {
const uiContext: UIContext = this.getUIContext()
const maxWidth = this.globalInfoModel.deviceWidth - BACK_ICON_WIDTH - TOTAL_PADDING
let currentFontSize: number = this.fontSize
let titleWidth: number = Math.ceil(uiContext.px2vp(uiContext.getMeasureUtils().measureText({
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | a3ac80ccf40943f36e04f07965d6e21feebcb6bc | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | setTestTarget | 设置测试目标 | setTestTarget(host: string, port: number): void {
this.testHost = host
this.testPort = port
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTestTarget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left host AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , A... | setTestTarget(host: string, port: number): void {
this.testHost = host
this.testPort = port
} | https://github.com/AetheriumSimulator/qemu-hmos | 040474e58e5fb80ffc442d377c9dfa08e1a08df9 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | constructor | Creates a new instance of PlainArray | public constructor() {
this.buckets = new LightWeightMap<int, 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.buckets = new LightWeightMap<int, T>();
} | https://gitcode.com/iop123123/arkts-static-skills | 42844f37a493ce43745060e7f36a5de59ec3825e | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/WebSearchService.ets | arkts | getRuntimeConfigSnapshot | 获取单次搜索链路可复用的配置快照 | async getRuntimeConfigSnapshot(): Promise<SearchRuntimeConfigSnapshot> {
registerAllSearchEngines()
const prefsService = getPreferencesService()
const snapshot = new SearchRuntimeConfigSnapshot()
const enabled = await prefsService.getBoolean(PreferenceKeys.SEARCH_SERVICE_ENABLED, false)
const eng... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getRuntimeConfigSnapshot 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 : AS... | async getRuntimeConfigSnapshot(): Promise<SearchRuntimeConfigSnapshot> {
registerAllSearchEngines()
const prefsService = getPreferencesService()
const snapshot = new SearchRuntimeConfigSnapshot()
const enabled = await prefsService.getBoolean(PreferenceKeys.SEARCH_SERVICE_ENABLED, false)
const eng... | https://github.com/LongLiveY96/chatcube | a3a439536bfec7d24c3dd05aba4f1bc029535b27 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | setSettings | 设置账本设置 | setSettings(settings: LedgerSettings): void {
this.settingsJson = JSON.stringify(settings);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left settings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LedgerSettings AST#identifier#Right AST#... | setSettings(settings: LedgerSettings): void {
this.settingsJson = JSON.stringify(settings);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f526dee37307ec0d3f57a560ce2b3618eb1e3876 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | normalizeNovelCoverPath | 标准化小说封面路径(别名方法) | private normalizeNovelCoverPath(coverPath: string | undefined): string {
if (!coverPath) {
return '';
}
return this.normalizeCoverPath(coverPath);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeNovelCoverPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left coverPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | private normalizeNovelCoverPath(coverPath: string | undefined): string {
if (!coverPath) {
return '';
}
return this.normalizeCoverPath(coverPath);
} | https://github.com/DaLongZhuaZi/manxia | 0d754b029174491cb217d59000b6ca0a688219a3 | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/interceptor/AuthInterceptor.ets | arkts | getToken | Get the token by calling the tokenGetter function.
@returns A Promise that resolves to the token. | getToken(): Promise<string | undefined> {
return this.tokenGetter();
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : A... | getToken(): Promise<string | undefined> {
return this.tokenGetter();
} | https://github.com/killetom/ktretrofit | 380e7925d0dce9325287908688a139e219163e1d | github |
LongLiveY96/chatcube | entry/src/main/ets/entryability/EntryAbility.ets | arkts | applyLanguageSettings | 应用语言设置 | private async applyLanguageSettings(): Promise<void> {
await ServiceRegistry.language().applyStoredLanguage(this.context);
} | 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 applyLanguageSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async applyLanguageSettings(): Promise<void> {
await ServiceRegistry.language().applyStoredLanguage(this.context);
} | https://github.com/LongLiveY96/chatcube | d42ac7299791839d9f6b32d3c2486b39762a429b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/right_shift/right_shift_short.ets | arkts | main | ---
desc: check right shift operation for short integer
--- | function main(): void {
const a: short = {{v.left}}
const b: int = {{v.right}}
assert (a >> b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: short = {{v.left}}
const b: int = {{v.right}}
assert (a >> b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 26151ae888aaa91989cd6167cdc4cc908bcd20db | gitee |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/AlbumService.ets | arkts | filterKGMusicInfoList | 处理酷狗音乐歌曲信息列表
@param rawList 原始歌曲数据
@returns SongInfo[] | private static filterKGMusicInfoList(rawList: KGSongRawInfo[]): SongInfo[] {
const ids = new Set<string>();
const list: SongInfo[] = [];
rawList.forEach((item: KGSongRawInfo) => {
if (!item || !item.audio_info) return;
// 去重
if (ids.has(item.audio_info.audio_id)) return;
ids.add(... | 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 filterKGMusicInfoList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rawList AST#identifier#Right A... | private static filterKGMusicInfoList(rawList: KGSongRawInfo[]): SongInfo[] {
const ids = new Set<string>();
const list: SongInfo[] = [];
rawList.forEach((item: KGSongRawInfo) => {
if (!item || !item.audio_info) return;
// 去重
if (ids.has(item.audio_info.audio_id)) return;
ids.add(... | https://github.com/cpdd5201314/harmonyOS-music-app | 36f6903f5a19cb5b48006ad451581cd0df1f5c94 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/ProcessUtil.ets | arkts | moveAbilityToBackground | 移动能力到后台
@param context common.UIAbilityContext | public static moveAbilityToBackground(context: common.UIAbilityContext): void {
try {
context.moveAbilityToBackground().then(() => {
Logger.info(TAG, `移动能力到后台成功`)
}).catch((error: BusinessError) => {
Logger.error(TAG, `移动能力到后台失败, 错误码: ${error.code}, 错误信息: ${error.message}`)
})
... | 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 moveAbilityToBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AS... | public static moveAbilityToBackground(context: common.UIAbilityContext): void {
try {
context.moveAbilityToBackground().then(() => {
Logger.info(TAG, `移动能力到后台成功`)
}).catch((error: BusinessError) => {
Logger.error(TAG, `移动能力到后台失败, 错误码: ${error.code}, 错误信息: ${error.message}`)
})
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 47adfc7560a8f79a17de322ddc98c47d05606714 | gitcode |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/PageRepository.ets | arkts | getHomeData | 获取首页数据
@returns 首页数据 | async getHomeData(): Promise<NetworkResponse<Home>> {
return this.networkDataSource.getHomeData();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getHomeData 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_... | async getHomeData(): Promise<NetworkResponse<Home>> {
return this.networkDataSource.getHomeData();
} | https://github.com/Joker-x-dev/CoolMallArkTS | d64fb6fcffc4f1a5307e987d2e6b4d3f1c2c71ec | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/UrlUtils.ets | arkts | resolveUrl | 解析相对 URL 为完整 URL | static resolveUrl(url: string | null): string {
const raw: string = url !== undefined && url !== null ? url.trim() : '';
if (raw.length === 0) {
return '';
}
if (raw.startsWith('file://')) {
return raw;
}
if (raw.startsWith('http://') || raw.startsWith('https://')) {
return U... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resolveUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left... | static resolveUrl(url: string | null): string {
const raw: string = url !== undefined && url !== null ? url.trim() : '';
if (raw.length === 0) {
return '';
}
if (raw.startsWith('file://')) {
return raw;
}
if (raw.startsWith('http://') || raw.startsWith('https://')) {
return U... | https://github.com/Amaz1ny/HarmonyDO-public | f43474017df35a309190577361de967d5e340ddd | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | getTrend | 获取趋势数据 | getTrend(): ScoreTrend {
try {
const parsed = JSON.parse(this.trendJson) as ScoreTrend;
return parsed;
} catch (e) {
return HealthScoreUtils.createDefaultTrend();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTrend 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 ScoreTrend AST#identifier#Right AST#ERROR#Right AST#s... | getTrend(): ScoreTrend {
try {
const parsed = JSON.parse(this.trendJson) as ScoreTrend;
return parsed;
} catch (e) {
return HealthScoreUtils.createDefaultTrend();
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 94869c5f227980c143c0efb806389a8c05a24ee1 | github |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/popup/index.ets | arkts | getTransitionDir | 显示隐藏时的运动方向 | getTransitionDir() {
switch (this.placement) {
case 'top':
return TransitionEdge.TOP
case 'bottom':
return TransitionEdge.BOTTOM
case 'left':
return TransitionEdge.START
case 'right':
return TransitionEdge.END
default:
return undefined
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTransitionDir 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... | getTransitionDir() {
switch (this.placement) {
case 'top':
return TransitionEdge.TOP
case 'bottom':
return TransitionEdge.BOTTOM
case 'left':
return TransitionEdge.START
case 'right':
return TransitionEdge.END
default:
return undefined
}
... | https://github.com/itrainhub/wu-ui | 21f35f486a731d81846b4790dc32864c414c22c6 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/Option.ets | arkts | valueSeparator | 空参时,默认传入"=" | public valueSeparator(sep: string): CliBulider{
this.valueSepara = sep;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueSeparator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sep AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public valueSeparator(sep: string): CliBulider{
this.valueSepara = sep;
return this;
} | https://gitee.com/openharmony-sig/commons-cli.git | c9c5a4eb0ff76e8302472c4597533e7c749482c6 | gitee |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _error | 抛出错误信息
@param message 错误信息 | private _error(message: string): void{
let charIndex = this._svgStringReader!.charIndex;
let xml: string= this._svgStringReader!.xmlDetailInfo
let column = 1;
let excerpt = '';
let line = 1;
// 找到错误信息的行数及字符位置
for (let i = 0; i < charIndex; ++i) {
let char = xml[i];
if (char ==... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left _error AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | private _error(message: string): void{
let charIndex = this._svgStringReader!.charIndex;
let xml: string= this._svgStringReader!.xmlDetailInfo
let column = 1;
let excerpt = '';
let line = 1;
// 找到错误信息的行数及字符位置
for (let i = 0; i < charIndex; ++i) {
let char = xml[i];
if (char ==... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 87bf2dea925384ed109d2c1d7c890ee2d6f39fbc | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | getSmallestContentExtension | Returns the smallest extension of the content rect (width or height).
@return | public getSmallestContentExtension(): number {
return Math.min(this.mContentRect.width(), this.mContentRect.height());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSmallestContentExtension 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#Lef... | public getSmallestContentExtension(): number {
return Math.min(this.mContentRect.width(), this.mContentRect.height());
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6355fd23d5355676151f303b1d1532aef7f8c2d0 | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/widget2/pages/Widget2Card.ets | arkts | getShopName | 获取店铺显示名称(截断过长名称) | getShopName(shop: string): string {
if (!shop) return '-'
if (shop.length > 5) {
return shop.substring(0, 4) + '..'
}
return shop
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getShopName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shop AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST... | getShopName(shop: string): string {
if (!shop) return '-'
if (shop.length > 5) {
return shop.substring(0, 4) + '..'
}
return shop
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 7f8b1b91e13fee65478745078c521a38db6bee87 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | startNavigation | 启动导航
@param destination 目的地
@param options 导航选项 | public async startNavigation(
destination: NavigationDestination,
options?: NavigationOptions
): Promise<void> {
console.log('[ARNavigationService] 启动导航,目的地:', destination.name);
// 检查是否已在导航中
if (this.navigationState.isActive) {
console.warn('[ARNavigationService] 已在导航中,请先结束当前导航');
... | 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 startNavigation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left destination AST#identifier#Right AST#:#L... | public async startNavigation(
destination: NavigationDestination,
options?: NavigationOptions
): Promise<void> {
console.log('[ARNavigationService] 启动导航,目的地:', destination.name);
// 检查是否已在导航中
if (this.navigationState.isActive) {
console.warn('[ARNavigationService] 已在导航中,请先结束当前导航');
... | https://github.com/LJ666-ui/harmony-health-care | 5ac5631c0f8b3fad5190008eca210fe058abe401 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/BinaryFileHandler.ets | arkts | computeFileKey | 计算文件 Hash(简化 SHA-256)
真实环境应使用 cryptoFramework.createMessageDigest('SHA-256')
此处提供简化实现,返回基于大小+时间+首尾字节的组合 Key | static computeFileKey(content: string): string {
const head = content.substring(0, Math.min(256, content.length));
const tail = content.substring(Math.max(0, content.length - 256));
let hash = 0;
const combined = head + tail;
for (let i = 0; i < combined.length; i++) {
const ch = combined.ch... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left computeFileKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | static computeFileKey(content: string): string {
const head = content.substring(0, Math.min(256, content.length));
const tail = content.substring(Math.max(0, content.length - 256));
let hash = 0;
const combined = head + tail;
for (let i = 0; i < combined.length; i++) {
const ch = combined.ch... | https://github.com/XJTUWYD/ArkDiff | a1100a3ef5f401cecb696bf65bc087012d1dd248 | github |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/request/OrderPageRequest.ets | arkts | constructor | @param {Partial<OrderPageRequest>} init - 初始化数据 | constructor(init?: Partial<OrderPageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.status = init.status ?? this.status;
} | 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#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres... | constructor(init?: Partial<OrderPageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.status = init.status ?? this.status;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 7268aa17eff3b4af09eea45b38844682728c871d | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/SettingsService.ets | arkts | deleteSync | 删除数据
@param key | public deleteSync(key: string) {
try {
this.preferences?.deleteSync(key);
} catch (error) {
hilog.error(DOMAIN, TAG, `Failed to delete ${key}. Code: ${error}`);
}
try {
this.preferences?.flushSync();
} catch (error) {
hilog.error(DOMAIN, TAG, `Failed to flush ${key}. Code: ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | public deleteSync(key: string) {
try {
this.preferences?.deleteSync(key);
} catch (error) {
hilog.error(DOMAIN, TAG, `Failed to delete ${key}. Code: ${error}`);
}
try {
this.preferences?.flushSync();
} catch (error) {
hilog.error(DOMAIN, TAG, `Failed to flush ${key}. Code: ... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L260-L271 | a0d8b8570aec52045fef9c4187b9e41cad77a03c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/arkruntime/StackTrace.ets | arkts | toString | Formats the stack trace element information into a string.
@returns { String } data in formatted string.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toString(): String {
return "\tat " + this.className + "." + this.methodName +
// NOTE(@sandee, #24492): Extraction of column number is not implemented
((this.lineNumber !== StackTraceElement.NATIVE_METHOD_LINE_NUMBER) ?
" (" + this.sourceFileName + ":"... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toString(): String {
return "\tat " + this.className + "." + this.methodName +
// NOTE(@sandee, #24492): Extraction of column number is not implemented
((this.lineNumber !== StackTraceElement.NATIVE_METHOD_LINE_NUMBER) ?
" (" + this.sourceFileName + ":"... | https://gitcode.com/iop123123/arkts-static-skills | 870ef6d10436798d9218e7efc89b7dc0f96a3602 | gitcode |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets | arkts | setElementsText | 设置当前节点的文本(覆盖原有文本)
@param text 文本 | public setElementsText(text: string): void{
this._elements = new Array();
this._textObj[SVGAttrConstants.ATTR_KEY_TYPE] = SVGAttrConstants.ATTR_KEY_OR_VALUE_TEXT;
this._textObj[SVGAttrConstants.ATTR_KEY_OR_VALUE_TEXT] = text;
this._elements.push(this._textObj);
this._formatResultObj[SVGAttrConstan... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setElementsText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public setElementsText(text: string): void{
this._elements = new Array();
this._textObj[SVGAttrConstants.ATTR_KEY_TYPE] = SVGAttrConstants.ATTR_KEY_OR_VALUE_TEXT;
this._textObj[SVGAttrConstants.ATTR_KEY_OR_VALUE_TEXT] = text;
this._elements.push(this._textObj);
this._formatResultObj[SVGAttrConstan... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 199b20d20652197a91f7a64243f182434e1e57e5 | gitee |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/pages/Index.ets | arkts | onPageShow | 页面显示时触发 (包括从编辑页返回) | onPageShow() {
this.initSystem();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
this.initSystem();
} | https://gitcode.com/openharmony/codelabs | 731218d8c484aa23317fe8213077bb504f93dcdc | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Search/SearchIntentParser.ets | arkts | isUrl | 检测是否为URL | private static isUrl(text: string): boolean {
return text.startsWith('http://') || text.startsWith('https://');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left isUrl AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#... | private static isUrl(text: string): boolean {
return text.startsWith('http://') || text.startsWith('https://');
} | https://github.com/DaLongZhuaZi/manxia | eb4967f59f9026674f05a48dd100f5635d7979c3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorBitwiseXor | Performs bitwise XOR operation with another BigInt.
@param { BigInt } other The other BigInt.
@returns { BigInt } The result of the bitwise XOR.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorBitwiseXor(other: BigInt): BigInt {
return this.bitwiseHelper(other, (a:int, b:int) => {return (a ^ b)})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorBitwiseXor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public operatorBitwiseXor(other: BigInt): BigInt {
return this.bitwiseHelper(other, (a:int, b:int) => {return (a ^ b)})
} | https://gitcode.com/iop123123/arkts-static-skills | 6acec57c5fb2e851e077bf00cca574425f148d86 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | SegmentedPhotograph/entry/src/main/ets/pages/EditPage.ets | arkts | build | [End photo_buffer_callback] | build() {
Column() {
Column() {
// DocsCode 1
Image($r('app.media.ic_public_back'))
.objectFit(ImageFit.Cover)
.onClick(() => {
Logger.info(TAG, 'back onClick');
this.getUIContext().getRouter().back();
})
.width(40)
.h... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Column() {
// DocsCode 1
Image($r('app.media.ic_public_back'))
.objectFit(ImageFit.Cover)
.onClick(() => {
Logger.info(TAG, 'back onClick');
this.getUIContext().getRouter().back();
})
.width(40)
.h... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 08dc504696a09750f949b16e48a96c7328b0641f | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieDataSet.ets | arkts | isValueLineVariableLength | When valuePosition is OutsideSlice, this allows variable line length
@Override | public isValueLineVariableLength(): boolean {
return this.mValueLineVariableLength;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isValueLineVariableLength 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... | public isValueLineVariableLength(): boolean {
return this.mValueLineVariableLength;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1426d45f552dddf7653037da2254911b75a139a9 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | constructor | Creates a new DataFrame with specified columns
@param {Array<ColumnName>} columns - Array of column names
@ensures All columns are initialized with empty value arrays
@ensures Column widths are initialized to the length of column names | constructor(columns: Array<ColumnName>) {
this.tableModel = new Map<ColumnName, ColumnValues>();
this.columnWidths = new Map<ColumnName, ColumnWidth>();
for (let column of columns) {
this.tableModel.set(column, new Array<string>());
this.columnWidths.set(column, colum... | 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#instantiation_expression#Left AST#identifier#Left columns AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AS... | constructor(columns: Array<ColumnName>) {
this.tableModel = new Map<ColumnName, ColumnValues>();
this.columnWidths = new Map<ColumnName, ColumnWidth>();
for (let column of columns) {
this.tableModel.set(column, new Array<string>());
this.columnWidths.set(column, colum... | https://gitcode.com/iop123123/arkts-static-skills | 63f527c210008c4f2dca1d799fb17c1960b92a0d | gitcode |
openharmony/applications_call | entry/src/main/ets/common/components/FuncBtn.ets | arkts | changeBtn | Button group change picture | changeBtn(type) {
LogUtils.i(TAG, 'changeBtn type : ' + type);
const btnName = ['record', 'video', 'mute'];
if (Method.includes(btnName, type)) {
this.isActive = !this.isActive;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeBtn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left type AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expressio... | changeBtn(type) {
LogUtils.i(TAG, 'changeBtn type : ' + type);
const btnName = ['record', 'video', 'mute'];
if (Method.includes(btnName, type)) {
this.isActive = !this.isActive;
}
} | https://gitee.com/openharmony/applications_call.git | 8f712cbd94ad995588795c2f575a81759ddd55d3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets | arkts | normalizeRepositoryUrl | 解析图源配置文件URL
支持两种格式:
- 新格式(文件夹): base/pkg/source.json
- 旧格式(扁平): base/pkg.json | private normalizeRepositoryUrl(url: string): string {
if (!url) {
return '';
}
return url.trim();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeRepositoryUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private normalizeRepositoryUrl(url: string): string {
if (!url) {
return '';
}
return url.trim();
} | https://github.com/DaLongZhuaZi/manxia | b816aa36c49d343f67d9f20da156fa69798a6366 | github |
CLMC2025/Vignette | entry/src/main/ets/sync/VersionControl.ets | arkts | incrementVersion | 增加版本号 | incrementVersion(description: string = ''): void {
this.currentVersion.version++;
this.currentVersion.timestamp = Date.now();
this.currentVersion.description = description;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left incrementVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left description AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left s... | incrementVersion(description: string = ''): void {
this.currentVersion.version++;
this.currentVersion.timestamp = Date.now();
this.currentVersion.description = description;
} | https://github.com/CLMC2025/Vignette | 9f07e2fb354f27adc758d7fac618272d82ab39ad | github |
erosTeam/NextE | shared/src/main/ets/settings/ThemeColorSettings.ets | arkts | customSeed | Seed the custom picker from the current selection: a preset → its hex, a custom hex → itself. | static customSeed(color: string): string {
return ThemeColorSettings.colorValue(ThemeColorSettings.normalize(color)) as string
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left customSeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | static customSeed(color: string): string {
return ThemeColorSettings.colorValue(ThemeColorSettings.normalize(color)) as string
} | https://github.com/erosTeam/NextE | 97ad75e6f171060e04cb3a3e73f310c4542c8304 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BaseDataSet.ets | arkts | setColorByColor | Sets the one and ONLY color that should be used for this DataSet.
Internally, this recreates the colors array and adds the specified color.
@param color | public setColorByColor(color: Number): void {
this.resetColors();
this.mColors.add(color);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setColorByColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setColorByColor(color: Number): void {
this.resetColors();
this.mColors.add(color);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ada40cb1f9bb3b7409f891814505d3eaf8e4c7d7 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | isNetworkError | 检查是否是网络错误
@param error 错误对象
@returns 是否是网络错误 | private static isNetworkError(error: Error): boolean {
const message = error.message?.toLowerCase() || '';
// 常见的网络错误关键词
const networkErrorKeywords = [
'couldn\'t resolve host',
'network',
'timeout',
'connection refused',
'connection reset',
'connection failed',
'... | 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 isNetworkError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left... | private static isNetworkError(error: Error): boolean {
const message = error.message?.toLowerCase() || '';
// 常见的网络错误关键词
const networkErrorKeywords = [
'couldn\'t resolve host',
'network',
'timeout',
'connection refused',
'connection reset',
'connection failed',
'... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L677-L696 | af6cc958c09cec324d5cd923559b64d5001db0c6 | github |
YANGZX22/Voot | entry/src/main/ets/services/SherpaWhisperMicService.ets | arkts | stop | Stop mic capture; triggers decodeFinal(). | stop(): void {
this.capturing = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS... | stop(): void {
this.capturing = false;
} | https://github.com/YANGZX22/Voot | 6778364c6edb1f5ae818a19f7c876a72ec476fa4 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | insert | 插入分类规则 | static async insert(rule: SmartCategoryRule): Promise<number> {
try {
if (!rule.validate()) {
throw new Error('[SmartCategoryRuleDAO] 无效规则数据');
}
await SmartCategoryRuleDAO.ensureSchema();
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
... | 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 insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : AST#:#Righ... | static async insert(rule: SmartCategoryRule): Promise<number> {
try {
if (!rule.validate()) {
throw new Error('[SmartCategoryRuleDAO] 无效规则数据');
}
await SmartCategoryRuleDAO.ensureSchema();
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 62816d9595a2b26cac107876dcc2ac0d3f58628b | github |
LZZLHY/hlib | entry/src/main/ets/utils/Layout.ets | arkts | readerMaxWidth | Reader 内容最大宽度(vp):≥lg 时限制行长 720vp。 | static readerMaxWidth(bp: Breakpoint): number {
if (bp === 'sm' || bp === 'md') return -1;
if (bp === 'lg') return 720;
return 800;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left readerMaxWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bre... | static readerMaxWidth(bp: Breakpoint): number {
if (bp === 'sm' || bp === 'md') return -1;
if (bp === 'lg') return 720;
return 800;
} | https://github.com/LZZLHY/hlib | 7aaaa5976f6e0efd53fa9633fc8a6d5c608b5258 | github |
Your-USTC/DailyNic_HMOS | entry/src/main/ets/utils/Classes/ScheduleManager.ets | arkts | getDisplayClassesByWeek | 获取课表页面指定周的所有课程
@param week 周数
@returns 课程列表 | getDisplayClassesByWeek(week: number): classAttribute[] {
return this.displayIndex.get(week) || [];
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getDisplayClassesByWeek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | getDisplayClassesByWeek(week: number): classAttribute[] {
return this.displayIndex.get(week) || [];
} | https://github.com/Your-USTC/DailyNic_HMOS | 81bf13a4fca45fc9dda4903caac03b136be56432 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ImagePreprocessor.ets | arkts | setPixel | 设置像素值
@param imageData 图像数据
@param x X坐标
@param y Y坐标
@param pixel 像素数据 | setPixel(imageData: ImageData, x: number, y: number, pixel: PixelData): void {
const idx = (y * imageData.width + x) * 4;
imageData.data[idx] = pixel.r;
imageData.data[idx + 1] = pixel.g;
imageData.data[idx + 2] = pixel.b;
imageData.data[idx + 3] = pixel.a;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPixel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imageData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageData AST#identifier#Right AST#,#Left ... | setPixel(imageData: ImageData, x: number, y: number, pixel: PixelData): void {
const idx = (y * imageData.width + x) * 4;
imageData.data[idx] = pixel.r;
imageData.data[idx + 1] = pixel.g;
imageData.data[idx + 2] = pixel.b;
imageData.data[idx + 3] = pixel.a;
} | https://github.com/LJ666-ui/harmony-health-care | c649d017d1069f3a274937eb10dc9d292fe11483 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ReportGenerator.ets | arkts | generateStageDetails | 生成各阶段详情
@param stageResults 各阶段结果
@returns 阶段详情列表 | private generateStageDetails(stageResults: StageResult[]): StageDetail[] {
const stageDescriptions: Map<ProcessingStage, string> = new Map();
stageDescriptions.set(ProcessingStage.PREPROCESSING, '预处理:格式转换、尺寸调整、质量评估');
stageDescriptions.set(ProcessingStage.DENOISING, '降噪:去除图像噪点');
stageDescriptions.set... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateStageDetails AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stageResults AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private generateStageDetails(stageResults: StageResult[]): StageDetail[] {
const stageDescriptions: Map<ProcessingStage, string> = new Map();
stageDescriptions.set(ProcessingStage.PREPROCESSING, '预处理:格式转换、尺寸调整、质量评估');
stageDescriptions.set(ProcessingStage.DENOISING, '降噪:去除图像噪点');
stageDescriptions.set... | https://github.com/LJ666-ui/harmony-health-care | f5912f52486ddc2a7a75a35b069e5d0b1f729934 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/DeviceTypeUtil.ets | arkts | getContentWidthPercent | 获取内容区域宽度百分比 | public getContentWidthPercent(): string {
if (this.isWatchOrWearable()) {
return '95%';
} else if (this.isPhone()) {
return '90%';
} else if (this.isTablet()) {
return '80%';
} else {
return '70%';
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getContentWidthPercent 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 str... | public getContentWidthPercent(): string {
if (this.isWatchOrWearable()) {
return '95%';
} else if (this.isPhone()) {
return '90%';
} else if (this.isTablet()) {
return '80%';
} else {
return '70%';
}
} | https://github.com/LJ666-ui/harmony-health-care | 771b2e094eec03a6c4eb1b418c4c5f470e41959e | github |
arkui-x/samples | CodeLab/Cases/feature/editaddress/src/main/ets/view/EditAddressView.ets | arkts | getSelectedPlace | 从TextPicker返回选中的数据中逐级查找省、市、区的名称,并将其组合成一个完整的地址字符串。 | getSelectedPlace(selectArr: number | number []) {
if (selectArr instanceof Array) {
let province = this.cascade[selectArr[0]]; // 获取省信息
let areaName = ""; // 存储最终构建的省市区名称
if (province) {
areaName += this.cascade[selectArr[0]].text; // 省的名称添加到容器里
if (province.children) { // 检查是否有市... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSelectedPlace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left selectArr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | getSelectedPlace(selectArr: number | number []) {
if (selectArr instanceof Array) {
let province = this.cascade[selectArr[0]]; // 获取省信息
let areaName = ""; // 存储最终构建的省市区名称
if (province) {
areaName += this.cascade[selectArr[0]].text; // 省的名称添加到容器里
if (province.children) { // 检查是否有市... | https://gitcode.com/arkui-x/samples | c5463fa68c3f91e69ac8f70ff8e667000e291858 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getValidEBookCoverPath | 获取有效的电子书封面路径
支持:APP沙箱目录、Download目录、网络URL等多种来源
[新增] 专门处理电子书封面路径的多种情况 | private getValidEBookCoverPath(ebook: EBook): string {
const raw = this.getEBookCoverPath(ebook);
if (!raw || raw.length === 0) {
return '';
}
if (raw.startsWith('http://') || raw.startsWith('https://')) {
return raw;
}
if (raw.startsWith('file://')) {
return raw;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getValidEBookCoverPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private getValidEBookCoverPath(ebook: EBook): string {
const raw = this.getEBookCoverPath(ebook);
if (!raw || raw.length === 0) {
return '';
}
if (raw.startsWith('http://') || raw.startsWith('https://')) {
return raw;
}
if (raw.startsWith('file://')) {
return raw;
}
... | https://github.com/DaLongZhuaZi/manxia | 59fca92e8fe67233890f411630fbcf43ef43277f | github |
openharmony-sig/homecheck | test/unittest/sample/CacheAvplayer/ets/CacheAvplayerNoReport.ets | arkts | switchPlayer | 切换页面时切换AVPlayer实例 | switchPlayer(): void {
if (this.currentPlayer === this.player1) {
this.currentPlayer = this.player2;
} else {
this.currentPlayer = this.player1;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left switchPlayer 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... | switchPlayer(): void {
if (this.currentPlayer === this.player1) {
this.currentPlayer = this.player2;
} else {
this.currentPlayer = this.player1;
}
} | https://gitee.com/openharmony-sig/homecheck.git | b9403fc05592db1e42c12617c3443e8dfae43491 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.