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 |
|---|---|---|---|---|---|---|---|---|---|---|
erosTeam/NextE | feature/search/src/main/ets/viewmodel/SearchViewModel.ets | arkts | refresh | Re-run the current query from page 1 (pull-to-refresh). Guarded + flagged isLoading so a
concurrent loadMore (which checks isLoading) can't interleave its appendData with this setData. | async refresh(): Promise<void> {
// Empty search has no network state to refresh.
if (
this.query.length === 0 ||
this.isLoading ||
this.isLoadingMore
) {
return
}
this.isLoading = true
this.errorMessage = ''
this.epoch = this.epoch + 1
this.lastNext = ''
tr... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left refresh AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type... | async refresh(): Promise<void> {
// Empty search has no network state to refresh.
if (
this.query.length === 0 ||
this.isLoading ||
this.isLoadingMore
) {
return
}
this.isLoading = true
this.errorMessage = ''
this.epoch = this.epoch + 1
this.lastNext = ''
tr... | https://github.com/erosTeam/NextE | 63146ac8bdfbff5ab16893b9330d97b7de9bc345 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ColorTemplate.ets | arkts | rgb | Converts the given hex-color-string to rgb.
@param {string} hex - 要转换的十六进制颜色代码(例如,"#336699"),或者带透明度的颜色代码(例如,”#99336699“)
@return {number} - 表示颜色的RGB值, 例如 0x336699 或者 0x99336699 | public static rgb(hex: string): number {
return Number("0x" + hex.replace("#", ""));
} | 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 rgb AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#iden... | public static rgb(hex: string): number {
return Number("0x" + hex.replace("#", ""));
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | bb88fe2b735b6897f39a5fdb235aa60da87c61c2 | gitee |
openharmony/codelabs | Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets | arkts | checkUserData | User name, nickname, password, and confirm password data verification.
@returns Check whether the check is passed. | checkUserData(): boolean {
if (this.username === '' || this.password === '' || this.confirmPassword === '') {
PromptUtil.promptMessage($r('app.string.message_register_empty'), CommonConstants.PROMPT_TIME);
return false;
}
// RegExp for matching username.
let namePattern = CommonConstants.R... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkUserData 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#state... | checkUserData(): boolean {
if (this.username === '' || this.password === '' || this.confirmPassword === '') {
PromptUtil.promptMessage($r('app.string.message_register_empty'), CommonConstants.PROMPT_TIME);
return false;
}
// RegExp for matching username.
let namePattern = CommonConstants.R... | https://gitee.com/openharmony/codelabs.git | fa79c2f2e9ff83da077f6d49497e0c2f1c99dec8 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets | arkts | stringToUint8Array | 字符串转 Uint8Array | private stringToUint8Array(str: string): Uint8Array {
const arr = new Uint8Array(str.length);
for (let i = 0; i < str.length; i++) {
arr[i] = str.charCodeAt(i);
}
return arr;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stringToUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private stringToUint8Array(str: string): Uint8Array {
const arr = new Uint8Array(str.length);
for (let i = 0; i < str.length; i++) {
arr[i] = str.charCodeAt(i);
}
return arr;
} | https://github.com/DaLongZhuaZi/manxia | ffef33f47ba5aa4156baa0581ef0783084bb8568 | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | request | 封装网络请求
@param options 请求选项 | async request(options: RequestOptions): Promise<ApiResponse> {
const { url, method = 'GET', data, params, showLoading = true } = options;
// 构建完整URL
const fullUrl = `${this.baseUrl}${url}`;
try {
// TODO: 实现鸿蒙原生网络请求
// 这里应该使用鸿蒙的网络请求API
console.log('发送请求:', url, data)... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left options AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async request(options: RequestOptions): Promise<ApiResponse> {
const { url, method = 'GET', data, params, showLoading = true } = options;
// 构建完整URL
const fullUrl = `${this.baseUrl}${url}`;
try {
// TODO: 实现鸿蒙原生网络请求
// 这里应该使用鸿蒙的网络请求API
console.log('发送请求:', url, data)... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 6b7d4ac312fe8f003a2bfef13a69e4cd887c34e5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an object of FixedArray<number>.
@param { FixedArray<number> } arr - An instance of the FixedArray type to convert to an array.
@returns { Float32Array } - A new Float32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: FixedArray<number>): Float32Array {
let result = new Float32Array(arr.length)
result.ofNumber(stub.toValueArray(arr))
return result
} | 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 arr AST#identifier#Righ... | public static from(arr: FixedArray<number>): Float32Array {
let result = new Float32Array(arr.length)
result.ofNumber(stub.toValueArray(arr))
return result
} | https://gitcode.com/iop123123/arkts-static-skills | b013910368fa9f3d9c84736c335c671e9e8b3fcc | gitcode |
Luxcis/PicACG_Next | entry/src/main/ets/pages/component/TitleBar.ets | arkts | aboutToAppear | 居中视图右间距 | aboutToAppear(): void {
if (this.statusBarColor === undefined) {
this.statusBarColor = this.titleBarColor
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
if (this.statusBarColor === undefined) {
this.statusBarColor = this.titleBarColor
}
} | https://github.com/Luxcis/PicACG_Next | 406388d756a881454410292ffc9c4f88a9d33946 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | isMemoryButtonClick | isMemoryButtonClick
@param keyCode number
@param callBack Function | private isMemoryButtonClick(keyCode: number, callBack: Function, leftExp: string, rightExp: string): boolean {
let isMem: boolean = false;
switch (keyCode) {
case KeyCode.KEYCODE_MEM_CLEAR: {
isMem = true;
this.clearMemory();
break;
}
case KeyCode.KEYCODE_MEM_ADD: {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isMemoryButtonClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | private isMemoryButtonClick(keyCode: number, callBack: Function, leftExp: string, rightExp: string): boolean {
let isMem: boolean = false;
switch (keyCode) {
case KeyCode.KEYCODE_MEM_CLEAR: {
isMem = true;
this.clearMemory();
break;
}
case KeyCode.KEYCODE_MEM_ADD: {
... | https://gitee.com/openharmony-sig/applications_calculator.git | 053d248ef415aca6d367c80aee787000a638a0dc | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | createRolePermissionConfig | 创建角色权限配置 | static createRolePermissionConfig(role: string): RolePermissionConfig {
const result: RolePermissionConfig = {
role: role,
permissions: SharedLedgerUtils.getPermissionsForRole(role),
description: SharedLedgerUtils.getRoleDescription(role)
};
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createRolePermissionConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left role AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | static createRolePermissionConfig(role: string): RolePermissionConfig {
const result: RolePermissionConfig = {
role: role,
permissions: SharedLedgerUtils.getPermissionsForRole(role),
description: SharedLedgerUtils.getRoleDescription(role)
};
return result;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 24b5988b32f17011ce703a9b24c7904597f4ca5a | github |
arkui-x/samples | CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/components/Component.ets | arkts | build | 拖动事件结束后图片Y轴位置 | build() {
Column() {
// 背景地图图片
Image($r("app.media.bottomdrawerslidecase_map"))
.id("bg_img")
.width($r("app.integer.bottomdrawerslidecase_number_1000"))
.height($r("app.integer.bottomdrawerslidecase_number_1000"))
.objectFit(ImageFit.Contain)
.translate({ x: th... | 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() {
// 背景地图图片
Image($r("app.media.bottomdrawerslidecase_map"))
.id("bg_img")
.width($r("app.integer.bottomdrawerslidecase_number_1000"))
.height($r("app.integer.bottomdrawerslidecase_number_1000"))
.objectFit(ImageFit.Contain)
.translate({ x: th... | https://gitcode.com/arkui-x/samples | 5fdf06d0a21443d7b5237be7f4baffcbc6a0677b | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/TerminalManager.ets | arkts | isRole | 检查是否为特定角色
@param role 用户角色 | isRole(role: UserRole): boolean {
return this.currentUserRole === role;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRole AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left role AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UserRole AST#identifier#Right AST#)#Left ) AST#)#... | isRole(role: UserRole): boolean {
return this.currentUserRole === role;
} | https://github.com/LJ666-ui/harmony-health-care | 153298e321d0160c5ee4367c669917b823f0c4f7 | github |
ibestservices/ibest-ui | library/src/main/ets/components/stepper/index.ets | arkts | handleSetStepperBtnStatus | 监听inputNumChange改变按钮状态 | handleSetStepperBtnStatus() {
const val = parseFloat(this.inputNumValue)
this.reduceBtnDisabled = val <= this.min
this.plusBtnDisabled = val >= this.max
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleSetStepperBtnStatus 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#statemen... | handleSetStepperBtnStatus() {
const val = parseFloat(this.inputNumValue)
this.reduceBtnDisabled = val <= this.min
this.plusBtnDisabled = val >= this.max
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/stepper/index.ets#L235-L239 | 64f459cca518de8ea6970871c97ef3934b763ec7 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | kdbxToArrayBuffer | 将对象转换为ArrayBuffer
@param kdbx KDBX对象 | public static async kdbxToArrayBuffer(kdbx: Kdbx | ArrayBuffer): Promise<ArrayBuffer> {
if (kdbx instanceof ArrayBuffer) {
return Promise.resolve(kdbx);
}
return Promise.resolve(ByteUtils.stringToBuffer(await kdbx.saveXml()));
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left kdbxToArrayBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | public static async kdbxToArrayBuffer(kdbx: Kdbx | ArrayBuffer): Promise<ArrayBuffer> {
if (kdbx instanceof ArrayBuffer) {
return Promise.resolve(kdbx);
}
return Promise.resolve(ByteUtils.stringToBuffer(await kdbx.saveXml()));
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L314-L319 | 5b6ec41c0311fb9c03e991e664e5017f912172a2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets | arkts | recordBehavior | 记录阅读行为 | public recordBehavior(pageViewDuration: number, direction: 'forward' | 'backward'): void {
const behavior: ReadingBehavior = {
pageViewDuration,
direction,
timestamp: Date.now()
};
this.behaviorHistory.push(behavior);
// 限制历史记录数量
if (this.behaviorHistory.length > this.M... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left recordBehavior AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageViewDuration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS... | public recordBehavior(pageViewDuration: number, direction: 'forward' | 'backward'): void {
const behavior: ReadingBehavior = {
pageViewDuration,
direction,
timestamp: Date.now()
};
this.behaviorHistory.push(behavior);
// 限制历史记录数量
if (this.behaviorHistory.length > this.M... | https://github.com/DaLongZhuaZi/manxia | 1ae24654b40b5ef418141c07895a8019c22486a1 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitString | 访问 string 字段
Wire type: 2 (length-delimited) | visitString(value: string, fieldNumber: number): void {
this.writer.tag(fieldNumber, 2).string(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitString 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 , AS... | visitString(value: string, fieldNumber: number): void {
this.writer.tag(fieldNumber, 2).string(value)
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 2eb904df03954cebb384ed9c7c91a68ef4e3aff4 | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | setMaxScaleFactor | Set max scale factor.
@param factorW
@param factorH | setMaxScaleFactor(factorW: number, factorH: number) {
this.maxScaleFactorW = factorW;
this.maxScaleFactorH = factorH;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setMaxScaleFactor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left factorW AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right ... | setMaxScaleFactor(factorW: number, factorH: number) {
this.maxScaleFactorW = factorW;
this.maxScaleFactorH = factorH;
} | https://gitee.com/openharmony/codelabs.git | 00608b7d5176923a25be02751d0183ae51711886 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | trimEnd | The trimEnd() method removes whitespace from the end of a string and returns a new string,
without modifying the original string. trimRight() is an alias of this method.
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public trimEnd(): String {
return this.trimRight()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trimEnd 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#ide... | public trimEnd(): String {
return this.trimRight()
} | https://gitcode.com/iop123123/arkts-static-skills | 69a5e6a7545f758e1d76d4397831fa68eb10e00f | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | map | Creates a new Int16Array using fn(arr[i]) over all elements of current Int16Array.
@param fn a function to apply for each element of current Int16Array
@returns a new Int16Array where for each element from current Int16Array fn was applied | public map(fn: (val: short, index: int) => short): Int16Array {
let resBuf = new ArrayBuffer(this.length * Int16Array.BYTES_PER_ELEMENT)
let res = new Int16Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: short, index: int) => short): Int16Array {
let resBuf = new ArrayBuffer(this.length * Int16Array.BYTES_PER_ELEMENT)
let res = new Int16Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | beb5985177a4d893a48bb9892f5e9f68afe5cc7a | gitee |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | input | 添加输入文件 | public input(path: string): FFmpegCommandBuilder {
this.inputFiles.push(path);
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public input(path: string): FFmpegCommandBuilder {
this.inputFiles.push(path);
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools | d751ab987251b6b5ae5b52b7f2598790a27dabc0 | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/compat/Handler.ets | arkts | sendMessageDelayed | 延迟发送消息 | sendMessageDelayed(msg: Message, delay: number) {
let taskId: number = setTimeout(() => {
this.updateMsgRecords(msg.what, false, taskId)
this.dispatchMessage(msg)
}, delay)
this.updateMsgRecords(msg.what, true, taskId)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendMessageDelayed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Message AST#identifier#... | sendMessageDelayed(msg: Message, delay: number) {
let taskId: number = setTimeout(() => {
this.updateMsgRecords(msg.what, false, taskId)
this.dispatchMessage(msg)
}, delay)
this.updateMsgRecords(msg.what, true, taskId)
} | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | c2bb259164bbf16704764a8ec7c4c83d407aceef | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/FilenameUtils.ets | arkts | isImage | 判断文件是否为图片格式
@param fileName 文件名
@returns 是否为图片 | public static isImage(fileName: string): boolean {
const ext = FilenameUtils.getFileExt(fileName).toLowerCase();
return FilenameUtils.IMAGE_EXTENSIONS.includes(ext);
} | 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 isImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static isImage(fileName: string): boolean {
const ext = FilenameUtils.getFileExt(fileName).toLowerCase();
return FilenameUtils.IMAGE_EXTENSIONS.includes(ext);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FilenameUtils.ets#L129-L132 | 40f349bc08de172b368444e2adc8ab14038564d4 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/PromptTemplateManager.ets | arkts | setActiveTemplate | 设置激活模板 | setActiveTemplate(type: PromptTemplateType, templateId: string): void {
const templates = this.getTemplateHistory(templateId);
if (templates.length === 0) {
throw new Error(`Template ${templateId} not found`);
}
const latestTemplate = templates[templates.length - 1];
if (latestTemplate.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setActiveTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PromptTemplateType AST#identifier#Righ... | setActiveTemplate(type: PromptTemplateType, templateId: string): void {
const templates = this.getTemplateHistory(templateId);
if (templates.length === 0) {
throw new Error(`Template ${templateId} not found`);
}
const latestTemplate = templates[templates.length - 1];
if (latestTemplate.... | https://github.com/CLMC2025/Vignette | 17534b46762f8ee4435af279eecd9b324e7d9e28 | github |
iichen-bycode/ArkTsWanandroid | entry/src/main/ets/view/ViewStateComponent.ets | arkts | convertValue | 转换文案
@returns | convertValue() {
switch (this.viewState) {
case ViewStateConstant.VIEW_STATE_LOADING:
return $r('app.string.loading')
break;
case ViewStateConstant.VIEW_STATE_ERROR:
return $r('app.string.load_error')
break;
case ViewStateConstant.VIEW_STATE_NETWORK_ERROR:
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left convertValue 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 ... | convertValue() {
switch (this.viewState) {
case ViewStateConstant.VIEW_STATE_LOADING:
return $r('app.string.loading')
break;
case ViewStateConstant.VIEW_STATE_ERROR:
return $r('app.string.load_error')
break;
case ViewStateConstant.VIEW_STATE_NETWORK_ERROR:
... | https://github.com/iichen-bycode/ArkTsWanandroid | 4df193a212710c32355320eac94e6fc4bd0958e8 | github |
openharmony/codelabs | Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets | arkts | updateForms | Update card.
@param {number} stepValue Number of steps to be updated.
@param {DataRdb.RdbStore} rdbStore RDB database. | updateForms(stepValue: number, rdbStore: DataRdb.RdbStore) {
let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_FORM);
rdbStore.query(predicates).then((resultSet: DataRdb.ResultSet) => {
if (resultSet.rowCount <= 0) {
Logger.error(CommonConstants.DATABASE_TAG... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateForms AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stepValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#... | updateForms(stepValue: number, rdbStore: DataRdb.RdbStore) {
let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_FORM);
rdbStore.query(predicates).then((resultSet: DataRdb.ResultSet) => {
if (resultSet.rowCount <= 0) {
Logger.error(CommonConstants.DATABASE_TAG... | https://gitee.com/openharmony/codelabs.git | 2b65aa28a0e85e6c027927dad942afbf0f6deb5f | gitee |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | downloadHls | HLS 流下载 | public static downloadHls(hlsUrl: string, output: string): string[] {
return ['ffmpeg', '-i', hlsUrl, '-c:v', 'copy', '-c:a', 'copy', '-y', output];
} | 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 downloadHls AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hlsUrl AST#identifier#Right AST#:#Left : AS... | public static downloadHls(hlsUrl: string, output: string): string[] {
return ['ffmpeg', '-i', hlsUrl, '-c:v', 'copy', '-c:a', 'copy', '-y', output];
} | https://github.com/jjjjjjava/ffmpeg_tools | bf4876dfbb54980986b29952e5e2b8e76563c51d | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | updateEventVersion | 更新事件版本 | updateEventVersion(version: number): void {
this.lastEventVersion = version;
this.lastUpdatedAt = new Date().toISOString();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateEventVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left version AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A... | updateEventVersion(version: number): void {
this.lastEventVersion = version;
this.lastUpdatedAt = new Date().toISOString();
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9af52f244750757769d1ccd46a96ed46b6c61619 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | slice | Creates a new ArrayBuffer with a copy of bytes in the range [begin, end).
@param { int } begin An inclusive index to start copying from.
@param { int } [end] An exclusive index to stop copying.
@returns { ArrayBuffer } The new ArrayBuffer.
@throws { TypeError } Throws if the ArrayBuffer is detached.
@syscap SystemCapab... | public slice(begin: int, end?: int): ArrayBuffer {
if (this.detached) {
throw new TypeError("ArrayBuffer was detached")
}
if (end == undefined) return this.sliceInternal(begin, this.getByteLength()) as ArrayBuffer
else return this.sliceInternal(begin, end) as ArrayBuffer
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public slice(begin: int, end?: int): ArrayBuffer {
if (this.detached) {
throw new TypeError("ArrayBuffer was detached")
}
if (end == undefined) return this.sliceInternal(begin, this.getByteLength()) as ArrayBuffer
else return this.sliceInternal(begin, end) as ArrayBuffer
... | https://gitcode.com/iop123123/arkts-static-skills | b36ef5cfa6423a75a39da42da6e184147c8ce8a2 | gitcode |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/BreakpointState.ets | arkts | isXS | 是否为超小断点
@returns {boolean} 是否超小断点 | isXS(): boolean {
return this.current === BreakpointType.XS;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isXS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_bloc... | isXS(): boolean {
return this.current === BreakpointType.XS;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 386f489ffaff86f14819452820dbbf5b8a0976fb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Annotations/UnifiedAnnotationManager.ets | arkts | getAllAnnotations | List annotations for all contents. | async getAllAnnotations(annotationType?: UnifiedAnnotationType): Promise<UnifiedAnnotationRecord[]> {
await this.ensureSchema();
const conditions: string[] = ['isDeleted = 0'];
const args: DatabaseValue[] = [];
if (annotationType) {
const variants = this.getAnnotationTypeVariants(annotationType... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllAnnotations AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left annotationType AST#identifier#Right AST#?#Left ? AST#?#Right ... | async getAllAnnotations(annotationType?: UnifiedAnnotationType): Promise<UnifiedAnnotationRecord[]> {
await this.ensureSchema();
const conditions: string[] = ['isDeleted = 0'];
const args: DatabaseValue[] = [];
if (annotationType) {
const variants = this.getAnnotationTypeVariants(annotationType... | https://github.com/DaLongZhuaZi/manxia | f9e717357bef86e8906f9450060245e600c1c105 | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/HomePage.ets | arkts | build | 方法名称: build
功能描述: 定义组件的 UI 结构。
布局结构:
使用 Column 垂直布局容器,将欢迎语、状态文本、功能按钮依次从上到下排列。 | build() {
// 创建一个垂直方向的容器,子组件之间的间距设置为 20vp
Column({ space: 20 }) {
/**
* 组件: Text (欢迎语)
* 内容: 绑定 this.welcomeMessage 状态变量
*/
Text(this.welcomeMessage)
.fontSize(24) // 设置字体大小为 24fp
.fontWeight(FontWeight.Bold) // 设置字体粗细为加粗
.margin... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // 创建一个垂直方向的容器,子组件... | build() {
// 创建一个垂直方向的容器,子组件之间的间距设置为 20vp
Column({ space: 20 }) {
/**
* 组件: Text (欢迎语)
* 内容: 绑定 this.welcomeMessage 状态变量
*/
Text(this.welcomeMessage)
.fontSize(24) // 设置字体大小为 24fp
.fontWeight(FontWeight.Bold) // 设置字体粗细为加粗
.margin... | https://gitcode.com/openharmony/codelabs | f6778978252dfb921d8bdc6743621c691a2caba6 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/AudioSettings.ets | arkts | aboutToAppear | 页面即将显示时恢复滚动位置并加载设置
Requirements: 14.7 | aboutToAppear(): void {
const params = router.getParams() as RouterParams | undefined;
if (params?.scrollPosition !== undefined) {
this.scrollPosition = params.scrollPosition;
}
hilog.info(DOMAIN, TAG, 'AudioSettings page appeared');
// 初始化主题
this.themeColors = this.themeManager.getCurr... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
const params = router.getParams() as RouterParams | undefined;
if (params?.scrollPosition !== undefined) {
this.scrollPosition = params.scrollPosition;
}
hilog.info(DOMAIN, TAG, 'AudioSettings page appeared');
// 初始化主题
this.themeColors = this.themeManager.getCurr... | https://github.com/richshaw2015/nds | 0476cd22b2172a6d78c6b537d85a72207ac966f3 | github |
dingzhilin1990/zhilinclaw | src/agents/HanwudiWorkflow.ets | arkts | getWorkflowLog | 获取工作流日志 | public getWorkflowLog(): WorkflowLogEntry[] {
return [...this.log];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWorkflowLog 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 Workflo... | public getWorkflowLog(): WorkflowLogEntry[] {
return [...this.log];
} | https://github.com/dingzhilin1990/zhilinclaw | 3392afba02808963b111b31c2b47e26714f74cda | github |
heeh02/superconnect | harmony/entry/src/main/ets/input/KeyboardHandler.ets | arkts | onKeyPreIme | onKeyPreIme delegate — returns true when consumed (so the tablet IME never composes). | onKeyPreIme(e: KeyEvent): boolean {
if (e.keySource !== KeySource.Keyboard) { return false; }
if (e.keyCode === KeyCode.KEYCODE_CAPS_LOCK) {
if (e.type === KeyType.Down) {
this.sendKey(InputType.KeyDown, KeyCode.KEYCODE_SPACE, 0x02); // Space + Control
this.sendKey(InputType.KeyUp, KeyCo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onKeyPreIme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KeyEvent AST#identifier#Right AST#)#Left ) AST#... | onKeyPreIme(e: KeyEvent): boolean {
if (e.keySource !== KeySource.Keyboard) { return false; }
if (e.keyCode === KeyCode.KEYCODE_CAPS_LOCK) {
if (e.type === KeyType.Down) {
this.sendKey(InputType.KeyDown, KeyCode.KEYCODE_SPACE, 0x02); // Space + Control
this.sendKey(InputType.KeyUp, KeyCo... | https://github.com/heeh02/superconnect | b13f8bf7f46856223167668d4c1f700548b5203e | github |
revalue-o/HarmonyOS-Next-Hook-demo | source_codes/ArkTS-inject/entry/src/main/ets/utils/SecurityCheckUtil.ets | arkts | base64Decode | 手动实现Base64解码 | private static base64Decode(base64Str: string): string {
try {
// 处理Base64URL编码
let str = base64Str.replace(/-/g, '+').replace(/_/g, '/');
// 补齐padding
while (str.length % 4 !== 0) {
str += '=';
}
// 手动实现Base64解码
const base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZab... | 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 base64Decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left base64Str AST#identifier#Right AST#ERROR#Left AST#:#Le... | private static base64Decode(base64Str: string): string {
try {
// 处理Base64URL编码
let str = base64Str.replace(/-/g, '+').replace(/_/g, '/');
// 补齐padding
while (str.length % 4 !== 0) {
str += '=';
}
// 手动实现Base64解码
const base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZab... | https://github.com/revalue-o/HarmonyOS-Next-Hook-demo | d509e05a3f0fa2c94e8aeb7387e689ef9931d0bc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | confirmDeleteShelf | 确认删除书架 | private async confirmDeleteShelf(): Promise<void> {
if (!this.shelfToDelete) return;
const shelfId = this.shelfToDelete.id;
this.deletingShelfId = shelfId;
// 删除动画
this.getUIContext().animateTo({ duration: 300, curve: Curve.EaseIn }, () => {
this.showDeleteShelfDialog = false;
});
... | 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 confirmDeleteShelf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async confirmDeleteShelf(): Promise<void> {
if (!this.shelfToDelete) return;
const shelfId = this.shelfToDelete.id;
this.deletingShelfId = shelfId;
// 删除动画
this.getUIContext().animateTo({ duration: 300, curve: Curve.EaseIn }, () => {
this.showDeleteShelfDialog = false;
});
... | https://github.com/DaLongZhuaZi/manxia | 351d2c5609011d9f46dec802a4f0311f81027eb9 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | sendInput | ---------------------------------------------------------------------------
输入 — 手柄(虚拟 + 物理)
---------------------------------------------------------------------------
发送虚拟手柄输入事件 | sendInput(input: InputEvent): void {
if (!this.isRunning) return;
if (input.type === InputType.CONTROLLER_BUTTON) {
this.handleControllerButton(input as ControllerButtonEvent);
} else if (input.type === InputType.CONTROLLER_AXIS) {
this.handleControllerAxis(input as ControllerAxisEvent);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InputEvent AST#identifier#Right AST#)#Left ) ... | sendInput(input: InputEvent): void {
if (!this.isRunning) return;
if (input.type === InputType.CONTROLLER_BUTTON) {
this.handleControllerButton(input as ControllerButtonEvent);
} else if (input.type === InputType.CONTROLLER_AXIS) {
this.handleControllerAxis(input as ControllerAxisEvent);
... | https://github.com/AlkaidLab/moonlight-harmony | a22fd7515baceac3614f382c09e8217fa207cee9 | github |
Explore-In-HMOS-Wearable/currency-converter | entry/src/main/ets/viewmodel/CurrencyViewModel.ets | arkts | selectedBaseCurrency | Getters and setters for selected currencies | get selectedBaseCurrency(): CurrencyData {
return this._selectedBaseCurrency;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left selectedBaseCurrency 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 CurrencyDa... | get selectedBaseCurrency(): CurrencyData {
return this._selectedBaseCurrency;
} | https://github.com/Explore-In-HMOS-Wearable/currency-converter | e4dbe34f04852721657c23decb5b23014dc2dd76 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | lastIndexOf | Finds the last occurrence of another String in this String at position <= fromIndex.
All values of fromIndex >= length are equivalent, and negative fromIndex implies no match.
@param str to find
@param fromIndex to start searching from
@returns index of the str from the beginning of this string, or -1 if not found | public lastIndexOf(str: String, fromIndex: number): number {
return this.lastIndexOf(str, fromIndex as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Strin... | public lastIndexOf(str: String, fromIndex: number): number {
return this.lastIndexOf(str, fromIndex as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9abc35f94a8f5da3d5e8561150e01f20d15ad389 | gitee |
openharmony/applications_call | entry/src/main/ets/model/CallDataManager.ets | arkts | init | Init data. | public init(callData, callList, callTimeList) {
this.mNotificationManager = new NotificationManager();
this.contactManager = new ContactManager();
this.mCallStateManager = CallStateManager.getInstance()
if (this.callData == null) {
this.callData = callData;
} else {
let oldCallData = t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callData AST#identifier#Right AST#,#Left , AST#,#Right AST#... | public init(callData, callList, callTimeList) {
this.mNotificationManager = new NotificationManager();
this.contactManager = new ContactManager();
this.mCallStateManager = CallStateManager.getInstance()
if (this.callData == null) {
this.callData = callData;
} else {
let oldCallData = t... | https://gitee.com/openharmony/applications_call.git | c53f02449ea0ce66170025f6c7939d032971f0ef | gitee |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/common/CommonNavigator.ets | arkts | toSettings | 跳转到设置页
@returns {void} 无返回值 | static toSettings(): void {
navigateTo(CommonRoutes.Settings);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static toSettings(): void {
navigateTo(CommonRoutes.Settings);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 93496446328e0b56fe7349103669ba502f6f3d86 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Transformer.ets | arkts | generateTransformedValuesScatter | Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the SCATTERCHART.
@param data
@return | public generateTransformedValuesScatter(data: IScatterDataSet, phaseX: number,
phaseY: number, from: number, to: number): number[] {
const count: number = Math.floor(((to - from) * phaseX + 1) * 2);
if (this.valuePointsForGenerateTransformedValuesScatter.length != c... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateTransformedValuesScatter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | public generateTransformedValuesScatter(data: IScatterDataSet, phaseX: number,
phaseY: number, from: number, to: number): number[] {
const count: number = Math.floor(((to - from) * phaseX + 1) * 2);
if (this.valuePointsForGenerateTransformedValuesScatter.length != c... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 86996d6340b20b2e2392b4114475a641fc955697 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/MetadataStorage.ets | arkts | registerManyToMany | 注册多对多关联关系
@param sourceEntity 源实体名称
@param targetEntity 目标实体名称
@param propertyName 在源实体中的属性名
@param joinTable 中间表名
@param joinSourceKey 源实体在中间表的外键列名
@param joinTargetKey 目标实体在中间表的外键列名 | registerManyToMany(
sourceEntity: string,
targetEntity: string,
propertyName: string,
joinTable: string,
joinSourceKey: string,
joinTargetKey: string
): void {
this.getEntityOrThrow(sourceEntity)
this.getEntityOrThrow(targetEntity)
const metadata = new ManyToManyMetadata(
s... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left registerManyToMany AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceEntity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ... | registerManyToMany(
sourceEntity: string,
targetEntity: string,
propertyName: string,
joinTable: string,
joinSourceKey: string,
joinTargetKey: string
): void {
this.getEntityOrThrow(sourceEntity)
this.getEntityOrThrow(targetEntity)
const metadata = new ManyToManyMetadata(
s... | https://github.com/offlinecat-dev/OCNetORM | b9c076c413a99a37c1ab28563fd4c3d1007f29ed | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamLifecycleManager.ets | arkts | setLatencyToastEnabled | 设置是否启用延迟统计 Toast | setLatencyToastEnabled(enabled: boolean): void {
this.latencyToastEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLatencyToastEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right A... | setLatencyToastEnabled(enabled: boolean): void {
this.latencyToastEnabled = enabled;
} | https://github.com/AlkaidLab/moonlight-harmony | bc576d51c2234173814ac1db6025f5fb85f7c51d | github |
midori52000/ArkPilot | Agent/entry/src/main/ets/skills/SkillsBackendService.ets | arkts | update | 更新单个 Skill | async update(id: string): Promise<InstalledSkill> {
const installed = await this.getInstalled();
const index = installed.findIndex((s: InstalledSkill): boolean => s.id === id);
if (index === -1) {
throw new SkillError(SkillErrorCode.SKILL_NOT_FOUND, `id=${id}`, '');
}
const skill = installe... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left update AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | async update(id: string): Promise<InstalledSkill> {
const installed = await this.getInstalled();
const index = installed.findIndex((s: InstalledSkill): boolean => s.id === id);
if (index === -1) {
throw new SkillError(SkillErrorCode.SKILL_NOT_FOUND, `id=${id}`, '');
}
const skill = installe... | https://github.com/midori52000/ArkPilot | 80ad285309b07c17ff951f03b12eefd5b5899ac8 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AccountDAO.ets | arkts | getAll | 查询所有账户
@returns Account 数组
@throws | static async getAll(): Promise<Account[]> {
const store = DatabaseManager.getDatabase();
// 执行原生 SQL 查询
const resultSet = await store.querySql('SELECT * FROM accounts ORDER BY account_id ASC');
const list: Account[] = [];
try {
while (resultSet.goToNextRow()) {
list.push(AccountDAO.... | 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 getAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ... | static async getAll(): Promise<Account[]> {
const store = DatabaseManager.getDatabase();
// 执行原生 SQL 查询
const resultSet = await store.querySql('SELECT * FROM accounts ORDER BY account_id ASC');
const list: Account[] = [];
try {
while (resultSet.goToNextRow()) {
list.push(AccountDAO.... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 588fafe107cb7923e901017b2452eb99758ee520 | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/http/HttpClient.ets | arkts | postJson | POST JSON | static async postJson(url: string, body: string, headers?: Record<string, string>): Promise<HttpResponse> {
const options = new RequestOptions()
options.method = http.RequestMethod.POST
options.body = body
options.headers = {
'Content-Type': 'application/json'
}
if (headers) {
cons... | 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 postJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Rig... | static async postJson(url: string, body: string, headers?: Record<string, string>): Promise<HttpResponse> {
const options = new RequestOptions()
options.method = http.RequestMethod.POST
options.body = body
options.headers = {
'Content-Type': 'application/json'
}
if (headers) {
cons... | https://github.com/encorexin/WordPressCMS | cb93308824da9a3a2dcee874a9e2ed1c956bcf0f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | querySql | 执行SQL查询 | public async querySql(sql: string, args?: DatabaseValue[]): Promise<DatabaseRecord[]> {
try {
const store = this.getStore();
const startTime = Date.now();
const resultSet = await store.querySql(sql, args);
const results: DatabaseRecord[] = [];
// [性能优化] 只获取一次列名和列类型,避免每行都调用异步的g... | 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 querySql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sql AST#identifier#Right AST#:#Left : AST#:#Rig... | public async querySql(sql: string, args?: DatabaseValue[]): Promise<DatabaseRecord[]> {
try {
const store = this.getStore();
const startTime = Date.now();
const resultSet = await store.querySql(sql, args);
const results: DatabaseRecord[] = [];
// [性能优化] 只获取一次列名和列类型,避免每行都调用异步的g... | https://github.com/DaLongZhuaZi/manxia | ade8c412040ca6c406d9602b745b5fc65f5c7722 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/DeviceManager.ets | arkts | getInstance | 获取设备管理器单例实例 | public static getInstance(): DeviceManager {
if (!DeviceManager.instance) {
DeviceManager.instance = new DeviceManager();
}
return DeviceManager.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(): DeviceManager {
if (!DeviceManager.instance) {
DeviceManager.instance = new DeviceManager();
}
return DeviceManager.instance;
} | https://github.com/LJ666-ui/harmony-health-care | 90b8280d77297ca73dce15eeaa953b0cabfb38e3 | github |
lidaixian999/Smart_Car | entry/src/main/ets/pages/map.ets | arkts | onPageShow | 页面每次显示时触发一次,包括路由过程、应用进入前台等场景,仅@Entry装饰的自定义组件生效 | onPageShow(): void {
// 将地图切换到前台
if (this.mapController) {
this.mapController.show();
}
} | 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#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left... | onPageShow(): void {
// 将地图切换到前台
if (this.mapController) {
this.mapController.show();
}
} | https://github.com/lidaixian999/Smart_Car | 65583dba6191c7765d9a7aa79ac8d7a23b8eed01 | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Column.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
ColumnSpaceEvenlyEnd() { Text("A"); Text("B"); Text("C"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marg... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marg... | https://github.com/Joker-x-dev/CoolMallArkTS | 77e9e4ad63f95af52ec603f445e63e2a0229194f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getClass | getClass
@returns {Class | undefined}
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getClass(): Class | undefined {
return TypeAPI.getClass(this.td, this.contextLinker)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#id... | public getClass(): Class | undefined {
return TypeAPI.getClass(this.td, this.contextLinker)
} | https://gitcode.com/iop123123/arkts-static-skills | ced972f216b660f1fadddba2e89ae51157a6ce4b | gitcode |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | execute | 执行FFmpeg任务(使用默认配置) | public execute(commands: string[], duration: number, callback: TaskCallback): string {
return this.executeWithConfig(commands, duration, TaskConfig.defaultConfig(), callback);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left execute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commands AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right ... | public execute(commands: string[], duration: number, callback: TaskCallback): string {
return this.executeWithConfig(commands, duration, TaskConfig.defaultConfig(), callback);
} | https://github.com/jjjjjjava/ffmpeg_tools | 51a9438efd29294655c0220f64da4c7633184381 | github |
huaweicloud/huaweicloud-iot-device-sdk-arkts | huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets | arkts | firePropertiesChanged | 触发属性变化,SDK会上报变化的属性
@param serviceId 服务id
@param properties 属性列表 | public firePropertiesChanged(serviceId: string, properties?: string[]): void {
const deviceService = this.getService(serviceId);
if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) {
return;
}
const props = deviceService.onRead(properties);
const se... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left firePropertiesChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left serviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | public firePropertiesChanged(serviceId: string, properties?: string[]): void {
const deviceService = this.getService(serviceId);
if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) {
return;
}
const props = deviceService.onRead(properties);
const se... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts | 6dde91602049b289819944ba118d2dcd7814d439 | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/avPlayerManager.ets | arkts | setLocalSource | 设置本地源逻辑保持不变 | private async setLocalSource(song: SongItemType) {
if (!this.context || !this.avPlayer) return;
await this.avPlayer.reset();
this.GlobalMusic.isPlay = false
try {
if (song.id.startsWith('user_') || song.id.startsWith('local_')) {
const filePath = `${this.context.filesDir}/${song.filePat... | 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 setLocalSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left :... | private async setLocalSource(song: SongItemType) {
if (!this.context || !this.avPlayer) return;
await this.avPlayer.reset();
this.GlobalMusic.isPlay = false
try {
if (song.id.startsWith('user_') || song.id.startsWith('local_')) {
const filePath = `${this.context.filesDir}/${song.filePat... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/avPlayerManager.ets#L60-L80 | 4ae9e9182e51145bb919788b6a2370a492cbd187 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | createDefaultTrend | 创建默认趋势 | static createDefaultTrend(): ScoreTrend {
const periodComparison: PeriodComparison = {
current: 0,
previous: 0,
change: 0
};
const forecast: ScoreForecast = {
nextPeriod: 0,
confidence: 0
};
const trend: ScoreTrend = {
direction: TREND_STABLE,
changePerc... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDefaultTrend 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 Sco... | static createDefaultTrend(): ScoreTrend {
const periodComparison: PeriodComparison = {
current: 0,
previous: 0,
change: 0
};
const forecast: ScoreForecast = {
nextPeriod: 0,
confidence: 0
};
const trend: ScoreTrend = {
direction: TREND_STABLE,
changePerc... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5a6144ffaab081ab092688a374e3ef2d911cb5d8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | removeLoginInfo | 删除登录信息 | removeLoginInfo(sourceId: string): void {
this.loginInfoStore.delete(sourceId);
this.savePersistedData();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeLoginInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST... | removeLoginInfo(sourceId: string): void {
this.loginInfoStore.delete(sourceId);
this.savePersistedData();
} | https://github.com/DaLongZhuaZi/manxia | 4617954e2673278200330891d5fdf4f14d8b5198 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | warn | ⚠️ 警告级别的日志
@param tag - 日志分类标签
@param message - 要输出的日志信息
@param args - 其他可选参数 | public warn(tag: string, message: string, ...args: (string | number | boolean)[]): void {
if (this.currentLevel <= LogLevel.WARN) {
if (this.shouldSkipForBackgroundPause(LogLevel.WARN)) {
return;
}
const formattedMessage = this.formatMessageWithArgs(LogLevel.WARN, tag, message, args);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left warn AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | public warn(tag: string, message: string, ...args: (string | number | boolean)[]): void {
if (this.currentLevel <= LogLevel.WARN) {
if (this.shouldSkipForBackgroundPause(LogLevel.WARN)) {
return;
}
const formattedMessage = this.formatMessageWithArgs(LogLevel.WARN, tag, message, args);
... | https://github.com/DaLongZhuaZi/manxia | 79b1db56ee279068e7276870bf6febcd44806605 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/HighLightOptionsBuilder.ets | arkts | setOnHighLightDrewListener | 为高亮区域添加重绘监听
@param listener 重绘高亮区域图形的监听
@returns 额外配置构建类 | public setOnHighLightDrewListener(listener: OnHighLightDrewListener | null): HighLightOptionsBuilder {
this.options.onHighLightDrewListener = listener;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnHighLightDrewListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#b... | public setOnHighLightDrewListener(listener: OnHighLightDrewListener | null): HighLightOptionsBuilder {
this.options.onHighLightDrewListener = listener;
return this;
} | https://github.com/wuba/omni-ui | 1e2ce3a8bc4ba0ec4a3ce5aca1a7be38fb53a1bf | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/HospitalBedController.ets | arkts | getDeviceStatus | 获取病床设备状态 | public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> {
let status = this.statusCache.get(deviceId);
// 如果没有缓存状态,创建默认状态
if (!status) {
const properties: Map<string, DeviceProperty> = new Map();
properties.set('headAngle', {
key: 'headAngle',
value: 0,
u... | 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 getDeviceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left... | public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> {
let status = this.statusCache.get(deviceId);
// 如果没有缓存状态,创建默认状态
if (!status) {
const properties: Map<string, DeviceProperty> = new Map();
properties.set('headAngle', {
key: 'headAngle',
value: 0,
u... | https://github.com/LJ666-ui/harmony-health-care | b4121b95fd79a6685bebe9456bfcdcf62a445b29 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setLabelXOffset | sets the horizontal offset of the y-label
@param xOffset | public setLabelXOffset(xOffset: number): void {
this.mXLabelOffset = xOffset;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLabelXOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public setLabelXOffset(xOffset: number): void {
this.mXLabelOffset = xOffset;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 154e7f8b52a6fea5ccfd71e914ad243f56ccdd45 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | equals | Checks for equality this instance with provided object, treated as a EnumType
@param {Type} other type to be checked against
@returns {boolean} true if object also has EnumType and their names are the same
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override equals(other: Type): boolean {
// NOTE(shumilov-petr): not implemented
return false
} | 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 equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public override equals(other: Type): boolean {
// NOTE(shumilov-petr): not implemented
return false
} | https://gitcode.com/iop123123/arkts-static-skills | 5fb1c4dc7cc8bdeae872872210897622c0593825 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets | arkts | getMakeupRecords | 获取补卡记录 | async getMakeupRecords(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> {
return this.client.get<any>('/api/v1/attendance/makeup', params as Record<string, any>)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMakeupRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_... | async getMakeupRecords(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> {
return this.client.get<any>('/api/v1/attendance/makeup', params as Record<string, any>)
} | https://github.com/David8Idira/AI-OA | 32c16758f194723131f0f2f11c4db5fd5527219e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | subarray | Creates a Int8Array with the same underlying ArrayBuffer
@param { int } [begin] - start index, inclusive
@param { int } [end] - last index, exclusive
@returns { Int8Array } - a new Int8Array with the same underlying ArrayBuffer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public subarray(begin?: int, end?: int): Int8Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le... | public subarray(begin?: int, end?: int): Int8Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | https://gitcode.com/iop123123/arkts-static-skills | eddb219696aee83aa679cdbd360a284d45fd2bb1 | gitcode |
openharmony/codelabs | ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets | arkts | drawCircularText | Draw Arc Text.
@param textString textString.
@param startAngle startAngle.
@param endAngle endAngle. | drawCircularText(textString: string, startAngle: number, endAngle: number) {
if (CheckEmptyUtils.isEmptyStr(textString)) {
Logger.error('[DrawModel][drawCircularText] textString is empty.')
return;
}
class CircleText {
x: number = 0;
y: number = 0;
radius: number = 0;
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawCircularText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left textString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Righ... | drawCircularText(textString: string, startAngle: number, endAngle: number) {
if (CheckEmptyUtils.isEmptyStr(textString)) {
Logger.error('[DrawModel][drawCircularText] textString is empty.')
return;
}
class CircleText {
x: number = 0;
y: number = 0;
radius: number = 0;
}
... | https://gitee.com/openharmony/codelabs.git | 7db7ee75b547c6dc719aeec6be8357112ecd4c6f | gitee |
honjow/Next2V | shared/src/main/ets/services/TwoFactorChallengeService.ets | arkts | request | V2-only: the global 2FA challenge sheet state lives solely in the AppStorageV2 'v2:twoFactor' holder
(TwoFactorState). This service is its single writer (via the publish* helpers); the @ComponentV2 Index
@Monitors visible and reads cookie/source. No legacy V1 AppStorage timestamp breadcrumbs remain — the
former write-o... | static request(cookie: string, source: string = ''): number {
const requestedAt = Date.now()
publishTwoFactorCookie(cookie)
publishTwoFactorSource(source)
publishTwoFactorVisible(true)
return requestedAt
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left request AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cookie AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | static request(cookie: string, source: string = ''): number {
const requestedAt = Date.now()
publishTwoFactorCookie(cookie)
publishTwoFactorSource(source)
publishTwoFactorVisible(true)
return requestedAt
} | https://github.com/honjow/Next2V | d4f3884c48388892ba346dfff60ea45c50e81c2a | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | setSplitDetails | 设置分摊详情 | setSplitDetails(details: BillSplitDetail[]): void {
this.splitDetailsJson = JSON.stringify(details);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSplitDetails AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left details AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left BillSpl... | setSplitDetails(details: BillSplitDetail[]): void {
this.splitDetailsJson = JSON.stringify(details);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b898894db29d3c619c32c273df5c60cc5513462f | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleRemoteConfig.ets | arkts | downloadAllKeys | -- Download API (modern `method=rc`) -- | public async downloadAllKeys(callback: RCDownloadCallback | null): Promise<void> {
if (this.rejectIfHalted('ModuleRemoteConfig', 'downloadAllKeys')) return;
await this.downloadInternal(null, null, callback);
} | 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 downloadAllKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left... | public async downloadAllKeys(callback: RCDownloadCallback | null): Promise<void> {
if (this.rejectIfHalted('ModuleRemoteConfig', 'downloadAllKeys')) return;
await this.downloadInternal(null, null, callback);
} | https://github.com/Countly/countly-sdk-hos | bce243d7bc02c8fb16952eda2a13862332bed0a5 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | releaseAllKeys | 释放所有通过 ArkUI onKeyEvent 按下但未释放的键
在焦点丢失(如 onBackPress 弹出对话框)时调用,防止键卡住 | releaseAllKeys(): void {
if (this.activeVkKeys.size === 0) return;
const session = this.viewModel?.getSession();
if (session) {
this.activeVkKeys.forEach((vkCode: number) => {
session.sendKeyboardInput(vkCode, KEY_ACTION_UP, 0);
});
}
this.activeVkKeys.clear();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left releaseAllKeys 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#{#Right AST#prop... | releaseAllKeys(): void {
if (this.activeVkKeys.size === 0) return;
const session = this.viewModel?.getSession();
if (session) {
this.activeVkKeys.forEach((vkCode: number) => {
session.sendKeyboardInput(vkCode, KEY_ACTION_UP, 0);
});
}
this.activeVkKeys.clear();
} | https://github.com/AlkaidLab/moonlight-harmony | 0d2ff0ff8b16d9138b6e52dcdbbebcb462282566 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | toString | Converts this error to a string
@returns { String } - String representation of the Error
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | override toString(): String {
return this.name + ((this.name !== "" && this.message) ? ": " + this.message : this.message);
} | AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#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 ... | override toString(): String {
return this.name + ((this.name !== "" && this.message) ? ": " + this.message : this.message);
} | https://gitcode.com/iop123123/arkts-static-skills | 40242b0951a3e4d85616503c82e9b94215c89ccb | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | addLoadListener | 添加加载监听器 | addLoadListener(listener: WebViewImageLoadListener): void {
if (this.loadListeners.indexOf(listener) === -1) {
this.loadListeners.push(listener);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addLoadListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WebViewImageLoadListener AST#identif... | addLoadListener(listener: WebViewImageLoadListener): void {
if (this.loadListeners.indexOf(listener) === -1) {
this.loadListeners.push(listener);
}
} | https://github.com/DaLongZhuaZi/manxia | 72d7966b27d8d305ad67f98dc5e1c5268c467155 | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBootNotifyIssueInjection | 测试通道:want.parameters.bootNotifyIssue=fullName|number,
HomePage 启动后会进入 NotifyPage,NotifyPage 注入一条 Issue 通知用于点击路由回归。 | private handleBootNotifyIssueInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_NOTIFY_ISSUE];
if (typeof raw !== 'string') {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootNotifyIssueInjection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | private handleBootNotifyIssueInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_NOTIFY_ISSUE];
if (typeof raw !== 'string') {
... | https://github.com/CarGuo/GSYGithubAppOH | 6cab73712ab457d35431fd7040b241b2af8c7b4b | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/StringReader.ets | arkts | isEnd | -- Public Methods ---------------------------------------------------------
判断当前读取的字符位置是否为文档最后 | public isEnd(): boolean{
return this.charIndex >= this._charCount;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left isEnd AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public isEnd(): boolean{
return this.charIndex >= this._charCount;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 835e0a21743e348a783f86d67a597cdc114a9225 | gitee |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | getUnknownWordStats | 获取未知词汇统计 | getUnknownWordStats(): UnknownWordStats {
const all = this.getAllUnknownWords();
const highPriority = all.filter((info: UnknownWordInfo): boolean =>
info.priority === Priority.HIGH
).length;
const mediumPriority = all.filter((info: UnknownWordInfo): boolean =>
info.priority === Priority.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUnknownWordStats 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 UnknownWordStats AST#identifier#Right AST#... | getUnknownWordStats(): UnknownWordStats {
const all = this.getAllUnknownWords();
const highPriority = all.filter((info: UnknownWordInfo): boolean =>
info.priority === Priority.HIGH
).length;
const mediumPriority = all.filter((info: UnknownWordInfo): boolean =>
info.priority === Priority.... | https://github.com/CLMC2025/Vignette | 7aaf6edaaaade91923b6ee2eee8e93be92c369c2 | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | reCustomScan | 重新触发一次扫码(仅能使用在customScan.start的异步回调中)
@returns {void} | reCustomScan(): void {
try {
customScan.rescan();
} catch (error) {
logger.error('reCustomScan failed error: ' + JSON.stringify(error));
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reCustomScan 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... | reCustomScan(): void {
try {
customScan.rescan();
} catch (error) {
logger.error('reCustomScan failed error: ' + JSON.stringify(error));
}
} | https://gitcode.com/arkui-x/samples | 9ebac25913eef404a6915946220f2f933b6e6385 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | of | Creates a new Int16Array using initializer
@param data initializer
@returns a new Int16Array from data | public of(data: Object[]): Int16Array {
throw new Error("Int16Array.of: not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public of(data: Object[]): Int16Array {
throw new Error("Int16Array.of: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d1c4e7afe2d35bdd29c15f9d64ff66cd38112cde | gitee |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/AIService.ets | arkts | setApiKey | 设置 API Key。 | setApiKey(apiKey: string): void {
this.config.apiKey = apiKey;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setApiKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left apiKey AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST... | setApiKey(apiKey: string): void {
this.config.apiKey = apiKey;
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/AIService.ets#L93-L95 | 4a6eb79f116ecf3b8792483672a5fd68cb191073 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SourceUpdateManager.ets | arkts | setRepoUrl | 设置仓库URL | public async setRepoUrl(url: string): Promise<void> {
this.repoUrl = url;
await this.saveSettings();
} | 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 setRepoUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#R... | public async setRepoUrl(url: string): Promise<void> {
this.repoUrl = url;
await this.saveSettings();
} | https://github.com/DaLongZhuaZi/manxia | 746d9d50b6bd033a0fd93cc7d68d53d720e2522d | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/DeviceTypeUtil.ets | arkts | shouldShowFullContent | 是否显示完整内容
手环手表只显示精简内容 | public shouldShowFullContent(): boolean {
return !this.isWatchOrWearable();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left shouldShowFullContent 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 boo... | public shouldShowFullContent(): boolean {
return !this.isWatchOrWearable();
} | https://github.com/LJ666-ui/harmony-health-care | 5a886415f01b50bb0c47ac7a20fdfe70974279c7 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/SettingsManager.ets | arkts | getColorModeFromTheme | 根据主题模式获取系统颜色模式 | getColorModeFromTheme(mode: ThemeMode): ConfigurationConstant.ColorMode {
if (mode === ThemeMode.LIGHT) {
return ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT
} else if (mode === ThemeMode.DARK) {
return ConfigurationConstant.ColorMode.COLOR_MODE_DARK
} else {
return ConfigurationCons... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getColorModeFromTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | getColorModeFromTheme(mode: ThemeMode): ConfigurationConstant.ColorMode {
if (mode === ThemeMode.LIGHT) {
return ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT
} else if (mode === ThemeMode.DARK) {
return ConfigurationConstant.ColorMode.COLOR_MODE_DARK
} else {
return ConfigurationCons... | https://github.com/LongLiveY96/chatcube | 5a15559a5eedfeda2e2f5e87a515ad6022b0d71c | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | pow | Return a new Decimal whose value is `base` raised to the power `exponent`, rounded to precision
significant digits using rounding mode `rounding`.
@param { Value } base {double | string | Decimal} The base.
@param { Value } exponent {double | string | Decimal} The exponent.
@returns { Decimal } the Decimal type
@throws... | static pow(base: Value, exponent: Value): Decimal {
return new Decimal(base).pow(exponent);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left pow AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | static pow(base: Value, exponent: Value): Decimal {
return new Decimal(base).pow(exponent);
} | https://gitcode.com/iop123123/arkts-static-skills | 6e63352970eab41de75c79f8bb8ae4dec7dc5780 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/SnowballSystem.ets | arkts | generateSnowballContext | 生成滚雪球语境 | async generateSnowballContext(params: SnowballParams): Promise<SnowballResult> {
try {
// 1. 选择支持词汇
const supportWords = await this.selectSupportWords(
params.targetWord,
params.associationStrength,
params.maxSupportWords
);
if (supportWords.length === 0) {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left generateSnowballContext AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AS... | async generateSnowballContext(params: SnowballParams): Promise<SnowballResult> {
try {
// 1. 选择支持词汇
const supportWords = await this.selectSupportWords(
params.targetWord,
params.associationStrength,
params.maxSupportWords
);
if (supportWords.length === 0) {
... | https://github.com/CLMC2025/Vignette | c4866b978cce36d32a0e1dd0e9bd42dad84b0f22 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/DatabaseTest.ets | arkts | testBasicCRUD | 基本CRUD测试 | public static async testBasicCRUD(): Promise<string> {
try {
const categoryDao = DatabaseHelper.getCategoryDao();
// 创建测试分类
const categoryId = await categoryDao.insertCategory({
name: 'CRUD测试',
type: 0
});
// 查询验证
const categories = await categoryDao.getAllCat... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left testBasicCRUD AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#... | public static async testBasicCRUD(): Promise<string> {
try {
const categoryDao = DatabaseHelper.getCategoryDao();
// 创建测试分类
const categoryId = await categoryDao.insertCategory({
name: 'CRUD测试',
type: 0
});
// 查询验证
const categories = await categoryDao.getAllCat... | https://github.com/fuhhhhhhhh/openharmony | d8fd3ea98823a6c04acb1467aad1477624a2e0cb | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/StringBuilder.ets | arkts | ensureCapacity | ensure the capacity is enough to append the size amount of chars | private static ensureCapacity(sb: StringBuilder, size: int) : char[] {
let capacity = sb.value.length
if (size + sb.count <= capacity) {
return sb.value;
}
capacity = StringBuilder.newCapacity(capacity, size + sb.count);
let newvalue = new char[capacity];
... | 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 ensureCapacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sb AST#identifier#Right AST#:#Left : ... | private static ensureCapacity(sb: StringBuilder, size: int) : char[] {
let capacity = sb.value.length
if (size + sb.count <= capacity) {
return sb.value;
}
capacity = StringBuilder.newCapacity(capacity, size + sb.count);
let newvalue = new char[capacity];
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 570dae4988d2706d9400547e7fa1d6815746cd6c | gitee |
openharmony/codelabs | ETSUI/SimpleApp/entry/src/main/ets/pages/Index.ets | arkts | getAppColor | 根据应用名称获取颜色 | private getAppColor(appName: string): string {
const colorMap: Record<string, string> = {
'通讯': '#FF9500',
'相机': '#007AFF',
'备忘录': '#FFD700',
'照片': '#FF2D55',
'设置': '#8E8E93'
};
return colorMap[appName] || '#007AFF';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getAppColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left appName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | private getAppColor(appName: string): string {
const colorMap: Record<string, string> = {
'通讯': '#FF9500',
'相机': '#007AFF',
'备忘录': '#FFD700',
'照片': '#FF2D55',
'设置': '#8E8E93'
};
return colorMap[appName] || '#007AFF';
} | https://gitcode.com/openharmony/codelabs | ee520b8df829921cd52addb77b004da449b56c8d | gitcode |
Eklps/harmony-mall-perf | entry/src/main/ets/pages/ListIndex.ets | arkts | showThemeDialog | ... (keep showThemeDialog) ... | showThemeDialog() {
promptAction.showActionMenu({
title: '选择主题',
buttons: [
{ text: '浅色模式', color: '#000000' },
{ text: '深色模式', color: '#000000' },
{ text: '跟随系统', color: '#000000' }
]
}, (err, data) => {
if (err) return;
let colorMode = ConfigurationConst... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showThemeDialog 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#Le... | showThemeDialog() {
promptAction.showActionMenu({
title: '选择主题',
buttons: [
{ text: '浅色模式', color: '#000000' },
{ text: '深色模式', color: '#000000' },
{ text: '跟随系统', color: '#000000' }
]
}, (err, data) => {
if (err) return;
let colorMode = ConfigurationConst... | https://github.com/Eklps/harmony-mall-perf | f89b3d9bd59926c1294e30642092903be61dc544 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets | arkts | generateCover | 生成封面图片 | private async generateCover(
mangaId: string,
chapterDir: string,
imageFiles: PdfPageImage[]
): Promise<string | null> {
if (imageFiles.length === 0) {
return null;
}
try {
// 使用第一页作为封面
const firstPage = imageFiles[0];
const coverDir = `${this.config.outputDir}/${man... | 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 generateCover AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left... | private async generateCover(
mangaId: string,
chapterDir: string,
imageFiles: PdfPageImage[]
): Promise<string | null> {
if (imageFiles.length === 0) {
return null;
}
try {
// 使用第一页作为封面
const firstPage = imageFiles[0];
const coverDir = `${this.config.outputDir}/${man... | https://github.com/DaLongZhuaZi/manxia | 0f1f8a0ffa8e8238431e19430056b0dae06b2644 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/navigation/TabContentDemo.ets | arkts | getTabBar | BottomTabBarStyle - 图文方式的页签
of() - 页签图文
可以指定一个图标和一个文本
可以指定两个图标(分别是未选中时的图标和选中时的图标)和一个文本
padding() - 内边距
labelStyle() - 页签文本的样式
overflow, maxLines, minFontSize, maxFontSize, heightAdaptivePolicy - 详见 component/text/TextDemo.ets 中的说明
font - 字体(size, style, weight, family)
selectedColor - 选中时的颜色
unselectedColor - 未选中时的颜色
i... | getTabBar(text: string) {
return BottomTabBarStyle.of($r("app.media.app_icon"), text)
.padding({
top: 0,
right: 0,
bottom: 0,
left: 0
})
.labelStyle({
overflow: TextOverflow.Ellipsis,
maxLines: 1,
minFontSize: 24,
maxFontSize: 24,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTabBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST... | getTabBar(text: string) {
return BottomTabBarStyle.of($r("app.media.app_icon"), text)
.padding({
top: 0,
right: 0,
bottom: 0,
left: 0
})
.labelStyle({
overflow: TextOverflow.Ellipsis,
maxLines: 1,
minFontSize: 24,
maxFontSize: 24,
... | https://github.com/webabcd/HarmonyDemo | b0e70f9795e08a9b6620c67a82f3bd2255a2372f | github |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/NativeBridge.ets | arkts | imagesToPdf | ---------------- 本地工具 ---------------- | static async imagesToPdf(imagePaths: string[], pdfPath: string): Promise<void> {
await zla.imagesToPdf(JSON.stringify(imagePaths), pdfPath);
} | 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 imagesToPdf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imagePaths AST#identifier#Right AST#ERROR#Left AST#:#Left :... | static async imagesToPdf(imagePaths: string[], pdfPath: string): Promise<void> {
await zla.imagesToPdf(JSON.stringify(imagePaths), pdfPath);
} | https://github.com/picklerick422/zju-learning-assistant-OH | a263553576449e71269282e40cb2abe942870cfd | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | toString | Returns a string representation of the Int8Array
@returns a string representation of the Int8Array | public override toString(): string {
let res = new StringBuilder();
for (let i = 0; i < this.length - 1; ++i) {
res.append(this.at(i))
res.append(c',')
}
if (this.length > 0) {
res.append(this.at(this.length - 1))
}
return res.toStr... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toString(): string {
let res = new StringBuilder();
for (let i = 0; i < this.length - 1; ++i) {
res.append(this.at(i))
res.append(c',')
}
if (this.length > 0) {
res.append(this.at(this.length - 1))
}
return res.toStr... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a1773256d96c0b0e86a2c9284250eab24b165ca9 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | deleteState | 删除存档槽位
@param slot 存档槽位索引 (0-99)
@returns 删除是否成功 | static deleteState(slot: number): boolean {
return MelonDSNative.native.deleteState(slot);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left deleteState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slot AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | static deleteState(slot: number): boolean {
return MelonDSNative.native.deleteState(slot);
} | https://github.com/richshaw2015/nds | c70f4a3032adc40f426740ca17ab64ce8fda166c | github |
openharmony/applications_mms | entry/src/main/ets/service/NotificationService.ets | arkts | getWantAgent | Create a wanted message to be sent.
@param agentInfo
@callback callback | getWantAgent(agentInfo, callback) {
WantAgent.getWantAgent(agentInfo).then(data1 => {
callback(data1);
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWantAgent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left agentInfo AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Right... | getWantAgent(agentInfo, callback) {
WantAgent.getWantAgent(agentInfo).then(data1 => {
callback(data1);
});
} | https://gitee.com/openharmony/applications_mms.git | 4b2cc1342ef8f9c1064bb49d036bb2e6a9cb03c1 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getLocalChapterPageCounts | [懒加载优化] 批量查询本地章节的页面数量
@param comicId 漫画ID
@returns Map<章节ID, 页面数量> | public async getLocalChapterPageCounts(comicId: string): Promise<Map<string, number>> {
try {
const sql = `
SELECT chapterId, COUNT(*) as pageCount
FROM page
WHERE chapterId IN (SELECT id FROM chapter WHERE comicId = ?)
GROUP BY chapterId
`;
const result = await... | 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 getLocalChapterPageCounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left A... | public async getLocalChapterPageCounts(comicId: string): Promise<Map<string, number>> {
try {
const sql = `
SELECT chapterId, COUNT(*) as pageCount
FROM page
WHERE chapterId IN (SELECT id FROM chapter WHERE comicId = ?)
GROUP BY chapterId
`;
const result = await... | https://github.com/DaLongZhuaZi/manxia | 70edffa6e175118026a935e9b068fe891f740bf2 | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getLatestAudio | 查询最近播放音频
@returns | public async getLatestAudio(): Promise<Array<BaseItemDto>> {
return this.requireApi().getLatestAudio(this.currentLibrary?.Id)
} | 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 getLatestAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async getLatestAudio(): Promise<Array<BaseItemDto>> {
return this.requireApi().getLatestAudio(this.currentLibrary?.Id)
} | https://github.com/OHPG/FinMusic | 33511a934baefc8c14e6d001f81b2e0d62d3523d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | getLowSurrogate | getLowSurrogate(UTF_16_CodePoint) splits code point as a two code units and return the second one.
The result can be malformed und thus has to be checked with {@link <isLowSurrogate(char)>}.
@param { UTF_16_CodePoint } value an encoded code point.
@returns { char }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStag... | public static getLowSurrogate(value: UTF_16_CodePoint): char {
return (((value - 0x10000) & 0x3FF) + Char.LOW_SURROGATE_MIN.toInt()).toChar();
} | 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 getLowSurrogate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left :... | public static getLowSurrogate(value: UTF_16_CodePoint): char {
return (((value - 0x10000) & 0x3FF) + Char.LOW_SURROGATE_MIN.toInt()).toChar();
} | https://gitcode.com/iop123123/arkts-static-skills | ad5a14c1e3eb8c5839240051e6b0ed5dd590bdcd | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | dequeueElementLocked | Removes and returns the first visible element while preserving invariant checks.
The caller must hold the pop-side mutex while invoking this helper.
@returns { T } The removed head element.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private dequeueElementLocked(): T {
const firstNode = this.requireFirstNodeLocked();
const first = this.requireNodeElement(firstNode);
this.popListNode(firstNode);
return first;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dequeueElementLocked 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#Lef... | private dequeueElementLocked(): T {
const firstNode = this.requireFirstNodeLocked();
const first = this.requireNodeElement(firstNode);
this.popListNode(firstNode);
return first;
} | https://gitcode.com/iop123123/arkts-static-skills | 38fea79c8c8ebc1aa9708811be95327e4ac7c8b9 | gitcode |
openharmony/applications_calendar_data | datamanager/src/main/ets/utils/CalendarUriHelper.ets | arkts | getPathByUri | transfer the user input uri to the specific resource path
@param table's path that is got from user input uri
@return the resource path | function getPathByUri(uri: string): string {
// delete dataShare's prefix
if (uri.startsWith(DATA_SHARE_PREFIX)) {
uri = uri.split(DATA_SHARE_PREFIX).join("");
}
let endIndex = uri.indexOf(QUERY_START);
const totalLength = uri.length;
if (endIndex === -1 && totalLength > 0) {
return uri;
}
// ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getPathByUri AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uri AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function getPathByUri(uri: string): string {
// delete dataShare's prefix
if (uri.startsWith(DATA_SHARE_PREFIX)) {
uri = uri.split(DATA_SHARE_PREFIX).join("");
}
let endIndex = uri.indexOf(QUERY_START);
const totalLength = uri.length;
if (endIndex === -1 && totalLength > 0) {
return uri;
}
// ... | https://gitee.com/openharmony/applications_calendar_data.git | bd2221508df239de92bf656f7e2b76d9e8090b1a | gitee |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/database/RecurringBillDatabase.ets | arkts | updateConfig | 更新定期配置 | async updateConfig(config: RecurringBillConfig): Promise<number> {
if (!this.rdbStore || !config.id) {
throw new Error('数据库未初始化或配置ID为空');
}
const valueBucket: relationalStore.ValuesBucket = {
'amount': config.amount,
'type': config.type,
'category': config.category,
'note': ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#... | async updateConfig(config: RecurringBillConfig): Promise<number> {
if (!this.rdbStore || !config.id) {
throw new Error('数据库未初始化或配置ID为空');
}
const valueBucket: relationalStore.ValuesBucket = {
'amount': config.amount,
'type': config.type,
'category': config.category,
'note': ... | https://github.com/qiuhaotc/HarmonyOSPlayground | b8c16cc3da71a4042f9b563f4488c7676ad8feb8 | github |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | logPagination | 记录分页查询日志
仅在 DEBUG 级别记录,包含页码、每页数量和总数
@param page 当前页码
@param pageSize 每页数量
@param total 总记录数
@param duration 查询耗时(毫秒) | logPagination(page: number, pageSize: number, total: number, duration: number): void {
// 分页日志仅在 DEBUG 级别记录
if (!this.shouldLog(LogLevel.DEBUG)) {
return
}
const totalPages = pageSize > 0 ? Math.ceil(total / pageSize) : 0
const content = `页码: ${page}/${totalPages}, 每页: ${pageSize}, 总数: ${tot... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logPagination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , A... | logPagination(page: number, pageSize: number, total: number, duration: number): void {
// 分页日志仅在 DEBUG 级别记录
if (!this.shouldLog(LogLevel.DEBUG)) {
return
}
const totalPages = pageSize > 0 ? Math.ceil(total / pageSize) : 0
const content = `页码: ${page}/${totalPages}, 每页: ${pageSize}, 总数: ${tot... | https://github.com/offlinecat-dev/OCNetORM | 69d73190efafd4a5515574b8446d9b23674a5ffb | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | constructor | @param parameter type | public constructor(typ: Type) {
this(TypeOrCreator.from(typ))
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typ AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Type ... | public constructor(typ: Type) {
this(TypeOrCreator.from(typ))
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 62630cc62d37d46d3917ada6a4aafbe809cf34ae | gitee |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets | arkts | unSubscribeCollectEvent | 取消订阅收藏event | unSubscribeCollectEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_COLLECT, key)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unSubscribeCollectEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identif... | unSubscribeCollectEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_COLLECT, key)
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 67e8704a88e87d4ae08b0e6f5bbb23b248720b6e | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.