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 |
|---|---|---|---|---|---|---|---|---|---|---|
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleContent.ets | arkts | placementFromGeo | Server returns `geo` values in DP (the same unit we reported via
`resolution`). ArkUI's layout primitives treat bare numbers as **vp**
(virtual pixels), which are effectively DP, so we pass the values
through unchanged. Multiplying by density here would double-upscale the
overlay and push it off-screen. The `density` p... | private static placementFromGeo(raw: Object | undefined, _density: number): ContentPlacement | null {
if (raw === undefined || raw === null || typeof raw !== 'object' || Array.isArray(raw)) return null;
const obj: Record<string, Object> = raw as Record<string, Object>;
const x: number = ModuleContent.numO... | 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 placementFromGeo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left... | private static placementFromGeo(raw: Object | undefined, _density: number): ContentPlacement | null {
if (raw === undefined || raw === null || typeof raw !== 'object' || Array.isArray(raw)) return null;
const obj: Record<string, Object> = raw as Record<string, Object>;
const x: number = ModuleContent.numO... | https://github.com/Countly/countly-sdk-hos | eafa825365082a8e6710d0f04d0540a6f258563f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets | arkts | sendTaskFailedNotification | 发送任务失败通知 | private async sendTaskFailedNotification(task: InternalTask): Promise<void> {
if (!task.options?.notification) {
return;
}
const errorMessage = task.errorMessage || '未知错误';
switch (task.options.notification.scene) {
case TaskNotificationScene.PDF_IMPORT:
logger.warn(
TAG... | 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 sendTaskFailedNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right ... | private async sendTaskFailedNotification(task: InternalTask): Promise<void> {
if (!task.options?.notification) {
return;
}
const errorMessage = task.errorMessage || '未知错误';
switch (task.options.notification.scene) {
case TaskNotificationScene.PDF_IMPORT:
logger.warn(
TAG... | https://github.com/DaLongZhuaZi/manxia | dce3f3094182504013f692daf66ea0082d7394e1 | github |
codelably/HCompass | core/navigation/src/main/ets/GuardManager.ets | arkts | size | 获取已注册的守卫数量
@returns 守卫数量 | get size(): number {
return this.guards.length;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left size AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ER... | get size(): number {
return this.guards.length;
} | https://github.com/codelably/HCompass | eee7dda27dd40281916c95dc71a47f1597393c51 | github |
openharmony/applications_calendar_data | datamanager/src/main/ets/utils/CalendarUriHelper.ets | arkts | getTablePathNameByPath | transfer uri without prefix to the table's path
@param user input uri without prefix
@return the table path name | function getTablePathNameByPath(path: string): string {
const array = path.split("/");
if (array === null || array === undefined || array.length < 1) {
return '';
}
return array[1];
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getTablePathNameByPath AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | function getTablePathNameByPath(path: string): string {
const array = path.split("/");
if (array === null || array === undefined || array.length < 1) {
return '';
}
return array[1];
} | https://gitee.com/openharmony/applications_calendar_data.git | 56af0e979d8869fb9b363a619c3285fdbe2fd00c | gitee |
jjjjjjava/ffmpeg_tools | example/BasicUsage.ets | arkts | scale | ============================================================
硬解硬编(零配置)
============================================================
视频缩放 | scale(): void {
const cmd = FFmpegFactory.scale('/input.mp4', '/720p.mp4', 1280, 720);
this.run(cmd);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left scale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | scale(): void {
const cmd = FFmpegFactory.scale('/input.mp4', '/720p.mp4', 1280, 720);
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools | 413bafcf406c1b82a267460e302481e4177f7761 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/arkts/class/Function.ets | arkts | f1 | 定义函数时要指定参数的类型和返回值的类型,无返回值时可以用 void 表示 | function f1(x:number, y:number):number {
return x + y;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left f1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predef... | function f1(x:number, y:number):number {
return x + y;
} | https://github.com/webabcd/HarmonyDemo | 81b29b336ca2f8b5f55c75066545c13f950760ef | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/RadarDataSet.ets | arkts | isDrawHighlightCircleEnabled | / Returns true if highlight circle should be drawn, false if not | public isDrawHighlightCircleEnabled(): boolean {
return this.mDrawHighlightCircleEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDrawHighlightCircleEnabled 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#L... | public isDrawHighlightCircleEnabled(): boolean {
return this.mDrawHighlightCircleEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | eb509468ea0ee0cb253e3d19ddb182598191bc45 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AirConditionerController.ets | arkts | notifySubscribers | 通知订阅者状态变化 | private notifySubscribers(deviceId: string, status: DeviceStatus): void {
const callbacks = this.subscribers.get(deviceId);
if (callbacks) {
callbacks.forEach(callback => {
try {
callback(status);
} catch (error) {
console.error(`AirConditionerController: Error in sub... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifySubscribers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private notifySubscribers(deviceId: string, status: DeviceStatus): void {
const callbacks = this.subscribers.get(deviceId);
if (callbacks) {
callbacks.forEach(callback => {
try {
callback(status);
} catch (error) {
console.error(`AirConditionerController: Error in sub... | https://github.com/LJ666-ui/harmony-health-care | 3fcb41ea6f2f1c817e2f26857d86af4037f2dc28 | github |
Octo-o-o-o/harmonyos-ai-workspace | samples/templates/huks-secure-store/SecureStore.ets | arkts | ensureKey | ─── HUKS 包装 / 解包 ─────────────────────────────────────
懒生成 AES-256-GCM key —— 首次 set 时建一次 | private async ensureKey(): Promise<void> {
const checkOpts: huks.HuksOptions = { properties: [] }
try {
const ret = await huks.isKeyItemExist(HUKS_ALIAS, checkOpts)
if (ret) {
return
}
} catch (_e) {
// 落空 → 走生成
// scan-ignore: ARKTS-016
}
const generateOpts: ... | 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 ensureKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | private async ensureKey(): Promise<void> {
const checkOpts: huks.HuksOptions = { properties: [] }
try {
const ret = await huks.isKeyItemExist(HUKS_ALIAS, checkOpts)
if (ret) {
return
}
} catch (_e) {
// 落空 → 走生成
// scan-ignore: ARKTS-016
}
const generateOpts: ... | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | 429cf058c19d32cdd43dcc6f2eeccef4fd48a5fc | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | drawCrop | Draw crop rect. | private drawCrop(): void {
let crop = this.cropShow.getCropRect();
MathUtils.roundOutRect(crop);
let display = new RectF();
display.set(0, 0, this.displayWidth, this.displayHeight);
if (this.ctx !== undefined) {
DrawingUtils.drawMask(this.ctx, display, crop, this.splitLineShow);
if (th... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawCrop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Ri... | private drawCrop(): void {
let crop = this.cropShow.getCropRect();
MathUtils.roundOutRect(crop);
let display = new RectF();
display.set(0, 0, this.displayWidth, this.displayHeight);
if (this.ctx !== undefined) {
DrawingUtils.drawMask(this.ctx, display, crop, this.splitLineShow);
if (th... | https://gitee.com/openharmony/codelabs.git | 4c78f53e1796e1cdcf0c23c9dd4e4a8eac2244a5 | gitee |
openharmony/arkui_ace_engine | examples/Info/entry/src/main/ets/pages/progress/ProgressTestCase006.ets | arkts | progress4 | contentModifier不设置宽高 | @Builder
function progress4(config: ProgressConfiguration) {
Column() {
Row({ space: 40 }) {
Path()
.width(30)
.height(30)
.commands('M108 0 L141 70 L218 78.3 L162 131 L175 205 L108 170 L41.2 205 L55 131 L1 78 L75 68 L108 0 Z')
.fill(config.enabled && config.value >= 20 ? (co... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left progress4 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#require... | @Builder
function progress4(config: ProgressConfiguration) {
Column() {
Row({ space: 40 }) {
Path()
.width(30)
.height(30)
.commands('M108 0 L141 70 L218 78.3 L162 131 L175 205 L108 170 L41.2 205 L55 131 L1 78 L75 68 L108 0 Z')
.fill(config.enabled && config.value >= 20 ? (co... | https://gitee.com/openharmony/arkui_ace_engine.git | 009f50d11d749f7cf2fe545423ad81009640205b | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint8ClampedArray) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = this.$_get(0).toDouble... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint8ClampedArray) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = this.$_get(0).toDouble... | https://gitcode.com/iop123123/arkts-static-skills | de11134bae5f305a04d3adb86e52744624ace5a3 | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/UsersApi.ets | arkts | getUserItems | getUserItems
@summary Gets items from a user's library. Walks GET /Users/{userId}/Items.
@param {UsersApiGetItemsRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UsersApi | public async getUserItems(requestParameters: UsersApiGetItemsRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.userId)
return this.apiClient.get({
path: `/Users/${requestParameters.userId}/Items`,
parameters: requestParameters,
excludeParams: ['userId']
})
... | 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 getUserItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#... | public async getUserItems(requestParameters: UsersApiGetItemsRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.userId)
return this.apiClient.get({
path: `/Users/${requestParameters.userId}/Items`,
parameters: requestParameters,
excludeParams: ['userId']
})
... | https://github.com/OHPG/FinSdk | 510d1a0225706e489fc48fb69fdfd5ba72899392 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | build | 构建命令数组 | public build(): string[] {
if (this.inputFiles.length === 0) {
throw new Error('At least one input is required');
}
if (this.outputPath === '') {
throw new Error('Output path is required');
}
const cmd: string[] = ['ffmpeg'];
// 硬解码
if (this.useHwDecode) {
cmd.push('-c:... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left build AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#... | public build(): string[] {
if (this.inputFiles.length === 0) {
throw new Error('At least one input is required');
}
if (this.outputPath === '') {
throw new Error('Output path is required');
}
const cmd: string[] = ['ffmpeg'];
// 硬解码
if (this.useHwDecode) {
cmd.push('-c:... | https://github.com/jjjjjjava/ffmpeg_tools | cb15e9081ae8c885a8fb8961a886e3bb52248ced | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | getHttpsBaseUrl | 获取 HTTPS 基础 URL(懒加载模式,匹配 Android 的 getHttpsUrl 行为)
当 httpsPort 未知时,自动通过 HTTP 调用 serverinfo 获取真实 HTTPS 端口
端口优先级:
1. 已缓存的 httpsPort(来自 serverInfo 或自动解析)
2. 自动通过 HTTP serverinfo 获取(懒加载)
3. 根据 httpPort 计算的端口(httpPort - 5)作为最终兜底 | private async getHttpsBaseUrl(connectTimeout: number = NvHttp.CONNECTION_TIMEOUT): Promise<string> {
// 已缓存 → 直接使用
if (this.httpsPort > 0) {
return `https://${formatAddressForUrl(this.address)}:${this.httpsPort}`;
}
// 自定义端口(frp / 端口转发)→ Sunshine 规则直接推算,跳过 HTTP 探测避免 3s 超时
if (this.httpPort ... | 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 getHttpsBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left connectTimeout AST#identifier#Right A... | private async getHttpsBaseUrl(connectTimeout: number = NvHttp.CONNECTION_TIMEOUT): Promise<string> {
// 已缓存 → 直接使用
if (this.httpsPort > 0) {
return `https://${formatAddressForUrl(this.address)}:${this.httpsPort}`;
}
// 自定义端口(frp / 端口转发)→ Sunshine 规则直接推算,跳过 HTTP 探测避免 3s 超时
if (this.httpPort ... | https://github.com/AlkaidLab/moonlight-harmony | 07ea3d3cbc191e0239443b323f66381504a37c85 | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | updateContactName | 更新联系人
@param {string} value - 联系人
@returns {void} 无返回值 | updateContactName(value: string): void {
this.contactName = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateContactName 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 string AST#identifier#Right AST#)#Lef... | updateContactName(value: string): void {
this.contactName = value;
} | https://github.com/Joker-x-dev/CoolMallArkTS | a03e7fac693d7322c2de36ae10426b0657360a66 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isDecDigit | isDecDigit() checks whether the underlying char represents a decimal digit.
@returns { boolean }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isDecDigit(): boolean {
return Char.isDecDigit(this.value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDecDigit 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#bo... | public isDecDigit(): boolean {
return Char.isDecDigit(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | 3108dc5f37d7ce55904408b94c9211ea7bc9fcb8 | gitcode |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/GlobalExtAbility/GlobalDialogModel.ets | arkts | createWindow | 创建全局弹窗
@param context ServiceExtensionContext
@param rect 窗口大小及位置
@param storage 数据管理
return 创建的窗口 | public async createWindow(
context: Context, rect: display.Rect, storage: LocalStorage
): Promise<window.Window | null> {
try {
Log.info('create window');
let configuration: window.Configuration = {
ctx: context,
name: 'globalDialog',
windowType: window.WindowType.TYPE_VO... | 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 createWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : A... | public async createWindow(
context: Context, rect: display.Rect, storage: LocalStorage
): Promise<window.Window | null> {
try {
Log.info('create window');
let configuration: window.Configuration = {
ctx: context,
name: 'globalDialog',
windowType: window.WindowType.TYPE_VO... | https://gitee.com/openharmony/applications_permission_manager.git | e836a96bc164e969b8a0e406dd5c3b22ae4360af | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/SFTPHandler.ets | arkts | exec | 执行命令并返回输出 | private async exec(command: string): Promise<string> {
if (!this.client || this.client.isClosed()) {
throw new Error('SFTP client is not connected');
}
const result = await this.client.exec(command);
if (result.status !== 0) {
throw new Error(`Command failed with status ${result.status}: $... | 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 exec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left command AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | private async exec(command: string): Promise<string> {
if (!this.client || this.client.isClosed()) {
throw new Error('SFTP client is not connected');
}
const result = await this.client.exec(command);
if (result.status !== 0) {
throw new Error(`Command failed with status ${result.status}: $... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/SFTPHandler.ets#L75-L84 | 7315f68518f4bc4f87617da0c5e44cf58cc4b8c0 | github |
openharmony/web_webview | interfaces/kits/ani/webview/ets/@ohos.web.webview.ets | arkts | saveCookieAsync | Save the cookies Asynchronously.
@param { AsyncCallback<void> } callback - Called after the cookies have been saved.
@throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
<br>2. Incorrect parameter types. 3.Parameter verification failed.
@syscap SystemCapability... | static saveCookieAsync(callback: AsyncCallback<void>): void {
let pCallback = taskpool.execute(():undefined => {WebCookieManager.saveCookieSync(); return undefined});
pCallback.then((e :NullishType)=>{
callback(null, undefined);
}, (err: Error): void => {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveCookieAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio... | static saveCookieAsync(callback: AsyncCallback<void>): void {
let pCallback = taskpool.execute(():undefined => {WebCookieManager.saveCookieSync(); return undefined});
pCallback.then((e :NullishType)=>{
callback(null, undefined);
}, (err: Error): void => {
... | https://gitee.com/openharmony/web_webview.git | 522867241d22207d9aa3485bf4b5347aea09c827 | gitee |
openharmony-tpc/openharmony_tpc_samples | class-transformer/entry/src/ohosTest/ets/utils/utils.ets | arkts | isObject | 简化代码 使用函数的方式判断是否为对象 且不为null | function isObject(obj:object|string|number|boolean|undefined) {
return typeof obj === 'object' && obj !== null
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isObject AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left obj AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS... | function isObject(obj:object|string|number|boolean|undefined) {
return typeof obj === 'object' && obj !== null
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 5c1d989c1618bca50e95c034325e3908bc994cc4 | gitee |
openharmony-sig/smartperf | device/device_ui/entry/src/main/ets/common/ui/detail/chart/utils/Utils.ets | arkts | getSizeOfRotatedRectangleByRadians | /**
* Returns a recyclable FSize instance.
* Represents size of a rotated rectangle by radians.
*
* @param rectangleWidth
* @param rectangleHeight
* @param radians
* @return A Recyclable FSize instance | public static getSizeOfRotatedRectangleByRadians(rectangleWidth: number,
rectangleHeight: number, radians: number): FSize{
return FSize.getInstance(
Math.abs(rectangleWidth * Math.cos(radians)) + Math.abs(rectangleHeight *
Math.sin(radians)),
Ma... | 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 getSizeOfRotatedRectangleByRadians AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rectangleWidth AST#identifier#Right... | public static getSizeOfRotatedRectangleByRadians(rectangleWidth: number,
rectangleHeight: number, radians: number): FSize{
return FSize.getInstance(
Math.abs(rectangleWidth * Math.cos(radians)) + Math.abs(rectangleHeight *
Math.sin(radians)),
Ma... | https://gitee.com/openharmony-sig/smartperf.git | c8e88023912185c1340bee511bcaa1e06b4ecf95 | gitee |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | onRotationAngleChange | Determine whether to rotate. | onRotationAngleChange(): void {
Logger.debug(TAG, 'onRotationAngleChange');
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
this.cropShow.enlargeCropArea();
} else {
this.rotationAngle = (this.rotationAngle - CropAngle.ONE_QUARTER_CIRCLE_ANGLE) % CropAngle.CIRCLE_ANGLE;
this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRotationAngleChange 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#statem... | onRotationAngleChange(): void {
Logger.debug(TAG, 'onRotationAngleChange');
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
this.cropShow.enlargeCropArea();
} else {
this.rotationAngle = (this.rotationAngle - CropAngle.ONE_QUARTER_CIRCLE_ANGLE) % CropAngle.CIRCLE_ANGLE;
this... | https://gitee.com/openharmony/codelabs.git | 8812f472449d901d4365f36c216cb4ba4c0dc4bc | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/HooksProcessor.ets | arkts | resetInstance | 重置单例实例(主要用于测试) | static resetInstance(): void {
HooksProcessor.instance = new HooksProcessor()
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resetInstance 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#... | static resetInstance(): void {
HooksProcessor.instance = new HooksProcessor()
} | https://github.com/offlinecat-dev/OCNetORM | 2cc50ad0749488b9c800c4571d4c203416ae896a | github |
PollenWang6/HiXD | entry/src/main/ets/utils/HttpUtil.ets | arkts | getNoRedirect | 发送 GET 请求但不自动跟随重定向。
HarmonyOS NETSTACK 不支持 followRedirects: false,
此方法通过 on('headersReceive') 拦截 302 响应头,
读取 Location 后立即 destroy 请求,避免自动跟随重定向。
返回的 HttpResponse 中 location 字段包含重定向地址。 | async getNoRedirect(url: string, headers?: Record<string, string>): Promise<HttpResponse> {
await this.loadCookies();
return this.requestNoRedirect(url, http.RequestMethod.GET, undefined, headers);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNoRedirect AST#identifier#Right AST#ERROR#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 : AS... | async getNoRedirect(url: string, headers?: Record<string, string>): Promise<HttpResponse> {
await this.loadCookies();
return this.requestNoRedirect(url, http.RequestMethod.GET, undefined, headers);
} | https://github.com/PollenWang6/HiXD | 7db767b8e2a67bc22f0206c8fd928a477000c70f | github |
Tianpei-Shi/MusicDash | src/pages/LoginPage.ets | arkts | switchToLogin | 切换到登录视图 | switchToLogin(): void {
this.isRegistering = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left switchToLogin 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... | switchToLogin(): void {
this.isRegistering = false;
} | https://github.com/Tianpei-Shi/MusicDash | 7e7ad7d54ef494b39091a22c1e0a0c8db70ae67b | github |
xblLab/HarmonyProjectTemplate | features/mine/src/main/ets/components/Toast.ets | arkts | dialogBuilder | dialog builder | @Builder
function dialogBuilder(option: ToastOption) {
Column() {
if (option.hasTitle) {
Column() {
Text(option.hasTitle)
.fontColor($r('sys.color.font_primary'))
.fontSize($r('sys.float.Title_S'))
.fontWeight(FontWeight.Medium)
}
}
Column() {
Row({ ... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left dialogBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#req... | @Builder
function dialogBuilder(option: ToastOption) {
Column() {
if (option.hasTitle) {
Column() {
Text(option.hasTitle)
.fontColor($r('sys.color.font_primary'))
.fontSize($r('sys.float.Title_S'))
.fontWeight(FontWeight.Medium)
}
}
Column() {
Row({ ... | https://github.com/xblLab/HarmonyProjectTemplate | 33895e18a124cc842cd48b9dcfc0eab01efc4da6 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationManager.ets | arkts | getPreviousPage | 获取上一页面路径
@returns string | null | public getPreviousPage(): string | null {
if (this.navigationHistory.length > 1) {
return this.navigationHistory[this.navigationHistory.length - 2];
}
return null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPreviousPage 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... | public getPreviousPage(): string | null {
if (this.navigationHistory.length > 1) {
return this.navigationHistory[this.navigationHistory.length - 2];
}
return null;
} | https://github.com/LJ666-ui/harmony-health-care | 79fd0a855e4176403365a769a392a2c14b8cfa7a | github |
somnio-software/my-bot-pal | entry/src/main/ets/utils/PermissionUtils.ets | arkts | getAppTokenId | Gets the application token ID
@returns The token ID or -1 if there is an error | private async getAppTokenId(): Promise<number> {
try {
const bundleInfo: bundleManager.BundleInfo =
bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
const appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
return appInfo.accessT... | 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 getAppTokenId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async getAppTokenId(): Promise<number> {
try {
const bundleInfo: bundleManager.BundleInfo =
bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
const appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
return appInfo.accessT... | https://github.com/somnio-software/my-bot-pal | 3f159b417cf9ada208a96c3937182cf5fb6775cd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | box | Creates a new CharBox instance with the specified initial value.
@param { char } value - The initial char value to be wrapped
@returns { CharBox } A new CharBox instance containing the specified char value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static box(value: char): CharBox {
return new CharBox(value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left box AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right ... | public static box(value: char): CharBox {
return new CharBox(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 901c32ae412f1733e031bacfd3ff2fe10c285710 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | doFlush | After all data is flushed to the write stream,
you can use the Transform.doFlush writes some extra data, must
not be called directly, only called by Writable after flushing all data.
@param { Function } callback - Callback after flush completion.
@throws { BusinessError } 401 - Parameter error. Possible causes:
1.Manda... | doFlush(callback: Function): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left doFlush AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#)#Left ) A... | doFlush(callback: Function): void {} | https://gitcode.com/iop123123/arkts-static-skills | c6a360a3e7a9121cc308f757cc00bdf2b98475ca | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/core/ColumnMetadata.ets | arkts | setDefaultValue | 设置默认值
@param value 默认值
@returns 当前实例,支持链式调用 | setDefaultValue(value: string | number | boolean | null): ColumnMetadata {
this.defaultValue = value
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDefaultValue 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#binary_expression#Left AST#binary_expression#Left AST#b... | setDefaultValue(value: string | number | boolean | null): ColumnMetadata {
this.defaultValue = value
return this
} | https://github.com/offlinecat-dev/OCNetORM | 5f3d8c4c1b613f897ee61112b32911e900bc62f6 | github |
Your-USTC/DailyNic_HMOS | entry/src/main/ets/pages/ThemeSetting.ets | arkts | calculateProgress | 计算环形进度条的进度
@param n 进度条总数
@param given 已知进度为50%的编号
@param target 目标编号
@returns 进度值(0-100之间的数字) | function calculateProgress(n: number, given: number, target: number): number {
const delta = ((target - given) % n + n) % n;
const step = 200 / n;
const quarter = n / 4;
const threeQuarter = 3 * n / 4;
let progress: number;
if (delta >= 0 && delta < quarter) {
progress = 50 - delta * step;
} else if (... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calculateProgress AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function calculateProgress(n: number, given: number, target: number): number {
const delta = ((target - given) % n + n) % n;
const step = 200 / n;
const quarter = n / 4;
const threeQuarter = 3 * n / 4;
let progress: number;
if (delta >= 0 && delta < quarter) {
progress = 50 - delta * step;
} else if (... | https://github.com/Your-USTC/DailyNic_HMOS | f4f01f11d10d1e179bbca8eeaa4cb18c4e86622a | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/ThemeManager.ets | arkts | enableFullScreen | 启用全屏模式 | enableFullScreen() {
const uiContext: UIContext = new UIContext()
this.getWindowStage()
.then((windowStage: window.Window) => {
windowStage.setWindowLayoutFullScreen(true)
const topArea = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
AppStorage.setOrCreate('top... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left enableFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | enableFullScreen() {
const uiContext: UIContext = new UIContext()
this.getWindowStage()
.then((windowStage: window.Window) => {
windowStage.setWindowLayoutFullScreen(true)
const topArea = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
AppStorage.setOrCreate('top... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 4636650cb75db611c285b53467ccc58dcec7888f | gitcode |
arkui-x/samples | CodeLab/Cases/feature/dynamicattributes/src/main/ets/common/LazyForEach.ets | arkts | getData | 获取指定索引数据。
@param {number} index - 索引值。
@returns {string} 返回指定索引数据。 | public getData(index: number): string {
return this.dataArray[index];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData 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 ... | public getData(index: number): string {
return this.dataArray[index];
} | https://gitcode.com/arkui-x/samples | 9413c6403582b5302c052999c0c67148ed380a00 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/pages/ExportImportPage.ets | arkts | saveToFile | 功能 1.2: 保存到文件 (保存到应用沙箱) | saveToFile() {
if (!this.csvContent) return;
try {
// 获取应用沙箱路径 (用户无法直接在文件管理器看到,但适合内部备份)
const context = getContext(this);
const filePath = context.filesDir + '/backup_' + new Date().getTime() + '.csv';
const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | saveToFile() {
if (!this.csvContent) return;
try {
// 获取应用沙箱路径 (用户无法直接在文件管理器看到,但适合内部备份)
const context = getContext(this);
const filePath = context.filesDir + '/backup_' + new Date().getTime() + '.csv';
const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | dbb8ac984146ce07829421eec77c76199a9b6aac | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets | arkts | base64ToBase32 | Base64 字符串转 Base32
@param base64String Base64 字符串
@returns Base32 编码的字符串 | private base64ToBase32(base64String: string): string {
// Base64 解码为字节数组(使用 util.Base64Helper)
const helper = new util.Base64Helper();
const bytes = helper.decodeSync(base64String);
// 字节数组转 Base32
return TotpService.getInstance().base32Encode(bytes);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left base64ToBase32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left base64String AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private base64ToBase32(base64String: string): string {
// Base64 解码为字节数组(使用 util.Base64Helper)
const helper = new util.Base64Helper();
const bytes = helper.decodeSync(base64String);
// 字节数组转 Base32
return TotpService.getInstance().base32Encode(bytes);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets#L120-L127 | 6519875aae92bd573f5f7c31e13537eff08cf20a | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Int32Array that satisfies the condition
@param fn condition
@returns the index of the last element that satisfies fn, -1 otherwise | public findLastIndex(fn: (val: int) => boolean): int {
let newF: (val: int, index: int, array: Int32Array) => boolean =
(val: int, index: int, array: Int32Array): boolean => { return fn(val) }
return this.findLastIndex(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public findLastIndex(fn: (val: int) => boolean): int {
let newF: (val: int, index: int, array: Int32Array) => boolean =
(val: int, index: int, array: Int32Array): boolean => { return fn(val) }
return this.findLastIndex(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 04555f04ad48e6b1362090dd2355529c44586f97 | gitee |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/model/SshKey.ets | arkts | isLegacyFormat | 是否为旧格式 (不可导出/安装) | isLegacyFormat(): boolean {
return this.formatVersion === 0 &&
!SshKey.looksLikeOpenSshPrivateKey(this.privateKey) &&
!SshKey.looksLikeOpenSshPublicKey(this.publicKey);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLegacyFormat 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#stat... | isLegacyFormat(): boolean {
return this.formatVersion === 0 &&
!SshKey.looksLikeOpenSshPrivateKey(this.privateKey) &&
!SshKey.looksLikeOpenSshPublicKey(this.publicKey);
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 5c1d24c02568f4e70755bdd4926beffb6b316d6f | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/NetworkManager.ets | arkts | setOnReconnectFailureCallback | Set callback for reconnect failure | static setOnReconnectFailureCallback(callback: (error: string) => void): void {
onReconnectFailureCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left setOnReconnectFailureCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AS... | static setOnReconnectFailureCallback(callback: (error: string) => void): void {
onReconnectFailureCallback = callback;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 929e28c3f18ac2ba3b0076ac0a3521414a0315d7 | github |
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets | arkts | nativeSetInputString | Notifies engine to update the input string. | public static nativeSetInputString(): void {
tuanjie.nativeSetInputString();
} | 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 nativeSetInputString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public static nativeSetInputString(): void {
tuanjie.nativeSetInputString();
} | https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | ff040c918dbd089462c05174c3e41667cb895aa2 | github |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/UserState.ets | arkts | getUserId | 获取当前用户 ID
@returns {number | null} 用户 ID,未登录返回 null | getUserId(): number | null {
return this.userInfo?.id ?? null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left... | getUserId(): number | null {
return this.userInfo?.id ?? null;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 8d24e01ec097cee50a24c480551b70cf7de17500 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/OnlineMangaArchiveService.ets | arkts | generatePlaceholderPng | 生成最小占位PNG图片(白色1x1像素,约67字节)
用于部分归档中缺失的页面位置 | private async generatePlaceholderPng(targetPath: string): Promise<void> {
// 最小合法PNG: 1x1 白色像素
const placeholder = new Uint8Array([
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, // PNG signature
0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, // IHDR length + type
0x00, 0x00, 0x00, 0x01, 0... | 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 generatePlaceholderPng AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetPath AST#identifier#Right AST#ERROR#Lef... | private async generatePlaceholderPng(targetPath: string): Promise<void> {
// 最小合法PNG: 1x1 白色像素
const placeholder = new Uint8Array([
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, // PNG signature
0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, // IHDR length + type
0x00, 0x00, 0x00, 0x01, 0... | https://github.com/DaLongZhuaZi/manxia | 01c3f671904f0c67d9461d80b332856e9549f86d | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | clear | @deprecated
@see {ZRouter.getInstance().clear} | public static clear() {
ZRouter.getRouterMgr().clear()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#a... | public static clear() {
ZRouter.getRouterMgr().clear()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L496-L498 | 6edf95efdc9a48165697079f6fcd54c1929fef78 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/AvifTranscoder.ets | arkts | normalizeOptions | 规范化选项,提供默认格式与质量 | private normalizeOptions(options?: AvifTranscodeOptions): AvifTranscodeOptions {
const defaultOpts: AvifTranscodeOptions = { format: TranscodeFormat.WEBP, quality: 85 } as AvifTranscodeOptions;
if (!options) {
return defaultOpts as AvifTranscodeOptions;
}
const format: TranscodeFormat = options.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#... | private normalizeOptions(options?: AvifTranscodeOptions): AvifTranscodeOptions {
const defaultOpts: AvifTranscodeOptions = { format: TranscodeFormat.WEBP, quality: 85 } as AvifTranscodeOptions;
if (!options) {
return defaultOpts as AvifTranscodeOptions;
}
const format: TranscodeFormat = options.... | https://github.com/DaLongZhuaZi/manxia | 5e3765471e38d40691d67914af44af593c71ed73 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/network/ApiService.ets | arkts | unlikeComment | 取消点赞评论 | static async unlikeComment(commentId: number): Promise<ApiResponse> {
const response = await httpClient.delete(`/comments/${commentId}/like`);
const result = parseJsonSafe(response.data);
if (result) {
const data = result as Record<string, Object>;
const apiResponse = new ApiResponse();
... | 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 unlikeComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static async unlikeComment(commentId: number): Promise<ApiResponse> {
const response = await httpClient.delete(`/comments/${commentId}/like`);
const result = parseJsonSafe(response.data);
if (result) {
const data = result as Record<string, Object>;
const apiResponse = new ApiResponse();
... | https://github.com/Harrisonls2004/WaterFlow | fa5bbcff5c22a8aa9043e437a153afcd4f40c7e5 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | expireOldInvitations | 使过期的邀请失效 | static async expireOldInvitations(): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
status: INVITATION_STATUS_EXPIRED,
updated_at: now
};
const predicates = ne... | 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 expireOldInvitations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | static async expireOldInvitations(): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
status: INVITATION_STATUS_EXPIRED,
updated_at: now
};
const predicates = ne... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | cc2b2c8149f67d2cbea5915c4f5cd434891507fe | github |
IoTAccessControl/ArkTSAnalysis | TestApps/AdsKit/entry/src/main/ets/event/InterstitialAdStatusHandler.ets | arkts | registerPPSReceiver | Subscription method, which must be called each time before an ad is displayed. | public registerPPSReceiver(): void {
if (this.subscriber) {
this.unRegisterPPSReceiver();
}
// Subscriber information.
const subscribeInfo: commonEventManager.CommonEventSubscribeInfo = {
events: ['com.huawei.hms.pps.action.PPS_INTERSTITIAL_STATUS_CHANGED'],
publisherBundleName: 'com... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerPPSReceiver 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... | public registerPPSReceiver(): void {
if (this.subscriber) {
this.unRegisterPPSReceiver();
}
// Subscriber information.
const subscribeInfo: commonEventManager.CommonEventSubscribeInfo = {
events: ['com.huawei.hms.pps.action.PPS_INTERSTITIAL_STATUS_CHANGED'],
publisherBundleName: 'com... | https://github.com/IoTAccessControl/ArkTSAnalysis | d1494312a63ae7e12633ba000d64f0df250a069f | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | onCouponAction | 点击优惠券卡片操作
@param {number} couponId - 优惠券 ID
@returns {void} 无返回值 | onCouponAction(couponId: number): void {
const coupons: Coupon[] = this.data?.userCoupon ?? [];
const currentCouponId: number = this.selectedCoupon?.id ?? 0;
if (couponId === currentCouponId) {
this.selectCoupon(null);
return;
}
const coupon: Coupon | undefined = coupons.find((item: Co... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCouponAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left couponId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#... | onCouponAction(couponId: number): void {
const coupons: Coupon[] = this.data?.userCoupon ?? [];
const currentCouponId: number = this.selectedCoupon?.id ?? 0;
if (couponId === currentCouponId) {
this.selectCoupon(null);
return;
}
const coupon: Coupon | undefined = coupons.find((item: Co... | https://github.com/Joker-x-dev/CoolMallArkTS | 0ce952d9d5ee4085cb22e35e57f707e1f9fc95de | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/CommentViewModel.ets | arkts | fetchComments | 获取评论
@param isRefresh 是否是下拉刷新 | async fetchComments(isRefresh: boolean) {
if (this.isLoading || this.isFetchingMore) return;
if (isRefresh) {
this.isLoading = true;
this.nextUrl = null;
} else {
this.isFetchingMore = true;
}
try {
const res = await pixiv.getComments(
this.type,
this.targ... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchComments AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isRe... | async fetchComments(isRefresh: boolean) {
if (this.isLoading || this.isFetchingMore) return;
if (isRefresh) {
this.isLoading = true;
this.nextUrl = null;
} else {
this.isFetchingMore = true;
}
try {
const res = await pixiv.getComments(
this.type,
this.targ... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/CommentViewModel.ets#L45-L74 | f56663b848146b2b122647db1dc19879234e3c8d | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets | arkts | confirmStartDate | 确认开始日期 | confirmStartDate(): void {
const date = new Date(this.scheduleStartTime)
date.setFullYear(this.tempYear, this.tempMonth - 1, this.tempDay)
this.scheduleStartTime = date.getTime()
// 如果结束时间早于开始时间,调整结束时间
if (this.scheduleEndTime < this.scheduleStartTime) {
this.scheduleEndTime = this.scheduleS... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmStartDate 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_b... | confirmStartDate(): void {
const date = new Date(this.scheduleStartTime)
date.setFullYear(this.tempYear, this.tempMonth - 1, this.tempDay)
this.scheduleStartTime = date.getTime()
// 如果结束时间早于开始时间,调整结束时间
if (this.scheduleEndTime < this.scheduleStartTime) {
this.scheduleEndTime = this.scheduleS... | https://gitcode.com/openharmony/codelabs | 76eceac86d5f6d784f7ec28963ace99f96ea64dd | gitcode |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | onPlayComplete | 播放完成处理 | onPlayComplete() {
// 自动播放下一集
if (this.param.canNext) {
setTimeout(() => {
this.nextEpisode()
}, 800)
} else {
ToastUtil.showToast("已全部播放完毕")
setTimeout(() => {
this.doGoBack()
}, 2000)
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPlayComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | onPlayComplete() {
// 自动播放下一集
if (this.param.canNext) {
setTimeout(() => {
this.nextEpisode()
}, 800)
} else {
ToastUtil.showToast("已全部播放完毕")
setTimeout(() => {
this.doGoBack()
}, 2000)
}
} | https://github.com/fbinba3955/Flymby | e54c0fa346a4d67692c3a18573193c5d6cef6a4c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/GenericEBookParser.ets | arkts | validateFormat | 验证文件格式 | async validateFormat(filePath: string): Promise<boolean> {
try {
const extension = filePath.substring(filePath.lastIndexOf('.') + 1).toUpperCase();
return extension === this.format.toString();
} catch (error) {
logger.error(TAG, `验证${this.format}格式失败: ${String(error)}`);
return false;
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left validateFormat AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async validateFormat(filePath: string): Promise<boolean> {
try {
const extension = filePath.substring(filePath.lastIndexOf('.') + 1).toUpperCase();
return extension === this.format.toString();
} catch (error) {
logger.error(TAG, `验证${this.format}格式失败: ${String(error)}`);
return false;
... | https://github.com/DaLongZhuaZi/manxia | c1057acc7a1b753d2aaa31c5b3dfbfa3a43ad3d5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | removeFromQueue | 从队列中移除指定页面 | private removeFromQueue(pageIndex: number): void {
this.queue.delete(pageIndex);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left removeFromQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | private removeFromQueue(pageIndex: number): void {
this.queue.delete(pageIndex);
} | https://github.com/DaLongZhuaZi/manxia | 7d98d220f4376f744629a2deb30700307e9a42fc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | parseFolderAsArchiveStructure | 解析文件夹结构(用于已解压的漫画文件夹导入)
不做解压操作,直接扫描文件夹
@param folderPath 文件夹路径
@returns 解析后的结构信息(与parseArchiveStructure兼容) | public async parseFolderAsArchiveStructure(folderPath: string): Promise<ParsedArchiveStructure> {
const warnings: string[] = [];
const detectedChapters: DetectedChapterInfo[] = [];
let hasComicInfo = false;
let comicInfoContent: string | undefined;
let totalImageCount = 0;
let rootImageCount =... | 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 parseFolderAsArchiveStructure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderPath AST#identifier#Right AST#ERROR... | public async parseFolderAsArchiveStructure(folderPath: string): Promise<ParsedArchiveStructure> {
const warnings: string[] = [];
const detectedChapters: DetectedChapterInfo[] = [];
let hasComicInfo = false;
let comicInfoContent: string | undefined;
let totalImageCount = 0;
let rootImageCount =... | https://github.com/DaLongZhuaZi/manxia | 8c5f2c2ecdd797bd7a9e09e2b578dc8239607269 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/entryability/EntryAbility.ets | arkts | insertMockPrerequisites | 插入模拟数据(用于开发测试)
确保数据库中至少有一个账户和分类,满足外键约束 | private async insertMockPrerequisites(): Promise<void> {
// 1. 插入模拟账户
try {
const existingAccount = await AccountDAO.getById(1);
if (!existingAccount) {
const mockAccount = new Account();
mockAccount.userId = 1;
mockAccount.name = '模拟现金账户';
mockAccount.type = 'cash'... | 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 insertMockPrerequisites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | private async insertMockPrerequisites(): Promise<void> {
// 1. 插入模拟账户
try {
const existingAccount = await AccountDAO.getById(1);
if (!existingAccount) {
const mockAccount = new Account();
mockAccount.userId = 1;
mockAccount.name = '模拟现金账户';
mockAccount.type = 'cash'... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | aa942266c7d5ad414d1e3bd9b6bd07e3d5501fbe | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/viewmodel/DetailViewModel.ets | arkts | transAlarmRepeatDayContent | Conversion alarm repeat day content
@param repeatDay number
@return repeatContent string | public transAlarmRepeatDayContent(repeatDay: number): string {
let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY;
switch (repeatDay) {
case WeekDays.DEFAULT_NUMBER_MONDAY:
repeatContent = CommonConstants.DEFAULT_STRING_MONDAY;
break;
case WeekDays.DEFAULT_NUMBER_TUE... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left transAlarmRepeatDayContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left repeatDay AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb... | public transAlarmRepeatDayContent(repeatDay: number): string {
let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY;
switch (repeatDay) {
case WeekDays.DEFAULT_NUMBER_MONDAY:
repeatContent = CommonConstants.DEFAULT_STRING_MONDAY;
break;
case WeekDays.DEFAULT_NUMBER_TUE... | https://gitee.com/harmonyos/codelabs.git | 12165d040dec5b10b31995d550f98c037bb8f2a9 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/smartwardMock.ets | arkts | getInstance | 获取模拟数据生成器单例实例 | public static getInstance(): MockDataGenerator {
if (!MockDataGenerator.instance) {
MockDataGenerator.instance = new MockDataGenerator();
}
return MockDataGenerator.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(): MockDataGenerator {
if (!MockDataGenerator.instance) {
MockDataGenerator.instance = new MockDataGenerator();
}
return MockDataGenerator.instance;
} | https://github.com/LJ666-ui/harmony-health-care | 5b3adedb55e62f79c917852c266e3e38c15d1534 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/dialogs/settings/WoofAdBlocker/WoofAdBlockerRules.ets | arkts | applyFiles | Apply the changes. | applyFiles() {
applyEasyListFromDisk();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left applyFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | applyFiles() {
applyEasyListFromDisk();
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 38653fc1a50d11ed4a8346dd755caf2a73123d16 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Type.ets | arkts | subTypeOf | T.subTypeOf(U) means that `T extends U` | protected subTypeOf(other: Type): boolean {
if (this.equals(other)) {
return true
} else if (other.equals(ObjectType)) {
let isNullable = (this) instanceof UndefinedType || (this) instanceof NullType
return this.isReference() && !isNullable && !((this) instanceof ... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left subTypeOf 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 Type AST#ide... | protected subTypeOf(other: Type): boolean {
if (this.equals(other)) {
return true
} else if (other.equals(ObjectType)) {
let isNullable = (this) instanceof UndefinedType || (this) instanceof NullType
return this.isReference() && !isNullable && !((this) instanceof ... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ea40bfe076bdc11037b84e51e762fa7123ac6600 | gitee |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | updateIsPlay | Updates MusicAppState.isPlay and AVSession playback state snapshot. | private updateIsPlay(isPlay: boolean) {
this.getAppState().isPlay = isPlay;
this.setPlayState({
state: isPlay ? avSession.PlaybackState.PLAYBACK_STATE_PLAY : avSession.PlaybackState.PLAYBACK_STATE_PAUSE,
position: {
elapsedTime: this.getCurrentTime(),
updateTime: new Date().getTime... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateIsPlay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isPlay AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private updateIsPlay(isPlay: boolean) {
this.getAppState().isPlay = isPlay;
this.setPlayState({
state: isPlay ? avSession.PlaybackState.PLAYBACK_STATE_PLAY : avSession.PlaybackState.PLAYBACK_STATE_PAUSE,
position: {
elapsedTime: this.getCurrentTime(),
updateTime: new Date().getTime... | https://gitcode.com/HarmonyOS_Samples/MusicHome | e43f9cf7422767d27dd411ff69b17f0efe14ae55 | gitcode |
webabcd/HarmonyUtils | harmony_utils/src/main/ets/UrlHelper.ets | arkts | decode | url 解码 | static decode(url: string): string {
let decodedURL = decodeURIComponent(url);
return decodedURL
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST... | static decode(url: string): string {
let decodedURL = decodeURIComponent(url);
return decodedURL
} | https://github.com/webabcd/HarmonyUtils | b4690d0bb955167fa20fe4d6c0c04458c4e12c60 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/IndoorLocator.ets | arkts | getPositionHistory | 获取定位历史 | public getPositionHistory(): PositioningResult[] {
return this.positionHistory.slice();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPositionHistory 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#exp... | public getPositionHistory(): PositioningResult[] {
return this.positionHistory.slice();
} | https://github.com/LJ666-ui/harmony-health-care | a1e93c5c55289f10b2a9b6aa8cf13132fe1ca35a | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test44_original_index.ets | arkts | inRange | === Round 44: Chained comparisons, multi-dim array, function composition,
Map forEach, string building, leap year check, power of two check ===
--- Chained range check (AND composition) --- | function inRange(x: number, lo: number, hi: number): boolean {
return x > lo && x < hi;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left inRange AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#p... | function inRange(x: number, lo: number, hi: number): boolean {
return x > lo && x < hi;
} | https://github.com/miaochiahao/ark-ghidra | 30d8bbd9d082879db5058f04b69e9e5b909a1591 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnRadioViewModel.ets | arkts | setRadioValue3 | 设置单选框组3的选中值
@param value 新的选中值 | setRadioValue3(value: string): void {
this.radioValue3 = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRadioValue3 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 string AST#identifier#Right AST#)#Left )... | setRadioValue3(value: string): void {
this.radioValue3 = value;
} | https://github.com/codelably/tuniao-ui | 5080da0d8a37634cffa25f3a64b7c61f47b56728 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | setBackgroundImageUrl | 设置自定义背景图 URL
@param url 背景图 URL | async setBackgroundImageUrl(url: string): Promise<void> {
try {
await PreferencesUtil.put(BACKGROUND_IMAGE_URL_KEY, url);
this.cachedUrl = url;
if (url) {
await this.setBackgroundImageType(BackgroundImageType.API);
} else {
await this.setBackgroundImageType(Backgroun... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setBackgroundImageUrl AST#identifier#Right AST#ERROR#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#:#L... | async setBackgroundImageUrl(url: string): Promise<void> {
try {
await PreferencesUtil.put(BACKGROUND_IMAGE_URL_KEY, url);
this.cachedUrl = url;
if (url) {
await this.setBackgroundImageType(BackgroundImageType.API);
} else {
await this.setBackgroundImageType(Backgroun... | https://github.com/AlkaidLab/moonlight-harmony | f658b3e47be5d451f0df3f224c48417f2d50aeb4 | github |
openharmony/applications_notes | features/src/main/ets/components/NoteListComp.ets | arkts | deleteDataByIndex | 删除列表中处于index位置的对象 | public deleteDataByIndex(index: number): void {
LogUtil.info(TAG, `delete data , index = ${index}}`);
this.noteList.splice(index, 1);
this.notifyDataDelete(index);
}; | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteDataByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public deleteDataByIndex(index: number): void {
LogUtil.info(TAG, `delete data , index = ${index}}`);
this.noteList.splice(index, 1);
this.notifyDataDelete(index);
}; | https://gitee.com/openharmony/applications_notes.git | db1c612de2ac7ddf837a94fa5e1cdceb58c821cd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | addComicInfo | ==================== 漫画信息管理 ====================
添加漫画信息 | public async addComicInfo(comic: ComicInfoInput): Promise<string> {
try {
const generatedId = this.generateId();
const now = Date.now();
const comicData: ComicInfo = {
id: generatedId,
title: comic.title,
author: comic.author,
description: comic.description,
... | 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 addComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comic AST#identifier#Right AST#:#Left : AST... | public async addComicInfo(comic: ComicInfoInput): Promise<string> {
try {
const generatedId = this.generateId();
const now = Date.now();
const comicData: ComicInfo = {
id: generatedId,
title: comic.title,
author: comic.author,
description: comic.description,
... | https://github.com/DaLongZhuaZi/manxia | 9ef222643e68b03e6bbeab917418bdd065922282 | github |
openharmony/applications_settings | product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets | arkts | openExtensionServiceManagementApplicationListener | listen extensionService application | openExtensionServiceManagementApplicationListener() {
try {
bundleMonitor.on('add', (bundleChangeInfo) => {
LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`);
this.setExtensionServiceManagementListener();
});
} catch (ex... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openExtensionServiceManagementApplicationListener 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_stat... | openExtensionServiceManagementApplicationListener() {
try {
bundleMonitor.on('add', (bundleChangeInfo) => {
LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`);
this.setExtensionServiceManagementListener();
});
} catch (ex... | https://gitee.com/openharmony/applications_settings.git | 59caee17199f79e50427c3e63fe5c91a1e7bee9e | gitee |
HarmonyOS_Samples/BestPracticeSnippets | JSCrash/entry/src/main/ets/pages/utils.ets | arkts | showDebug | Outputs debug-level logs.
@param tag Identifies the log tag.
@param format Indicates the log format string.
@param args Indicates the log parameters.
@since 7 | static showDebug(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.DEBUG)) {
hilog.debug(DOMAIN, TAG, tag + SYMBOL + format, args);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showDebug AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static showDebug(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.DEBUG)) {
hilog.debug(DOMAIN, TAG, tag + SYMBOL + format, args);
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 1e90dfaf83f1b8bb09bcda54aef5fb649abe4ec6 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/FullscreenController.ets | arkts | toggleFullscreen | 切换全屏模式
@returns Promise<boolean> 切换后的全屏状态 | public async toggleFullscreen(): Promise<boolean> {
if (this.isFullscreen) {
await this.disableFullscreen();
} else {
await this.enableFullscreen();
}
return this.isFullscreen;
} | 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 toggleFullscreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public async toggleFullscreen(): Promise<boolean> {
if (this.isFullscreen) {
await this.disableFullscreen();
} else {
await this.enableFullscreen();
}
return this.isFullscreen;
} | https://github.com/richshaw2015/nds | b20bafe8588ac01566be3cb8133b8039ea6c7cbf | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/ChatPage.ets | arkts | onPageShow | 界面显示时被调用。 | onPageShow(): void {
// 本界面显示时,将输入法软键盘避让模式设置为KeyboardAvoidMode.RESIZE(即压缩窗体,而不是将窗体整体上移)
ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), true);
// 设置全面屏状态栏颜色
ToolKits.setStatusBarColor(getContext(this), ToolKits.chat_page_title_color, ToolKits.chat_page_title_background_color);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | onPageShow(): void {
// 本界面显示时,将输入法软键盘避让模式设置为KeyboardAvoidMode.RESIZE(即压缩窗体,而不是将窗体整体上移)
ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), true);
// 设置全面屏状态栏颜色
ToolKits.setStatusBarColor(getContext(this), ToolKits.chat_page_title_color, ToolKits.chat_page_title_background_color);
} | https://github.com/JackJiang2011/harmonychat | e4af1f3fdfc0f1846b72e7e18233a81c8b11e079 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TarPackager.ets | arkts | addFileToTar | 添加文件到 tar 包 | private async addFileToTar(tarFile: fs.File, baseDir: string, relativePath: string): Promise<void> {
const fullPath = `${baseDir}/${relativePath}`;
const stat = SafeFileUtils.statSyncStrict(fullPath);
// 创建文件头
const header = this.createTarHeader(relativePath, stat.size, stat.mtime);
// 写... | 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 addFileToTar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left tarFile AST#identifier#Right... | private async addFileToTar(tarFile: fs.File, baseDir: string, relativePath: string): Promise<void> {
const fullPath = `${baseDir}/${relativePath}`;
const stat = SafeFileUtils.statSyncStrict(fullPath);
// 创建文件头
const header = this.createTarHeader(relativePath, stat.size, stat.mtime);
// 写... | https://github.com/DaLongZhuaZi/manxia | 160b67a4c3b6277bb4174abd5ac9476bdf02744e | github |
HarmonyOS_Samples/BestPracticeSnippets | PCProject/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageDestroy | [End available_area] | onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onWindowStageDestroy');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy 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... | onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onWindowStageDestroy');
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | e1d40471b87d5bb3cf6ceed62bdaf5563802d787 | gitcode |
honjow/Next2V | feature/detail/src/main/ets/viewmodel/DetailViewModel.ets | arkts | switchToThreadModeAndPreload | Called when user switches to a thread mode after the topic is already loaded.
Triggers preloading remaining pages if not yet done. | async switchToThreadModeAndPreload(mode: string): Promise<void> {
this.preloadFallbackToFlat = false
this.setReplyDisplayMode(mode)
if (!this.allRepliesLoaded && this.repliesHasMore) {
await this.preloadRemainingReplies()
}
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left switchToThreadModeAndPreload AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST... | async switchToThreadModeAndPreload(mode: string): Promise<void> {
this.preloadFallbackToFlat = false
this.setReplyDisplayMode(mode)
if (!this.allRepliesLoaded && this.repliesHasMore) {
await this.preloadRemainingReplies()
}
} | https://github.com/honjow/Next2V | 1723d6ca2043e6bbca356c5eb171416a5fa4e989 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/equal/equal_ulong.ets | arkts | main | ---
desc: check equality of two unsigned long integers
--- | function main(): void {
const a: ulong = {{v.left}}
const b: ulong = {{v.right}}
assert (a == b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ulong = {{v.left}}
const b: ulong = {{v.right}}
assert (a == b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f26c270830db36141605b266f724e0f6fdc3e556 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getCustomThemeBackground | 获取当前自定义主题的背景图片路径 | public getCustomThemeBackground(): string {
return AppStorage.get<string>(CUSTOM_THEME_KEYS.BACKGROUND_IMAGE) || '';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCustomThemeBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left s... | public getCustomThemeBackground(): string {
return AppStorage.get<string>(CUSTOM_THEME_KEYS.BACKGROUND_IMAGE) || '';
} | https://github.com/DaLongZhuaZi/manxia | c54ef2d3f36120b2584bf328e3ccb0612a4c685f | github |
zmuxuny/ai-guardian-star | entry/src/main/ets/database/DatabaseHelper.ets | arkts | queryUserByPhone | 按手机号查询用户 | public async queryUserByPhone(phone: string): Promise<UserInfo | null> {
const predicates = new relationalStore.RdbPredicates("t_user");
predicates.equalTo("phone", phone);
return this._querySingleUser(predicates);
} | 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 queryUserByPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left :... | public async queryUserByPhone(phone: string): Promise<UserInfo | null> {
const predicates = new relationalStore.RdbPredicates("t_user");
predicates.equalTo("phone", phone);
return this._querySingleUser(predicates);
} | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L368-L372 | d2013c6ddff0b5b866eda9f2910311c93982d4b2 | github |
HarmonyCandies/extended_text | extended_text/src/main/ets/Utils.ets | arkts | increment | Increases the value by the addend. | increment(addend: number): void {
if (addend < 0) {
throw new Error("Addend must be non-negative");
}
this._value += addend;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left increment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addend AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST... | increment(addend: number): void {
if (addend < 0) {
throw new Error("Addend must be non-negative");
}
this._value += addend;
} | https://github.com/HarmonyCandies/extended_text | 525bf69da33123e71e947ee58527f016b4d7bc6a | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | syncToNative | ============================================================================
Native 同步方法
Requirements: 1.1, 1.2, 1.3, 1.4, 1.5
============================================================================
同步单个设置到 C++ 层
Requirements: 1.1, 1.2, 1.3
@param key 设置键名
@param value 设置值
@returns 操作结果 | public async syncToNative(key: string, value: SettingValue): Promise<SettingsResult<void>> {
const definition = getSettingDefinition(key);
if (!definition) {
console.error(`${TAG} syncToNative: unknown key '${key}'`);
return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key, value);... | 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 syncToNative AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:... | public async syncToNative(key: string, value: SettingValue): Promise<SettingsResult<void>> {
const definition = getSettingDefinition(key);
if (!definition) {
console.error(`${TAG} syncToNative: unknown key '${key}'`);
return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key, value);... | https://github.com/richshaw2015/nds | e98dc9994b9e5c16edab9dc5a0a98526622215ee | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts array of bytes to JSON format
@param d: FixedArray<byte> - array of byte to be converted to a JSON as an Array of Numbers
@returns String - JSON representation of array of bytes | public static stringify(d: FixedArray<float>): String {
let s = new StringBuilder('[')
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(JSON.stringify(d[i]))
s.append(',')
}
if (d.length > 0) {
s.append(JSON.strin... | 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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: FixedArray<float>): String {
let s = new StringBuilder('[')
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(JSON.stringify(d[i]))
s.append(',')
}
if (d.length > 0) {
s.append(JSON.strin... | https://gitcode.com/iop123123/arkts-static-skills | 3cce58a91bcce853109e77868a62d6d3e156292d | gitcode |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/RequireAwait/ets/requireAwaitNoReport.ets | arkts | numberOne | Async function declaration with async function return | async function numberOne(): Promise<number> {
return getAsyncNumber(1);
}; | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left numberOne AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef... | async function numberOne(): Promise<number> {
return getAsyncNumber(1);
}; | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 87b90784c5a41d1508c55ea9207b0a131a45c19e | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/DigitPanelController.ets | arkts | setWorker | set worker
@param worker worker.ThreadWorker | public setWorker(worker: worker.ThreadWorker): void {
this.worker = worker;
this.evaluator = new Evaluator(this.worker);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left worker AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Le... | public setWorker(worker: worker.ThreadWorker): void {
this.worker = worker;
this.evaluator = new Evaluator(this.worker);
} | https://gitee.com/openharmony-sig/applications_calculator.git | dadc2d63da44ffaab4bff1433136a153a9f7bbd1 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/button/index.ets | arkts | handleColorChange | 当传入自定义颜色时 设置type保证颜色渲染正常 | handleColorChange() {
if (this.color) {
this.type = 'primary'
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleColorChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#... | handleColorChange() {
if (this.color) {
this.type = 'primary'
}
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/button/index.ets#L256-L260 | 199bb7eea0bf38072a440bfb09c5320259c6c041 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from a set of type std.core.Set<number>.
@param { Set<number> } set - A set object to convert to an array.
@returns { Float32Array } - A new Float32Array
@throws { RangeError } - Input parameter error.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(set: Set<number>): Float32Array {
const length = set.size;
const result = new Float32Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('W... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ... | public static from(set: Set<number>): Float32Array {
const length = set.size;
const result = new Float32Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('W... | https://gitcode.com/iop123123/arkts-static-skills | 78ff3acf6a317c14fc4ba3771c74dea69c4e8f92 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | $_iterator | Returns an iterator over the elements in the list.
@returns An iterator over the elements in the list. | public override $_iterator(): IterableIterator<T> {
return this.buffer.$_iterator();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left $_iterator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public override $_iterator(): IterableIterator<T> {
return this.buffer.$_iterator();
} | https://gitcode.com/iop123123/arkts-static-skills | d3673993f18475dfb7bc67deaf5e521c90cb5b47 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/components/DualPageCurlEffect.ets | arkts | onExternalProgressChange | ========== 进度驱动 ========== | onExternalProgressChange(): void {
if (this.externalProgress >= 0 && this.isReady) {
this.checkAndUpdateBitmaps();
this.curlProgress = this.externalProgress;
this.renderCurlEffect();
} else if (this.externalProgress >= 0 && !this.isReady) {
// Canvas 未就绪时记录,帮助诊断 onReady 延迟问题
logg... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onExternalProgressChange 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#{#Left { AST#{#Righ... | onExternalProgressChange(): void {
if (this.externalProgress >= 0 && this.isReady) {
this.checkAndUpdateBitmaps();
this.curlProgress = this.externalProgress;
this.renderCurlEffect();
} else if (this.externalProgress >= 0 && !this.isReady) {
// Canvas 未就绪时记录,帮助诊断 onReady 延迟问题
logg... | https://github.com/DaLongZhuaZi/manxia | 221912d2bb039d4d70d4de476f0706cce0b196c4 | github |
HarmonyOS_Samples/multi-tab-navigation | entry/src/main/ets/pages/UnderlineTab.ets | arkts | build | [End Underline_tab_tabBuilder] | build() {
Column() {
// [Start Underline_tab_tabs]
Tabs({ barPosition: BarPosition.Start }) {
ForEach(this.tabArray.slice(0, 4), (item: TabItem) => {
TabContent() {
Row() {
Text(item.name)
.height(300)
.fontSize(30)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
// [Start Underline_tab_tabs]
Tabs({ barPosition: BarPosition.Start }) {
ForEach(this.tabArray.slice(0, 4), (item: TabItem) => {
TabContent() {
Row() {
Text(item.name)
.height(300)
.fontSize(30)
... | https://gitcode.com/HarmonyOS_Samples/multi-tab-navigation | 7317ddc91b3947aa91094b049e956c4d020824b6 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/checkbox/index.ets | arkts | getBorderColor | 获取边框色 | getBorderColor() {
if (this.getIsDisabled()) {
return GRAY_COLOR.GRAY_5
} else {
return this.isShowBackground() ? (this.checkedColor || this.baseStyle.primary as string) : this.bdColor
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBorderColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | getBorderColor() {
if (this.getIsDisabled()) {
return GRAY_COLOR.GRAY_5
} else {
return this.isShowBackground() ? (this.checkedColor || this.baseStyle.primary as string) : this.bdColor
}
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkbox/index.ets#L186-L192 | 6dc77ef027ff32c3baa32b869af62179e6e7ce37 | github |
openharmony/codelabs | Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets | arkts | constructor | Constructor initialization to generate a key. | constructor() {
let symAlgName = CommonConstants.ENCRYPTION_MODE;
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(symAlgName);
// Randomly generate a 256-bit symmetric key by using a key generator.
let keyMaterialBlob = this.genKeyMaterialBlob(CommonConstants.KEY_DATA);
symKeyGenerator... | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
let symAlgName = CommonConstants.ENCRYPTION_MODE;
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(symAlgName);
// Randomly generate a 256-bit symmetric key by using a key generator.
let keyMaterialBlob = this.genKeyMaterialBlob(CommonConstants.KEY_DATA);
symKeyGenerator... | https://gitee.com/openharmony/codelabs.git | ff2e9da64a97a69e3bdefb807ab0f7f608f6d4cb | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | off | Unregistering event messages.
@param { string } event - Unregister event.
@param { Function } callback - Event callbacks. | off(event: string, callback: Function): void {
if (this.handlers.has(event)) {
const funcList = this.handlers.get(event);
const pos = funcList!.findIndex((element) => element === callback);
if (pos !== -1) {
funcList!.splice(pos, 1)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left off AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Righ... | off(event: string, callback: Function): void {
if (this.handlers.has(event)) {
const funcList = this.handlers.get(event);
const pos = funcList!.findIndex((element) => element === callback);
if (pos !== -1) {
funcList!.splice(pos, 1)... | https://gitcode.com/iop123123/arkts-static-skills | a385f25a739c1ca3f7971873482121a08dfb39b3 | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getPixelMap | 获取控件截图
@returns | public getPixelMap(): image.PixelMap | undefined {
return SnapShotImage.pixelMap
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPixelMap 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... | public getPixelMap(): image.PixelMap | undefined {
return SnapShotImage.pixelMap
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L219-L221 | d22c655ba12f7ee4a97fcb7a209e27f3db315a78 | github |
openharmony-tpc/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | removeFileCache | 清除指定文件缓存 | removeFileCache(url: string | ImageKnifeOption) {
let imageKnifeOption: ImageKnifeOption;
if (url instanceof ImageKnifeOption) {
imageKnifeOption = url;
} else {
imageKnifeOption = {
loadSrc: url
};
}
let key = this.getEngineKeyImpl().generateFileKey(imageKnifeOption.load... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeFileCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left... | removeFileCache(url: string | ImageKnifeOption) {
let imageKnifeOption: ImageKnifeOption;
if (url instanceof ImageKnifeOption) {
imageKnifeOption = url;
} else {
imageKnifeOption = {
loadSrc: url
};
}
let key = this.getEngineKeyImpl().generateFileKey(imageKnifeOption.load... | https://gitee.com/openharmony-tpc/ImageKnife.git | e8a28f8b09bd3d724693125de81e75772f5a88de | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setInSubWindow | 是否在子窗口中显示
@param showInSubWindow
@returns | setInSubWindow(showInSubWindow: boolean): Builder {
this.dialogOptions.showInSubWindow = showInSubWindow
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInSubWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left showInSubWindow AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#L... | setInSubWindow(showInSubWindow: boolean): Builder {
this.dialogOptions.showInSubWindow = showInSubWindow
return this
} | https://github.com/wuba/omni-ui | 1c5d92c86d9e3de53eeadd02dc38a1d3e3af2e72 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | equals | Compare the current RationalNumber object to the given object equally.
@param { object } obj the given object.
@returns { boolean } if the given object is same as the current object return true otherwise return false. | public equals(obj: object): boolean {
if (!(obj instanceof RationalNumber)) {
return false;
}
return this.compare(obj) === 0;
} | 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#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left object AST... | public equals(obj: object): boolean {
if (!(obj instanceof RationalNumber)) {
return false;
}
return this.compare(obj) === 0;
} | https://gitcode.com/iop123123/arkts-static-skills | d715dcd01565c6b9d5a03876a11cbbd108e031cc | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/EntryOhos.ets | arkts | toString | returns a string representation of the entry containing x-index and value | public toString(): String {
return "Entry, x: " + this.x + " y: " + this.getY();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#id... | public toString(): String {
return "Entry, x: " + this.x + " y: " + this.getY();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 4c64d632a7bea81296a40c18e783d0d720afe362 | gitee |
openharmony-sig/knowledge_demo_entainment | FA/notebook/entry/src/main/ets/common/database/NoteInfoTable.ets | arkts | deleteById | 通过ID删除笔记
@param id 笔记id
@param callback 删除成功的回调方法 | deleteById(id, callback) {
try {
// 获取RdbStore
this.getRdbStore(() => {
// 获取RdbPredicates
let predicates = new data_rdb.RdbPredicates(NOTE_INFO.tableName);
// 匹配id字段
predicates.equalTo("id", id);
// 删除数据
this.rdbStore.delete(predicates, function (err, r... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left id AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Right AST#argu... | deleteById(id, callback) {
try {
// 获取RdbStore
this.getRdbStore(() => {
// 获取RdbPredicates
let predicates = new data_rdb.RdbPredicates(NOTE_INFO.tableName);
// 匹配id字段
predicates.equalTo("id", id);
// 删除数据
this.rdbStore.delete(predicates, function (err, r... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 9392f262491bcaf873173b12231956db3db7d92b | gitee |
electronicminer/Harmony-Markdown-Editor | entry/src/main/ets/utils/AIService.ets | arkts | mapLegacyStep | 旧版字段 -> 新版 step | private static mapLegacyStep(raw: RawPlanJSON): AgentStep {
switch (raw.action) {
case 'replace_content':
return { action: 'replace', anchor: raw.targetContent, content: raw.replacementContent, note: raw.description };
case 'delete_content':
return { action: 'delete', anchor: raw.targe... | 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 mapLegacyStep AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : ... | private static mapLegacyStep(raw: RawPlanJSON): AgentStep {
switch (raw.action) {
case 'replace_content':
return { action: 'replace', anchor: raw.targetContent, content: raw.replacementContent, note: raw.description };
case 'delete_content':
return { action: 'delete', anchor: raw.targe... | https://github.com/electronicminer/Harmony-Markdown-Editor | c47100c39934ff01aa3d56df8072d0aeb4c97f07 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/setting/setting_index.ets | arkts | player_mode_name | 播放器模式名称 // | player_mode_name(): string {
return this.global_config.player_mode ? '星铃播放器' : '官方播放器'
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left player_mode_name AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#state... | player_mode_name(): string {
return this.global_config.player_mode ? '星铃播放器' : '官方播放器'
} | https://github.com/Nekofox-POT/LinMusic | 3ddcefa030a8e14dcaf407e67dba3ae750dfec01 | github |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | resolveFilePath | @deprecated 此方法已废弃,请使用 preprocessImageFile 方法
检测并转换 URI 路径
处理鸿蒙系统中的 file:// URI
@param uriOrPath URI 或普通路径
@returns 转换后的文件路径 | static resolveFilePath(uriOrPath: string): string {
LogUtil.warn('⚠️ resolveFilePath 方法已废弃,建议使用 preprocessImageFile 方法');
if (!uriOrPath) {
throw new Error('路径或URI不能为空');
}
// 如果不是 URI,直接返回原路径
if (!LubanUtils.isUri(uriOrPath)) {
return uriOrPath;
}
// 对于 URI,抛出错误提示使用正确的方... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resolveFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left uriOrPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static resolveFilePath(uriOrPath: string): string {
LogUtil.warn('⚠️ resolveFilePath 方法已废弃,建议使用 preprocessImageFile 方法');
if (!uriOrPath) {
throw new Error('路径或URI不能为空');
}
// 如果不是 URI,直接返回原路径
if (!LubanUtils.isUri(uriOrPath)) {
return uriOrPath;
}
// 对于 URI,抛出错误提示使用正确的方... | https://github.com/kumaleap/ArkLuban | 9f6029593d78c937100295d381634ba1b9552e54 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.