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 |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | toReversed | Creates a reversed copy
@returns { Int8Array } - a reversed copy
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toReversed(): Int8Array {
let newArray = new Int8Array(this.lengthInt);
if (this.lengthInt > 0) {
Int8Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed 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 Int8Array A... | public toReversed(): Int8Array {
let newArray = new Int8Array(this.lengthInt);
if (this.lengthInt > 0) {
Int8Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | https://gitcode.com/iop123123/arkts-static-skills | 40c9349f181659eb7345e332ecf52eefbcb3fdfa | gitcode |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/AccountKitService.ets | arkts | getIdToken | 获取 ID Token (JWT) | getIdToken(): string {
return this.credential?.idToken || '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIdToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_b... | getIdToken(): string {
return this.credential?.idToken || '';
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | cfdd2521686b0421e30091f547602392be8c85c0 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | chunk | 分块查询(大数据量场景)
按指定批大小逐批加载数据并回调处理,避免一次性加载全部数据
@param batchSize 每批数量,必须大于 0
@param callback 每批处理回调 | async chunk(
batchSize: number,
callback: (entities: Array<EntityData>, chunkIndex: number) => Promise<void> | void
): Promise<void> {
const normalizedBatchSize = Math.floor(batchSize)
if (normalizedBatchSize <= 0) {
throw new ExecutionError('CHUNK', 'chunk 大小必须大于 0')
}
const original... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left chunk AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left batchSize AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async chunk(
batchSize: number,
callback: (entities: Array<EntityData>, chunkIndex: number) => Promise<void> | void
): Promise<void> {
const normalizedBatchSize = Math.floor(batchSize)
if (normalizedBatchSize <= 0) {
throw new ExecutionError('CHUNK', 'chunk 大小必须大于 0')
}
const original... | https://github.com/offlinecat-dev/OCNetORM | 2365c7ff14b359a0250de362ec256e2afe131e63 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/YAxisRenderer.ets | arkts | drawYLabels | draws the y-labels on the specified x-position
@param fixedPosition
@param positions | protected drawYLabels(c: CanvasRenderingContext2D, fixedPosition: number, positions: number[], offset: number, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
// let paints:Paint[] = [];
if (!this.mYAxis) {
return;
}
const fromIndex = this.mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawYLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | protected drawYLabels(c: CanvasRenderingContext2D, fixedPosition: number, positions: number[], offset: number, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
// let paints:Paint[] = [];
if (!this.mYAxis) {
return;
}
const fromIndex = this.mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 42d7b385586485b71534267a40f6c3025732ee2f | gitee |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets | arkts | constructor | @param indexComponent - The host page component that manages the container list. | constructor(indexComponent: Index) {
this.indexComponent = indexComponent;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left indexComponent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Index AST#identifier#Right AST#ERRO... | constructor(indexComponent: Index) {
this.indexComponent = indexComponent;
} | https://github.com/AGenUI/AGenUI | f52749a8358f26c8f1946b1b15284a1b4a248148 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/DualSenseController.ets | arkts | rumbleTriggers | 扳机震动反馈 | rumbleTriggers(leftTrigger: number, rightTrigger: number): void {
// DualSense 支持自适应扳机效果
// 这里简化为震动模式
const data = new Uint8Array(48);
data[0] = 0x02;
data[1] = 0x04; // 只更新扳机
data[2] = 0x00;
// 右扳机效果
data[11] = 0x01; // 连续阻力模式
data[12] = 0x00; // 起始位置
data[13] = (right... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rumbleTriggers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left leftTrigger AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , A... | rumbleTriggers(leftTrigger: number, rightTrigger: number): void {
// DualSense 支持自适应扳机效果
// 这里简化为震动模式
const data = new Uint8Array(48);
data[0] = 0x02;
data[1] = 0x04; // 只更新扳机
data[2] = 0x00;
// 右扳机效果
data[11] = 0x01; // 连续阻力模式
data[12] = 0x00; // 起始位置
data[13] = (right... | https://github.com/AlkaidLab/moonlight-harmony | 3141e45b25845a290250ec639c8743ed60b9b401 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an BigUint64Array with respect to buf.
@param { ArrayLike<Number> | ArrayBuffer } buf - data initializer
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLengthInt = (buf as ArrayBuffer).getByteLength()
if (this.byteLengthInt % BigUint64Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength... | 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 buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Lef... | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLengthInt = (buf as ArrayBuffer).getByteLength()
if (this.byteLengthInt % BigUint64Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength... | https://gitcode.com/iop123123/arkts-static-skills | 98fd94286c0147cf633c6409bfd00f0bbd9e4f17 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toPrecision | Return a string representing the value of this Decimal.
@returns { string } the string type | public toPrecision(): string {
let str = this.finiteToString(this.e <= Decimal.toExpNeg || this.e >= Decimal.toExpPos);
return this.isNegative() && !this.isZero() ? '-' + str : str;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toPrecision AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public toPrecision(): string {
let str = this.finiteToString(this.e <= Decimal.toExpNeg || this.e >= Decimal.toExpPos);
return this.isNegative() && !this.isZero() ? '-' + str : str;
} | https://gitcode.com/iop123123/arkts-static-skills | ad6508df10811ccdb3bf5dd2ef6b94704882a179 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets | arkts | constructor | Create a Task instance
@param { Function } func Concurrent function to execute in the taskpool
@param { ...Any } args arguments for function to execute with | constructor(func: Function, ...args: FixedArray<Any>) {
this(func.name, func, ...args);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left func AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right... | constructor(func: Function, ...args: FixedArray<Any>) {
this(func.name, func, ...args);
} | https://gitcode.com/iop123123/arkts-static-skills | b988504b1a994643d910de7ec3f6bd8328cc4093 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setNoDataTextColor | Sets the color of the no data text.
@param color | public setNoDataTextColor(color: number | string) {
if (this.mInfoPaint) {
this.mInfoPaint.setColor(color);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNoDataTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expre... | public setNoDataTextColor(color: number | string) {
if (this.mInfoPaint) {
this.mInfoPaint.setColor(color);
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 92566745f67bb3415fa2114dcc575c134843da95 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/UUIDGenerator.ets | arkts | generateVariantChar | 生成UUID的变体字符(8、9、A、B) | private generateVariantChar(): string {
const variants = ['8', '9', 'a', 'b'];
const index = Math.floor(Math.random() * variants.length);
return variants[index] as string;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateVariantChar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left str... | private generateVariantChar(): string {
const variants = ['8', '9', 'a', 'b'];
const index = Math.floor(Math.random() * variants.length);
return variants[index] as string;
} | https://github.com/DaLongZhuaZi/manxia | 1b3b5a003c3224ef033f3cfa22e4fed8cdcd28f3 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/DiffEngine.ets | arkts | invalidateCache | 失效缓存(文本被外部修改时调用;同时清空缓存的行数组,避免命中陈旧数据) | static invalidateCache(): void {
DiffEngine.lastTextA = '';
DiffEngine.lastTextB = '';
DiffEngine.cachedLinesA = [];
DiffEngine.cachedLinesB = [];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left invalidateCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | static invalidateCache(): void {
DiffEngine.lastTextA = '';
DiffEngine.lastTextB = '';
DiffEngine.cachedLinesA = [];
DiffEngine.cachedLinesB = [];
} | https://github.com/XJTUWYD/ArkDiff | de1c7e14a15651d807970d8b3c23804e923ff43b | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets | arkts | initAppStorage | query folders and notes from the database, then save them to the AppStorage. | initAppStorage(context: common.UIAbilityContext) {
let folderDataArray: FolderData[] = [];
let noteDataArray: NoteData[] = [];
try {
relationalStore.getRdbStore(context, SysDefData.dbInfo.db_name)
.then(async (store) => {
LogUtil.info(TAG, "initAppStorage, store is " + store)
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initAppStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#L... | initAppStorage(context: common.UIAbilityContext) {
let folderDataArray: FolderData[] = [];
let noteDataArray: NoteData[] = [];
try {
relationalStore.getRdbStore(context, SysDefData.dbInfo.db_name)
.then(async (store) => {
LogUtil.info(TAG, "initAppStorage, store is " + store)
... | https://gitee.com/openharmony/applications_notes.git | 42fd5bf4660a5a0ce42327a23c4092aa33ee2089 | gitee |
YANGZX22/Voot | entry/src/main/ets/pages/ConfigurationPage.ets | arkts | aboutToAppear | 卡片宽度 130 + margin 8*2 | aboutToAppear() {
// 找到当前选中项在列表中的索引
for (let i = 0; i < this.validatedSlots.length; i++) {
if (this.validatedSlots[i].apiIndex === this.selectedApiIndex &&
this.validatedSlots[i].slotIndex === this.selectedSlotIndex) {
this.currentSelectedIndex = i;
break;
}
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 找到当前选中项在列表中的索引
for (let i = 0; i < this.validatedSlots.length; i++) {
if (this.validatedSlots[i].apiIndex === this.selectedApiIndex &&
this.validatedSlots[i].slotIndex === this.selectedSlotIndex) {
this.currentSelectedIndex = i;
break;
}
}
... | https://github.com/YANGZX22/Voot | 2798157450f9650d7bb06c2fd434580593c5d835 | github |
offlinecat-dev/OCNetORM | example/UsageExample.ets | arkts | deleteArticle | 删除文章(软删除) | async function deleteArticle(id: number): Promise<DeleteResult> {
const repository = new Repository('ArticleEntity')
return await repository.removeById(id)
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left deleteArticle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_an... | async function deleteArticle(id: number): Promise<DeleteResult> {
const repository = new Repository('ArticleEntity')
return await repository.removeById(id)
} | https://github.com/offlinecat-dev/OCNetORM | f6e5d407eef5a692af67caf904e53e99f69f33d1 | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/presentation/progress/components/CircleProgress.ets | arkts | finishDownload | Finishes the download | finishDownload() {
this.progressValue = this.total;
this.currentState = DownloadState.FINISHED;
this.clearTimer();
// Shows a toast notification
CommonUtils.showToast($r('app.string.download_complete_notification_label'));
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left finishDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | finishDownload() {
this.progressValue = this.total;
this.currentState = DownloadState.FINISHED;
this.clearTimer();
// Shows a toast notification
CommonUtils.showToast($r('app.string.download_complete_notification_label'));
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 00bef46cf86872abac43191cd3330f59043011b1 | gitcode |
dingzhilin1990/zhilinclaw | src/security/SandboxedExecutor.ets | arkts | isToolAllowed | 检查工具是否被允许 | private isToolAllowed(toolName: string): boolean {
// 实际项目中应该检查工具白名单
return true;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isToolAllowed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left toolName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | private isToolAllowed(toolName: string): boolean {
// 实际项目中应该检查工具白名单
return true;
} | https://github.com/dingzhilin1990/zhilinclaw | 97dd583ba82d3e31dfef2541dffce6f62e6914cf | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | parseResponsesReasoningBlob | 反序列化消息里持久化的 Responses reasoning 项。
blob 是 JSON 字符串,内容为 OpenAIResponsesInputItem[];解析失败返回空数组避免把请求打挂。 | private parseResponsesReasoningBlob(blob: string): OpenAIResponsesInputItem[] {
if (blob.trim() === '') {
return []
}
try {
const parsed = JSON.parse(blob) as Object
if (!Array.isArray(parsed)) {
return []
}
const result: OpenAIResponsesInputItem[] = []
for (let... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseResponsesReasoningBlob AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left blob AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i... | private parseResponsesReasoningBlob(blob: string): OpenAIResponsesInputItem[] {
if (blob.trim() === '') {
return []
}
try {
const parsed = JSON.parse(blob) as Object
if (!Array.isArray(parsed)) {
return []
}
const result: OpenAIResponsesInputItem[] = []
for (let... | https://github.com/LongLiveY96/chatcube | 55d48e4de88b78b6e93361a9d7437e9237635175 | github |
xiebyapps/ClipLink | entry/src/main/ets/services/HistoryStorageService.ets | arkts | upsertRecord | Insert or update history record | async upsertRecord(record: HistoryRecordDto): Promise<void> {
try {
const store = await this.ensureStore();
const profileHash = `${record.type}-${record.hash}`;
const valueBucket: relationalStore.ValuesBucket = {
profileHash: profileHash,
type: record.type,
text: record.t... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left upsertRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left record AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async upsertRecord(record: HistoryRecordDto): Promise<void> {
try {
const store = await this.ensureStore();
const profileHash = `${record.type}-${record.hash}`;
const valueBucket: relationalStore.ValuesBucket = {
profileHash: profileHash,
type: record.type,
text: record.t... | https://github.com/xiebyapps/ClipLink | 46ef05e2ea3c710dd188d5eaa5a8b6a461bbbe2f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | updateSourceProxySetting | 更新图源的代理设置
@param sourceId 图源ID
@param requireProxy 是否需要代理 | async updateSourceProxySetting(sourceId: number, requireProxy: boolean): Promise<void> {
try {
const sql = 'UPDATE comic_source SET requireProxy = ?, lastUpdateTime = ? WHERE id = ?';
await this.databaseManager.executeSql(sql, [requireProxy ? 1 : 0, Date.now(), sourceId]);
logger.info(TAG, `图源代理... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateSourceProxySetting AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left... | async updateSourceProxySetting(sourceId: number, requireProxy: boolean): Promise<void> {
try {
const sql = 'UPDATE comic_source SET requireProxy = ?, lastUpdateTime = ? WHERE id = ?';
await this.databaseManager.executeSql(sql, [requireProxy ? 1 : 0, Date.now(), sourceId]);
logger.info(TAG, `图源代理... | https://github.com/DaLongZhuaZi/manxia | 6ae0a43730cab42281b7f9c7b66afe9790e791f2 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets | arkts | getEventById | 根据ID获取日程 | async getEventById(id: string): Promise<GetResult> {
try {
if (!id) {
return { success: false, error: '无效的日程ID' };
}
const event = await this.eventDao.getEventById(id);
if (!event) {
return { success: false, error: '未找到对应的日程' };
}
return { success: true, data... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEventById 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#... | async getEventById(id: string): Promise<GetResult> {
try {
if (!id) {
return { success: false, error: '无效的日程ID' };
}
const event = await this.eventDao.getEventById(id);
if (!event) {
return { success: false, error: '未找到对应的日程' };
}
return { success: true, data... | https://gitcode.com/openharmony/codelabs | 477583b0bebd119795d84840989d61dbe549c481 | gitcode |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getNodeIgnoreToggleActionWithCookie | Read the node-ignore toggle state (requires Cookie session). Same two-URL shape as site favorite:
the authed `/go/{node}` page renders `/settings/ignore/node/{id}?once=` when NOT ignored and
`/settings/unignore/node/{id}?once=` when ignored. `currentlyOn` == currently ignored. | async getNodeIgnoreToggleActionWithCookie(
cookie: string,
nodeName: string,
): Promise<V2exToggleAction> {
const cleanName = (nodeName || '').trim()
if (!cookie) {
throw ApiErrors.authRequired()
}
if (!cleanName) {
throw ApiErrors.invalidNode()
}
const nodePath = `/go/${... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNodeIgnoreToggleActionWithCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier#Right AST#type_annota... | async getNodeIgnoreToggleActionWithCookie(
cookie: string,
nodeName: string,
): Promise<V2exToggleAction> {
const cleanName = (nodeName || '').trim()
if (!cookie) {
throw ApiErrors.authRequired()
}
if (!cleanName) {
throw ApiErrors.invalidNode()
}
const nodePath = `/go/${... | https://github.com/honjow/Next2V | fcf6766d0a7785ac4e65e115900bcb09f402f0d6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts double to JSON format
@param d: double - double to be converted to a JSON as a Number
@returns String - JSON representation of double | public static stringify(d: double): String {
if (Double.isFinite(d)) {
return StringBuilder.toString(d)
} else {
return 'null'
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: double): String {
if (Double.isFinite(d)) {
return StringBuilder.toString(d)
} else {
return 'null'
}
} | https://gitcode.com/iop123123/arkts-static-skills | 0e8333e028dc1879f8505111fba76918e89214c5 | gitcode |
erosTeam/NextE | shared/src/main/ets/model/CustomProfile.ets | arkts | requiresLogin | watched / favorite list types require a logged-in account. | requiresLogin(): boolean {
return this.listType === PROFILE_TYPE_WATCHED || this.listType === PROFILE_TYPE_FAVORITE
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left requiresLogin 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... | requiresLogin(): boolean {
return this.listType === PROFILE_TYPE_WATCHED || this.listType === PROFILE_TYPE_FAVORITE
} | https://github.com/erosTeam/NextE | f6766a91999fb1afcd10867d967aa7cbb386e1f7 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test50_original_index.ets | arkts | extendedGCD | === Round 50: Extended GCD, array rotation, run-length encoding,
Range class, multi-level data structure, digit sum ===
--- Extended GCD (iterative) --- | function extendedGCD(a: number, b: number): number[] {
let oldR: number = a;
let r: number = b;
let oldS: number = 1;
let s: number = 0;
while (r !== 0) {
let q: number = Math.floor(oldR / r);
let temp: number = r;
r = oldR - q * r;
oldR = temp;
temp = s;
s = oldS - q * s;
oldS = t... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extendedGCD AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function extendedGCD(a: number, b: number): number[] {
let oldR: number = a;
let r: number = b;
let oldS: number = 1;
let s: number = 0;
while (r !== 0) {
let q: number = Math.floor(oldR / r);
let temp: number = r;
r = oldR - q * r;
oldR = temp;
temp = s;
s = oldS - q * s;
oldS = t... | https://github.com/miaochiahao/ark-ghidra | 532cd31d0b1de86ab39301a0180c63c3e8b981a6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | escapeAttrValue | 转义属性值 | private escapeAttrValue(value: string): string {
return value
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/</g, '<')
.replace(/>/g, '>');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeAttrValue 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#L... | private escapeAttrValue(value: string): string {
return value
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/</g, '<')
.replace(/>/g, '>');
} | https://github.com/DaLongZhuaZi/manxia | 51be3f36d2ecd66719663778da147d34db1f3956 | github |
openharmony/arkui_ace_engine | advanced_ui_component/treeview/source/treeview.ets | arkts | addImageCollapse | NodeInfo add collapse image
@param isHasChildNode whether node has child node | addImageCollapse(isHasChildNode: boolean): void {
if (isHasChildNode) {
this.nodeItemView.imageCollapse =
CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_RIGHT);
} else {
this.nodeItemView.imageCollapse = undefined;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addImageCollapse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isHasChildNode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#... | addImageCollapse(isHasChildNode: boolean): void {
if (isHasChildNode) {
this.nodeItemView.imageCollapse =
CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_RIGHT);
} else {
this.nodeItemView.imageCollapse = undefined;
}
} | https://gitee.com/openharmony/arkui_ace_engine.git | f394dab492d76d6c77ef642c3b793e6ccd8edddf | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | collectCpuInfo | 收集CPU信息 | private async collectCpuInfo(): Promise<HidebugCpuInfo> {
const cpuInfo: HidebugCpuInfo = {
cpuUsage: 0,
systemCpuUsage: 0,
appThreadCpuUsage: null
};
try {
// 获取进程CPU使用率
cpuInfo.cpuUsage = hidebug.getCpuUsage();
// 获取系统CPU使用情况
cpuInfo.systemCpuUsage = hid... | 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 collectCpuInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async collectCpuInfo(): Promise<HidebugCpuInfo> {
const cpuInfo: HidebugCpuInfo = {
cpuUsage: 0,
systemCpuUsage: 0,
appThreadCpuUsage: null
};
try {
// 获取进程CPU使用率
cpuInfo.cpuUsage = hidebug.getCpuUsage();
// 获取系统CPU使用情况
cpuInfo.systemCpuUsage = hid... | https://github.com/DaLongZhuaZi/manxia | 782ce177170b6ca2bfbb8c55fb10267e19998d53 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | $_invoke | Creates a new instance of a String from int
@param { int } value The value to be converted to a string.
@returns { string } A new String instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: int): string {
return new String(value);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig... | static $_invoke(value: int): string {
return new String(value);
} | https://gitcode.com/iop123123/arkts-static-skills | e0d56c034b6adfbf7ce4cfcc2620e99519978166 | gitcode |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/common/utils/Logger.ets | arkts | setLevel | 设置日志级别 | static setLevel(level: LogLevel): void {
Logger.currentLevel = level
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LogLev... | static setLevel(level: LogLevel): void {
Logger.currentLevel = level
} | https://gitcode.com/openharmony/codelabs | c21f80990ff823beadd87ad7015f1666a1674563 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitFixed64 | 访问 fixed64 字段
Wire type: 1 (64-bit) | visitFixed64(value: bigint, fieldNumber: number): void {
this.writer.tag(fieldNumber, 1).fixed64(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitFixed64 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 bigint AST#identifier#Right AST#,#Left , A... | visitFixed64(value: bigint, fieldNumber: number): void {
this.writer.tag(fieldNumber, 1).fixed64(value)
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 456c66d96e4b7fd681ecc1b56e90113913a2fdf3 | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnCheckboxPage.ets | arkts | build | 构建复选框展示页面 | build() {
AppNavDestination({
title: "复选框",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "复选框",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | https://github.com/codelably/tuniao-ui | 9e1c9d9feb0f7c98f4c19636cce976b12f26ed79 | github |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | initBreakpointObserver | 初始化断点监听
@param {window.Window} windowClass - 当前窗口
@returns {void} 无返回值 | private initBreakpointObserver(windowClass: window.Window): void {
const initialWidth = windowClass.getWindowProperties().windowRect.width;
if (initialWidth !== undefined) {
this.updateBreakpoint(initialWidth);
}
this.windowSizeChangeHandler = (windowSize) => {
if (windowSize.width !== und... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initBreakpointObserver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowClass AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | private initBreakpointObserver(windowClass: window.Window): void {
const initialWidth = windowClass.getWindowProperties().windowRect.width;
if (initialWidth !== undefined) {
this.updateBreakpoint(initialWidth);
}
this.windowSizeChangeHandler = (windowSize) => {
if (windowSize.width !== und... | https://github.com/Joker-x-dev/CoolMallArkTS | 7eee63e4bc13675e029b27063067b3318d7bd9f5 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/Rect.ets | arkts | width | @return the rectangle's width. This does not check for a valid rectangle
(i.e. left <= right) so the result may be negative. | public width(): number {
return this.right - this.left;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left width 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 width(): number {
return this.right - this.left;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 178165696fe83acd2e165a592d54cbf8febbba36 | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WordRepository.ets | arkts | parseWordsJson | Pure function: parse a JSON string matching the bundled word file schema
into validated WordEntry instances. Returns an empty array on structural
failure instead of throwing — callers decide how to surface empty state.
Kept static so local unit tests can call it without constructing a
repository instance. | static parseWordsJson(jsonText: string): WordEntry[] {
if (jsonText.length === 0) {
return [];
}
let payload: WordsFilePayload;
try {
payload = JSON.parse(jsonText) as WordsFilePayload;
} catch (err) {
console.error(`WordRepository: invalid JSON: ${JSON.stringify(err)}`);
r... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseWordsJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | static parseWordsJson(jsonText: string): WordEntry[] {
if (jsonText.length === 0) {
return [];
}
let payload: WordsFilePayload;
try {
payload = JSON.parse(jsonText) as WordsFilePayload;
} catch (err) {
console.error(`WordRepository: invalid JSON: ${JSON.stringify(err)}`);
r... | https://github.com/terryma2024/happyword | 42f4e2df0b4d1e176a2aa5fc5e59386acd4f7606 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | isFullyZoomedOutX | Returns true if the chart is fully zoomed out on it's x-axis
(horizontal).
@return | public isFullyZoomedOutX(): boolean {
return !(this.mScaleX > this.mMinScaleX || this.mMinScaleX > 1);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFullyZoomedOutX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean... | public isFullyZoomedOutX(): boolean {
return !(this.mScaleX > this.mMinScaleX || this.mMinScaleX > 1);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 8e75c387e2a68e3c3f74190c76c6b2efff9bc791 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | getSMLayoutParams | SM断点布局参数(手机横屏/小平板) | private static getSMLayoutParams(): ResponsiveLayoutParams {
return new ResponsiveLayoutParams(4, 16, 20, 700, false, 0, 1.0);
} | 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 getSMLayoutParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private static getSMLayoutParams(): ResponsiveLayoutParams {
return new ResponsiveLayoutParams(4, 16, 20, 700, false, 0, 1.0);
} | https://github.com/DaLongZhuaZi/manxia | 4d247e6f9b26b49e28ff0ff6ae6a5fed7cdd39c5 | github |
the-wwyang/kids-learning-app | src/main/ets/services/ScoreService.ets | arkts | getPinyinScore | 获取拼音学习分数 | public getPinyinScore(isComplete: boolean): number {
return isComplete ? ScoreConfig.PINYIN_SECTION_COMPLETE : ScoreConfig.PINYIN_NEXT_REWARD;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPinyinScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isComplete AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo... | public getPinyinScore(isComplete: boolean): number {
return isComplete ? ScoreConfig.PINYIN_SECTION_COMPLETE : ScoreConfig.PINYIN_NEXT_REWARD;
} | https://github.com/the-wwyang/kids-learning-app | 4e19a6c9c95799e86ac11a5db702f6f01af2b7e0 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | Spine/entry/src/main/ets/pages/Example4.ets | arkts | complete | 每次此条目的动画完成循环时调用 | complete(entry: TrackEntry) {
console.info('spine listener loadAnimation complete entry:', entry)
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left complete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TrackEntry AST#identifier#Right... | complete(entry: TrackEntry) {
console.info('spine listener loadAnimation complete entry:', entry)
}, | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 0b3767dc588627eeb152536f3ef0eaea1e313e7c | gitcode |
openharmony-sig/FastBle | library/src/main/ets/BleManager.ets | arkts | isSupportBle | is support ble?
@return | public isSupportBle(): boolean {
return true; //TODO
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSupportBle 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#... | public isSupportBle(): boolean {
return true; //TODO
} | https://gitee.com/openharmony-sig/FastBle.git | 3929625a9c266bd87c9d9f1d21d10bc4c3f76e57 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Object.ets | arkts | assign | Copies all own properties from one or more source objects to a target Record.
@param target target Record -- what to apply the sources' properties to
@param source objects containing the properties you want to apply
@returns the modified target Record | public static assign(target: Record<PropertyKey, Any>, ...source: FixedArray<Object>): Record<PropertyKey, Any> {
for (const s of source) {
const entries = Object.entries(s)
for (const e of entries) {
target.set(e![0] as PropertyKey, e![1] as Any)
}
... | 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 assign AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#R... | public static assign(target: Record<PropertyKey, Any>, ...source: FixedArray<Object>): Record<PropertyKey, Any> {
for (const s of source) {
const entries = Object.entries(s)
for (const e of entries) {
target.set(e![0] as PropertyKey, e![1] as Any)
}
... | https://gitcode.com/iop123123/arkts-static-skills | 9bfe012c24d6991bf165bfee227b222ea57d76cf | gitcode |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/reminders/RemindersProcessor.ets | arkts | isEventSameWithReminderCreator | 检查待插入的 reminder 与 event 表中相同 event_id 的元组是否拥有相同的 creator
@param rdbStore rdb数据库
@param values 插入操作的数据
@return true 相同 false 不相同 | async function isEventSameWithReminderCreator(rdbStore: data_rdb.RdbStore,
values: data_rdb.ValuesBucket): Promise<boolean> {
Log.debug(TAG, 'isEventSameWithReminderCreator start');
const reminderCreator = values[RemindersColumns.CREATOR];
let resultSet = await queryE... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left isEventSameWithReminderCreator AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#ident... | async function isEventSameWithReminderCreator(rdbStore: data_rdb.RdbStore,
values: data_rdb.ValuesBucket): Promise<boolean> {
Log.debug(TAG, 'isEventSameWithReminderCreator start');
const reminderCreator = values[RemindersColumns.CREATOR];
let resultSet = await queryE... | https://gitee.com/openharmony/applications_calendar_data.git | a365c611857ae20ab1a747668bc9bb5fc000856e | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/DeviceTypeUtil.ets | arkts | getItemsPerRow | 获取每行显示的项目数量 | public getItemsPerRow(): number {
if (this.isWatchOrWearable()) {
return 2;
} else if (this.isPhone()) {
return 3;
} else if (this.isTablet()) {
return 4;
} else {
return 6;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getItemsPerRow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | public getItemsPerRow(): number {
if (this.isWatchOrWearable()) {
return 2;
} else if (this.isPhone()) {
return 3;
} else if (this.isTablet()) {
return 4;
} else {
return 6;
}
} | https://github.com/LJ666-ui/harmony-health-care | be5745cd3af4a7714d122af5c75ff2025d7e7a04 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies all elements of arr to the current Float64Array.
@param { FixedArray<double> } arr - array to copy data from
@throws { RangeError } - If the number of assigned elements exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(arr: FixedArray<double>): void {
this.set(arr, 0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: FixedArray<double>): void {
this.set(arr, 0)
} | https://gitcode.com/iop123123/arkts-static-skills | 227ff389fba3f807daab32e1d1d5b09ff201e598 | gitcode |
zcg741/chengyu-game | entry/src/main/ets/service/ChengyuService.ets | arkts | getBuiltInFallbackData | 内置后备数据(JSON 加载失败时使用) | function getBuiltInFallbackData(): Chengyu[] {
return [
{ word: '一心一意', pinyin: 'yī xīn yī yì', explanation: '形容做事专心,毫不分心', source: '《三国志》', difficulty: 1, category: '数字成语' },
{ word: '狐假虎威', pinyin: 'hú jiǎ hǔ wēi', explanation: '比喻依仗别人的势力来欺压人', source: '《战国策》', difficulty: 2, category: '动物成语' },
{ word:... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getBuiltInFallbackData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#arra... | function getBuiltInFallbackData(): Chengyu[] {
return [
{ word: '一心一意', pinyin: 'yī xīn yī yì', explanation: '形容做事专心,毫不分心', source: '《三国志》', difficulty: 1, category: '数字成语' },
{ word: '狐假虎威', pinyin: 'hú jiǎ hǔ wēi', explanation: '比喻依仗别人的势力来欺压人', source: '《战国策》', difficulty: 2, category: '动物成语' },
{ word:... | https://github.com/zcg741/chengyu-game | d76dd2ccb1aa1513470d1c73b75c6c78575cd4fe | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/modal/BottomModal.ets | arkts | build | 构建底部弹窗
@returns {void} 无返回值 | build() {
Column()
.width(0)
.height(0)
.bindSheet($$this.visible, this.sheetBuilder, {
detents: this.detents,
dragBar: this.dragBar,
showClose: this.showClose,
backgroundColor: this.containerColor,
radius: this.sheetBorderRadius,
title: this.title... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Column()
.width(0)
.height(0)
.bindSheet($$this.visible, this.sheetBuilder, {
detents: this.detents,
dragBar: this.dragBar,
showClose: this.showClose,
backgroundColor: this.containerColor,
radius: this.sheetBorderRadius,
title: this.title... | https://github.com/Joker-x-dev/CoolMallArkTS | 714551d407e2f6b33319d871362e13fd0d9b2991 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | getSimilarMovies | @summary Gets similar items.
@param {LibraryApiGetSimilarMoviesRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public async getSimilarMovies(requestParameters: LibraryApiGetSimilarMoviesRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Movies/${requestParameters.itemId}/Similar`, parameters: requestParameters})
} | 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 getSimilarMovies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ... | public async getSimilarMovies(requestParameters: LibraryApiGetSimilarMoviesRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Movies/${requestParameters.itemId}/Similar`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 8d0752ddb87ec2010b4b847d0c361de2f45be8be | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/pages/DeviceMonitor.ets | arkts | updateDeviceStatus | 更新设备状态 | updateDeviceStatus() {
if (this.useRealDevice && this.tcpSocket && this.deviceStatus.online) {
// 请求真实设备状态
this.requestDeviceStatus();
} else {
// 使用模拟数据
this.updateSimulatedStatus();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateDeviceStatus 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... | updateDeviceStatus() {
if (this.useRealDevice && this.tcpSocket && this.deviceStatus.online) {
// 请求真实设备状态
this.requestDeviceStatus();
} else {
// 使用模拟数据
this.updateSimulatedStatus();
}
} | https://github.com/chendi126/harmonyOS-TCP | b22acc79d34a59abf2107be41d7d9b25f61b5192 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/UserDetailViewModel.ets | arkts | handleIllustClick | 统一的插画点击处理逻辑 | handleIllustClick(illust: PixivIllust) {
// 自动计算当前插画在当前列表中的索引
const index = this.currentIllustList.findIndex(i => i.id === illust.id);
// 构造携带 Swiper 信息的参数
const params: DetailPageParams = {
id: illust.id,
illust: illust,
swiperProvider: this, // 传入自身
swiperIndex: index >... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleIllustClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left illust AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PixivIllust AST#ident... | handleIllustClick(illust: PixivIllust) {
// 自动计算当前插画在当前列表中的索引
const index = this.currentIllustList.findIndex(i => i.id === illust.id);
// 构造携带 Swiper 信息的参数
const params: DetailPageParams = {
id: illust.id,
illust: illust,
swiperProvider: this, // 传入自身
swiperIndex: index >... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/UserDetailViewModel.ets#L238-L250 | 16666ff98c03c982f64f852396df027edea4db7c | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | searchInEntries | 搜索条目
@param totpEntries 条目
@param searchText 搜索文本
@returns | public static searchInEntries(entries: Array<KdbxEntry>, searchText: string): Array<KdbxEntry> {
const result = new Array<KdbxEntry>();
if (!entries || entries.length === 0 || !searchText) {
return result;
}
const searchTextLower = searchText.toLowerCase().trim();
for (const entry of entrie... | 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 searchInEntries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left entries AST#identifi... | public static searchInEntries(entries: Array<KdbxEntry>, searchText: string): Array<KdbxEntry> {
const result = new Array<KdbxEntry>();
if (!entries || entries.length === 0 || !searchText) {
return result;
}
const searchTextLower = searchText.toLowerCase().trim();
for (const entry of entrie... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L192-L205 | 8b88ee71179bb3df6bd2170ba43dca52bd7f1076 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_ushort.ets | arkts | main | ---
desc: check not equal operation for two unsigned short integer operands
--- | function main(): void {
const a: ushort = {{v.left}}
const b: ushort = {{v.right}}
assert (a != b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ushort = {{v.left}}
const b: ushort = {{v.right}}
assert (a != b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7ba9b94654eeed96a929b7cff2c6f55062f65248 | gitee |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | cleanTempCache | 清理临时缓存文件(同时清理临时目录和缓存目录)
@param tempDir 临时目录名(默认为 luban)
@param cacheDir 缓存目录名(默认为 luban_temp,兼容旧版本)
@returns 清理的文件数量 | static cleanTempCache(tempDir: string = "luban", cacheDir: string = "luban_temp"): number {
try {
let totalCleanedCount = 0;
// 清理临时目录(新版本使用的目录)
const tempDirPath = LubanUtils.getTempDirPath(tempDir);
LogUtil.debug(`🧹 清理临时目录: ${tempDirPath}`);
if (fileIo.accessSync(tempDirPath)) {... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cleanTempCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tempDir AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_exp... | static cleanTempCache(tempDir: string = "luban", cacheDir: string = "luban_temp"): number {
try {
let totalCleanedCount = 0;
// 清理临时目录(新版本使用的目录)
const tempDirPath = LubanUtils.getTempDirPath(tempDir);
LogUtil.debug(`🧹 清理临时目录: ${tempDirPath}`);
if (fileIo.accessSync(tempDirPath)) {... | https://github.com/kumaleap/ArkLuban | 6f456eea15f5a3298329ff765270376edca83368 | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | executeNodeFavoriteToggleWithCookie | Execute node follow toggle (requires Cookie session)
- Returns follow state after operation | async executeNodeFavoriteToggleWithCookie(
cookie: string,
nodeName: string,
toggle: V2exToggleAction,
): Promise<boolean> {
const cleanName = (nodeName || '').trim()
if (!cookie) {
throw ApiErrors.authRequired()
}
if (!cleanName) {
throw ApiErrors.invalidNode()
}
con... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeNodeFavoriteToggleWithCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier#Right AST#type_annota... | async executeNodeFavoriteToggleWithCookie(
cookie: string,
nodeName: string,
toggle: V2exToggleAction,
): Promise<boolean> {
const cleanName = (nodeName || '').trim()
if (!cookie) {
throw ApiErrors.authRequired()
}
if (!cleanName) {
throw ApiErrors.invalidNode()
}
con... | https://github.com/honjow/Next2V | b5ef3f94e63cf4c2237a3d318722ce1ecb630895 | github |
codelably/HCompass | packages/demo/src/main/ets/viewmodel/NetworkDemoViewModel.ets | arkts | requestRepository | 请求商品详情数据
@returns {Promise<NetworkResponse<Goods>>} 网络请求 Promise | protected requestRepository(): Promise<NetworkResult<Goods>> {
return this.repository.getGoodsInfo("1");
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestRepository 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... | protected requestRepository(): Promise<NetworkResult<Goods>> {
return this.repository.getGoodsInfo("1");
} | https://github.com/codelably/HCompass | 0ab3ac04f0cdcfa68ceb8c5804bcb527b6207877 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | fitScreen | Resets all zooming and dragging and makes the chart fit exactly it's
bounds. | public fitScreen(): void {
let save: Matrix = this.mFitScreenMatrixBuffer;
this.mViewPortHandler.fitScreen(save);
this.mViewPortHandler.refresh(save, this, false);
this.calculateOffsets();
this.invalidate();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fitScreen 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_s... | public fitScreen(): void {
let save: Matrix = this.mFitScreenMatrixBuffer;
this.mViewPortHandler.fitScreen(save);
this.mViewPortHandler.refresh(save, this, false);
this.calculateOffsets();
this.invalidate();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0c0d8157cca0a17797d1f4dc309c40b7aac19609 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets | arkts | parseTags | 解析标签字符串 | private static parseTags(tagsStr?: string): string[] | undefined {
if (!tagsStr) return undefined;
try {
// 尝试解析JSON数组
const parsed = SafeUtils.parseObj(tagsStr);
if (Array.isArray(parsed)) {
return parsed;
}
} catch (e) {
// 如果不是JSON,尝试按逗号分割
if (tagsStr.in... | 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 parseTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tagsStr AST#identifier#Right AST#ERROR#Left AST#?#Left ? ... | private static parseTags(tagsStr?: string): string[] | undefined {
if (!tagsStr) return undefined;
try {
// 尝试解析JSON数组
const parsed = SafeUtils.parseObj(tagsStr);
if (Array.isArray(parsed)) {
return parsed;
}
} catch (e) {
// 如果不是JSON,尝试按逗号分割
if (tagsStr.in... | https://github.com/DaLongZhuaZi/manxia | 5dd80f2a5f297b76b644049292d9d08498ed2f9d | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/UserService.ets | arkts | init | 初始化用户服务 | async init(context: common.UIAbilityContext): Promise<void> {
try {
this.store = await preferences.getPreferences(context, 'user_data');
console.log('用户服务初始化成功');
} catch (error) {
console.error('初始化用户服务失败:', error);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async init(context: common.UIAbilityContext): Promise<void> {
try {
this.store = await preferences.getPreferences(context, 'user_data');
console.log('用户服务初始化成功');
} catch (error) {
console.error('初始化用户服务失败:', error);
}
} | https://gitcode.com/openharmony/codelabs | 8f55aa446a8c1b3b198097d833b7fe02052df509 | gitcode |
apap6628114/nga_oh | entry/src/main/ets/parser/bbcode/lexer.ets | arkts | escAngle | 将字符串中的 < > 转义为 HTML 实体,用于 title 等需原样展示的文本。 | function escAngle(s: string): string {
return s.replace(/</g, '<').replace(/>/g, '>')
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left escAngle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function escAngle(s: string): string {
return s.replace(/</g, '<').replace(/>/g, '>')
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/bbcode/lexer.ets#L47-L49 | c4ce579d46d2a13c60f6742df17dae6f58770efc | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test25_original_index.ets | arkts | testPatternMatch | --- String pattern matching (manual, no RegExpMatchArray) --- | function testPatternMatch(): string {
let s: string = 'Hello, World!';
let idx: number = s.indexOf('World');
let found: boolean = idx >= 0;
let before: string = s.substring(0, 5);
let after: string = s.substring(7, 12);
return String(found) + ',' + before + ',' + after;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testPatternMatch AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testPatternMatch(): string {
let s: string = 'Hello, World!';
let idx: number = s.indexOf('World');
let found: boolean = idx >= 0;
let before: string = s.substring(0, 5);
let after: string = s.substring(7, 12);
return String(found) + ',' + before + ',' + after;
} | https://github.com/miaochiahao/ark-ghidra | 7410b315fbb520da0b46689fb9fdb830457e727b | github |
LongLiveY96/chatcube | entry/src/main/ets/services/registry/ModelProfileRegistry.ets | arkts | stripGoogleModelsPrefix | ============ 工具:剥离 Google 的 models/ 前缀 ============ | function stripGoogleModelsPrefix(modelId: string): string {
const trimmed = modelId.trim()
const lower = trimmed.toLowerCase()
if (lower.startsWith('models/')) {
return trimmed.substring(7)
}
return trimmed
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left stripGoogleModelsPrefix AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modelId AST#identifier#Right AST#type_annotation#Left AST#:#Le... | function stripGoogleModelsPrefix(modelId: string): string {
const trimmed = modelId.trim()
const lower = trimmed.toLowerCase()
if (lower.startsWith('models/')) {
return trimmed.substring(7)
}
return trimmed
} | https://github.com/LongLiveY96/chatcube | 722273934cfb488325a615097d285b64280e09ec | github |
YANGZX22/Voot | entry/src/main/ets/services/ModelDownloadService.ets | arkts | checkModelExists | 检查模型是否已下载 | public async checkModelExists(context: common.UIAbilityContext): Promise<boolean> {
try {
const modelDir = this.getModelDir(context);
// 检查目录是否存在 - 使用异步方法返回布尔值
const dirExists = await fs.access(modelDir);
if (!dirExists) {
return false;
}
// 检查所有必需文件
for (... | 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 checkModelExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left... | public async checkModelExists(context: common.UIAbilityContext): Promise<boolean> {
try {
const modelDir = this.getModelDir(context);
// 检查目录是否存在 - 使用异步方法返回布尔值
const dirExists = await fs.access(modelDir);
if (!dirExists) {
return false;
}
// 检查所有必需文件
for (... | https://github.com/YANGZX22/Voot | 1cc5d9f05fabe5a418ad2191504e34682c6e3184 | github |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/request/CancelOrderRequest.ets | arkts | constructor | @param {CancelOrderRequest} init - 初始化数据 | constructor(init?: CancelOrderRequest) {
if (init) {
this.orderId = init.orderId;
this.remark = init.remark;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Canc... | constructor(init?: CancelOrderRequest) {
if (init) {
this.orderId = init.orderId;
this.remark = init.remark;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 5e1088fb2c16e834107bbdf1034c2fc2c76a1fd2 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | getTitleSize | 获取标题字体大小
@returns 字体大小 | public getTitleSize(): number {
return this.titleSize;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTitleSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | public getTitleSize(): number {
return this.titleSize;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 8d3fc6523af47c1d756b55a02a79b2d1b1923987 | gitcode |
OHPG/FinSdk | emby/src/main/ets/network/EmbyApiClient.ets | arkts | getNormalHeader | 普通请求 header:使用 X-Emby-Authorization(含 Token) | private getNormalHeader(): Record<string, string> {
return {
'Content-Type': 'application/json',
'Accept': 'application/json, application/octet-stream;q=0.9, */*;q=0.8',
'X-Emby-Authorization': this.buildEmbyAuthorization(true),
'User-Agent': `${this.clientInfo.name}/${this.clientInfo.vers... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNormalHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp... | private getNormalHeader(): Record<string, string> {
return {
'Content-Type': 'application/json',
'Accept': 'application/json, application/octet-stream;q=0.9, */*;q=0.8',
'X-Emby-Authorization': this.buildEmbyAuthorization(true),
'User-Agent': `${this.clientInfo.name}/${this.clientInfo.vers... | https://github.com/OHPG/FinSdk | 98f978b4c2bffea0042171ba67b389c12c9c8d55 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | getRequestTopP | 助手未启用相应开关时返回 undefined,让 AIApiService 不下发对应采样参数。
显式打开覆盖时即使是 1.0 / 0 这类默认值也保留用户意图。 | private async getRequestTopP(): Promise<number | undefined> {
const assistantConfig = await this.getAssistantRuntimeConfig()
return assistantConfig.topPEnabled ? assistantConfig.topP : undefined
} | 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 getRequestTopP AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async getRequestTopP(): Promise<number | undefined> {
const assistantConfig = await this.getAssistantRuntimeConfig()
return assistantConfig.topPEnabled ? assistantConfig.topP : undefined
} | https://github.com/LongLiveY96/chatcube | e36750aafc70127ae8d6c6753be3e9e3cfa819e2 | github |
codelably/HCompass | core/network/src/main/ets/RequestHelper.ets | arkts | onError | 设置 toast 错误回调
@param callback toast 回调
@returns 当前实例 | onError(callback: (message: string) => void): RequestHelper<T> {
this.toastErrorCallback = callback;
return this;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left ... | onError(callback: (message: string) => void): RequestHelper<T> {
this.toastErrorCallback = callback;
return this;
} | https://github.com/codelably/HCompass | f17319856589af53ec78505f107b15b213909cab | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/RouterManager.ets | arkts | pushLogin | 跳转到登录页 | static pushLogin(): void {
RouterManager.pushPath(RouteConstants.PAGE_LOGIN);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left pushLogin 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_s... | static pushLogin(): void {
RouterManager.pushPath(RouteConstants.PAGE_LOGIN);
} | https://github.com/Amaz1ny/HarmonyDO-public | 8cc23e51c981716ea25d696ce7f98d4350814efe | github |
erosTeam/NextE | shared/src/main/ets/network/EhApiService.ets | arkts | getGalleryArchiver | Fetch the gallery archiver quote/options page. Submit actions use the protected POST methods below. | async getGalleryArchiver(
gid: string,
token: string,
archiverLink: string,
isEx: boolean,
): Promise<EhGalleryArchiverQuote> {
const url: string = this.archiverUrl(gid, token, archiverLink, isEx)
const resp = await this.fetch(url, isEx, 'generic')
return EhGalleryArchiverParser.parse(re... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGalleryArchiver AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left gid AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getGalleryArchiver(
gid: string,
token: string,
archiverLink: string,
isEx: boolean,
): Promise<EhGalleryArchiverQuote> {
const url: string = this.archiverUrl(gid, token, archiverLink, isEx)
const resp = await this.fetch(url, isEx, 'generic')
return EhGalleryArchiverParser.parse(re... | https://github.com/erosTeam/NextE | 89be13aa291239438d6ed5bcaef44e5f4d1bc600 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | init | 初始化 WebRTC(异步) | public async init(config?: WebRTCConfig): Promise<boolean> {
const merged: WebRTCConfig = {
stunServers: config?.stunServers ?? DEFAULT_CONFIG.stunServers,
turnServers: config?.turnServers ?? DEFAULT_CONFIG.turnServers,
localPort: config?.localPort ?? DEFAULT_CONFIG.localPort,
preferredVid... | 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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#?#Left ? AST#?#Righ... | public async init(config?: WebRTCConfig): Promise<boolean> {
const merged: WebRTCConfig = {
stunServers: config?.stunServers ?? DEFAULT_CONFIG.stunServers,
turnServers: config?.turnServers ?? DEFAULT_CONFIG.turnServers,
localPort: config?.localPort ?? DEFAULT_CONFIG.localPort,
preferredVid... | https://github.com/tdcare/tdwebrtc | e1b6f8dd01662e1327fca744d1c0fd33dbc0b29f | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/TiktokCollection.ets | arkts | hasCollection | 检测是否收藏
@param item 视频
@return boolean | static hasCollection(item: mediaType) {
const list = TiktokCollection.getCollectionData()
if (list.includes(item)) {
return true
} else {
return false
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasCollection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left me... | static hasCollection(item: mediaType) {
const list = TiktokCollection.getCollectionData()
if (list.includes(item)) {
return true
} else {
return false
}
} | https://github.com/SMAT-Lab/PhantomRendering | ddb84345a5566a7c3199b16a34f13a4f58f05b50 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/HttpClient.ets | arkts | postFormTextWithStatus | POST 表单并返回 HTTP 状态码(不抛出异常,由调用方判断成功/失败) | async postFormTextWithStatus(
path: string,
form: Record<string, Object>,
extraHeaders: Record<string, string> | null = null,
readTimeoutMs: number = 60000,
connectTimeoutMs: number | null = null,
guardOptions: CfGuardOptions | null = null
): Promise<number> {
await this.cookieStore.init... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left postFormTextWithStatus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_par... | async postFormTextWithStatus(
path: string,
form: Record<string, Object>,
extraHeaders: Record<string, string> | null = null,
readTimeoutMs: number = 60000,
connectTimeoutMs: number | null = null,
guardOptions: CfGuardOptions | null = null
): Promise<number> {
await this.cookieStore.init... | https://github.com/Amaz1ny/HarmonyDO-public | 68fc54f90623501c32ffcd37b44bd9f2acb60b69 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | find | Finds the first element in the Float32Array that satisfies the condition
@param fn condition
@returns the first element that satisfies fn | public find(fn: (val: float) => boolean): float {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.find(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find 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#Righ... | public find(fn: (val: float) => boolean): float {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.find(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | eedf11dc50bb54e14d9e4b75a3cbe04948408390 | gitee |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/ApiVersionUtil.ets | arkts | getCurrentApiVersion | 获取当前设备API版本
@returns 当前设备的API版本号 | static getCurrentApiVersion(): number {
return deviceInfo.sdkApiVersion;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentApiVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left numbe... | static getCurrentApiVersion(): number {
return deviceInfo.sdkApiVersion;
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | f255b73e98b150090959cb250770328ae2600a73 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets | arkts | updateRefreshRate | 更新刷新率
@param rate | updateRefreshRate(refreshRateFPS : number) {
flutter.nativeUpdateRefreshRate(refreshRateFPS);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateRefreshRate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left refreshRateFPS AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR... | updateRefreshRate(refreshRateFPS : number) {
flutter.nativeUpdateRefreshRate(refreshRateFPS);
} | https://gitee.com/openharmony-sig/flutter_engine.git | 3afa41ee2f983428f06b899d1971c401dd11ad08 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets | arkts | clearPreloadQueue | 清空预加载队列 | public clearPreloadQueue(): void {
this.preloadQueue = [];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearPreloadQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr... | public clearPreloadQueue(): void {
this.preloadQueue = [];
} | https://github.com/DaLongZhuaZi/manxia | af68b2daf90dff80d9f71e26879d2ea0f1ea4efc | github |
genjishare/snake-game | entry/src/main/ets/pages/WebViewPage.ets | arkts | gameOver | 定义一个方法用于接收H5传递的游戏数据 | gameOver(gameStateJson: string): void {
try {
// 解析传入的游戏状态JSON字符串
const gameState = JSON.parse(gameStateJson) as GameState;
const score = gameState.score;
const boundaryCollision = gameState.boundaryCollision;
console.info(`游戏结束,分数: ${score},接收到完整游戏状态数据,边界碰撞: ${boundaryCollisi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left gameOver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left gameStateJson AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)... | gameOver(gameStateJson: string): void {
try {
// 解析传入的游戏状态JSON字符串
const gameState = JSON.parse(gameStateJson) as GameState;
const score = gameState.score;
const boundaryCollision = gameState.boundaryCollision;
console.info(`游戏结束,分数: ${score},接收到完整游戏状态数据,边界碰撞: ${boundaryCollisi... | https://github.com/genjishare/snake-game | c80239fb2adb8103ad72433231f29fdde95447ce | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TabConfig.ets | arkts | parseFilterGroup | 解析筛选组 | function parseFilterGroup(groupDef: Record<string, Object>, defaultOrder: number): FilterGroup | null {
if (!groupDef || typeof groupDef !== 'object') {
return null;
}
const id = String(groupDef['id'] || '');
const title = String(groupDef['title'] || groupDef['name'] || id);
if (!id) {
return null... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseFilterGroup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left groupDef AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function parseFilterGroup(groupDef: Record<string, Object>, defaultOrder: number): FilterGroup | null {
if (!groupDef || typeof groupDef !== 'object') {
return null;
}
const id = String(groupDef['id'] || '');
const title = String(groupDef['title'] || groupDef['name'] || id);
if (!id) {
return null... | https://github.com/DaLongZhuaZi/manxia | 5707831394350e75bd0d9b1446bdbe1d2e387ec5 | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | analyzeLine | Analyze a single line of text
@param text Single line text content
@param info Metadata for the current line
@return Single line analysis result | public analyzeLine(text: string, info: TextLineInfo): LineAnalyzeResult {
if (this.nativeHandle == 0) {
return new LineAnalyzeResult();
}
let buffer: Int32Array = lib.TextAnalyzer_AnalyzeLine(
this.nativeHandle, text, info.line, info.startState, info.startCharOffset);
return ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeLine 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 stri... | public analyzeLine(text: string, info: TextLineInfo): LineAnalyzeResult {
if (this.nativeHandle == 0) {
return new LineAnalyzeResult();
}
let buffer: Int32Array = lib.TextAnalyzer_AnalyzeLine(
this.nativeHandle, text, info.line, info.startState, info.startCharOffset);
return ... | https://github.com/FinalScave/SweetLine | 62e8e422cf1270f4466abe267cb99b7884b8b3d9 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/arkts/class/Class.ets | arkts | walk | 抽象类可以定义有具体逻辑的方法 | public walk():string {
return `walk: ${this.name}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left walk 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#:#Righ... | public walk():string {
return `walk: ${this.name}`;
} | https://github.com/webabcd/HarmonyDemo | 95a16a0dbe4828b1ccd4a271c332940e0db513ec | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/MangaDataLoader.ets | arkts | loadMangaDetail | 加载漫画详情和章节列表
策略:
1. 优先从数据库加载
2. 如果是在线漫画且缓存过期或为空,则从网络加载
3. 如果用户手动刷新,强制从网络加载 | async loadMangaDetail(
mangaId: string,
forceRefresh: boolean = false
): Promise<MangaDetailLoadResult> {
logger.info(TAG, `加载漫画详情: mangaId=${mangaId}, forceRefresh=${forceRefresh}`);
try {
// 1. 从数据库加载漫画信息
const legacyManga = await this.dataManager.getComicById(mangaId);
if (... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadMangaDetail AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left mangaId AST#identifier#Right AST#type_annotation#Left ... | async loadMangaDetail(
mangaId: string,
forceRefresh: boolean = false
): Promise<MangaDetailLoadResult> {
logger.info(TAG, `加载漫画详情: mangaId=${mangaId}, forceRefresh=${forceRefresh}`);
try {
// 1. 从数据库加载漫画信息
const legacyManga = await this.dataManager.getComicById(mangaId);
if (... | https://github.com/DaLongZhuaZi/manxia | 3503181f451a7756398c22a8551437ede3a79b40 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/LRU.ets | arkts | getSize | Returns the current number of entries in the cache.
@returns { int } The current number of entries in the cache.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getSize(): int {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
return this.size;
} finally {
ConcurrencyHelpers.mutexUnlock(this.mutex);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi... | public getSize(): int {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
return this.size;
} finally {
ConcurrencyHelpers.mutexUnlock(this.mutex);
}
} | https://gitcode.com/iop123123/arkts-static-skills | 48c80b6221fcc517bdb75c83e9218cbe345dac74 | gitcode |
openharmony/codelabs | Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets | arkts | getChartPoints | Get chart points.
@param {DataRdb.RdbStore} rdbStore RDB database.
@return Return the steps value of the last three days. | async getChartPoints(rdbStore: DataRdb.RdbStore) {
let chartPoints = await DatabaseUtils.getLastThreeDaysValue(rdbStore).catch((error: Error) => {
Logger.error(CommonConstants.TAG_CHART, 'getLastThreeDaysValue error ' + JSON.stringify(error));
});
return chartPoints;
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getChartPoints AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST#type_annotation#Left ... | async getChartPoints(rdbStore: DataRdb.RdbStore) {
let chartPoints = await DatabaseUtils.getLastThreeDaysValue(rdbStore).catch((error: Error) => {
Logger.error(CommonConstants.TAG_CHART, 'getLastThreeDaysValue error ' + JSON.stringify(error));
});
return chartPoints;
} | https://gitee.com/openharmony/codelabs.git | 3924b2c7dc892ff54345c4a3d5fc1ba91eb4aee6 | gitee |
openharmony-tpc/ImageKnife | entry/src/main/ets/pages/LoadStatePage.ets | arkts | custom | 自定义下载方法 | @Concurrent
async function custom(context: Context, src: string | PixelMap | Resource,headers?: Record<string,Object>): Promise<ArrayBuffer | undefined> {
console.info('ImageKnife:: custom download:' + src)
// 举例写死从本地文件读取,也可以自己请求网络图片
return undefined
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left custom AST#identifier#Right AST#formal_parameters#Left... | @Concurrent
async function custom(context: Context, src: string | PixelMap | Resource,headers?: Record<string,Object>): Promise<ArrayBuffer | undefined> {
console.info('ImageKnife:: custom download:' + src)
// 举例写死从本地文件读取,也可以自己请求网络图片
return undefined
} | https://gitee.com/openharmony-tpc/ImageKnife.git | 80fd6651d14a7c201bde52b2296fc51c5e8f7b22 | gitee |
fbinba3955/Flymby | common/src/main/ets/utils/StringUtil.ets | arkts | formatFileSize | 格式化文件大小
@param bytes 字节数
@returns 格式化的文件大小字符串 | static formatFileSize(bytes: number): string {
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatFileSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static formatFileSize(bytes: number): string {
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
} | https://github.com/fbinba3955/Flymby | 265b4da66621cccd4502d79b4c445d2664e2c1d7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets | arkts | mul | Performs shortegral multiplication of this instance with provided one, returns the result as new instance
@param { Short } other Right hand side of the multiplication
@returns { Short } Result of the multiplication
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public mul(other: Short): Short {
return new Short((this.value * other.toShort()).toShort())
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public mul(other: Short): Short {
return new Short((this.value * other.toShort()).toShort())
} | https://gitcode.com/iop123123/arkts-static-skills | 6a73fc67bd4f01dee1171a7828eb4dce84189c7c | gitcode |
offlinecat-dev/OCNetORM | example/repository/UserRepository.ets | arkts | findByAgeRange | 查询指定年龄范围的用户
@param minAge 最小年龄
@param maxAge 最大年龄
@returns 用户列表 | async findByAgeRange(minAge: number, maxAge: number): Promise<Array<EntityData>> {
const queryBuilder = this.repository.createQueryBuilder()
queryBuilder.whereBetween('age', minAge, maxAge)
queryBuilder.orderBy('age', 'ASC')
const executor = new QueryExecutor(queryBuilder)
return await executor.ge... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left findByAgeRange AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left minAge AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async findByAgeRange(minAge: number, maxAge: number): Promise<Array<EntityData>> {
const queryBuilder = this.repository.createQueryBuilder()
queryBuilder.whereBetween('age', minAge, maxAge)
queryBuilder.orderBy('age', 'ASC')
const executor = new QueryExecutor(queryBuilder)
return await executor.ge... | https://github.com/offlinecat-dev/OCNetORM | a18643caa2887ffdc56621dbf9cf04763bdac6ac | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | whereNull | 添加 IS NULL 条件
@param column 列名或属性名
@returns 当前实例(支持链式调用) | whereNull(column: string): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.isNull(resolvedColumn)
condition.logica... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left whereNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST... | whereNull(column: string): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.isNull(resolvedColumn)
condition.logica... | https://github.com/offlinecat-dev/OCNetORM | 66d3d56bbd795726f61bff307d91d1c1cc0e0790 | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/calculator/AdvancedSunshineCalculator.ets | arkts | getDayLengthHours | 计算日照长度(小时) | private getDayLengthHours(latitude: number, dayOfYear: number): number {
const latRad = latitude * Math.PI / 180;
const declination = this.getSolarDeclination(dayOfYear);
const hourAngle = Math.acos(
Math.min(1, Math.max(-1, -Math.tan(latRad) * Math.tan(declination)))
);
return 2 *... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDayLengthHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left latitude AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | private getDayLengthHours(latitude: number, dayOfYear: number): number {
const latRad = latitude * Math.PI / 180;
const declination = this.getSolarDeclination(dayOfYear);
const hourAngle = Math.acos(
Math.min(1, Math.max(-1, -Math.tan(latRad) * Math.tan(declination)))
);
return 2 *... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 884ccc6945653a28129b21931f118df46096574d | github |
erosTeam/NextE | feature/user/src/main/ets/viewmodel/FavoritesViewModel.ets | arkts | mergeFavList | Accumulate the favcat selector list across loads. EH OMITS the currently-selected favcat
from the bar (the active chip isn't a clickable `fp` element), so a filtered page's favList
is missing exactly the slot every row on it belongs to. Overwriting would break favTitle→slot
resolution for the active favcat; merging (Ma... | private mergeFavList(incoming: Favcat[]): void {
if (incoming.length === 0) {
return
}
const byId: Map<string, Favcat> = new Map<string, Favcat>()
this.favList.forEach((f: Favcat) => byId.set(f.favId, f))
incoming.forEach((f: Favcat) => {
const current: Favcat | undefined = byId.get(f.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeFavList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left incoming AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Favcat AST#i... | private mergeFavList(incoming: Favcat[]): void {
if (incoming.length === 0) {
return
}
const byId: Map<string, Favcat> = new Map<string, Favcat>()
this.favList.forEach((f: Favcat) => byId.set(f.favId, f))
incoming.forEach((f: Favcat) => {
const current: Favcat | undefined = byId.get(f.... | https://github.com/erosTeam/NextE | d5798e2de386310dad6d691add5308a2fcd30fcc | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/input/search/components/MixedStyleSearch.ets | arkts | LeadingButton | Extract common left icon button (Chevron Left) | @Builder
function LeadingButton() {
Button({ type: ButtonType.Circle, stateEffect: true }) {
SymbolGlyph($r('sys.symbol.chevron_left'))
.fontSize($r('sys.float.Title_M'))
.fontColor([$r('sys.color.icon_primary')])
}
.width(SizeToken.SIZE_NUM_40)
.height(SizeToken.SIZE_NUM_40)
.backgroundColor(... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left LeadingButton AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#L... | @Builder
function LeadingButton() {
Button({ type: ButtonType.Circle, stateEffect: true }) {
SymbolGlyph($r('sys.symbol.chevron_left'))
.fontSize($r('sys.float.Title_M'))
.fontColor([$r('sys.color.icon_primary')])
}
.width(SizeToken.SIZE_NUM_40)
.height(SizeToken.SIZE_NUM_40)
.backgroundColor(... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 7061e42bbc1cc1dfe7a93064cb077a6be8d705b5 | gitcode |
somnio-software/my-bot-pal | entry/src/main/ets/utils/PermissionUtils.ets | arkts | isPermissionGranted | Checks if a permission is granted without requesting it from the user.
@param permission - The permission to check
@returns A promise that resolves to true if the permission is granted, false otherwise | public async isPermissionGranted(permission: Permissions): Promise<boolean> {
console.log(`[REAL] Checking if permission is granted: ${permission}`);
const tokenId = await this.getAppTokenId();
if (tokenId === -1) {
return false;
}
const hasPermission = await this.checkPermissionWithTo... | 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 isPermissionGranted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#... | public async isPermissionGranted(permission: Permissions): Promise<boolean> {
console.log(`[REAL] Checking if permission is granted: ${permission}`);
const tokenId = await this.getAppTokenId();
if (tokenId === -1) {
return false;
}
const hasPermission = await this.checkPermissionWithTo... | https://github.com/somnio-software/my-bot-pal | 2e56166c833e11af6ebbd3040c81375c1b589cb7 | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/services/PreferencesStore.ets | arkts | endVoluntaryOTSession | Ends the current voluntary OT session, adding its elapsed time to accumulated. | public async endVoluntaryOTSession(): Promise<void> {
const active: boolean = await this.loadVoluntaryOTActive()
if (!active) { return }
const sessionStart: number = await this.loadVoluntaryOTSessionStart()
const nowSec: number = Date.now() / 1000
const sessionElapsed: number = Math.max(0, nowSec ... | 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 endVoluntaryOTSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public async endVoluntaryOTSession(): Promise<void> {
const active: boolean = await this.loadVoluntaryOTActive()
if (!active) { return }
const sessionStart: number = await this.loadVoluntaryOTSessionStart()
const nowSec: number = Date.now() / 1000
const sessionElapsed: number = Math.max(0, nowSec ... | https://github.com/OMGCA/sakipay | 7eeac322f4192410b2fb4adefcd1d724f1665a5c | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/AppStateManager.ets | arkts | setCurrentModel | 设置当前模型 | async setCurrentModel(modelId: string, modelName: string, providerId: string): Promise<void> {
this.currentModelId = modelId
this.currentModelName = modelName
this.currentProviderId = providerId
await this.preferencesService.setCurrentModelId(modelId)
await this.preferencesService.setCurrentModelN... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setCurrentModel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L... | async setCurrentModel(modelId: string, modelName: string, providerId: string): Promise<void> {
this.currentModelId = modelId
this.currentModelName = modelName
this.currentProviderId = providerId
await this.preferencesService.setCurrentModelId(modelId)
await this.preferencesService.setCurrentModelN... | https://github.com/LongLiveY96/chatcube | 8f416bedb40cf699761c5e1d373951f900fa99ff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | saveChapterToFile | 保存章节内容到txt文件 | private async saveChapterToFile(
bookId: string,
chapterIndex: number,
chapterTitle: string,
content: string
): Promise<void> {
try {
const bookDir = this.getBookCacheDir(bookId);
const chaptersDir = `${bookDir}/chapters`;
// 确保目录存在
await this.sandboxManager.create... | 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 saveChapterToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#L... | private async saveChapterToFile(
bookId: string,
chapterIndex: number,
chapterTitle: string,
content: string
): Promise<void> {
try {
const bookDir = this.getBookCacheDir(bookId);
const chaptersDir = `${bookDir}/chapters`;
// 确保目录存在
await this.sandboxManager.create... | https://github.com/DaLongZhuaZi/manxia | ec6189c6ee1726b6cd3323f4cd8e3f66d66aad48 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/DefaultParser.ets | arkts | isJavaProperty | Tests if the specified token is a Java-like property (-Dkey=value). | private isJavaProperty(token: string): boolean{
let opt = token.substring(0, 1);
let option: CliOption = this.options.getOption(opt);
return option != null && (option.getArgs() >= 2 || option.getArgs() == CliOption.UNLIMITED_VALUES);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isJavaProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private isJavaProperty(token: string): boolean{
let opt = token.substring(0, 1);
let option: CliOption = this.options.getOption(opt);
return option != null && (option.getArgs() >= 2 || option.getArgs() == CliOption.UNLIMITED_VALUES);
} | https://gitee.com/openharmony-sig/commons-cli.git | dabf10bdfe57aee42d441f6cec64482bbd22c8e6 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/resources/classes/meowResources.ets | arkts | pickBackgroundImageFromDocuments | Pick background image from documents. | async pickBackgroundImageFromDocuments() {
const result = await fileDocumentPick2Path(['*.png *.jpeg *.jpg|.png,.jpeg,.jpg'], 1);
if (!result.succeed) {
meow(`Failed to pick background image from documents.`, 'meowResources][pickBackgroundImageFromDocuments', meowLevel.WARN);
return;
}
con... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pickBackgroundImageFromDocuments AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left ... | async pickBackgroundImageFromDocuments() {
const result = await fileDocumentPick2Path(['*.png *.jpeg *.jpg|.png,.jpeg,.jpg'], 1);
if (!result.succeed) {
meow(`Failed to pick background image from documents.`, 'meowResources][pickBackgroundImageFromDocuments', meowLevel.WARN);
return;
}
con... | https://github.com/awaLiny2333/LinysBrowser_NEXT | f210f9b6ad069983fe3351c5a0675f2013321491 | github |
YDYm233/EasyRandom_HarmonyNextApp | product/wearable/src/main/ets/utils/WearScreenUtil.ets | arkts | _initDimensions | ==================== 屏幕尺寸 ====================
懒加载初始化屏幕尺寸(宽度+高度一起设,避免重复获取) | private static _initDimensions(): void {
if (WearScreenUtil._screenWidth === 0 && WearScreenUtil._screenHeight === 0) {
try {
const d = display.getDefaultDisplaySync();
WearScreenUtil._screenWidth = px2vp(d.width);
WearScreenUtil._screenHeight = px2vp(d.height);
} catch (e) {
... | 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 _initDimensions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private static _initDimensions(): void {
if (WearScreenUtil._screenWidth === 0 && WearScreenUtil._screenHeight === 0) {
try {
const d = display.getDefaultDisplaySync();
WearScreenUtil._screenWidth = px2vp(d.width);
WearScreenUtil._screenHeight = px2vp(d.height);
} catch (e) {
... | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 0368d8e8ba8f7e3642924c1217a6f95d59c20e55 | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibratePattern | 按自定义振动序列触发振动(pattern模式)
可实现长短交替、渐强渐弱等复杂振动效果
@param durations 振动时长序列,单位ms,例如 [100, 50, 200] 表示振100ms→停50ms→振200ms
@param count 序列重复次数,默认1;-1表示无限重复(需手动stop)
@param usage 振动场景,默认TOUCH | static vibratePattern(
durations: number[],
count: number = 1,
usage: VibrationUsage = VibrationUsage.TOUCH
): void {
if (!VibratorManager.isEnabled()) {
return;
}
VibratorManager.logExecution(`vibratePattern([${durations.join(',')}], count=${count})`);
if (!durations || durations.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibratePattern AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durations AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | static vibratePattern(
durations: number[],
count: number = 1,
usage: VibrationUsage = VibrationUsage.TOUCH
): void {
if (!VibratorManager.isEnabled()) {
return;
}
VibratorManager.logExecution(`vibratePattern([${durations.join(',')}], count=${count})`);
if (!durations || durations.... | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | f5a686b56d5bb08eb091056a6e5f1529c2bd356f | github |
LZZLHY/hlib | entry/src/main/ets/utils/AppRouter.ets | arkts | bind | RootPage 在 aboutToAppear 时调一次。 | static bind(stack: NavPathStack): void {
AppRouter.stack = stack;
Logger.i(TAG, 'pathStack bound');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left bind AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | static bind(stack: NavPathStack): void {
AppRouter.stack = stack;
Logger.i(TAG, 'pathStack bound');
} | https://github.com/LZZLHY/hlib | a02d7dbea70400ffbfbe29d6f5488fe9bbc9bb18 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | leftThumbUpdate | 更新左边滑块位置 | leftThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
// 左边距
if (deltaPx <= 0 && ((this.leftThumbRect[0] + deltaPx) <= this.leftPadding)) {
deltaPx = this.leftPadding - this.leftThumbRect[0];
}
// 右边距
if (deltaPx >= 0 && ((this.leftThumbRect[2] + deltaPx) >= (this.rightThumbRect[0] - t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left leftThumbUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deltaX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#R... | leftThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
// 左边距
if (deltaPx <= 0 && ((this.leftThumbRect[0] + deltaPx) <= this.leftPadding)) {
deltaPx = this.leftPadding - this.leftThumbRect[0];
}
// 右边距
if (deltaPx >= 0 && ((this.leftThumbRect[2] + deltaPx) >= (this.rightThumbRect[0] - t... | https://github.com/openharmony/applications_app_samples | cd80301c33b7c4fb9977f80e4cf6e0f36d101b15 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.