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 |
|---|---|---|---|---|---|---|---|---|---|---|
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/database/Config.ets | arkts | getUpgradeSqlsForVersion | 根据当前版本获取需要执行的升级脚本
@param currentVersion 当前数据库版本
@returns 需要执行的升级脚本数组,按版本顺序排列 | getUpgradeSqlsForVersion(currentVersion: number): DatabaseUpgradeSql[] {
const scripts = this.getUpgradeSqls();
const targetVersion = this.getConfigVersion();
if (currentVersion >= targetVersion) {
return [];
}
// 构建升级路径
const upgradePath: DatabaseUpgradeSql[] = [];
let nextVersion... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getUpgradeSqlsForVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentVersion AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AS... | getUpgradeSqlsForVersion(currentVersion: number): DatabaseUpgradeSql[] {
const scripts = this.getUpgradeSqls();
const targetVersion = this.getConfigVersion();
if (currentVersion >= targetVersion) {
return [];
}
// 构建升级路径
const upgradePath: DatabaseUpgradeSql[] = [];
let nextVersion... | https://github.com/ZestBox-18/kitebook-frontend | ff8f3d61720acd3e024f63e11a80b93c367ed132 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setMinWidth | Sets the minimum width that the axis should take (in vp).
@param minWidth | public setMinWidth(minWidth: number): void {
this.mMinWidth = minWidth;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | public setMinWidth(minWidth: number): void {
this.mMinWidth = minWidth;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 94fd60e51c414c76a9e25c864c05942cc1657505 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/step/OmniSteps.ets | arkts | _getTitleColor | 取标题颜色 | _getTitleColor(index: number): ResourceColor {
if (index <= this.config.currentIndex) {
return this.horizontalStepsStyle.activatedTitleColor
} else {
return this.horizontalStepsStyle.unactivatedTitleColor
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left _getTitleColor 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 AST#)#Left )... | _getTitleColor(index: number): ResourceColor {
if (index <= this.config.currentIndex) {
return this.horizontalStepsStyle.activatedTitleColor
} else {
return this.horizontalStepsStyle.unactivatedTitleColor
}
} | https://github.com/wuba/omni-ui | f1b3e6a737e3e160987090645e4e58ab2f250fc1 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/DatabaseManager.ets | arkts | createAllTables | 创建所有数据表(按依赖顺序) | private static async createAllTables(): Promise<void> {
const store = DatabaseManager.getDatabase();
try {
// 1. 创建用户表(独立表,无外键依赖)
await store.executeSql(`
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL,
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left createAllTables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum... | private static async createAllTables(): Promise<void> {
const store = DatabaseManager.getDatabase();
try {
// 1. 创建用户表(独立表,无外键依赖)
await store.executeSql(`
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL,
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | fef3344fc91720bd8c8895256553040f99f5512d | github |
openharmony/applications_mms | entry/src/main/ets/pages/infomsg/InfoMsgController.ets | arkts | clickToMarkAllAsReadForInfo | Mark all unread notifications as read. | clickToMarkAllAsReadForInfo() {
let threadIds: Array<number> = [];
for (let msg of this.messageList) {
msg.countOfUnread = common.int.MESSAGE_CODE_ZERO;
threadIds.push(msg.threadId);
}
let actionData: LooseObject = {};
actionData.threadIds = threadIds;... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickToMarkAllAsReadForInfo 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#statem... | clickToMarkAllAsReadForInfo() {
let threadIds: Array<number> = [];
for (let msg of this.messageList) {
msg.countOfUnread = common.int.MESSAGE_CODE_ZERO;
threadIds.push(msg.threadId);
}
let actionData: LooseObject = {};
actionData.threadIds = threadIds;... | https://gitee.com/openharmony/applications_mms.git | 414562f7efa47d7b5813458dbbd2ba51dd6769df | gitee |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | sosHangup | SOS 挂断 | public sosHangup(toMacList: string[], roomId: string): void {
for (let i = 0; i < toMacList.length; i++) {
this.signaling?.sendSosHangup(toMacList[i], roomId);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sosHangup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left toMacList AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | public sosHangup(toMacList: string[], roomId: string): void {
for (let i = 0; i < toMacList.length; i++) {
this.signaling?.sendSosHangup(toMacList[i], roomId);
}
} | https://github.com/tdcare/tdwebrtc | ba639e4dd2fb99d02d09c020d8bf068780a699ce | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpSessionManager.ets | arkts | isActive | Check if session is active | static isActive(): boolean {
return isSessionActive;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool... | static isActive(): boolean {
return isSessionActive;
} | https://github.com/tangwengang-del/freerdp-harmonyos | fb1e48f6d1adbb2e4159d61b4049d974a756b806 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/BarLineChartTouchListener.ets | arkts | midPoint | ################ ################ ################ ################
DOING THE MATH BELOW ;-)
Determines the center point between two pointer touch points.
@param point
@param event | private static midPoint(point: MPPointF, isTouchEvent: boolean, event: TouchEvent | GestureEvent) {
let x: number = 0;
let y: number = 0;
if (isTouchEvent) {
event = event as TouchEvent;
if (!event.touches || event.touches.length < 2 || !event.touches[0] || !event.touches[1]) {
return... | 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 midPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left point AST#identifier#Right AST#:#Left : AST... | private static midPoint(point: MPPointF, isTouchEvent: boolean, event: TouchEvent | GestureEvent) {
let x: number = 0;
let y: number = 0;
if (isTouchEvent) {
event = event as TouchEvent;
if (!event.touches || event.touches.length < 2 || !event.touches[0] || !event.touches[1]) {
return... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a56756a4b12726596c6305cadbf3cc3ff3f8b5e1 | gitee |
openharmony-sig/applications_calculator | common/src/main/ets/util/RdbHelper.ets | arkts | isEmpty | 是否存在历史记录.
@param callback 返回查询结果. | async isEmpty(callback: Function): Promise<void> {
await this.getRdbStore();
if (this.rdbStore === null) {
LogUtil.error(TAG, 'rdbStore is null, query fail.');
callback(false);
return;
}
try {
let predicatesV9: relationalStore.RdbPredicates =
new relationalStore.RdbPred... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isEmpty AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left callback AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async isEmpty(callback: Function): Promise<void> {
await this.getRdbStore();
if (this.rdbStore === null) {
LogUtil.error(TAG, 'rdbStore is null, query fail.');
callback(false);
return;
}
try {
let predicatesV9: relationalStore.RdbPredicates =
new relationalStore.RdbPred... | https://gitee.com/openharmony-sig/applications_calculator.git | cc19c246c43b1193070772e1cfc99f339adfb60c | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/pages/DiyCacheSizePage.ets | arkts | destroyCurrentConnect | 在切换视频前,先销毁当前的连接和监听器 | destroyCurrentConnect() {
try {
const currentUrl = this.SRC_LIST[this.index];
if (currentUrl && this.server) {
// 先注销当前视频的缓存监听器
this.currentCacheListener && this.server.unregisterCacheListener(this.currentCacheListener, currentUrl);
// 再销毁当前视频的连接
GlobalProxyServer?.getI... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left destroyCurrentConnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl... | destroyCurrentConnect() {
try {
const currentUrl = this.SRC_LIST[this.index];
if (currentUrl && this.server) {
// 先注销当前视频的缓存监听器
this.currentCacheListener && this.server.unregisterCacheListener(this.currentCacheListener, currentUrl);
// 再销毁当前视频的连接
GlobalProxyServer?.getI... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 1dac0e1bb07b3481b198ecd12c4724bcc24cc3bc | gitcode |
Delsin-Yu/JustPDF | entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets | arkts | isAtHorizontalScrollRightEnd | 横向可滚动且已贴右端(可向左拖出下一页预览) | isAtHorizontalScrollRightEnd(uiContext: UIContext, epsilonVp: number = 2): boolean {
const b = this.getPanClampBounds(uiContext);
if (b.scaledViewSizeVp.x <= b.viewportSizeVp.x) {
return false;
}
return this.viewPan.x <= b.minX + b.relaxX * 0.35 + epsilonVp;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAtHorizontalScrollRightEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIContext AST#identifi... | isAtHorizontalScrollRightEnd(uiContext: UIContext, epsilonVp: number = 2): boolean {
const b = this.getPanClampBounds(uiContext);
if (b.scaledViewSizeVp.x <= b.viewportSizeVp.x) {
return false;
}
return this.viewPan.x <= b.minX + b.relaxX * 0.35 + epsilonVp;
} | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets#L417-L423 | 7499626588e2733e677e3eaa79f1293a05c5b4e3 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/NdsRomCache.ets | arkts | gigabytes | 创建 GB 单位 | static gigabytes(value: number): SizeUnit {
return new SizeUnit(value * 1024 * 1024 * 1024);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left gigabytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | static gigabytes(value: number): SizeUnit {
return new SizeUnit(value * 1024 * 1024 * 1024);
} | https://github.com/richshaw2015/nds | f542adc351e7886560a591f61d2f40573b458fb6 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | getSelectRawExpressions | 获取原生 SELECT 表达式
@returns 表达式数组 | getSelectRawExpressions(): Array<string> {
return this.selectRawExpressions.slice()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSelectRawExpressions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argu... | getSelectRawExpressions(): Array<string> {
return this.selectRawExpressions.slice()
} | https://github.com/offlinecat-dev/OCNetORM | 9f5348c9c047b23603955f1410a152fd942f6f34 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | playAnimation | 播放动画(兼容AnimationManager接口) | public playAnimation(
animationType: AnimationType,
targetState: AnimationState,
config: AnimationConfig = { type: AnimationType.FADE_IN },
animationId?: string
): Promise<void> {
return new Promise((resolve, reject) => {
try {
const finalConfig: AnimationConfig = {
type:... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left animationType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public playAnimation(
animationType: AnimationType,
targetState: AnimationState,
config: AnimationConfig = { type: AnimationType.FADE_IN },
animationId?: string
): Promise<void> {
return new Promise((resolve, reject) => {
try {
const finalConfig: AnimationConfig = {
type:... | https://github.com/DaLongZhuaZi/manxia | b4edbef6c962c2cf717e44da3f5411ea5247ef17 | github |
the-wwyang/kids-learning-app | src/main/ets/common/SecurityUtils.ets | arkts | checkPasswordStrength | 检查密码强度
@param password 密码
@returns 密码强度结果 | static checkPasswordStrength(password: string): PasswordStrengthResult {
if (password.length < 6) {
return new PasswordStrengthResult(
PasswordStrength.WEAK,
'密码长度至少6个字符',
false
);
}
if (password.length > 20) {
return new PasswordStrengthResult(
PasswordS... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkPasswordStrength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | static checkPasswordStrength(password: string): PasswordStrengthResult {
if (password.length < 6) {
return new PasswordStrengthResult(
PasswordStrength.WEAK,
'密码长度至少6个字符',
false
);
}
if (password.length > 20) {
return new PasswordStrengthResult(
PasswordS... | https://github.com/the-wwyang/kids-learning-app | 2349bb5e6fd63adf64bfcceba4a8ad48dbff9fc2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BuiltinArraySort.ets | arkts | median3 | Put median of three array elements to arr[index1] | function median3(arr: FixedArray<byte>, index1: int, index2: int, index3: int): void {
let swap_idx = index2
if ((arr[index1] < arr[index2])) {
if ((arr[index3] < arr[index1])) {
return
}
if ((arr[index3] < arr[index2])) {
swap_idx = index3
}
} else {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left median3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function median3(arr: FixedArray<byte>, index1: int, index2: int, index3: int): void {
let swap_idx = index2
if ((arr[index1] < arr[index2])) {
if ((arr[index3] < arr[index1])) {
return
}
if ((arr[index3] < arr[index2])) {
swap_idx = index3
}
} else {
... | https://gitcode.com/iop123123/arkts-static-skills | 8baeab62f33e5d68530fd958d9f996d7310dc080 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | cancelApproval | 撤回审批
@param approvalId 审批ID | async cancelApproval(approvalId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/cancel`, {})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cancelApproval AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async cancelApproval(approvalId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/cancel`, {})
} | https://github.com/David8Idira/AI-OA | 94a2be85a7d2f36064368dda715d8b2126d65024 | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/Retrofit.ets | arkts | addInterceptors | Add multiple interceptors to the HTTP client.
@param interceptors The list of interceptors to add.
@returns This builder instance for method chaining. | addInterceptors(interceptors: Interceptor[]): RetrofitBuilder {
// Create a new HttpClientBuilder with the existing client's configuration
const newClientBuilder = new HttpClientBuilder();
// Add all existing interceptors from the current client
if (typeof (this.client as any).interceptors ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addInterceptors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left interceptors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left In... | addInterceptors(interceptors: Interceptor[]): RetrofitBuilder {
// Create a new HttpClientBuilder with the existing client's configuration
const newClientBuilder = new HttpClientBuilder();
// Add all existing interceptors from the current client
if (typeof (this.client as any).interceptors ... | https://github.com/killetom/ktretrofit | f1412271e13a8d442cb82b107262728aee234de4 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | getFormLineWidth | returns the line width in vp for drawing forms that consist of lines
@return | public getFormLineWidth(): number {
return this.mFormLineWidth;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFormLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS... | public getFormLineWidth(): number {
return this.mFormLineWidth;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 85817579c8fa93efff46edf9699183dc77629eb3 | gitee |
Yebingiscn/SweetVideo | entry/src/main/ets/database/Preferences.ets | arkts | saveFileFolder | 保存所有文件夹视频数据 | static saveFileFolder(context: Context, file_folder: FileFolder[]) {
PreferencesUtil.putPreferencesValue(context, DATA_BASE_NAME, 'file_folder', file_folder)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveFileFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static saveFileFolder(context: Context, file_folder: FileFolder[]) {
PreferencesUtil.putPreferencesValue(context, DATA_BASE_NAME, 'file_folder', file_folder)
} | https://github.com/Yebingiscn/SweetVideo | 3530b6fcceefb3bcd8eee8c1920c9c9f366c0c44 | github |
YANGZX22/Voot | entry/src/main/ets/storage/OnboardingStorage.ets | arkts | setNumberVerified | 设置号码验证状态
@param ctx UI Ability Context
@param verified 是否已验证 | static async setNumberVerified(ctx: common.UIAbilityContext, verified: boolean): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_NUMBER_VERIFIED, verified);
await prefs.flush();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left setNumberVerified AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : ... | static async setNumberVerified(ctx: common.UIAbilityContext, verified: boolean): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_NUMBER_VERIFIED, verified);
await prefs.flush();
} | https://github.com/YANGZX22/Voot | f7cadc079ea85ac834a8ae26d94f16df3f0333ec | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | login | 登录 TODO 目前Axios框架有bug无法从header获取多个set-cookie,所以改用原生的请求实现
@param username
@param password
@param success
@param failure | public async login(username: string, password: string): Promise<LoginRegistResult> {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp()
try {
const response = await httpRequest.request(// 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
WanHttpClient.BASE_UR... | 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 login AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public async login(username: string, password: string): Promise<LoginRegistResult> {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp()
try {
const response = await httpRequest.request(// 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
WanHttpClient.BASE_UR... | https://github.com/RedRackham-R/WanAndroidHarmoney | d856db091695c4d95cd0858b09f69bc2b35a9860 | github |
HarmonyOS_Samples/MultiPictureBeautification | multipicturecommon/src/main/ets/utils/WindowUtil.ets | arkts | setDecorButtonStyle | Set decoration button style (light/dark mode for title bar buttons on PC) | setDecorButtonStyle(buttonStyle: window.DecorButtonStyle): void {
if (!this.mainWindow) {
return;
}
try {
this.mainWindow.setDecorButtonStyle(buttonStyle);
} catch (err) {
Logger.error(LogConstants.LOG_TAG_WINDOW_UTIL, 'Failed to set decor button style. Cause: %{public}s',
JS... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDecorButtonStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left buttonStyle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | setDecorButtonStyle(buttonStyle: window.DecorButtonStyle): void {
if (!this.mainWindow) {
return;
}
try {
this.mainWindow.setDecorButtonStyle(buttonStyle);
} catch (err) {
Logger.error(LogConstants.LOG_TAG_WINDOW_UTIL, 'Failed to set decor button style. Cause: %{public}s',
JS... | https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification | 87de2a9ccf57f1a58dbf440fec8ff517dbb9ef1e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets | arkts | checkBiometricSupport | 检查设备是否支持生物识别 | public async checkBiometricSupport(): Promise<boolean> {
try {
userAuth.getAvailableStatus(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1);
logger.info(TAG, '设备支持指纹识别');
return true;
} catch (error) {
logger.error(TAG, `生物识别不支持: ${JSON.stringify(error)}`);
return... | 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 checkBiometricSupport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public async checkBiometricSupport(): Promise<boolean> {
try {
userAuth.getAvailableStatus(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1);
logger.info(TAG, '设备支持指纹识别');
return true;
} catch (error) {
logger.error(TAG, `生物识别不支持: ${JSON.stringify(error)}`);
return... | https://github.com/DaLongZhuaZi/manxia | b0c0616afbc7a8ceaa600d7538051f57d57f92e3 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/BuiltInColorViewModel.ets | arkts | getColorItems | 获取内置颜色列表
@returns {BuiltInColorItem[]} 颜色数组 | getColorItems(): BuiltInColorItem[] {
return [
new BuiltInColorItem(
"Red",
$r("app.color.tn_color_red"),
"红色",
[
new ColorVariantItem("dark", $r("app.color.tn_color_red_dark")),
new ColorVariantItem("light", $r("app.color.tn_color_red_light")),
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColorItems 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 BuiltInColorItem AST#identifier#Right AST#[#Left... | getColorItems(): BuiltInColorItem[] {
return [
new BuiltInColorItem(
"Red",
$r("app.color.tn_color_red"),
"红色",
[
new ColorVariantItem("dark", $r("app.color.tn_color_red_dark")),
new ColorVariantItem("light", $r("app.color.tn_color_red_light")),
... | https://github.com/codelably/tuniao-ui | ee7e05f05148e8cd6f980412b224af50d00177fe | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | equals | Checks for equality this instance with provided object, treated as a Byte Returns false if type of provided
object is not the same as this type
@param { Any } other object to be checked against
@returns { boolean }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(other: Any): boolean {
if (this === other) {
return true
}
if (!(other instanceof Byte)) {
return false
}
return this.value == (other as Byte).value
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Any AST#identifier#Right... | public equals(other: Any): boolean {
if (this === other) {
return true
}
if (!(other instanceof Byte)) {
return false
}
return this.value == (other as Byte).value
} | https://gitcode.com/iop123123/arkts-static-skills | ec03218c43d5f0b7752b7b76ff11f386dd288597 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setOnChartValueSelectedListener | set a selection listener for the chart
@param l | public setOnChartValueSelectedListener(l: OnChartValueSelectedListener) {
this.mSelectionListener = l;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnChartValueSelectedListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left l AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | public setOnChartValueSelectedListener(l: OnChartValueSelectedListener) {
this.mSelectionListener = l;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 21320874d7a95863d60a56ef9844dfbf1e9401dd | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SeasonalityDetectionService.ets | arkts | getDefaultThresholds | 获取默认阈值 | private static getDefaultThresholds(): SeasonalityThresholds {
return {
minDataPoints: 6, // 至少6个月数据
acfThreshold: 0.3, // ACF显著性阈值
cvThreshold: 0.3, // 变异系数阈值(30%)
peakThreshold: 1.5, // Z-score阈值(1.5倍标准差)
significanceLevel: 0.05 // 显著性水平(5%)... | 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 getDefaultThresholds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private static getDefaultThresholds(): SeasonalityThresholds {
return {
minDataPoints: 6, // 至少6个月数据
acfThreshold: 0.3, // ACF显著性阈值
cvThreshold: 0.3, // 变异系数阈值(30%)
peakThreshold: 1.5, // Z-score阈值(1.5倍标准差)
significanceLevel: 0.05 // 显著性水平(5%)... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 315d74a4008df589e878da20bbde1cd0ea86ffeb | github |
openharmony-sig/applications_compass | feature/compass/src/main/ets/components/CompassView.ets | arkts | drawAngleLine | Draw angle line. | private drawAngleLine(): void {
for (let n = 0; n < ConfigData.SCALE_NUM; n++) {
let theta = n * (Math.PI * this.times) / ConfigData.SCALE_NUM;
this.outsideContext.save();
this.outsideContext.beginPath();
this.outsideContext.lineWidth = this.outsideLineWidth;
let x_to = (this.outside... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawAngleLine 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#vo... | private drawAngleLine(): void {
for (let n = 0; n < ConfigData.SCALE_NUM; n++) {
let theta = n * (Math.PI * this.times) / ConfigData.SCALE_NUM;
this.outsideContext.save();
this.outsideContext.beginPath();
this.outsideContext.lineWidth = this.outsideLineWidth;
let x_to = (this.outside... | https://gitee.com/openharmony-sig/applications_compass.git | c52ce5dfdc981fe4612e681c420c36e5852993bd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportNovelReadProgress | 导出小说阅读进度 | private async exportNovelReadProgress(): Promise<NovelReadProgressBackup[]> {
try {
const sql = 'SELECT * FROM novel_read_progress';
const results = await this.dbManager.querySql(sql);
const progress: NovelReadProgressBackup[] = [];
for (const record of results) {
const rec ... | 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 exportNovelReadProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | private async exportNovelReadProgress(): Promise<NovelReadProgressBackup[]> {
try {
const sql = 'SELECT * FROM novel_read_progress';
const results = await this.dbManager.querySql(sql);
const progress: NovelReadProgressBackup[] = [];
for (const record of results) {
const rec ... | https://github.com/DaLongZhuaZi/manxia | c9e1be53d8eb7ec2ec44ccad8468a2899d037d2f | github |
dingzhilin1990/zhilinclaw | src/security/SecurityContext.ets | arkts | getPolicy | 获取安全策略 | public getPolicy(): SecurityPolicy {
return { ...this.policy };
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPolicy 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 SecurityPoli... | public getPolicy(): SecurityPolicy {
return { ...this.policy };
} | https://github.com/dingzhilin1990/zhilinclaw | d159ff22f81b000b749ec2085dc73d9e430b7aac | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/pages/24Points.ets | arkts | showSolutionsDialog | 显示解法弹窗 | showSolutionsDialog() {
this.showSolutions = true;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showSolutionsDialog 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_bloc... | showSolutionsDialog() {
this.showSolutions = true;
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 078bd43cffa3fc747d4631e11d56739c0d0f9282 | github |
YANGZX22/Voot | entry/src/main/ets/pages/SettingsPage.ets | arkts | if | 模型切换中的加载遮罩 | if (this.isSwitchingModel) {
Column() {
Column({ space: 16 }) {
LoadingProgress()
.width(24)
.height(24)
.color(Color.White)
Text('切换中,请稍等...')
.fontSize(16)
.fontColor(Color.White)
.fontW... | AST#program#Left AST#if_statement#Left AST#if#Left if AST#if#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#this#Left this AST#this#Right AST#.#Left . AST#.#Right AST#property_identifier#Left isSwitchingModel AST#property_identifier#Right AST#member_expression#Right AST#... | if (this.isSwitchingModel) {
Column() {
Column({ space: 16 }) {
LoadingProgress()
.width(24)
.height(24)
.color(Color.White)
Text('切换中,请稍等...')
.fontSize(16)
.fontColor(Color.White)
.fontW... | https://github.com/YANGZX22/Voot | c345307ce0a9254a819a1164edc0c9e17bbb394e | github |
openharmony/communication_netmanager_ext | frameworks/vpn_dialog/dialog_ui/vpn_dialog/src/main/ets/pages/VpnDialog.ets | arkts | controlBtn | allow,notAllow button style | @Extend(Text)
function controlBtn(fontColor : string) {
.fontColor(fontColor)
.backgroundColor(0xffffff)
.width(100)
.height(56)
.fontSize(20)
.textAlign(TextAlign.Center);
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function controlBtn(fontColor : string) {
.fontColor(fontColor)
.backgroundColor(0xffffff)
.width(100)
.height(56)
.fontSize(20)
.textAlign(TextAlign.Center);
} | https://gitee.com/openharmony/communication_netmanager_ext.git | eaba610840f95887eedc4f85b10c6b1ddc1d1de3 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CategoryDAO.ets | arkts | buildCategoryTree | 构建分类树结构
@param categories 分类列表
@returns 分类树节点数组 | private static buildCategoryTree(categories: Category[]): CategoryTreeNode[] {
const map = new Map<number, CategoryTreeNode>();
const roots: CategoryTreeNode[] = [];
// 初始化节点
categories.forEach(cat => {
map.set(cat.categoryId, {
category: cat,
children: []
});
});
... | 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 buildCategoryTree AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categories AST#identifier#Right AST#ERROR#Left AS... | private static buildCategoryTree(categories: Category[]): CategoryTreeNode[] {
const map = new Map<number, CategoryTreeNode>();
const roots: CategoryTreeNode[] = [];
// 初始化节点
categories.forEach(cat => {
map.set(cat.categoryId, {
category: cat,
children: []
});
});
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a088093bc4bea68cb9df20c067f060186808e3e4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskHelper.ets | arkts | buildWantAgent | 构建 WantAgent,供后台任务通知栏入口使用 | private static async buildWantAgent(context: common.UIAbilityContext): Promise<WantAgent> {
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
abilityName: 'EntryAbility'
}
],
actionType: wantAgent.Operation... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left buildWantAgent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | private static async buildWantAgent(context: common.UIAbilityContext): Promise<WantAgent> {
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
abilityName: 'EntryAbility'
}
],
actionType: wantAgent.Operation... | https://github.com/DaLongZhuaZi/manxia | 9ea3c5cb5ceb28756854caf64e11094c61cd2386 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | getActiveIndex | 获取侧边栏当前激活索引
@returns {number} 当前激活索引 | getActiveIndex(): number {
return this.selectedCategoryIndex < 0 ? 0 : this.selectedCategoryIndex;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getActiveIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getActiveIndex(): number {
return this.selectedCategoryIndex < 0 ? 0 : this.selectedCategoryIndex;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 07302634006473a37649bdf7dac1e2c011331d5d | github |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | updateFavorite | Edit Contact Favorite
@param {string} daHelper
@param {Object} addParams Contact Information
@param {Object} callBack Contact ID | async updateFavorite(daHelper: dataShare.DataShareHelper | null, addParams: Record<string, string | number>,
callBack: Function,
context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'updateFavorite start.');
if (daHelper == undefined || daHelper == null) {
daHelper = await dataShare.creat... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateFavorite AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left daHelper AST#identifier#Right AST#type_annotation#Left ... | async updateFavorite(daHelper: dataShare.DataShareHelper | null, addParams: Record<string, string | number>,
callBack: Function,
context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'updateFavorite start.');
if (daHelper == undefined || daHelper == null) {
daHelper = await dataShare.creat... | https://gitee.com/openharmony/applications_contacts.git | 1469fbb1ea8522a3265e14f9b561796c48c63616 | gitee |
dingzhilin1990/zhilinclaw | src/agents/HanwudiWorkflow.ets | arkts | exportWorkflowReport | 导出工作流报告 | public exportWorkflowReport(result: TaskResult): string {
return JSON.stringify({
summary: {
success: result.success,
executionTime: result.executionTime,
totalSteps: this.log.length
},
qualityScore: result.qualityReport?.overallScore,
logs: this.log,
document... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left exportWorkflowReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public exportWorkflowReport(result: TaskResult): string {
return JSON.stringify({
summary: {
success: result.success,
executionTime: result.executionTime,
totalSteps: this.log.length
},
qualityScore: result.qualityReport?.overallScore,
logs: this.log,
document... | https://github.com/dingzhilin1990/zhilinclaw | 1906cabbdd9ce3daea9843c93695429534d68c0e | github |
GrassyUnknown/Health-Life-HarmonyOS-Next | oh_modules/.ohpm/cjcalendar@2.0.4/oh_modules/cjcalendar/src/main/ets/utils/ColorUtil.ets | arkts | lightenColor | 颜色变淡
@param colorCode 颜色代码
@param percentage 百分比
@returns | static lightenColor(colorCode: string, percentage: number): string {
const color = colorCode.replace('#', '');
const r = parseInt(color.substring(0, 2), 16);
const g = parseInt(color.substring(2, 4), 16);
const b = parseInt(color.substring(4, 6), 16);
const newR = Math.round(r + (255 - r) * perce... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left lightenColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left colorCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | static lightenColor(colorCode: string, percentage: number): string {
const color = colorCode.replace('#', '');
const r = parseInt(color.substring(0, 2), 16);
const g = parseInt(color.substring(2, 4), 16);
const b = parseInt(color.substring(4, 6), 16);
const newR = Math.round(r + (255 - r) * perce... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | 1f1114d9cc83efc386673303c56e1a0521c68ebc | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Row.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
RowCenterTop() { Text("Hi"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | https://github.com/Joker-x-dev/CoolMallArkTS | ef07f2612d104aa3ec33eddcaa13735e52d20163 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets | arkts | waitForInterval | 等待请求间隔 | private async waitForInterval(): Promise<void> {
const now = Date.now();
const elapsed = now - this.lastRequestTime;
if (elapsed < this.MIN_REQUEST_INTERVAL) {
const waitTime = this.MIN_REQUEST_INTERVAL - elapsed;
await new Promise<void>(resolve => setTimeout(resolve, waitTime));
}
... | 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 waitForInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async waitForInterval(): Promise<void> {
const now = Date.now();
const elapsed = now - this.lastRequestTime;
if (elapsed < this.MIN_REQUEST_INTERVAL) {
const waitTime = this.MIN_REQUEST_INTERVAL - elapsed;
await new Promise<void>(resolve => setTimeout(resolve, waitTime));
}
... | https://github.com/DaLongZhuaZi/manxia | 2fa91b04595aa2ca1d3042b1dd0bc276d7833d5e | github |
xblLab/HarmonyProjectTemplate | products/phone/src/main/ets/common/NetworkUtils.ets | arkts | initNetwork | 注册网络监听 | public static initNetwork() {
let networkInstance = NetworkUtil.getInstance();
networkInstance.init();
} | 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 initNetwork AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR... | public static initNetwork() {
let networkInstance = NetworkUtil.getInstance();
networkInstance.init();
} | https://github.com/xblLab/HarmonyProjectTemplate | d77ebecb506c0cd7aab9022b133ff8eb0c4cee60 | github |
ZestBox-18/kitebook-frontend | features/profile/src/main/ets/components/UserCard.ets | arkts | playLoginAnimation | 播放登录动画(完整动画,从头开始) | playLoginAnimation(): void {
this.isAnimating = true;
this.angle = 0;
this.shouldStop = false;
this.avatarSwitched = false;
const rotateSpeed = 8;
const updateRotate = () => {
if (this.shouldStop) {
return;
}
this.angle += rotateSpeed;
if (this.angle >= 360) {... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left playLoginAnimation 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... | playLoginAnimation(): void {
this.isAnimating = true;
this.angle = 0;
this.shouldStop = false;
this.avatarSwitched = false;
const rotateSpeed = 8;
const updateRotate = () => {
if (this.shouldStop) {
return;
}
this.angle += rotateSpeed;
if (this.angle >= 360) {... | https://github.com/ZestBox-18/kitebook-frontend | e35a558637f440f2e557576a6946500861d1d015 | github |
harmonyos/codelabs | HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/FormInfoApi.ets | arkts | deleteFormData | Delete form data.
@param {string} formId Form ID | public deleteFormData(formId: string): void {
let predicates = new dataRdb.RdbPredicates(Const.FORM_INFO.tableName ? Const.FORM_INFO.tableName : '');
predicates.equalTo('formId', formId);
RdbUtils.del(predicates).catch((error: Error) => {
Logger.error('FormInfoTable', 'deleteFormData error ' + JSON.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public deleteFormData(formId: string): void {
let predicates = new dataRdb.RdbPredicates(Const.FORM_INFO.tableName ? Const.FORM_INFO.tableName : '');
predicates.equalTo('formId', formId);
RdbUtils.del(predicates).catch((error: Error) => {
Logger.error('FormInfoTable', 'deleteFormData error ' + JSON.... | https://gitee.com/harmonyos/codelabs.git | f6b0c30ae1347f9e0ae3135e9678257a3b28a84e | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/ShopExportImportManager.ets | arkts | exportToJson | 导出所有店铺和饮品数据为JSON字符串 | async exportToJson(): Promise<string> {
const shops = await this.shopDao.queryAll();
const shareData: ShopShareData = {
version: 1,
exportedAt: Date.now(),
shops: []
};
for (let i = 0; i < shops.length; i++) {
const shop = shops[i];
const drinks = await this.shopDrinkDao... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left exportToJson AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async exportToJson(): Promise<string> {
const shops = await this.shopDao.queryAll();
const shareData: ShopShareData = {
version: 1,
exportedAt: Date.now(),
shops: []
};
for (let i = 0; i < shops.length; i++) {
const shop = shops[i];
const drinks = await this.shopDrinkDao... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | dd21c814a1746574b5b8da509e59c475fb3a08b7 | github |
Gramony/Gramony | features/home/src/main/ets/entities/Message.ets | arkts | constructor | CustomEmoji 的 ID | constructor(
entityType: MessageEntityType,
offset: number,
length: number,
url?: string,
userId?: number,
language?: string,
customEmojiId?: number
) {
this.entityType = entityType;
this.offset = offset;
this.length = length;
this.url = url;
this.userId = userId;
... | 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 entityType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MessageEntityType AST#i... | constructor(
entityType: MessageEntityType,
offset: number,
length: number,
url?: string,
userId?: number,
language?: string,
customEmojiId?: number
) {
this.entityType = entityType;
this.offset = offset;
this.length = length;
this.url = url;
this.userId = userId;
... | https://github.com/Gramony/Gramony | 43d53f4679d49f1c305e1f25359606b0fcbd6c33 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/TaskRepository.ets | arkts | toValueBucket | 将 TaskListData 转换为 ValuesBucket
@param task 任务模型
@returns relationalStore.ValuesBucket | private toValueBucket(task: TaskListData): relationalStore.ValuesBucket {
return {
task_name: task.task_name,
detail: task.detail,
subject: task.subject,
start_date_stamp: task.start_date_stamp,
due_date_stamp: task.due_date_stamp,
is_completed: task.is_completed ? 1 : 0,
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left toValueBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private toValueBucket(task: TaskListData): relationalStore.ValuesBucket {
return {
task_name: task.task_name,
detail: task.detail,
subject: task.subject,
start_date_stamp: task.start_date_stamp,
due_date_stamp: task.due_date_stamp,
is_completed: task.is_completed ? 1 : 0,
... | https://github.com/Kira-Yagami-Light/Kira-Projects | 57e96e03dc94eceef0cce3e34b38f9bfad7a71ef | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderLogisticsViewModel.ets | arkts | loadOrderLogistics | 获取订单物流信息
@returns {void} 无返回值 | loadOrderLogistics(): void {
if (!this.orderId) {
this.logisticsInfo = new Logistics();
return;
}
RequestHelper.repository<Logistics>(this.repository.getOrderLogistics(this.orderId))
.toast(false)
.execute()
.then((data: Logistics): void => {
this.logisticsInfo = data... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadOrderLogistics 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... | loadOrderLogistics(): void {
if (!this.orderId) {
this.logisticsInfo = new Logistics();
return;
}
RequestHelper.repository<Logistics>(this.repository.getOrderLogistics(this.orderId))
.toast(false)
.execute()
.then((data: Logistics): void => {
this.logisticsInfo = data... | https://github.com/Joker-x-dev/CoolMallArkTS | 4efbe5a765a9eeb6a4d02c52ebf7f85b0c7ae864 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | getBigInt64 | === Int64 ===
Read bytes as they represent given type
@param { int } byteOffset zero index to read
@returns { int } return byteOffset's BigInt64 value
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getBigInt64(byteOffset: int): bigint {
return this.getBigInt64Big(byteOffset)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBigInt64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi... | public getBigInt64(byteOffset: int): bigint {
return this.getBigInt64Big(byteOffset)
} | https://gitcode.com/iop123123/arkts-static-skills | 2aa075b872faf3a22836b358bf1c828dcea25245 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/UsbDriverService.ets | arkts | checkDetachedControllers | 检查已断开的控制器 | private checkDetachedControllers(): void {
// 获取当前已连接的 USB 设备列表
try {
const currentDevices = usbManager.getDevices();
const currentDeviceKeys = new Set<string>();
// 使用完整的 deviceKey (VID:PID:busNum:devAddress) 进行匹配
for (const device of currentDevices) {
const key = `${de... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkDetachedControllers 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 ... | private checkDetachedControllers(): void {
// 获取当前已连接的 USB 设备列表
try {
const currentDevices = usbManager.getDevices();
const currentDeviceKeys = new Set<string>();
// 使用完整的 deviceKey (VID:PID:busNum:devAddress) 进行匹配
for (const device of currentDevices) {
const key = `${de... | https://github.com/AlkaidLab/moonlight-harmony | 783a5db38b2af48c4e7e01d0dd5f81abfffb7082 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/StabilityScenarioEngine.ets | arkts | buildCreateSurfaceJSON | Helper: build create surface JSON | private buildCreateSurfaceJSON(surfaceId: string): string {
return `{"version":"v0.9","createSurface":{"surfaceId":"${surfaceId}","catalogId":"https://a2ui.org/specification/v0_9/basic_catalog.json"}}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildCreateSurfaceJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | private buildCreateSurfaceJSON(surfaceId: string): string {
return `{"version":"v0.9","createSurface":{"surfaceId":"${surfaceId}","catalogId":"https://a2ui.org/specification/v0_9/basic_catalog.json"}}`;
} | https://github.com/AGenUI/AGenUI | a326c6e20ca6bf4377d2e99867a827e596e1548d | github |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/model/Device.ets | arkts | getStatus | 实现 IDevice 接口的 status 属性:通过getStatus()控制访问权限
外部只能读取状态,不能直接修改(需通过turnOn()/turnOff()方法) | getStatus(): 'on' | 'off' {
return this.status;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#string#Left AST#'#Left ' AST#'#Right AST#... | getStatus(): 'on' | 'off' {
return this.status;
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | 8c441a42f8a034506670ac12968b3bfc672f39b2 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/PageStateManager.ets | arkts | saveHandsShowToSp | save saveHandsShowToSp to preferences
@param showHandsClock value | public async saveHandsShowToSp(showHandsClock: boolean): Promise<void> {
const preferences = await this.getPreferences();
LogUtil.info(TAG, 'save showHandsClock toSp:' + showHandsClock);
await preferences.put(showHandsClockKey, showHandsClock);
await preferences.flush();
} | 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 saveHandsShowToSp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left showHandsClock AST#identifier#Right AST#ERROR#Left AS... | public async saveHandsShowToSp(showHandsClock: boolean): Promise<void> {
const preferences = await this.getPreferences();
LogUtil.info(TAG, 'save showHandsClock toSp:' + showHandsClock);
await preferences.put(showHandsClockKey, showHandsClock);
await preferences.flush();
} | https://gitee.com/openharmony-sig/applications_clock.git | 0a143b50791dfa9113ae50ee59b7ff845066b876 | gitee |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets | arkts | aboutToAppear | 页面出现前生命周期
@returns {void} 无返回值 | aboutToAppear(): void {
super.aboutToAppear();
this.loadSavedCredentials();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
super.aboutToAppear();
this.loadSavedCredentials();
} | https://github.com/Joker-x-dev/CoolMallArkTS | a1d76c2e8cc35e2c447263c53da96ca19ef30830 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | clear | Clear all elements in PlainArray | public clear(): void {
this.buckets.clear();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear 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#:#Left : AST#:#Rig... | public clear(): void {
this.buckets.clear();
} | https://gitcode.com/iop123123/arkts-static-skills | 92a4fff4e216591499967c9c2a7cc1a9c612807f | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/xiaoyi/XiaoyiSkillManager.ets | arkts | autoRouteAndProcess | 智能路由:根据用户输入自动匹配最佳Skill
当用户没有明确指定Skill时调用此方法 | async autoRouteAndProcess(query: string, userId: string, sessionId?: string): Promise<XiaoyiSkillResponse> {
console.info(`[Xiaoyi] 自动路由: query=${query}`);
let bestMatch: { skillId: string; confidence: number } | null = null;
// 遍历所有Skill,找到最佳匹配
for (const [skillId, skillDef] of this.skills) {
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left autoRouteAndProcess AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Lef... | async autoRouteAndProcess(query: string, userId: string, sessionId?: string): Promise<XiaoyiSkillResponse> {
console.info(`[Xiaoyi] 自动路由: query=${query}`);
let bestMatch: { skillId: string; confidence: number } | null = null;
// 遍历所有Skill,找到最佳匹配
for (const [skillId, skillDef] of this.skills) {
... | https://github.com/LJ666-ui/harmony-health-care | 053610c48b4297de25fb2385d7d8ec65a35c7003 | github |
zmuxuny/ai-guardian-star | entry/src/main/ets/database/DatabaseHelper.ets | arkts | getRdbStore | 【公开方法】获取 RdbStore 实例(用于诊断工具等高级操作) | public getRdbStore(): relationalStore.RdbStore {
if (!this.store) {
throw new Error("DatabaseHelper 未初始化,请先调用 init(context)");
}
return this.store;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRdbStore 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 AST... | public getRdbStore(): relationalStore.RdbStore {
if (!this.store) {
throw new Error("DatabaseHelper 未初始化,请先调用 init(context)");
}
return this.store;
} | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L196-L201 | 5c6a4876781b6e719d0eb640aef7a292fa484a45 | github |
openharmony-sig/flutter_packages | packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets | arkts | getMaxZoomRatio | 获取支持的最大变焦范围 | public static getMaxZoomRatio(captureSession: camera.PhotoSession | camera.VideoSession): number {
let maxZoomRatio: number = 10;
try {
let zoomRatioRange: Array<number> = captureSession.getZoomRatioRange();
maxZoomRatio = Math.max(...zoomRatioRange);
} catch (error) {
// 失败返回错误码error.co... | 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 getMaxZoomRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left ... | public static getMaxZoomRatio(captureSession: camera.PhotoSession | camera.VideoSession): number {
let maxZoomRatio: number = 10;
try {
let zoomRatioRange: Array<number> = captureSession.getZoomRatioRange();
maxZoomRatio = Math.max(...zoomRatioRange);
} catch (error) {
// 失败返回错误码error.co... | https://gitee.com/openharmony-sig/flutter_packages.git | 201faac1b2c77a6bfccff83da951eb31fa63bac9 | gitee |
openharmony/applications_app_samples | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | notifyDataChange | 通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件。
@param {number} index - 索引值。 | notifyDataChange(index: double): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataChange 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 double AST#identifier#Right AST#)#Left... | notifyDataChange(index: double): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
} | https://github.com/openharmony/applications_app_samples | ae40d18afb18257763c10ac85cb94d6cd2471188 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/UpdateChecker.ets | arkts | openRelease | 用系统浏览器打开 Release 页。 | static async openRelease(ctx: common.UIAbilityContext, url: string): Promise<void> {
const target: string = url.length > 0 ? url : DEFAULT_RELEASE_URL;
const want: Want = { action: 'ohos.want.action.viewData', uri: target };
await ctx.startAbility(want);
} | 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 openRelease AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#... | static async openRelease(ctx: common.UIAbilityContext, url: string): Promise<void> {
const target: string = url.length > 0 ? url : DEFAULT_RELEASE_URL;
const want: Want = { action: 'ohos.want.action.viewData', uri: target };
await ctx.startAbility(want);
} | https://github.com/LZZLHY/hlib | 127be936858399ad0a9757935dfb888728102cee | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | formatRange | Formats a range of numbers according to the locale and formatting options of this Intl.NumberFormat object.
@param start Start range to format a number or BigInt
@param end End range to format a number or BigInt
@throws TypeError if start or end is NaN
@returns A string representing the given range of numbers formatted... | public formatRange(start: number | bigint, end: number | bigint): string {
let isStartBigInt: boolean = false;
if (start instanceof BigInt) {
isStartBigInt = true;
} else if (isNaN(start as number)) {
throw new TypeError('Invalid start: NaN');
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left formatRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#L... | public formatRange(start: number | bigint, end: number | bigint): string {
let isStartBigInt: boolean = false;
if (start instanceof BigInt) {
isStartBigInt = true;
} else if (isNaN(start as number)) {
throw new TypeError('Invalid start: NaN');
... | https://gitcode.com/iop123123/arkts-static-skills | 89a89448bc97f39c692052d60cfd6ddce930e7af | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | trimAll | 去除字符串里的所有空格
@param str
@returns | static trimAll(str: string): string {
return str.replace(/\s/g,"");
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left trimAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS... | static trimAll(str: string): string {
return str.replace(/\s/g,"");
} | https://github.com/tdcare/tdwebrtc | 673c36912257697cf0d576b0378a6375744594a8 | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | getStateSlots | 获取所有存档槽位信息
@returns 槽位信息数组 | static getStateSlots(): SaveStateSlot[] {
return MelonDSNative.native.getStateSlots();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStateSlots 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#expressi... | static getStateSlots(): SaveStateSlot[] {
return MelonDSNative.native.getStateSlots();
} | https://github.com/richshaw2015/nds | 32aec377a41bf14fe8642d127749e128dfed3844 | github |
CLMC2025/Vignette | entry/src/main/ets/algorithm/Algorithm.ets | arkts | getIntervalPreviews | Get preview of next intervals for UI display | getIntervalPreviews(word: WordItem): Map<Rating, string> {
const lastReviewMs = this.getLastReviewTime(word);
const elapsedDays = lastReviewMs > 0
? this.algorithm.calculateElapsedDays(lastReviewMs)
: 0;
const shortTerm: boolean = word.status === WordStatus.NEW
|| word.status === WordSt... | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getIntervalPreviews AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right A... | getIntervalPreviews(word: WordItem): Map<Rating, string> {
const lastReviewMs = this.getLastReviewTime(word);
const elapsedDays = lastReviewMs > 0
? this.algorithm.calculateElapsedDays(lastReviewMs)
: 0;
const shortTerm: boolean = word.status === WordStatus.NEW
|| word.status === WordSt... | https://github.com/CLMC2025/Vignette | dbf7f391f0dbada5b99fc4b64ab94aefaf622c13 | github |
openharmony-sig/applications_filemanager | entry/src/main/ets/Components/ClassityList.ets | arkts | getSizeNum | 内存单位转化 | getSizeNum(num:number) {
if (num == 0) {
return 0
}
return Number((num/1024/1024/1024).toFixed(2))
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSizeNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST... | getSizeNum(num:number) {
if (num == 0) {
return 0
}
return Number((num/1024/1024/1024).toFixed(2))
} | https://gitee.com/openharmony-sig/applications_filemanager.git | 89f36ef5b0442909a0bb9c34f458e7348ff24c8e | gitee |
HomoArk/Homogram | features/home/src/main/ets/views/Message/FmtEntities.ets | arkts | normalizeUrl | 瑙勮寖鍖?URL锛氳ˉ鍏ㄥ崗璁瓑 | function normalizeUrl(url: string): string {
const trimmed = (url || '').trim();
if (trimmed.length === 0) return url;
const lower = trimmed.toLowerCase();
if (lower.startsWith('http://') || lower.startsWith('https://')) {
return trimmed;
}
// 涓哄儚 `www.example.com` 鎴栬8鍩熷悕琛ュ叏榛樿鍗忚
return `https://${tr... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left normalizeUrl AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function normalizeUrl(url: string): string {
const trimmed = (url || '').trim();
if (trimmed.length === 0) return url;
const lower = trimmed.toLowerCase();
if (lower.startsWith('http://') || lower.startsWith('https://')) {
return trimmed;
}
// 涓哄儚 `www.example.com` 鎴栬8鍩熷悕琛ュ叏榛樿鍗忚
return `https://${tr... | https://github.com/HomoArk/Homogram | 319b7db885f8b41f0ee3880045527e4475ab9170 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | showSourceActionMenu | ==================== 书源操作菜单 ====================
显示书源操作菜单(使用popup形式) | showSourceActionMenu(source: NovelSourceInfo): void {
logger.info(TAG, `显示书源操作菜单: ${source.name}`);
this.contextMenuSource = source;
this.contextMenuHoverAction = '';
this.showSourceContextMenu = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showSourceActionMenu AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NovelSourceInfo AST#identifier#Ri... | showSourceActionMenu(source: NovelSourceInfo): void {
logger.info(TAG, `显示书源操作菜单: ${source.name}`);
this.contextMenuSource = source;
this.contextMenuHoverAction = '';
this.showSourceContextMenu = true;
} | https://github.com/DaLongZhuaZi/manxia | 84fab142f11d757915a1ae9c02e08b9840e28a72 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WrongAnswerStore.ets | arkts | load | Load the snapshot. Returns an empty snapshot when no prior data
exists or when the stored blob fails to parse. | async load(): Promise<LearningSnapshot> {
if (this.prefs === undefined) {
return new LearningSnapshot();
}
const raw: string = await this.prefs.getString(PREFS_KEY);
if (raw.length === 0) {
return new LearningSnapshot();
}
return parseSnapshot(raw);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left load 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... | async load(): Promise<LearningSnapshot> {
if (this.prefs === undefined) {
return new LearningSnapshot();
}
const raw: string = await this.prefs.getString(PREFS_KEY);
if (raw.length === 0) {
return new LearningSnapshot();
}
return parseSnapshot(raw);
} | https://github.com/terryma2024/happyword | a6b2bd30f500ec43bdb9c72350f82ffccc63c941 | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | resumeSound | 恢复音效
@param type 音效类型 | resumeSound(type: SoundType): void {
const audioPlayer = this.loadedSounds.get(type);
if (audioPlayer) {
// TODO: 恢复播放
// audioPlayer.play();
console.log(`Resuming sound: ${type}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resumeSound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SoundType AST#identifier#Right AST#)#Left ) ... | resumeSound(type: SoundType): void {
const audioPlayer = this.loadedSounds.get(type);
if (audioPlayer) {
// TODO: 恢复播放
// audioPlayer.play();
console.log(`Resuming sound: ${type}`);
}
} | https://github.com/the-wwyang/kids-learning-app | 8a437100a8ca86041611f667f2d4867e86b3e9bb | github |
huaweicloud/huaweicloud-iot-device-sdk-arkts | huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets | arkts | messageArrived | 接收消息处理 | private messageArrived() {
this.mqttClient?.messageArrived((err: Error, message: MqttMessage) => {
const rawMessage: RawMessage = {
topic: message.topic,
qos: message.qos,
payload: message.payload
}
const topic = rawMessage.topic;
const listener =this.rawMessageList... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left messageArrived 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#{#Le... | private messageArrived() {
this.mqttClient?.messageArrived((err: Error, message: MqttMessage) => {
const rawMessage: RawMessage = {
topic: message.topic,
qos: message.qos,
payload: message.payload
}
const topic = rawMessage.topic;
const listener =this.rawMessageList... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts | 3bb45758485c20b1e75a5c9258e0aa6921613ed7 | github |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/pages/Index.ets | arkts | onTotalBudgetChanged | 预算变化后同步刷新预算卡摘要。 | onTotalBudgetChanged(): void {
this.updateMonthlySummary();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTotalBudgetChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme... | onTotalBudgetChanged(): void {
this.updateMonthlySummary();
} | https://github.com/ZestBox-18/kitebook-frontend | c40b7f573b54a72c373f28fbbf8c571efdf7390f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AccountDAO.ets | arkts | mapRowToAccount | 将 ResultSet 的一行数据映射为 Account 对象
@param resultSet 查询结果集
@returns Account 对象 | private static mapRowToAccount(resultSet: relationalStore.ResultSet): Account {
try {
// 构造 JSON 对象
const row = {
accountId: resultSet.getLong(resultSet.getColumnIndex('account_id')),
userId: resultSet.getLong(resultSet.getColumnIndex('user_id')),
name: resultSet.getString(resu... | 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 mapRowToAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:... | private static mapRowToAccount(resultSet: relationalStore.ResultSet): Account {
try {
// 构造 JSON 对象
const row = {
accountId: resultSet.getLong(resultSet.getColumnIndex('account_id')),
userId: resultSet.getLong(resultSet.getColumnIndex('user_id')),
name: resultSet.getString(resu... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a8fd0abf49eee261c9d9340d2abb0fbe07ccee21 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | handleSyncComplete | 处理同步完成回调 | private static handleSyncComplete(data: Array<[string, number]>): void {
try {
for (const item of data) {
const deviceId = item[0];
const status = item[1];
if (status !== 0) {
hilog.warn(DOMAIN, TAG, `Sync to device ${deviceId} failed with status ${status}`);
} else... | 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 handleSyncComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#L... | private static handleSyncComplete(data: Array<[string, number]>): void {
try {
for (const item of data) {
const deviceId = item[0];
const status = item[1];
if (status !== 0) {
hilog.warn(DOMAIN, TAG, `Sync to device ${deviceId} failed with status ${status}`);
} else... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L334-L348 | 0c4d564f914a8990ec4c20cce0f187bd7b355ae0 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test31_original_index.ets | arkts | testArrayFromFill | --- Array.from + fill --- | function testArrayFromFill(): string {
let arr: number[] = new Array<number>(5);
arr.fill(7);
let arr2: number[] = [1, 2, 3, 4, 5];
arr2.fill(0, 2, 4);
return String(arr[0]) + ',' + String(arr[4]) + ',' + String(arr2[2]) + ',' + String(arr2[3]);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayFromFill AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testArrayFromFill(): string {
let arr: number[] = new Array<number>(5);
arr.fill(7);
let arr2: number[] = [1, 2, 3, 4, 5];
arr2.fill(0, 2, 4);
return String(arr[0]) + ',' + String(arr[4]) + ',' + String(arr2[2]) + ',' + String(arr2[3]);
} | https://github.com/miaochiahao/ark-ghidra | 6db272ba7144b7d1f76b8c69bc700e7f323711d2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/AppInitializationManager.ets | arkts | isCompleted | 检查是否已完成 | isCompleted(): boolean {
return this.state.isCompleted;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isCompleted(): boolean {
return this.state.isCompleted;
} | https://github.com/DaLongZhuaZi/manxia | 88fe913c11d34ab9616408e5e497439833aae5c3 | github |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/request/MessagePageRequest.ets | arkts | constructor | @param {Partial<MessagePageRequest>} init - 初始化数据 | constructor(init?: Partial<MessagePageRequest>) {
if (!init) return;
this.sessionId = init.sessionId ?? this.sessionId;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.order = init.order ?? this.order;
this.sort = init.sort ?? this.sort;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres... | constructor(init?: Partial<MessagePageRequest>) {
if (!init) return;
this.sessionId = init.sessionId ?? this.sessionId;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.order = init.order ?? this.order;
this.sort = init.sort ?? this.sort;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 8289ddecfc524148c12addc4d142945c74841225 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | isTabularData | @section Console methods for tabular data display.
Checks whether data can be represented as a table
@param { Any } data Instance to check
@return { boolean } | private static isTabularData(data: Any): boolean {
if (data == undefined) {
return false
}
if (data == null) {
return false
}
if (data instanceof String) {
return false
}
if (Array.isArray(data) || Class.of(data as Object).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 isTabularData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left :... | private static isTabularData(data: Any): boolean {
if (data == undefined) {
return false
}
if (data == null) {
return false
}
if (data instanceof String) {
return false
}
if (Array.isArray(data) || Class.of(data as Object).i... | https://gitcode.com/iop123123/arkts-static-skills | d93227163f298b20086b3f805b375a1ea937b5a0 | gitcode |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/HistoryManager.ets | arkts | deleteAdvancedHistory | 删除高级评估器历史记录 | static async deleteAdvancedHistory(context: Context, id: string): Promise<void> {
try {
const prefs = await HistoryManager.getPreferences(context);
const historyStr = await prefs.get(HistoryManager.ADVANCED_HISTORY_KEY, '[]') as string;
let history: AdvancedHistoryItem[] = JSON.parse(historyStr)... | 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 deleteAdvancedHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:... | static async deleteAdvancedHistory(context: Context, id: string): Promise<void> {
try {
const prefs = await HistoryManager.getPreferences(context);
const historyStr = await prefs.get(HistoryManager.ADVANCED_HISTORY_KEY, '[]') as string;
let history: AdvancedHistoryItem[] = JSON.parse(historyStr)... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 794b84fe7235a05fa5a34fdd78ab9fb349c38b5c | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AccountDAO.ets | arkts | getById | 根据 ID 查询单个账户
@param accountId 账户 ID
@returns Account 对象或 null
@throws | static async getById(accountId: number): Promise<Account | null> {
const store = DatabaseManager.getDatabase();
// 构建查询条件
const predicates = new relationalStore.RdbPredicates('accounts');
predicates.equalTo('account_id', accountId);
// 执行查询
const resultSet = await store.query(predicates);
... | 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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accountId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async getById(accountId: number): Promise<Account | null> {
const store = DatabaseManager.getDatabase();
// 构建查询条件
const predicates = new relationalStore.RdbPredicates('accounts');
predicates.equalTo('account_id', accountId);
// 执行查询
const resultSet = await store.query(predicates);
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8ceed0a48463bfd17e44d1c7aa28db4279950738 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | clearDownloadDirectory | 清理Download文件夹中的目录 | private async clearDownloadDirectory(dirPath: string): Promise<ClearResult> {
const result: ClearResult = {
success: true,
clearedSize: 0,
clearedCount: 0,
errors: []
};
try {
try {
SafeFileUtils.accessSync(dirPath);
} catch {
// 目录不存在,直接返回
retu... | 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 clearDownloadDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left A... | private async clearDownloadDirectory(dirPath: string): Promise<ClearResult> {
const result: ClearResult = {
success: true,
clearedSize: 0,
clearedCount: 0,
errors: []
};
try {
try {
SafeFileUtils.accessSync(dirPath);
} catch {
// 目录不存在,直接返回
retu... | https://github.com/DaLongZhuaZi/manxia | 0d400204f4014bcf194fdc9eb7b1c3989f95fa82 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | sha1 | SHA-1 哈希(用于旧版本服务器) | static async sha1(data: Uint8Array): Promise<Uint8Array> {
const md = cryptoFramework.createMd('SHA1');
const blob = CryptoUtil.createDataBlob(data);
await md.update(blob);
const result = await md.digest();
return new Uint8Array(result.data);
} | 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 sha1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right ... | static async sha1(data: Uint8Array): Promise<Uint8Array> {
const md = cryptoFramework.createMd('SHA1');
const blob = CryptoUtil.createDataBlob(data);
await md.update(blob);
const result = await md.digest();
return new Uint8Array(result.data);
} | https://github.com/AlkaidLab/moonlight-harmony | 9e7aa312af2cac3aa02a619ce496b7e60456e187 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | set | Sets the boolean value wrapped in this BooleanBox.
@param { boolean } value - The new boolean value to set
@returns { boolean } The newly set boolean value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(value: boolean): boolean {
return (this.value = value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(value: boolean): boolean {
return (this.value = value);
} | https://gitcode.com/iop123123/arkts-static-skills | 3cc00f08955228ecc8951a340c719d87ce1a0f17 | gitcode |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | getDataSource | 获取数据源 | getDataSource(): Array<T> {
return this.dataSource;
} | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDataSource 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#:#Lef... | getDataSource(): Array<T> {
return this.dataSource;
} | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | 6fc4f369f99c0567c3f29099874f014d1a1e85fd | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/WindowUtil.ets | arkts | setWindowOrientation | Sets preferred window orientation and mirrors it to {@link WindowInfo.orientation} on success.
@param orientation Target orientation. | setWindowOrientation(orientation: window.Orientation): void {
try {
this.mainWindow!.setPreferredOrientation(orientation)
.then(() => {
Logger.info(`Succeeded in setting window orientation.`);
this.mainWindowInfo.orientation = orientation;
})
.catch((err: Business... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWindowOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left orientation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identi... | setWindowOrientation(orientation: window.Orientation): void {
try {
this.mainWindow!.setPreferredOrientation(orientation)
.then(() => {
Logger.info(`Succeeded in setting window orientation.`);
this.mainWindowInfo.orientation = orientation;
})
.catch((err: Business... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 0cf54c9eb15ce0a3c0fe118caafe35a4dd415009 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/RequestQueue.ets | arkts | evaluateBackoff | Slow-success backoff (BOM in dev guide §SDK Behavior Settings). Triggered
when a request succeeds but the server is straining, three gates must
all pass:
- response time ≥ `bom_at` seconds (server is slow)
- queue ≤ `bom_rqp` of capacity (we can afford to pause)
- request not older than `bom_ra` hours (slow response is... | private evaluateBackoff(result: HttpResult, requestData: string): void {
const sc: ServerConfig = this.config.serverConfig;
const acceptedTimeoutMs: number = sc.bomAcceptedTimeoutSeconds * 1000;
if (result.elapsedMs < acceptedTimeoutMs) return;
const threshold: number = sc.bomRequestQueuePercentage;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left evaluateBackoff AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private evaluateBackoff(result: HttpResult, requestData: string): void {
const sc: ServerConfig = this.config.serverConfig;
const acceptedTimeoutMs: number = sc.bomAcceptedTimeoutSeconds * 1000;
if (result.elapsedMs < acceptedTimeoutMs) return;
const threshold: number = sc.bomRequestQueuePercentage;
... | https://github.com/Countly/countly-sdk-hos | 4239b35497e4af4e944f0d83c73fadbcb20909f8 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/PullUpManager.ets | arkts | pullUpApp | try to start app ability from outside.
@param want
@returns void | public static pullUpApp(want: Want): void {
if (!PullUpManager.checkAndHandleParams(want)) {
return;
}
// In case of jump into app directly, clear the badge.
PullUpManager.clearBadgeNum();
if (PullUpManager.isShortCutPullUp(want)) {
AppStorage.setOrCreate<WantParams>(StorageKey.WANT_PA... | 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 pullUpApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#... | public static pullUpApp(want: Want): void {
if (!PullUpManager.checkAndHandleParams(want)) {
return;
}
// In case of jump into app directly, clear the badge.
PullUpManager.clearBadgeNum();
if (PullUpManager.isShortCutPullUp(want)) {
AppStorage.setOrCreate<WantParams>(StorageKey.WANT_PA... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 52914910acf85572ff98b7855063aa1ac0a7b13a | gitcode |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | handleImeCommandMessage | ==================== IME Composition Input ==================== | handleImeCommandMessage(message: ImeCommandMessage): EditorActionResult {
const data = CoreProtocol.encodeImeCommandMessage(message);
return CoreProtocol.decodeEditorActionResult(
native.editorImeHandleCommandMessage(this.handle, data)
);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleImeCommandMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImeCommandMessage AST#identif... | handleImeCommandMessage(message: ImeCommandMessage): EditorActionResult {
const data = CoreProtocol.encodeImeCommandMessage(message);
return CoreProtocol.decodeEditorActionResult(
native.editorImeHandleCommandMessage(this.handle, data)
);
} | https://github.com/FinalScave/SweetEditor | fca078badf861ed2087f732de45001918cf3414a | github |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | hasErrors | 是否有错误 | hasErrors(): boolean {
return this.errors.length > 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasErrors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | hasErrors(): boolean {
return this.errors.length > 0;
} | https://github.com/CLMC2025/Vignette | 835e204d2f7f3ce90851ad41a78b41a6b564b90b | github |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/AudioSettings.ets | arkts | aboutToDisappear | 组件即将消失时移除监听器 | aboutToDisappear(): void {
if (this.themeChangeListener) {
this.themeManager.removeListener(this.themeChangeListener);
this.themeChangeListener = null;
}
} | AST#program#Left AST#ERROR#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#ERROR#Right AST#expression_statement#Left AST#unary_expressio... | aboutToDisappear(): void {
if (this.themeChangeListener) {
this.themeManager.removeListener(this.themeChangeListener);
this.themeChangeListener = null;
}
} | https://github.com/richshaw2015/nds | c1b589bbb2e926ffe778f9a453818d9b98dc167c | github |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/oss/OssUploader.ets | arkts | quickUpload | 默认超时时间
静态上传方法
@param token OSS 临时凭证
@param config 上传配置 | static async quickUpload(
token: OSSToken,
config: OSSUploadConfig
): Promise<OSSUploadResponse> {
const uploader = new OSSUploader();
return uploader.upload(token, config);
} | 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 quickUpload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#... | static async quickUpload(
token: OSSToken,
config: OSSUploadConfig
): Promise<OSSUploadResponse> {
const uploader = new OSSUploader();
return uploader.upload(token, config);
} | https://github.com/iHongRen/harmony-study-demo | 4c437223301f87d4a98ae68b093f3a438903b84e | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _readSystemLiteral | 读取系统文字:`SystemLiteral`类似于属性值,但允许字符 `<`和`&`,并且不替换引用。
@see https://www.w3.org/TR/xml/ 2.3节 [11] SystemLiteral
@return {string|boolean} 返回值为去掉引号的 SystemLiteral的值或者空值,或者false; | private _readSystemLiteral(): string|boolean{
let _svgStringReader = this._svgStringReader!;
let quote: string = _svgStringReader.readStringFast(XMLConstants.XML_DOUBLE_QUOTATION_MARK)
|| _svgStringReader.readStringFast(XMLConstants.XML_SINGLE_QUOTATION_MARK);
if (!quote) {
return false;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readSystemLiteral 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 _readSystemLiteral(): string|boolean{
let _svgStringReader = this._svgStringReader!;
let quote: string = _svgStringReader.readStringFast(XMLConstants.XML_DOUBLE_QUOTATION_MARK)
|| _svgStringReader.readStringFast(XMLConstants.XML_SINGLE_QUOTATION_MARK);
if (!quote) {
return false;
}
... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 93f980b78083e22eaf6a6629a8245f58bd0cfc0f | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | getInstance | 获取单例实例
@returns SettingsManager 实例 | public static getInstance(): SettingsManager {
if (!SettingsManager.instance) {
SettingsManager.instance = new SettingsManager();
}
return SettingsManager.instance;
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): SettingsManager {
if (!SettingsManager.instance) {
SettingsManager.instance = new SettingsManager();
}
return SettingsManager.instance;
} | https://github.com/richshaw2015/nds | 15be65ddf8aaee483db7ab6120640b1a161590ec | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets | arkts | deleteRecordingsByScheduleId | 删除日程的所有录音 | async deleteRecordingsByScheduleId(scheduleId: string): Promise<void> {
if (!this.rdbStore) {
return
}
try {
const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_RECORDING)
predicates.equalTo('scheduleId', scheduleId)
await this.rdbStore.delete(predicates)
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteRecordingsByScheduleId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left scheduleId AST#i... | async deleteRecordingsByScheduleId(scheduleId: string): Promise<void> {
if (!this.rdbStore) {
return
}
try {
const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_RECORDING)
predicates.equalTo('scheduleId', scheduleId)
await this.rdbStore.delete(predicates)
... | https://gitcode.com/openharmony/codelabs | 9ffd3dd875389c285404cf6a566bd12eacf9fe55 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DeepLinkRouter.ets | arkts | resolveSource | ── 漫画源查找 ──
异步查找漫画源(按名称、别名、pkg、或数字ID) | async resolveSource(sourceKey: string): Promise<SourceInfo | null> {
try {
const sm: SourceManager = SourceManager.getInstance();
const allSources: SourceInfo[] = await sm.getAllSources();
// 1. 名称精确匹配
const byName: SourceInfo | undefined = allSources.find(
(s: SourceInfo) => s.na... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left resolveSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceKey AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async resolveSource(sourceKey: string): Promise<SourceInfo | null> {
try {
const sm: SourceManager = SourceManager.getInstance();
const allSources: SourceInfo[] = await sm.getAllSources();
// 1. 名称精确匹配
const byName: SourceInfo | undefined = allSources.find(
(s: SourceInfo) => s.na... | https://github.com/DaLongZhuaZi/manxia | 9756458e7d24211204af099a6b4965cfde2dc065 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets | arkts | onDownLoadUpdated | 监听是否开始下载/暂停下载 | onDownLoadUpdated(): void {
if (this.isStartAllDownload) {
// 如果下载失败,则重新下载。下载失败原因一般是网络原因导致。
if (this.state === '下载失败') {
// 下载任务完成或者任务失败时,底层会自动销毁任务资源。所以如果需要重新下载,重新创建任务即可。这里只做了初始化task对象
this.downloadTask = undefined;
// 隐藏下载状态图标
this.isShow = false;
// 重置下载任务状态
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDownLoadUpdated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressi... | onDownLoadUpdated(): void {
if (this.isStartAllDownload) {
// 如果下载失败,则重新下载。下载失败原因一般是网络原因导致。
if (this.state === '下载失败') {
// 下载任务完成或者任务失败时,底层会自动销毁任务资源。所以如果需要重新下载,重新创建任务即可。这里只做了初始化task对象
this.downloadTask = undefined;
// 隐藏下载状态图标
this.isShow = false;
// 重置下载任务状态
... | https://github.com/openharmony/applications_app_samples | 6d03b31e4ad7afc17b2fbba9269513af3c469636 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | isSuwayomiConfigured | 检查Suwayomi是否已配置 | isSuwayomiConfigured(): boolean {
return this.suwayomiExecutor.isConfigured();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSuwayomiConfigured AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AS... | isSuwayomiConfigured(): boolean {
return this.suwayomiExecutor.isConfigured();
} | https://github.com/DaLongZhuaZi/manxia | dcd07eb98f8049845ca7e64a9c658c9f7a432c99 | github |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/ProcessingInterfaceTest/entry/src/main/ets/utils/AVPlayerDemo.ets | arkts | avPlayerDataSrcSeekDemo | 以下demo为使用fs文件系VideoPage.ets统打开沙箱地址获取媒体文件地址并通过dataSrc属性进行播放(seek模式)示例 | async avPlayerDataSrcSeekDemo() {
// 创建avPlayer实例对象
// let avPlayer: media.AVPlayer = await media.createAVPlayer();
await media.createAVPlayer()
.then((avPlayer: media.AVPlayer) => {
this.avPlayer = avPlayer;
// 创建状态机变化回调函数
this.setAVPlayerCallback(avPlayer, this.callback);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left avPlayerDataSrcSeekDemo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Lef... | async avPlayerDataSrcSeekDemo() {
// 创建avPlayer实例对象
// let avPlayer: media.AVPlayer = await media.createAVPlayer();
await media.createAVPlayer()
.then((avPlayer: media.AVPlayer) => {
this.avPlayer = avPlayer;
// 创建状态机变化回调函数
this.setAVPlayerCallback(avPlayer, this.callback);
... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | e4e97e29ed3ee8188691eae676e2029f9d4633a1 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/BiosValidator.ets | arkts | validateDsDirectory | 验证 DS BIOS 目录 | static validateDsDirectory(dirPath: string): BiosValidationResult {
if (!dirPath) {
return { consoleType: 'ds', status: BiosValidationStatus.UNSET, files: [] };
}
return BiosValidator.validateDirectory('ds', dirPath, BiosValidator.DS_REQUIRED_FILES);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateDsDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | static validateDsDirectory(dirPath: string): BiosValidationResult {
if (!dirPath) {
return { consoleType: 'ds', status: BiosValidationStatus.UNSET, files: [] };
}
return BiosValidator.validateDirectory('ds', dirPath, BiosValidator.DS_REQUIRED_FILES);
} | https://github.com/richshaw2015/nds | efa179548fdb485e628016132a7966da00edac76 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/deviceAwareness/facades/AccessibilityFacade.ets | arkts | buildAccessibilityLabel | 为组件设置无障碍描述标签(供 .accessibilityText() 使用的推荐辅助工具)
@param componentId 组件逻辑 ID(建议与 .id() 保持一致)
@param label 朗读描述文字 | buildAccessibilityLabel(componentId: string, label: string): string {
logger.debug(TAG, '无障碍标签绑定: id=' + componentId + ', label=' + label);
return label;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildAccessibilityLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,... | buildAccessibilityLabel(componentId: string, label: string): string {
logger.debug(TAG, '无障碍标签绑定: id=' + componentId + ', label=' + label);
return label;
} | https://github.com/DaLongZhuaZi/NGF | 19c8a4b8ccadf226dffded0ab1b6f1c9f31f6c19 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.