nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | getByUserId | 获取用户参与的所有账本(包括作为成员) | static async getByUserId(userId: number): Promise<SharedLedger[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
// 查询用户作为owner或member的账本
const sql = `
SELECT DISTINCT l.*
FROM ${SharedLedger.tableName} l
... | 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 getByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST... | static async getByUserId(userId: number): Promise<SharedLedger[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
// 查询用户作为owner或member的账本
const sql = `
SELECT DISTINCT l.*
FROM ${SharedLedger.tableName} l
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | d89c8caf457bf7626eb47abf67c36b7a05e2b0b3 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/common/observer/EventObserver.ets | arkts | unregister | 注销监听
return | public unregister(): void {
if (this.subscriber === undefined) {
Log.error(`subscriber is undefined.`);
return;
}
try {
commonEventManager.unsubscribe(this.subscriber, err => {
if (err) {
Log.error(`unsubscriber faild, code: ${err.code}, message: ${err.message}.`);
... | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Rig... | public unregister(): void {
if (this.subscriber === undefined) {
Log.error(`subscriber is undefined.`);
return;
}
try {
commonEventManager.unsubscribe(this.subscriber, err => {
if (err) {
Log.error(`unsubscriber faild, code: ${err.code}, message: ${err.message}.`);
... | https://gitee.com/openharmony/applications_permission_manager.git | eae6a3041ffb5710f1c3a0f1129f20025f64d3bf | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from a set of type std.core.Set<number>.
@param { Set<number> } set - A set object to convert to an array.
@returns { Float64Array } - A new Float64Array
@throws { RangeError } - Input parameter error.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(set: Set<number>): Float64Array {
const length = set.size;
const result = new Float64Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('W... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ... | public static from(set: Set<number>): Float64Array {
const length = set.size;
const result = new Float64Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('W... | https://gitcode.com/iop123123/arkts-static-skills | ce720c69846b496f81d1be66726f3d062399057c | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | getYEntrySpace | returns the space between the legend entries on a vertical axis in pixels
@return | public getYEntrySpace(): number {
return this.mYEntrySpace;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYEntrySpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | public getYEntrySpace(): number {
return this.mYEntrySpace;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0fa39cd47a0544fd3cc99d6d599867ae411d56fb | gitee |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/goods/GoodsNavigator.ets | arkts | toComment | 跳转到商品评价
@param {number} goodsId - 商品 ID
@returns {void} 无返回值 | static toComment(goodsId: number): void {
const params: GoodsIdParam = { goodsId };
navigateTo(GoodsRoutes.Comment, params);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right... | static toComment(goodsId: number): void {
const params: GoodsIdParam = { goodsId };
navigateTo(GoodsRoutes.Comment, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 983a5bbe33e068caaa027e1ce416505c6971d8e7 | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/RdbManager.ets | arkts | getAllSongs | 获取本地库中的“所有歌曲”
场景:展示“我的音乐 -> 本地歌曲”列表 | async getAllSongs(): Promise<SongItemType[]> {
if (!this.rdbStore) return [];
let predicates = new relationalStore.RdbPredicates(this.tableNameSong);
// 按添加时间或名称排序,这里默认按名称
predicates.orderByAsc('name');
const resultSet = await this.rdbStore.query(predicates);
return this.parseSongResultSet(r... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllSongs 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#:... | async getAllSongs(): Promise<SongItemType[]> {
if (!this.rdbStore) return [];
let predicates = new relationalStore.RdbPredicates(this.tableNameSong);
// 按添加时间或名称排序,这里默认按名称
predicates.orderByAsc('name');
const resultSet = await this.rdbStore.query(predicates);
return this.parseSongResultSet(r... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L476-L485 | 0d4ffae5af63360893b2b99cbd3ad885ce00534c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildPageListActions | 构建页面列表获取操作序列 | buildPageListActions(config: MangaSourceConfig, chapterId: string, mangaId?: string): Action[] {
const workflow = this.getWorkflow(config, 'getPageList');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少页面列表工作流配置'
);
}
return this.proce... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildPageListActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfig ... | buildPageListActions(config: MangaSourceConfig, chapterId: string, mangaId?: string): Action[] {
const workflow = this.getWorkflow(config, 'getPageList');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少页面列表工作流配置'
);
}
return this.proce... | https://github.com/DaLongZhuaZi/manxia | fddbc03dd26ab6080e154d5e8abb458291787626 | github |
harmonyos/codelabs | DistributeNewsETS/entry/src/main/ets/default/component/DetailComponent.ets | arkts | aboutToDisappear | 释放DeviceManager实例 | aboutToDisappear() {
this.deviceMag.release();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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... | aboutToDisappear() {
this.deviceMag.release();
} | https://gitee.com/harmonyos/codelabs.git | f764346ea474ea2b3ae83f8a23a0d7f098188e94 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | hasNetBearType | 是否存在指定的网络
@param netType 网络类型。
@returns | static hasNetBearType(netType: connection.NetBearType): boolean {
const netBearTypes = NetworkUtil.getNetBearTypes()
for (let item of netBearTypes.values()) {
if (item === netType) {
return true;
}
}
return false;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasNetBearType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left netType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_express... | static hasNetBearType(netType: connection.NetBearType): boolean {
const netBearTypes = NetworkUtil.getNetBearTypes()
for (let item of netBearTypes.values()) {
if (item === netType) {
return true;
}
}
return false;
} | https://github.com/tdcare/tdwebrtc | ede96caf36452883a7c91f4cd15dd2b5b84bec38 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets | arkts | enableDashedHighlightLine | Enables the highlight-line to be drawn in dashed mode, e.g. like this "- - - - - -"
@param lineLength the length of the line pieces
@param spaceLength the length of space inbetween the line-pieces
@param phase offset, in degrees (normally, use 0) | public enableDashedHighlightLine(lineLength: number, spaceLength: number, phase: number): void {
var arr = [lineLength, spaceLength];
this.mHighlightDashPathEffect = new DashPathEffect(arr, phase);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableDashedHighlightLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb... | public enableDashedHighlightLine(lineLength: number, spaceLength: number, phase: number): void {
var arr = [lineLength, spaceLength];
this.mHighlightDashPathEffect = new DashPathEffect(arr, phase);
} | https://gitee.com/openharmony/developtools_profiler.git | cda0903512b9c6e83afeb9bbfe12979ba7f62f91 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | createBackup | 创建备份(支持用户选项) | async createBackup(options: BackupOptions = DEFAULT_BACKUP_OPTIONS): Promise<string> {
try {
logger.info(TAG, '开始创建备份');
const timestamp = Date.now();
const appVersion = await this.getAppVersion();
// 创建临时工作目录
const tempDir = await this.createTempBackupDir(timestamp);
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left options AST#identifier#Right AST#type_annotation#Left AST... | async createBackup(options: BackupOptions = DEFAULT_BACKUP_OPTIONS): Promise<string> {
try {
logger.info(TAG, '开始创建备份');
const timestamp = Date.now();
const appVersion = await this.getAppVersion();
// 创建临时工作目录
const tempDir = await this.createTempBackupDir(timestamp);
... | https://github.com/DaLongZhuaZi/manxia | 003846f9318d3ae3590752467024a66866c2f3b3 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/DeviceTypeUtil.ets | arkts | getAdaptiveIconSize | 获取适配后的图标大小
@param baseSize 基础图标大小 | public getAdaptiveIconSize(baseSize: number): number {
if (this.isWatchOrWearable()) {
// 手环手表图标缩小40%
return Math.round(baseSize * 0.6);
} else if (this.isPhone()) {
return baseSize;
} else if (this.isTablet()) {
return Math.round(baseSize * 1.2);
} else {
return Math.rou... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAdaptiveIconSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | public getAdaptiveIconSize(baseSize: number): number {
if (this.isWatchOrWearable()) {
// 手环手表图标缩小40%
return Math.round(baseSize * 0.6);
} else if (this.isPhone()) {
return baseSize;
} else if (this.isTablet()) {
return Math.round(baseSize * 1.2);
} else {
return Math.rou... | https://github.com/LJ666-ui/harmony-health-care | 81c684c663d771fc9f24339c1359ab5d532ed93f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/SampleImageUtil.ets | arkts | getSampleImagePath | 获取示例图片的资源路径
如果本地资源不存在,返回一个占位图片URL | static getSampleImagePath(imagingType: ImagingType): string {
const sampleImage = SampleImageManager.getSampleImageByType(imagingType);
if (sampleImage) {
// 尝试使用本地资源
// 注意:需要确保rawfile目录下有对应的图片文件
return sampleImage.resourcePath;
}
// 如果没有找到,返回占位图片
return SampleImageMana... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSampleImagePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imagingType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | static getSampleImagePath(imagingType: ImagingType): string {
const sampleImage = SampleImageManager.getSampleImageByType(imagingType);
if (sampleImage) {
// 尝试使用本地资源
// 注意:需要确保rawfile目录下有对应的图片文件
return sampleImage.resourcePath;
}
// 如果没有找到,返回占位图片
return SampleImageMana... | https://github.com/LJ666-ui/harmony-health-care | 3bcabc2b78d148aa0c3fca7fdfd383e99704ac18 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/common/MooSoloWeb.ets | arkts | updateUrl | Update the URL of the web component. | updateUrl() {
try {
this.realUrl = this.controllerMeow.getUrl();
} catch (e) {
console.error('[MooSoloWeb] onProgressChange error: ' + e);
}
this.onUrlUpdate(this.realUrl);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | updateUrl() {
try {
this.realUrl = this.controllerMeow.getUrl();
} catch (e) {
console.error('[MooSoloWeb] onProgressChange error: ' + e);
}
this.onUrlUpdate(this.realUrl);
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | f9aee42cd2d883187b344eab4a4b78fef19e73b4 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/contentSource/facades/AuthInterceptorFacade.ets | arkts | setHeaderName | 设置鉴权头名称
@param name 请求头名称,默认 'Authorization' | setHeaderName(name: string): void {
this.headerName = name;
logger.info(TAG, '鉴权头名称已设置为: ' + name);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHeaderName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | setHeaderName(name: string): void {
this.headerName = name;
logger.info(TAG, '鉴权头名称已设置为: ' + name);
} | https://github.com/DaLongZhuaZi/NGF | fcd3b952425a445b9decc82e92a0e6658b613271 | github |
openharmony-sig/qr-code-generator | library/src/main/ets/components/MainPage/qrcodegen.ets | arkts | finderPenaltyAddHistory | Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore(). | private finderPenaltyAddHistory(currentRunLength: int, runHistory: Array<int>): void {
if (runHistory[0] == 0)
currentRunLength += this.size; // Add white border to initial run
runHistory.pop();
runHistory.unshift(currentRunLength);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left finderPenaltyAddHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentRunLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifie... | private finderPenaltyAddHistory(currentRunLength: int, runHistory: Array<int>): void {
if (runHistory[0] == 0)
currentRunLength += this.size; // Add white border to initial run
runHistory.pop();
runHistory.unshift(currentRunLength);
} | https://gitee.com/openharmony-sig/qr-code-generator.git | 2df838f917c73d5c9688d406e126de3c5fd1dbf8 | gitee |
openharmony-sig/knowledge_demo_entainment | FA/GuoChat/entry/src/main/ets/MainAbility/pages/UserInfo.ets | arkts | build | 用户信息
private contactData: ContactData = new ContactData("10000" , "header1.png" , "刘备" , "刘备" , Gender.male , "三国·蜀国") | build() {
Column(){
/**
* 顶部导航栏
*/
appBar({isBack:true , isClose:false , isMenu: false , isSearch: false , isMore:true , bgColor: $r('app.color.white'),title:this.contactData.mark})
/**
* 个人信息栏
* 包括头像/昵称/微信号/地区
*/
Column(){
Image(this.contactData... | 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(){
/**
* 顶部导航栏
*/
appBar({isBack:true , isClose:false , isMenu: false , isSearch: false , isMore:true , bgColor: $r('app.color.white'),title:this.contactData.mark})
/**
* 个人信息栏
* 包括头像/昵称/微信号/地区
*/
Column(){
Image(this.contactData... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 20ddf8dc5066a95f8d2a5ba77915c5646d8880a7 | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets | arkts | getReminderMinutesByIndex | 根据索引获取分钟数 | getReminderMinutesByIndex(index: number): number {
const options = this.getReminderOptions();
if (index >= 0 && index < options.length) {
return options[index].minutes;
}
return -1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getReminderMinutesByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A... | getReminderMinutesByIndex(index: number): number {
const options = this.getReminderOptions();
if (index >= 0 && index < options.length) {
return options[index].minutes;
}
return -1;
} | https://gitcode.com/openharmony/codelabs | 19c1cce9bd482540fa18ec3554cf57070eae6e59 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | valuesToHighlight | Returns true if there are values to highlight, false if there are no
values to highlight. Checks if the highlight array is null, has a length
of zero or if the first object is null.
@return | public valuesToHighlight(): boolean {
return this.mIndicesToHighlight == null || this.mIndicesToHighlight.length <= 0
|| this.mIndicesToHighlight[0] == null ? false
: true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valuesToHighlight 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... | public valuesToHighlight(): boolean {
return this.mIndicesToHighlight == null || this.mIndicesToHighlight.length <= 0
|| this.mIndicesToHighlight[0] == null ? false
: true;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 2d39f3e757586f972d0882a1cf8403518aedee98 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets | arkts | getCookie | 获取Cookie | getCookie(url: string): string {
const domain = this.extractDomain(url);
if (!domain) return '';
const domainCookies = this.cookies.get(domain);
if (!domainCookies) return '';
const now = Date.now();
const validCookies: string[] = [];
domainCookies.forEach((cookie, name) => ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCookie 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#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#... | getCookie(url: string): string {
const domain = this.extractDomain(url);
if (!domain) return '';
const domainCookies = this.cookies.get(domain);
if (!domainCookies) return '';
const now = Date.now();
const validCookies: string[] = [];
domainCookies.forEach((cookie, name) => ... | https://github.com/DaLongZhuaZi/manxia | 29fee155bf1c197caea3cae11ab231635411797b | github |
LYM15/FireflyCompanion | entry/src/main/ets/view/MinePage.ets | arkts | getCodeByText | 根据文字返回 code | getCodeByText(text: string): number | undefined {
const keys = Object.keys(ORDER_CODE_STATUS); // 返回 string[]
for (let i = 0; i < keys.length; i++) {
const key = Number(keys[i]); // 转成 number
if (ORDER_CODE_STATUS[key] === text) {
return key; // 找到对应 code
}
}
return undefined... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCodeByText 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 ... | getCodeByText(text: string): number | undefined {
const keys = Object.keys(ORDER_CODE_STATUS); // 返回 string[]
for (let i = 0; i < keys.length; i++) {
const key = Number(keys[i]); // 转成 number
if (ORDER_CODE_STATUS[key] === text) {
return key; // 找到对应 code
}
}
return undefined... | https://github.com/LYM15/FireflyCompanion | 68f1e6b1a03774ad3f782a42dcccc76a6cd3e2d2 | github |
smarthane/DrawerLayout | DrawerLayout/src/main/ets/components/DrawerLayout.ets | arkts | getDeviceWidth | 获取屏幕宽度
@param dpi
@returns | public static getDeviceWidth(dpi?: number): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelWidth = displayObject.width;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelWidth * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI);
} | 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 getDeviceWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dpi AST#identifier#Right AST#?#Left ? AS... | public static getDeviceWidth(dpi?: number): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelWidth = displayObject.width;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelWidth * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI);
} | https://github.com/smarthane/DrawerLayout | 89414fa90c6c6bea2088a52b6dd2d4d44f01c1e5 | github |
openharmony/codelabs | ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/service/PhotoService.ets | arkts | getCategories | 获取所有分类列表(去重)
@returns Promise<string[]> 分类列表 | getCategories(): Promise<string[]> {
if (!this.rdbStore) {
console.error('[PhotoService] 数据库未初始化');
return Promise.reject('DB not initialized');
}
let predicates = new relationalStore.RdbPredicates(Constants.PHOTO_TABLE_NAME);
return this.rdbStore.query(predicates, [Constants.COL_CATEGOR... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | getCategories(): Promise<string[]> {
if (!this.rdbStore) {
console.error('[PhotoService] 数据库未初始化');
return Promise.reject('DB not initialized');
}
let predicates = new relationalStore.RdbPredicates(Constants.PHOTO_TABLE_NAME);
return this.rdbStore.query(predicates, [Constants.COL_CATEGOR... | https://gitcode.com/openharmony/codelabs | e4a625e804d7a0c18ed2a01d7c69bc82cc513a10 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | webViewGetSource | 使用WebView获取资源URL | async webViewGetSource(
html: string | null,
url: string | null,
js: string | null,
sourceRegex: string
): Promise<string> {
const executor = getWebViewExecutor();
return executor.webViewGetSource(html, url, js, sourceRegex);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left webViewGetSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async webViewGetSource(
html: string | null,
url: string | null,
js: string | null,
sourceRegex: string
): Promise<string> {
const executor = getWebViewExecutor();
return executor.webViewGetSource(html, url, js, sourceRegex);
} | https://github.com/DaLongZhuaZi/manxia | d62a68c8b1a28cfbcd70075f8e6c323e3587f82c | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/WebDavClient.ets | arkts | exists | 判断路径是否存在
0: 不存在
1: 存在
2: 存在,但大小不一致
@param path
@param size
@returns | public async exists(path: string): Promise<boolean> {
hilog.info(DOMAIN, TAG, `Query path exists: ${path}`);
const req = new rcp.Request(path, "PROPFIND", { "Depth": "0" });
const rr = await this.request(req);
// 不存在
if (!rr.success) {
hilog.info(DOMAIN, TAG, `Query path exists error,code: $... | 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 exists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Righ... | public async exists(path: string): Promise<boolean> {
hilog.info(DOMAIN, TAG, `Query path exists: ${path}`);
const req = new rcp.Request(path, "PROPFIND", { "Depth": "0" });
const rr = await this.request(req);
// 不存在
if (!rr.success) {
hilog.info(DOMAIN, TAG, `Query path exists error,code: $... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L300-L310 | 34aeeceb42231417d14ddc90e01271b66f2ffbd5 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/HttpClient.ets | arkts | isConnectionError | 判断是否连接级错误(应 invalidate session)
协议级错误(401/4xx/5xx)不应丢 session,因为连接本身是好的
重要:timeout 不在其中。timeout 仅意味单次请求慢/对端暂不响应,
session 本身可能还能用,rcp 内部 ConnectionPool 会自行重建坏 TCP。
主动 session.close() 会同步取消同 session 上所有 in-flight 请求(HTTP/2 RST_STREAM 雪崩),
且该 RST/GOAWAY 会触发 Sunshine (Simple-Web-Server) 一侧 SSL state machine 异常,
让 HTTPS lis... | private static isConnectionError(msg: string): boolean {
if (!msg) return false;
const lower = msg.toLowerCase();
return lower.includes('refused') ||
lower.includes('unreachable') ||
lower.includes('handshake') ||
lower.includes('1007900007') || // Couldn't connect
lower.includes('... | 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 isConnectionError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Lef... | private static isConnectionError(msg: string): boolean {
if (!msg) return false;
const lower = msg.toLowerCase();
return lower.includes('refused') ||
lower.includes('unreachable') ||
lower.includes('handshake') ||
lower.includes('1007900007') || // Couldn't connect
lower.includes('... | https://github.com/AlkaidLab/moonlight-harmony | 6da52646386d79c986306e9045a9e53d67557653 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets | arkts | getCookieByTag | 按标签获取Cookie(兼容Legado格式) | getCookieByTag(tag: string, key?: string): string {
// tag通常是域名或书源标识
const domain = tag.includes('.') ? tag : '';
if (key) {
// 获取指定key的cookie值
if (domain) {
return this.getCookieValue(`https://${domain}`, key);
}
// 遍历所有域名查找
const domains = Array.from(this.cooki... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCookieByTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , A... | getCookieByTag(tag: string, key?: string): string {
// tag通常是域名或书源标识
const domain = tag.includes('.') ? tag : '';
if (key) {
// 获取指定key的cookie值
if (domain) {
return this.getCookieValue(`https://${domain}`, key);
}
// 遍历所有域名查找
const domains = Array.from(this.cooki... | https://github.com/DaLongZhuaZi/manxia | a39c5234fa2056e984b46b9abb9a67bdd6a33e5a | github |
arkui-x/samples | CodeLab/Cases/common/routermodule/src/main/ets/router/DynamicsRouter.ets | arkts | registerAppRouterPage | 注册动态路由需要加载的页面,用于自动生成的路由
@param pageName 页面名,需要动态加载的页面名称
@param wrapBuilder wrapBuilder对象 | public static registerAppRouterPage(routerInfo: AppRouterInfo, wrapBuilder: WrappedBuilder<[object]>): void {
const builderName: string = routerInfo.name;
if (!DynamicsRouter.builderMap.has(builderName)) {
DynamicsRouter.registerBuilder(builderName, wrapBuilder);
}
} | 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 registerAppRouterPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left routerInfo AST#identifier#Right A... | public static registerAppRouterPage(routerInfo: AppRouterInfo, wrapBuilder: WrappedBuilder<[object]>): void {
const builderName: string = routerInfo.name;
if (!DynamicsRouter.builderMap.has(builderName)) {
DynamicsRouter.registerBuilder(builderName, wrapBuilder);
}
} | https://gitcode.com/arkui-x/samples | 2aab0a4fdcfb09e549d681abd6d3262add3fa4ff | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getNetBearType | 获取网络类型。 | static getNetBearType(): connection.NetBearType {
return NetworkUtil.getNetBearTypes()[0];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNetBearType 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 ... | static getNetBearType(): connection.NetBearType {
return NetworkUtil.getNetBearTypes()[0];
} | https://github.com/tdcare/tdwebrtc | 299b20f3ac8d454b45052e90f6a0fa8c81214ab1 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | getFootprintByGoodsId | 根据商品ID获取足迹记录
@param {number} goodsId 商品ID
@returns {Promise<Footprint | undefined>} 匹配到的足迹 | getFootprintByGoodsId(goodsId: number): Promise<Footprint | undefined> {
return this.dataSource.getFootprintByGoodsId(goodsId);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFootprintByGoodsId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ... | getFootprintByGoodsId(goodsId: number): Promise<Footprint | undefined> {
return this.dataSource.getFootprintByGoodsId(goodsId);
} | https://github.com/Joker-x-dev/CoolMallArkTS | ea18049c6aaee37ffa1b8df1308b0ffbf48a5aa0 | github |
heeh02/superconnect | harmony/entry/src/main/ets/input/TrackpadHandler.ets | arkts | isTrackpadTool | True for the integrated-trackpad tool types — the router uses this to route onTouch here. | isTrackpadTool(t: number): boolean {
return t === this.TRACKPAD_TOOL || t === 3 || t === 4;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isTrackpadTool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST... | isTrackpadTool(t: number): boolean {
return t === this.TRACKPAD_TOOL || t === 3 || t === 4;
} | https://github.com/heeh02/superconnect | 10e4850af6fe70967d5f3cdfcdf8ec60bb0790f7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/WaitersList.ets | arkts | restockQueue | takes list from tail_, reverses it and puts it into head_ | private restockQueue(): boolean {
let tail = this.tail_.exchange(undefined);
while (tail != undefined) {
let newHead = tail;
tail = tail!.next;
newHead.next = this.head_;
this.head_ = newHead;
}
return this.head_ != undefined;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left restockQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | private restockQueue(): boolean {
let tail = this.tail_.exchange(undefined);
while (tail != undefined) {
let newHead = tail;
tail = tail!.next;
newHead.next = this.head_;
this.head_ = newHead;
}
return this.head_ != undefined;
} | https://gitcode.com/iop123123/arkts-static-skills | 5ac847e03503f518b11ec55d0a138890119d59f3 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setForm | sets the form/shape of the legend forms
@param shape | public setForm(shape: LegendForm): void {
this.mShape = shape;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setForm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shape AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LegendF... | public setForm(shape: LegendForm): void {
this.mShape = shape;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0d20b416773f6825a80d2615514c78e81b98ab0e | gitee |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/ConfigFlow.ui.test.ets | arkts | restoreDefaultTimerChip | V0.6.7.7: cleanup helper. After a custom-timer test we restore the
canonical 5m chip (persisted on tap) and leave Config so subsequent
suites in the same `aa test` invocation see the expected default
battle length. Mirrors the defensive try/finally pattern in
PackManagerFlow's pack-toggle tests.
Caller can be anywhere ... | async function restoreDefaultTimerChip(driver: Driver): Promise<void> {
try {
await returnToHome(driver);
await openConfig(driver);
await driver.assertComponentExist(ON.id(DEFAULT_TIMER_CHIP_ID));
await clickByIdShared(driver, DEFAULT_TIMER_CHIP_ID);
await driver.delayMs(300);
await tapConfigS... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left restoreDefaultTimerChip AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Rig... | async function restoreDefaultTimerChip(driver: Driver): Promise<void> {
try {
await returnToHome(driver);
await openConfig(driver);
await driver.assertComponentExist(ON.id(DEFAULT_TIMER_CHIP_ID));
await clickByIdShared(driver, DEFAULT_TIMER_CHIP_ID);
await driver.delayMs(300);
await tapConfigS... | https://github.com/terryma2024/happyword | 9663900235c9fabf6529809b06d0a434a55f188c | github |
openharmony-sig/fluttertpc_flutter_qr_reader | ohos/src/main/ets/me/hetian/flutter_qr_reader/components/viewmodel/CustomScanViewModel.ets | arkts | tryCloseFlashLight | 尝试把开启的闪光灯关闭
@returns {void} | tryCloseFlashLight() {
try {
// 闪光灯标记移除
this.cameraLightUpdateCb(false);
// 如果闪光灯开启,则关闭
if (customScan.getFlashLightStatus()) {
customScan.closeFlashLight();
}
} catch (error) {
Log.e(TAG, 'flashLight try close failed, error: ' + JSON.stringify(error))
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tryCloseFlashLight 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... | tryCloseFlashLight() {
try {
// 闪光灯标记移除
this.cameraLightUpdateCb(false);
// 如果闪光灯开启,则关闭
if (customScan.getFlashLightStatus()) {
customScan.closeFlashLight();
}
} catch (error) {
Log.e(TAG, 'flashLight try close failed, error: ' + JSON.stringify(error))
}
} | https://gitee.com/openharmony-sig/fluttertpc_flutter_qr_reader.git | 41872c4e86147dff3174098bcc67a9b8bb280f4b | gitee |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/ImageFormat/ets/common/src/main/ets/common/utils/LogUtil.ets | arkts | constructor | Constructor.
@param prefix Identifies the log tag.
@param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. | constructor(prefix: string = 'MyNFC', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | 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 prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#L... | constructor(prefix: string = 'MyNFC', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 59e656f9533ed36da152a41c98d67a6d912cd4bc | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | setLeftPadding | Sets the 'leftPadding'.
@param padding the new value of 'leftPadding' | public setLeftPadding(padding:number):void {
this.defaultLeftPad = padding;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLeftPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left padding AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | public setLeftPadding(padding:number):void {
this.defaultLeftPad = padding;
} | https://gitee.com/openharmony-sig/commons-cli.git | 0b8763ccf6255c8e1c1a3a7f52dfef09f1f06cba | gitee |
codelably/tuniao-ui | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | 窗口创建时调用
加载入口页面、初始化UI基础样式
@param windowStage 窗口阶段 | async onWindowStageCreate(windowStage: window.WindowStage): Promise<void> {
windowStage.loadContent('view/EntryPage', (_) => {
IBestUIInitializer.initIBestUI(windowStage, this.context);
TnUIInitializer.initTnUI(windowStage, this.context);
});
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left windowStage AST#identifier#Right AST#type_annotati... | async onWindowStageCreate(windowStage: window.WindowStage): Promise<void> {
windowStage.loadContent('view/EntryPage', (_) => {
IBestUIInitializer.initIBestUI(windowStage, this.context);
TnUIInitializer.initTnUI(windowStage, this.context);
});
} | https://github.com/codelably/tuniao-ui | 190aa701bbc17b38fc96f9e3e21f206d84d6c1d0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | updateLayoutConfig | 更新布局配置 | public updateLayoutConfig(config: Partial<GridLayoutConfig>): void {
this.layoutConfig = {
columns: config.columns ?? this.layoutConfig.columns,
itemWidth: config.itemWidth ?? this.layoutConfig.itemWidth,
itemHeight: config.itemHeight ?? this.layoutConfig.itemHeight,
columnGap: config.colu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateLayoutConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiati... | public updateLayoutConfig(config: Partial<GridLayoutConfig>): void {
this.layoutConfig = {
columns: config.columns ?? this.layoutConfig.columns,
itemWidth: config.itemWidth ?? this.layoutConfig.itemWidth,
itemHeight: config.itemHeight ?? this.layoutConfig.itemHeight,
columnGap: config.colu... | https://github.com/DaLongZhuaZi/manxia | 8130ceaa70632e66fd4537f01d5af16b32830fd6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | byteLength | Number of bytes used
@returns { int }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get byteLength(): int {
return this.byteLengthInt
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left byteLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ... | public get byteLength(): int {
return this.byteLengthInt
} | https://gitcode.com/iop123123/arkts-static-skills | 0f13ef5e90f7606184bddc118b4a073a60ff17e1 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | parseOpenAIResponse | 解析 OpenAI 响应 | private parseOpenAIResponse(responseData: string): AIApiResult {
const response = JSON.parse(responseData) as ChatCompletionResponse
if (response.choices !== undefined && response.choices.length > 0) {
const choice = response.choices[0]
const structuredReasoning = (choice.message.reasoning_content... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseOpenAIResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left responseData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | private parseOpenAIResponse(responseData: string): AIApiResult {
const response = JSON.parse(responseData) as ChatCompletionResponse
if (response.choices !== undefined && response.choices.length > 0) {
const choice = response.choices[0]
const structuredReasoning = (choice.message.reasoning_content... | https://github.com/LongLiveY96/chatcube | 6a3d5dcd56f0d8288c333848bded831004030e93 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | getDesktopWidth | Get desktop width | getDesktopWidth(): number {
return this.desktopWidth;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDesktopWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statem... | getDesktopWidth(): number {
return this.desktopWidth;
} | https://github.com/tangwengang-del/freerdp-harmonyos | baa9454bf8cf2f150f402d58018af8be2ce8bc2b | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/FocusTimerEngine.ets | arkts | onRestComplete | 休息完成处理逻辑 | private onRestComplete(): void {
this.sendCompletionNotification('休息完成', '休息时间结束,自动开始下一段专注!');
this.cleanupTimer();
this.start(this.currentWorkDuration, this.currentRestDuration, this.todoId);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onRestComplete 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#expr... | private onRestComplete(): void {
this.sendCompletionNotification('休息完成', '休息时间结束,自动开始下一段专注!');
this.cleanupTimer();
this.start(this.currentWorkDuration, this.currentRestDuration, this.todoId);
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L210-L214 | 8943baa38d9c41d58a4c1ef05406e95df9e5b97e | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | scheduleNetworkReconfigure | Coalesce a burst of network callbacks into a single delayed re-evaluation. | private scheduleNetworkReconfigure(reason: string): void {
if (this.netChangeDebounceTimer >= 0) {
clearTimeout(this.netChangeDebounceTimer);
}
this.netChangeDebounceTimer = setTimeout(() => {
this.netChangeDebounceTimer = -1;
this.onNetworkChanged(reason).catch((err: BusinessError) => {... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleNetworkReconfigure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private scheduleNetworkReconfigure(reason: string): void {
if (this.netChangeDebounceTimer >= 0) {
clearTimeout(this.netChangeDebounceTimer);
}
this.netChangeDebounceTimer = setTimeout(() => {
this.netChangeDebounceTimer = -1;
this.onNetworkChanged(reason).catch((err: BusinessError) => {... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L888-L899 | a32ff615e459a8da041129af815c01cce9323762 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | getUTCMinutes | Returns the minutes in the specified date according to universal time.
@returns { int } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getUTCMinutes(): int {
return ecmaMinFromTime(this.ms);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#... | public getUTCMinutes(): int {
return ecmaMinFromTime(this.ms);
} | https://gitcode.com/iop123123/arkts-static-skills | 760f949c7e196f0554a508fdb40f0b5907390d4f | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/ConversationMemory.ets | arkts | retrieve | 检索对话历史
@param sessionId 会话ID
@returns 对话上下文 | async retrieve(sessionId: string): Promise<ConversationContext | null> {
const context = this.storage.get(sessionId);
if (!context) {
return null;
}
// 检查是否过期
const now = Date.now();
const ttl = this.config.sessionTTL * 1000;
if (now - context.updatedAt > ttl) {
this.storage... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left retrieve AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sessionId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async retrieve(sessionId: string): Promise<ConversationContext | null> {
const context = this.storage.get(sessionId);
if (!context) {
return null;
}
// 检查是否过期
const now = Date.now();
const ttl = this.config.sessionTTL * 1000;
if (now - context.updatedAt > ttl) {
this.storage... | https://github.com/LJ666-ui/harmony-health-care | 40c4856abf5dbf4357371bd4add2c9190ebf4ded | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | getTitle | 获取菜单项标题
@returns 标题文本 | public getTitle(): string | undefined {
return this.title;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#id... | public getTitle(): string | undefined {
return this.title;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 8296277cbc211a3aa0ce216bcbc53d275d3acd8f | gitcode |
HarmonyOS_Samples/MultiPictureBeautification | features/multipictureediting/src/main/ets/view/PictureEditingView.ets | arkts | showAlert | Show warning dialog for small screen devices | showAlert(): void {
this.getUIContext().showAlertDialog({
message: $r('app.string.small_screen_alert_message'),
alignment: DialogAlignment.Center,
width: '90%',
confirm: {
value: $r('app.string.small_screen_alert_confirm'),
action: () => {}
}
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showAlert 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#Le... | showAlert(): void {
this.getUIContext().showAlertDialog({
message: $r('app.string.small_screen_alert_message'),
alignment: DialogAlignment.Center,
width: '90%',
confirm: {
value: $r('app.string.small_screen_alert_confirm'),
action: () => {}
}
})
} | https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification | 0eb7018d749bd0065b901b44d377207c1c281e85 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/utils/DAOHelper.ets | arkts | convertToLedgerInvitation | 转换为LedgerInvitation | static convertToLedgerInvitation(resultSet: relationalStore.ResultSet): LedgerInvitation {
const invitation = new LedgerInvitation();
invitation.invitationId = DAOHelper.getNumberValue(resultSet, 'invitation_id');
invitation.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id');
invitation.invit... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToLedgerInvitation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#m... | static convertToLedgerInvitation(resultSet: relationalStore.ResultSet): LedgerInvitation {
const invitation = new LedgerInvitation();
invitation.invitationId = DAOHelper.getNumberValue(resultSet, 'invitation_id');
invitation.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id');
invitation.invit... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3d170b0cc458bad7024d5868bd43b01f50f1795a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | deleteGroup | 删除分组(仅移除分组标签,不删除书源) | async deleteGroup(groupName: string): Promise<number> {
return this.removeSourcesFromGroup(
this.getSourcesByGroup(groupName).map(s => s.id),
groupName
);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteGroup AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left groupName AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async deleteGroup(groupName: string): Promise<number> {
return this.removeSourcesFromGroup(
this.getSourcesByGroup(groupName).map(s => s.id),
groupName
);
} | https://github.com/DaLongZhuaZi/manxia | e2195296bfe3f6376919d20b6d56af052485838d | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/ImageUtil.ets | arkts | getColorByPath | 根据路径获取颜色
@param imageUrl string
@param isDeepColor boolean
@returns Promise<number[]> | private static getColorByPath(imageUrl: string, isDeepColor?: boolean): Promise<number[]> {
return new Promise((resolve: (value: number[]) => void, reject: (reason?: Object) => void) => {
ResourceUtil.getColorDataByPath(imageUrl).then((colors: number[]) => {
let colorArr: number[] = colors
i... | 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 getColorByPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imageUrl AST#identifier#Right AST#ERROR#Left AST#:#L... | private static getColorByPath(imageUrl: string, isDeepColor?: boolean): Promise<number[]> {
return new Promise((resolve: (value: number[]) => void, reject: (reason?: Object) => void) => {
ResourceUtil.getColorDataByPath(imageUrl).then((colors: number[]) => {
let colorArr: number[] = colors
i... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 5b6e94a93cab23686958df8798fb3ab3e1eca711 | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | pause | Pauses playback when currently in PLAY state. | public pause() {
Logger.info(TAG, 'AVPlayer pause() isPrepared:' + this.isPrepared + ', state:' + this.state);
if (this.isPrepared && this.state === AudioPlayerState.PLAY && this.avPlayer) {
this.avPlayer.pause().then(() => {
this.state = AudioPlayerState.PAUSE;
this.updateIsPlay(false);... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pause AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#L... | public pause() {
Logger.info(TAG, 'AVPlayer pause() isPrepared:' + this.isPrepared + ', state:' + this.state);
if (this.isPrepared && this.state === AudioPlayerState.PLAY && this.avPlayer) {
this.avPlayer.pause().then(() => {
this.state = AudioPlayerState.PAUSE;
this.updateIsPlay(false);... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 9505d9aca4b254800213725896b6305339207bf6 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AnomalyDetection.ets | arkts | detectBySigma3 | 使用3σ原则检测异常 | detectBySigma3(value: number): AnomalyDetectionResult {
const lowerBound = this.mean - 3 * this.stdDev;
const upperBound = this.mean + 3 * this.stdDev;
const isAnomaly = value < lowerBound || value > upperBound;
let deviation = 0;
if (this.stdDev > 0) {
deviation = Math.abs(value - this.mean... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left detectBySigma3 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left )... | detectBySigma3(value: number): AnomalyDetectionResult {
const lowerBound = this.mean - 3 * this.stdDev;
const upperBound = this.mean + 3 * this.stdDev;
const isAnomaly = value < lowerBound || value > upperBound;
let deviation = 0;
if (this.stdDev > 0) {
deviation = Math.abs(value - this.mean... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0653d48735b4ba843c7f14d0324f7e74759726ef | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/NoUselessBackreference/ets/NoUselessBackreferenceReport.ets | arkts | build | reference to (a) into another alternative | build() {
RelativeContainer() {
Text(this.message)
.id('BanESLintCommentHelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: Horizo... | 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() {
RelativeContainer() {
Text(this.message)
.id('BanESLintCommentHelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: Horizo... | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 93f3d2f91add6b08c88beb0e1c88a191f522432e | github |
arkui-x/samples | CodeLab/Cases/common/routermodule/src/main/ets/foldableRouter/FoldableRouter.ets | arkts | pushUri | 兼容折叠屏下的路由跳转
@param uri 路由名称
@param param 路由参数 | public static pushUri(uri: string, param: ESObject) {
// 记录当前进入路由名称
AppStorage.setOrCreate('enterRouteName', uri);
// 定义事件3
let innerEvent: emitter.InnerEvent = {
eventId: 3
};
let eventData: emitter.EventData = {
data: {
navMode: NavMode.ChildPageMode
}
};
//... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left pushUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Rig... | public static pushUri(uri: string, param: ESObject) {
// 记录当前进入路由名称
AppStorage.setOrCreate('enterRouteName', uri);
// 定义事件3
let innerEvent: emitter.InnerEvent = {
eventId: 3
};
let eventData: emitter.EventData = {
data: {
navMode: NavMode.ChildPageMode
}
};
//... | https://gitcode.com/arkui-x/samples | d98f293c2f8ba5203591ea2094a64b0a5383300f | gitcode |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/IWebDownloadFile.ets | arkts | validatePath | 路径验证与处理 | private validatePath(customPath?: string): string {
if (customPath) {
return this.ensureFileExtension(customPath)
}
return this.generateDefaultPath()
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validatePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left customPath AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#s... | private validatePath(customPath?: string): string {
if (customPath) {
return this.ensureFileExtension(customPath)
}
return this.generateDefaultPath()
} | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | 601a99d8d1cbfdafffe26fc37bc3f1c07a8f0d06 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_api10/app/i2c_app/entry/src/main/ets/pages/second.ets | arkts | getValue | 获取温湿度 | getValue() {
i2cnapidemo.ReadData();
this.ReadTemperatureC = i2cnapidemo.ReadTemperatureC();
this.ReadHumidity = i2cnapidemo.ReadHumidity();
this.ReadTemperatureF = i2cnapidemo.ReadTemperatureF();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#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 AS... | getValue() {
i2cnapidemo.ReadData();
this.ReadTemperatureC = i2cnapidemo.ReadTemperatureC();
this.ReadHumidity = i2cnapidemo.ReadHumidity();
this.ReadTemperatureF = i2cnapidemo.ReadTemperatureF();
} | https://gitee.com/openharmony/vendor_unionman.git | d588e87c805d835354a7ca238c53c417bfb9e289 | gitee |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | rtrim | Remove the trailing whitespace from the specified String.
@param s The String to remove the trailing padding from.
@return The String of without the trailing padding | public rtrim(s: string): string{
if (s.length == 0) {
return s;
}
let pos = s.length;
while (pos > 0 && HelpFormatter.isWhitespace(s.charAt(pos - 1))) {
--pos;
}
return s.substring(0, pos);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left rtrim AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public rtrim(s: string): string{
if (s.length == 0) {
return s;
}
let pos = s.length;
while (pos > 0 && HelpFormatter.isWhitespace(s.charAt(pos - 1))) {
--pos;
}
return s.substring(0, pos);
} | https://gitee.com/openharmony-sig/commons-cli.git | d546aeb078ce35f635a378abb20fbb552ff04e95 | gitee |
HarmonyOS_Samples/MultiPictureBeautification | features/multipicturebrowsing/src/main/ets/datasource/PictureListDataSource.ets | arkts | updatePictureList | Update the entire picture list | updatePictureList(newList: PictureViewModel[]): void {
this.pictureList = newList;
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updatePictureList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Pictu... | updatePictureList(newList: PictureViewModel[]): void {
this.pictureList = newList;
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification | 8db9bf0635179fe83648b71ca656a9d57802a3c5 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/healthchart/src/main/ets/model/BasicDataSource.ets | arkts | getFormattedValue | 设置X轴数据的格式转换器 | getFormattedValue(): string {
const result = (this.data?.getX() || 1) >= 24 ? '次日' + ((this.data?.getX() || 1) - 24) + '点' : (this.data?.getX() || 1) + '' + '点';
return result;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormattedValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stat... | getFormattedValue(): string {
const result = (this.data?.getX() || 1) >= 24 ? '次日' + ((this.data?.getX() || 1) - 24) + '点' : (this.data?.getX() || 1) + '' + '点';
return result;
} | https://gitcode.com/arkui-x/samples | ffe5a257411025f5d38ceea556447151c899e51d | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | with | Creates a copy with replaced value on index
@param { int } index - index to change
@param { int } value - value to set
@returns { Uint16Array } - an Uint16Array with replaced value on index
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageM... | public with(index: int, value: int): Uint16Array {
let res = new Uint16Array(this)
res.setUnsafeClamp(index, value)
return res
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | public with(index: int, value: int): Uint16Array {
let res = new Uint16Array(this)
res.setUnsafeClamp(index, value)
return res
} | https://gitcode.com/iop123123/arkts-static-skills | 0b2a39f733d37844ce0d614d6880a56356eb928a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DataConverter.ets | arkts | toInteger | 安全转换整数
@param value - 输入值
@param defaultValue - 默认值
@returns 整数值 | static toInteger(value: Object, defaultValue: number = 0): number {
const num = DataConverter.toNumber(value, defaultValue);
return Math.floor(num);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Objec... | static toInteger(value: Object, defaultValue: number = 0): number {
const num = DataConverter.toNumber(value, defaultValue);
return Math.floor(num);
} | https://github.com/DaLongZhuaZi/manxia | a8923a379996a3192674d42b00125802b62da9dd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | updateTrackRecord | 更新跟踪记录 | public async updateTrackRecord(
contentId: string,
trackerId: TrackerId,
params: UpdateTrackRecordParams
): Promise<boolean> {
try {
const updates: string[] = [];
const values: (string | number)[] = [];
if (params.lastChapterRead !== undefined) {
updates.push('lastChapterR... | 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 updateTrackRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#:#L... | public async updateTrackRecord(
contentId: string,
trackerId: TrackerId,
params: UpdateTrackRecordParams
): Promise<boolean> {
try {
const updates: string[] = [];
const values: (string | number)[] = [];
if (params.lastChapterRead !== undefined) {
updates.push('lastChapterR... | https://github.com/DaLongZhuaZi/manxia | 9a1c86af1173e9c49edbedea9b28316e04b4f39e | github |
CLMC2025/Vignette | entry/src/main/ets/sync/DataSyncManager.ets | arkts | mergeWordItem | 智能合并WordItem对象,保留用户特定的操作状态
算法状态由FSRS决定,用户状态由用户操作决定 | private mergeWordItem(local: WordItem, remote: WordItem): WordItem {
const merged = local.clone();
// === FSRS算法状态更新策略 ===
// 在FSRS算法状态下,采用时间戳驱动的合并 - 更晚的值被保留
if (remote.updatedAt > local.updatedAt) {
merged.fsrsState = remote.fsrsState.clone();
merged.history = ReviewHistory.fromJSO... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeWordItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left local AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private mergeWordItem(local: WordItem, remote: WordItem): WordItem {
const merged = local.clone();
// === FSRS算法状态更新策略 ===
// 在FSRS算法状态下,采用时间戳驱动的合并 - 更晚的值被保留
if (remote.updatedAt > local.updatedAt) {
merged.fsrsState = remote.fsrsState.clone();
merged.history = ReviewHistory.fromJSO... | https://github.com/CLMC2025/Vignette | e2169ad06128ce963dbb946e4a6a85f7b0cb97c4 | github |
Joker-x-dev/CoolMallArkTS | feature/feedback/src/main/ets/view/FeedbackSubmitPage.ets | arkts | build | 构建提交反馈页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "提交反馈",
viewModel: this.vm
}) {
this.FeedbackSubmitContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "提交反馈",
viewModel: this.vm
}) {
this.FeedbackSubmitContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | c2b8ffefb744163d93232df62df5c5cb386b6577 | github |
killetom/ktretrofit | entry/src/main/ets/example/RetrofitConfigExample.ets | arkts | getProtectedResourceExample | Example with authentication header | getProtectedResourceExample(authToken: string): ProtectedResource {
try {
const userService = this.createUserService();
const call = userService.getWithAuth(authToken);
const response = call.execute();
console.log('Protected resource fetched successfully:', response.body);
re... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProtectedResourceExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left authToken AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST... | getProtectedResourceExample(authToken: string): ProtectedResource {
try {
const userService = this.createUserService();
const call = userService.getWithAuth(authToken);
const response = call.execute();
console.log('Protected resource fetched successfully:', response.body);
re... | https://github.com/killetom/ktretrofit | 0f7e06dcd522986fed0cbcacb212defe49f5497d | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets | arkts | setLanguage | 设置语言
@param language 语言代码 | async setLanguage(language: string): Promise<void> {
try {
await this.dao.put(AppConstants.PREF_KEY_LANGUAGE, language);
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to set language: ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setLanguage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left language AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async setLanguage(language: string): Promise<void> {
try {
await this.dao.put(AppConstants.PREF_KEY_LANGUAGE, language);
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to set language: ${JSON.stringify(err)}`);
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | 8723c7983115e52ceccbdc0b5a8fb0013b80011b | github |
genjishare/snake-game | entry/src/main/ets/entryability/EntryAbility.ets | arkts | useExistingDataObjectForFlow | 使用现有分布式数据对象进行流转 | useExistingDataObjectForFlow() {
hilog.info(DOMAIN, TAG, '使用现有分布式数据对象进行流转');
this.updateExistingDataObject();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left useExistingDataObjectForFlow 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#state... | useExistingDataObjectForFlow() {
hilog.info(DOMAIN, TAG, '使用现有分布式数据对象进行流转');
this.updateExistingDataObject();
} | https://github.com/genjishare/snake-game | 1771d8a3270c9f09631de0a4462b0dbd3e61290d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from a set of type std.core.Set<int>.
@param { Set<int> } set - A set object to convert to an array.
@returns { Uint16Array } - A new Uint16Array
@throws { RangeError } - Input parameter error.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(set: Set<int>): Uint16Array {
const length = set.size;
const result = new Uint16Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('Wrong ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ... | public static from(set: Set<int>): Uint16Array {
const length = set.size;
const result = new Uint16Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('Wrong ... | https://gitcode.com/iop123123/arkts-static-skills | 7946768f78ed5f9f6a520737f741b4f1c871f7ff | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | toOrderCommentForGoods | 跳转订单评价页面(指定商品)
@param {number} goodsId - 商品 ID
@returns {void} 无返回值 | toOrderCommentForGoods(goodsId: number): void {
const orderId: number = this.data?.id ?? 0;
if (!orderId || !goodsId) {
return;
}
this.hideCommentModal();
OrderNavigator.toComment(orderId, goodsId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toOrderCommentForGoods AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left... | toOrderCommentForGoods(goodsId: number): void {
const orderId: number = this.data?.id ?? 0;
if (!orderId || !goodsId) {
return;
}
this.hideCommentModal();
OrderNavigator.toComment(orderId, goodsId);
} | https://github.com/Joker-x-dev/CoolMallArkTS | ea9e0406432b04d0124f6cf53de1d19ea4db3659 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | getLocalMac | ---- SignalingCallbackImpl 所需的访问器和事件触发方法 ---- | public getLocalMac(): string {
return this.localMac;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLocalMac 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... | public getLocalMac(): string {
return this.localMac;
} | https://github.com/tdcare/tdwebrtc | fc61aac4453b1e9f0c5ecac7af499a703141e02f | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/view/MonthView.ets | arkts | onSelectDayChange | 日期选择改变 | onSelectDayChange() {
// 记录选中的月视图日期,拉起添加日程页面会根据选中日期显示对应的"开始时间"
CommonData.CURRENT_SELECT_DATE = this.currentSelectDate;
const PARTS: string[] = this.currentSelectDate.split('-');
// 更新年月数据
this.currentShowYear = Number(PARTS[0]);
this.currentShowMonth = Number(PARTS[1]);
this.onChangeYearM... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onSelectDayChange 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#... | onSelectDayChange() {
// 记录选中的月视图日期,拉起添加日程页面会根据选中日期显示对应的"开始时间"
CommonData.CURRENT_SELECT_DATE = this.currentSelectDate;
const PARTS: string[] = this.currentSelectDate.split('-');
// 更新年月数据
this.currentShowYear = Number(PARTS[0]);
this.currentShowMonth = Number(PARTS[1]);
this.onChangeYearM... | https://gitcode.com/arkui-x/samples | a8342d78bd72e43dc3190c1c16b9f2bb6183b3fd | gitcode |
StarHeartY/CalculatorX | entry/src/main/ets/components/FormulaScreen.ets | arkts | aboutToAppear | 当前 S⇄D 面板的显示状态 | aboutToAppear() {
let eventHub = getContext(this).eventHub;
// 监听全局历史记录插板的插入、顶部撤销重做
eventHub.on('event_math_insert', (str: string) => {
this.insertToWeb(str);
});
eventHub.on('event_math_undo', () => {
this.webviewController.runJavaScript(`document.querySelector('math-field').executeC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
let eventHub = getContext(this).eventHub;
// 监听全局历史记录插板的插入、顶部撤销重做
eventHub.on('event_math_insert', (str: string) => {
this.insertToWeb(str);
});
eventHub.on('event_math_undo', () => {
this.webviewController.runJavaScript(`document.querySelector('math-field').executeC... | https://github.com/StarHeartY/CalculatorX | 5da34a4cadfe07352c452a8b261a7164cc4082a5 | github |
the-wwyang/kids-learning-app | src/main/ets/services/LearningRecordService.ets | arkts | createSession | 创建学习会话
@returns 新的学习会话 | static createSession(): LearningSession {
return {
id: LearningRecordService.generateSessionId(),
startTime: new Date().toISOString(),
records: [],
totalQuestions: 0,
correctCount: 0,
starsEarned: 0,
duration: 0
};
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createSession 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 Learning... | static createSession(): LearningSession {
return {
id: LearningRecordService.generateSessionId(),
startTime: new Date().toISOString(),
records: [],
totalQuestions: 0,
correctCount: 0,
starsEarned: 0,
duration: 0
};
} | https://github.com/the-wwyang/kids-learning-app | 179277359c87604a33615d8efaa06e7cc3ff7d11 | github |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | sendCall | 发送语音呼叫 | public sendCall(toMac: string, roomId: string, msg: string): void {
LogUtil.info(`${TAG} sendCall: from_mac=${this.mac}, to_mac=${toMac}, room_id=${roomId}, msg=${msg}`);
const env = this.buildForwardEnvelope(toMac);
const data: SignalingData = {
action: CmdAction.ACTION_CALL,
room_id: roomId,... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | public sendCall(toMac: string, roomId: string, msg: string): void {
LogUtil.info(`${TAG} sendCall: from_mac=${this.mac}, to_mac=${toMac}, room_id=${roomId}, msg=${msg}`);
const env = this.buildForwardEnvelope(toMac);
const data: SignalingData = {
action: CmdAction.ACTION_CALL,
room_id: roomId,... | https://github.com/tdcare/tdwebrtc | 2bef9633a11c4778afa3130a319c1183cb359862 | github |
PollenWang6/HiXD | entry/src/main/ets/services/CasLoginService.ets | arkts | navigateToYjspt | ========== 研究生 (yjspt) API ==========
走 CAS OAuth 链建立 yjspt session,自动跟随重定向直到拿到最终页面 | async navigateToYjspt(targetUrl: string): Promise<void> {
console.info(TAG, 'navigateToYjspt: ' + targetUrl.substring(0, 60));
try {
let currentUrl = targetUrl;
for (let hop = 0; hop < 8; hop++) {
const resp = await this.http.getNoRedirect(currentUrl);
if (!resp.isRedirect || !resp... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left navigateToYjspt AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left targetUrl AST#identifier#Right AST#type_annotation#Lef... | async navigateToYjspt(targetUrl: string): Promise<void> {
console.info(TAG, 'navigateToYjspt: ' + targetUrl.substring(0, 60));
try {
let currentUrl = targetUrl;
for (let hop = 0; hop < 8; hop++) {
const resp = await this.http.getNoRedirect(currentUrl);
if (!resp.isRedirect || !resp... | https://github.com/PollenWang6/HiXD | 8cd1ecb163305602e7a9d28e919a98317864c1ab | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/SearchFilter.ets | arkts | activeFilterCount | 获取激活的过滤条件数量(不包括 inType) | get activeFilterCount(): number {
let count: number = 0;
if (this.categoryId !== null) count++;
count += this.tags.length;
if (this.status !== null) count++;
if (this.beforeDate !== null || this.afterDate !== null) count++;
return count;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left activeFilterCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number... | get activeFilterCount(): number {
let count: number = 0;
if (this.categoryId !== null) count++;
count += this.tags.length;
if (this.status !== null) count++;
if (this.beforeDate !== null || this.afterDate !== null) count++;
return count;
} | https://github.com/Amaz1ny/HarmonyDO-public | 28cfa03514bd4b1f593a3b3672ceb88c248f2019 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | getLocalCoverPath | 获取本地封面路径(如果存在) | async getLocalCoverPath(sourceId: number, externalId: string): Promise<string | null> {
return this.getLocalCoverPathWithReferer(sourceId, externalId, '');
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLocalCoverPath AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#... | async getLocalCoverPath(sourceId: number, externalId: string): Promise<string | null> {
return this.getLocalCoverPathWithReferer(sourceId, externalId, '');
} | https://github.com/DaLongZhuaZi/manxia | 93477140c23f282c38321f05a4bef4fbe62d245d | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toBinary | Return a string representing the value of this Decimal in base 2.
@returns { string } the string type | public toBinary(): string {
return this.toStringBinary(2);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toBinary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string... | public toBinary(): string {
return this.toStringBinary(2);
} | https://gitcode.com/iop123123/arkts-static-skills | 40db7efa549f14adb2bfa6340d261a62134ee2a4 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setFormSize | sets the size in vp of the legend forms, default 8f
@param size | public setFormSize(size: number): void {
this.mFormSize = size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFormSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | public setFormSize(size: number): void {
this.mFormSize = size;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | aa3c33c671daf21adb10cef557cdce0e210cb908 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TabConfig.ets | arkts | parseTabDefinition | 解析单个标签定义 | function parseTabDefinition(tabDef: Record<string, Object>, defaultOrder: number): TabConfig | null {
if (!tabDef || typeof tabDef !== 'object') {
return null;
}
const id = String(tabDef['id'] || '');
const typeStr = String(tabDef['type'] || 'custom');
const name = String(tabDef['name'] || id);
if (... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseTabDefinition AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tabDef AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function parseTabDefinition(tabDef: Record<string, Object>, defaultOrder: number): TabConfig | null {
if (!tabDef || typeof tabDef !== 'object') {
return null;
}
const id = String(tabDef['id'] || '');
const typeStr = String(tabDef['type'] || 'custom');
const name = String(tabDef['name'] || id);
if (... | https://github.com/DaLongZhuaZi/manxia | d6611ab80a1ec868fde8eed9d8bb442ec2c4bb10 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitBytes | 访问 bytes 字段
JSON: base64 string | visitBytes(value: Uint8Array, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
// 转换为 base64
const base64 = this.bytesToBase64(value)
this.json[fieldName] = base64 as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AST#,#Left ,... | visitBytes(value: Uint8Array, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
// 转换为 base64
const base64 = this.bytesToBase64(value)
this.json[fieldName] = base64 as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 3dbb3ccf6207d0659290e77676f42b5c0f667da7 | gitcode |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/UserState.ets | arkts | getToken | 获取当前 token
@returns {string} token 字符串,未登录返回空串 | getToken(): string | null {
return this.auth?.token ?? null;
} | AST#program#Left AST#expression_statement#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 : AST#:#Right AST#string#Left ... | getToken(): string | null {
return this.auth?.token ?? null;
} | https://github.com/Joker-x-dev/CoolMallArkTS | c5042d5b95369db3fdfd3d038435c409c114cc6e | github |
openharmony-sig/fluttertpc_flutter_pdfview | ohos/ohos/src/main/ets/components/plugin/PDFView.ets | arkts | aboutToDisappear | 释放PDF文档 | aboutToDisappear() {
this.controller.releaseDocument()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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... | aboutToDisappear() {
this.controller.releaseDocument()
} | https://gitee.com/openharmony-sig/fluttertpc_flutter_pdfview.git | 873199071cc5a84891a85de99cbec3a9d05127b1 | gitee |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/BaseRepository.ets | arkts | logOperation | Helper to log database operations | protected logOperation(operation: string, details?: string): void {
const repoName = this.constructor.name;
if (details) {
console.info(`[${repoName}] ${operation}: ${details}`);
} else {
console.info(`[${repoName}] ${operation}`);
}
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left logOperation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | protected logOperation(operation: string, details?: string): void {
const repoName = this.constructor.name;
if (details) {
console.info(`[${repoName}] ${operation}: ${details}`);
} else {
console.info(`[${repoName}] ${operation}`);
}
} | https://github.com/CLMC2025/Vignette | 171d09ab62f635ce8b88cc66b2698a8b1379d58f | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets | arkts | sendInit | ── Outbound ─────────────────────────────────────────────────────────────── | private sendInit(): void {
const state: BattleState = this.engine.getState();
const playerArt: PlayerArtShape = {
idle: PLAYER_ART_IDLE,
fight: PLAYER_ART_FIGHT,
hurt: PLAYER_ART_HURT,
};
this.transport.send(encodeInit(
state.playerMaxHp,
state.monsterMaxHp,
state.m... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendInit 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#Ri... | private sendInit(): void {
const state: BattleState = this.engine.getState();
const playerArt: PlayerArtShape = {
idle: PLAYER_ART_IDLE,
fight: PLAYER_ART_FIGHT,
hurt: PLAYER_ART_HURT,
};
this.transport.send(encodeInit(
state.playerMaxHp,
state.monsterMaxHp,
state.m... | https://github.com/terryma2024/happyword | 026dee5a3b3f18e9e7242606705f64b69a50225c | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginationParams.ets | arkts | getOffset | 计算 offset 值
offset = (page - 1) * pageSize
@returns offset 值 | getOffset(): number {
return (this.page - 1) * this.pageSize
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_bl... | getOffset(): number {
return (this.page - 1) * this.pageSize
} | https://github.com/offlinecat-dev/OCNetORM | 3baafccf0ac46fdddc76233acbc8e3022425b93d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | getCallbacks | 获取动画回调 | public getCallbacks(animationId: string): AnimationCallbacks | undefined {
return this.animationCallbacks.get(animationId);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animationId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin... | public getCallbacks(animationId: string): AnimationCallbacks | undefined {
return this.animationCallbacks.get(animationId);
} | https://github.com/DaLongZhuaZi/manxia | aee1676a7eeddb6b11a106f870829f2583b75d9f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | resetAddShelfDialog | 重置新增书架对话框状态 | private resetAddShelfDialog(): void {
this.newShelfName = '';
this.newShelfType = ShelfType.SINGLE;
this.newShelfContentTypes = [ShelfContentType.MANGA];
this.newShelfIcon = '📚';
this.newShelfColor = '#FF6B6B';
this.addShelfDialogStep = 1;
// 重置动态书架筛选状态
this.dynamicFilterSelectedAutho... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetAddShelfDialog 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... | private resetAddShelfDialog(): void {
this.newShelfName = '';
this.newShelfType = ShelfType.SINGLE;
this.newShelfContentTypes = [ShelfContentType.MANGA];
this.newShelfIcon = '📚';
this.newShelfColor = '#FF6B6B';
this.addShelfDialogStep = 1;
// 重置动态书架筛选状态
this.dynamicFilterSelectedAutho... | https://github.com/DaLongZhuaZi/manxia | 0931018bcf0ccc8452372b073776940ed6b4c8b1 | github |
kumaleap/ArkLuban | library/src/main/ets/luban/Luban.ets | arkts | setQuality | 设置 JPEG 压缩质量,建议 5-95。值越高越清晰,文件也越大。
@param quality JPEG 质量
@returns 构建器实例 | setQuality(quality: number): LubanBuilder {
this.config.quality = quality;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setQuality AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left quality AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig... | setQuality(quality: number): LubanBuilder {
this.config.quality = quality;
return this;
} | https://github.com/kumaleap/ArkLuban | bbf9cb46f9b4feff81124a694c3e44fbe26a5987 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | filter | creates a new Uint32Array from current Uint32Array based on a condition fn
@param fn the condition to apply for each element
@returns a new Uint32Array with elements from current Uint32Array that satisfy condition fn | public filter(fn: (val: number, index: int) => boolean): Uint32Array {
let newF: (val: number, index: int, array: Uint32Array) => boolean =
(val: number, index: int, array: Uint32Array): boolean => { return fn(val, index) }
return this.filter(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: number, index: int) => boolean): Uint32Array {
let newF: (val: number, index: int, array: Uint32Array) => boolean =
(val: number, index: int, array: Uint32Array): boolean => { return fn(val, index) }
return this.filter(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2c99f085fdb3de63882460b3cc4e795351ceea59 | gitee |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/client/tools/ClientStream.ets | arkts | readShellOutputAsync | 异步读取Shell输出 | private async readShellOutputAsync(shellStreamId: number) {
try {
const decoder = util.TextDecoder.create('utf-8');
while (!this.isClosing && this.adbId >= 0) {
const isClosed: boolean = libscrcpy.adbIsStreamClosed(this.adbId, shellStreamId);
if (isClosed) {
... | 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 readShellOutputAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shellStreamId AST#identifier#Right AST#ERROR#Le... | private async readShellOutputAsync(shellStreamId: number) {
try {
const decoder = util.TextDecoder.create('utf-8');
while (!this.isClosing && this.adbId >= 0) {
const isClosed: boolean = libscrcpy.adbIsStreamClosed(this.adbId, shellStreamId);
if (isClosed) {
... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | d780a4b2fbae220beee0249db10cd8b52ea4c083 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | OhosVideoCache/library/src/main/ets/HttpProxyCache.ets | arkts | getCurrentSource | 获取当前活跃的 HttpUrlSource 实例
@returns HttpUrlSource 实例或 null | public getCurrentSource(): HttpUrlSourceTask | null {
return this.source;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Lef... | public getCurrentSource(): HttpUrlSourceTask | null {
return this.source;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | bbc8ea3496d9665644a6415c4ad7a57b6db927dc | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/CombinedChartRenderer.ets | arkts | getSubRenderers | Returns all sub-renderers.
@return | public getSubRenderers(): JArrayList<DataRenderer> {
return this.mRenderers;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSubRenderers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | public getSubRenderers(): JArrayList<DataRenderer> {
return this.mRenderers;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0d975ba6e2578310360f8c5ce3d8da36f9c935cb | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/CryptoDemo.ets | arkts | encryptRsa | rsa 加密,通过公钥加密 | public static encryptRsa(plainData: Uint8Array, publicKeyData: Uint8Array): Uint8Array {
let plainBlog: cryptoFramework.DataBlob = { data: plainData };
let publicKey = CryptoHelper.getRsaKeyPair(publicKeyData, null).pubKey
let cipher = cryptoFramework.createCipher('RSA1024|PKCS1');
cipher.initSync(cr... | 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 encryptRsa AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left plainData AST#identifier#Right AST#:#Left : ... | public static encryptRsa(plainData: Uint8Array, publicKeyData: Uint8Array): Uint8Array {
let plainBlog: cryptoFramework.DataBlob = { data: plainData };
let publicKey = CryptoHelper.getRsaKeyPair(publicKeyData, null).pubKey
let cipher = cryptoFramework.createCipher('RSA1024|PKCS1');
cipher.initSync(cr... | https://github.com/webabcd/HarmonyDemo | 00bc73f44a95f8cf9db280f18cc3c232eba5b844 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | lastIndexOf | Returns the last index at which a given element can be found in the array,
or -1 if it is not present.
@param element to find in the array.
@returns The last index of the element in the array; -1 if not found. | public lastIndexOf(element: T): int {
return this.lastIndexOf(element, this.data.length - 1);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#... | public lastIndexOf(element: T): int {
return this.lastIndexOf(element, this.data.length - 1);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 787721e35be8ad57fbb0f4bfb1409b24fb0ed4f5 | gitee |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets | arkts | updateRating | 更新评分
@param {number} value - 新评分
@returns {void} 无返回值 | updateRating(value: number): void {
this.rating = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateRating AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A... | updateRating(value: number): void {
this.rating = value;
} | https://github.com/Joker-x-dev/CoolMallArkTS | d9221848aabcbafa50c961c71c891be9202cdb6d | github |
azhu0001/localsend-harmony | serve/src/main/ets/http/ServerResponse.ets | arkts | constructor | 用于请求结束后重置数据 | constructor(client: socket.TCPSocketConnection, exchange: HttpExchange) {
this.client = client
this.default_headers = ['content-type', 'content-length', 'connection', 'date']
this.exchange = exchange
} | 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 client AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left ... | constructor(client: socket.TCPSocketConnection, exchange: HttpExchange) {
this.client = client
this.default_headers = ['content-type', 'content-length', 'connection', 'date']
this.exchange = exchange
} | https://gitcode.com/azhu0001/localsend-harmony | 09d8779a680687ebf2d4172af93829a76c5d4ade | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | convertFoldStatus | 转换折叠状态枚举 | private convertFoldStatus(status: display.FoldStatus): FoldStatus {
switch (status) {
case display.FoldStatus.FOLD_STATUS_EXPANDED:
return FoldStatus.EXPANDED;
case display.FoldStatus.FOLD_STATUS_FOLDED:
return FoldStatus.FOLDED;
case display.FoldStatus.FOLD_STATUS_HALF_FOLDED:
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertFoldStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_ex... | private convertFoldStatus(status: display.FoldStatus): FoldStatus {
switch (status) {
case display.FoldStatus.FOLD_STATUS_EXPANDED:
return FoldStatus.EXPANDED;
case display.FoldStatus.FOLD_STATUS_FOLDED:
return FoldStatus.FOLDED;
case display.FoldStatus.FOLD_STATUS_HALF_FOLDED:
... | https://github.com/DaLongZhuaZi/manxia | 69764ba7d9f2f55ff54e13d7b85fcce9340e92e5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/MessageHandler.ets | arkts | removeMessages | Remove all messages with a specific identifier
@param { int } what The message identifier to remove
@returns { boolean } True if messages were successfully removed, false otherwise | public removeMessages(what: int): boolean {
if (this.workerIsMain()) {
return false;
}
if (what == this.defaultMessagewhat) {
return false;
}
return this.removeMessages((value: MessageStatus, key: Message) => {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left what AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie... | public removeMessages(what: int): boolean {
if (this.workerIsMain()) {
return false;
}
if (what == this.defaultMessagewhat) {
return false;
}
return this.removeMessages((value: MessageStatus, key: Message) => {
... | https://gitcode.com/iop123123/arkts-static-skills | 6ed01821f0389cf3e6874e5d615f8444036fffd4 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.