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 |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/CommentNode.ets | arkts | rawText | 获取原始注释内容 | get rawText(): string {
return this._rawText;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left rawText 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... | get rawText(): string {
return this._rawText;
} | https://github.com/DaLongZhuaZi/manxia | 115aa327740fdec5d94f09047740ec0f51aa29f3 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/PreferenceUtil.ets | arkts | hasValue | 判断首选项
@param key 键
@returns Promise<boolean> | public async hasValue(key: string): Promise<boolean> {
if (this.preferences) {
return this.preferences.has(key)
.catch(() => {
Logger.error(TAG, `判断首选项失败`)
return false
})
} else {
return this.initPreference(PREFERENCES_NAME).then(() => {
return this.has... | 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 hasValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Rig... | public async hasValue(key: string): Promise<boolean> {
if (this.preferences) {
return this.preferences.has(key)
.catch(() => {
Logger.error(TAG, `判断首选项失败`)
return false
})
} else {
return this.initPreference(PREFERENCES_NAME).then(() => {
return this.has... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | c29b77f809b98ac7898003378dcb841f145f79e6 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DataConverter.ets | arkts | toArray | 安全转换数组
@param value - 输入值
@param defaultValue - 默认值
@returns 数组值 | static toArray<T>(value: Object, defaultValue: T[] = []): T[] {
if (value === null || value === undefined) {
return defaultValue;
}
if (Array.isArray(value)) {
return value as T[];
}
logger.warn(TAG, `数组转换失败: ${typeof value},使用默认值`);
return defaultValue;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left toArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right... | static toArray<T>(value: Object, defaultValue: T[] = []): T[] {
if (value === null || value === undefined) {
return defaultValue;
}
if (Array.isArray(value)) {
return value as T[];
}
logger.warn(TAG, `数组转换失败: ${typeof value},使用默认值`);
return defaultValue;
} | https://github.com/DaLongZhuaZi/manxia | 015c1021dc2faec905ffb664271249f621ea22d7 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Utils.ets | arkts | getSizeOfRotatedRectangleByRadians | Returns a recyclable FSize instance.
Represents size of a rotated rectangle by radians.
@param rectangleWidth
@param rectangleHeight
@param radians
@return A Recyclable FSize instance | public static getSizeOfRotatedRectangleByRadians(rectangleWidth: number,
rectangleHeight: number, radians: number): FSize {
return FSize.getInstance(
Math.abs(rectangleWidth * Math.cos(radians)) + Math.abs(rectangleHeight *
Math.sin(radians)),
M... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getSizeOfRotatedRectangleByRadians AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rectangleWidth AST#identifier#Right... | public static getSizeOfRotatedRectangleByRadians(rectangleWidth: number,
rectangleHeight: number, radians: number): FSize {
return FSize.getInstance(
Math.abs(rectangleWidth * Math.cos(radians)) + Math.abs(rectangleHeight *
Math.sin(radians)),
M... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f096693593611e87f6497b8e114da3785510452f | gitee |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | setDrawHighlightCircleEnabled | Sets whether highlight circle should be drawn or not
@Override | public setDrawHighlightCircleEnabled(enabled: boolean): void {
this.mDrawHighlightCircleEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawHighlightCircleEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | public setDrawHighlightCircleEnabled(enabled: boolean): void {
this.mDrawHighlightCircleEnabled = enabled;
} | https://gitee.com/openharmony/developtools_profiler.git | 50e3c289e60026a2343dbca3ab2ddabc23a70265 | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/OperationView.ets | arkts | onChange | Listening for calculatorState change. | onChange(): void {
LogUtil.info(TAG, 'calculatorState: ', this.calculatorState.toString());
if (this.calculatorState === CalculatorState.ANIMATE) {
if (this.result === '') {
AppStorage.set<CalculatorState>('calculatorState', CalculatorState.RESULT);
}
animateTo({
duration: A... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | onChange(): void {
LogUtil.info(TAG, 'calculatorState: ', this.calculatorState.toString());
if (this.calculatorState === CalculatorState.ANIMATE) {
if (this.result === '') {
AppStorage.set<CalculatorState>('calculatorState', CalculatorState.RESULT);
}
animateTo({
duration: A... | https://gitee.com/openharmony-sig/applications_calculator.git | 4e3413ac73c7441f05fdfc46654d192cc5d5b64b | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test18_original_index.ets | arkts | insertionSort | --- Insertion sort --- | function insertionSort(arr: number[]): number[] {
let n: number = arr.length;
for (let i: number = 1; i < n; i++) {
let key: number = arr[i];
let j: number = i - 1;
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
}
return arr;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left insertionSort AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function insertionSort(arr: number[]): number[] {
let n: number = arr.length;
for (let i: number = 1; i < n; i++) {
let key: number = arr[i];
let j: number = i - 1;
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
}
return arr;
} | https://github.com/miaochiahao/ark-ghidra | 0475c220ee67d1f279363e8d657c2539fcfc171a | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/VocabularyTracker.ets | arkts | getRecordsByStatus | 根据状态获取词汇 | getRecordsByStatus(status: WordStatus): VocabularyRecord[] {
return this.getAllRecords().filter(
(record: VocabularyRecord): boolean => record.status === status
);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getRecordsByStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left statu... | getRecordsByStatus(status: WordStatus): VocabularyRecord[] {
return this.getAllRecords().filter(
(record: VocabularyRecord): boolean => record.status === status
);
} | https://github.com/CLMC2025/Vignette | 82bd2834197390d0b2c18b497d8f909811d9fc20 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/RequestQueue.ets | arkts | replaceTempDeviceId | After temp-device-id mode ends, replace the placeholder `device_id=` value
in queued requests with the new real ID so they can be sent. Uses an
anchored regex so a user-set custom property value that happens to
contain the literal `CLYTemporaryDeviceID` is NOT rewritten, only the
query param itself is matched. | public async replaceTempDeviceId(realId: string): Promise<void> {
const encodedPlaceholder: string = encodeURIComponent(TEMP_DEVICE_ID);
const encodedReal: string = encodeURIComponent(realId);
// Anchored: match `device_id=VALUE` only at start-of-string or after `&`,
// and only up to the next `&` (or... | 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 replaceTempDeviceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left realId AST#identifier#Right AST#:#Le... | public async replaceTempDeviceId(realId: string): Promise<void> {
const encodedPlaceholder: string = encodeURIComponent(TEMP_DEVICE_ID);
const encodedReal: string = encodeURIComponent(realId);
// Anchored: match `device_id=VALUE` only at start-of-string or after `&`,
// and only up to the next `&` (or... | https://github.com/Countly/countly-sdk-hos | ae9189e8430691df510bb0a6217d439eeeb06dd2 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | setValueFormatter | Sets the formatter to be used for formatting the axis labels. If no formatter is set, the
chart will
automatically determine a reasonable formatting (concerning decimals) for all the values
that are drawn inside
the chart. Use chart.getDefaultValueFormatter() to use the formatter calculated by the chart.
@param f | public setValueFormatter(f: IAxisValueFormatter): void {
if (!f || f == null)
this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals);
else
this.mAxisValueFormatter = f;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValueFormatter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left f AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left I... | public setValueFormatter(f: IAxisValueFormatter): void {
if (!f || f == null)
this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals);
else
this.mAxisValueFormatter = f;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 9bf89c19f9dfe45e5e70e45fef7dbec16f9d32f5 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsService.ets | arkts | parsePerfOverlayPosition | 解析性能覆盖层位置 | private parsePerfOverlayPosition(positionStr: string): PerfOverlayPosition {
switch (positionStr) {
case '顶部':
return PerfOverlayPosition.TOP;
case '底部':
return PerfOverlayPosition.BOTTOM;
case '左上角':
return PerfOverlayPosition.TOP_LEFT;
case '右上角':
return P... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parsePerfOverlayPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left positionStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left s... | private parsePerfOverlayPosition(positionStr: string): PerfOverlayPosition {
switch (positionStr) {
case '顶部':
return PerfOverlayPosition.TOP;
case '底部':
return PerfOverlayPosition.BOTTOM;
case '左上角':
return PerfOverlayPosition.TOP_LEFT;
case '右上角':
return P... | https://github.com/AlkaidLab/moonlight-harmony | a0feb52ae60cc677956d5af22a1e4f7a7ca8cd78 | github |
LongLiveY96/chatcube | entry/src/main/ets/pages/ChatPage.ets | arkts | expandPendingToolApproval | 提供给 SnackBar action 调用: 用户主动展开折叠的待确认工具调用。 | expandPendingToolApproval(): void {
this.dismissedPendingToolCallId = ''
this.syncPendingToolInteractionFromService()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left expandPendingToolApproval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#st... | expandPendingToolApproval(): void {
this.dismissedPendingToolCallId = ''
this.syncPendingToolInteractionFromService()
} | https://github.com/LongLiveY96/chatcube | 4b53b265b6a930f0dc5ee1a0efdc2f329fb07ab4 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/view/AIFloatingButton.ets | arkts | getButtonIcon | Get the appropriate icon based on current state | getButtonIcon(): Resource {
if (this.hasCoupon) {
return $r('app.media.ic_coupon_dog');
}
if (this.isDocked && !this.isDragging && !this.isExpanded) {
if (this.isOnLeftSide) {
return $r('app.media.ic_dog_dock_left');
} else {
return $r('app.media.ic_dog_dock_right');
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getButtonIcon 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 Resource AST#identifier#Right AST#ERROR#Right AS... | getButtonIcon(): Resource {
if (this.hasCoupon) {
return $r('app.media.ic_coupon_dog');
}
if (this.isDocked && !this.isDragging && !this.isExpanded) {
if (this.isOnLeftSide) {
return $r('app.media.ic_dog_dock_left');
} else {
return $r('app.media.ic_dog_dock_right');
... | https://github.com/Harrisonls2004/WaterFlow | cb2f9a351c4fb2c0536530ab74e1d0054a9afc7c | github |
egavrin/arkts_agent_kit | examples/fslib/src/tests/fslib.test.ets | arkts | testPromiseReadText | --- Promise / FileSystemAsync --- | async function testPromiseReadText(): Promise<void> {
ensureSetup()
let afs: FileSystemAsync = new FileSystemAsync()
let fpath: string = TMPDIR + "/async.txt"
await afs.writeText(fpath, "async write")
let content: string = await afs.readText(fpath)
arktest.assertEQ(content, "async write")
le... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left testPromiseReadText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left... | async function testPromiseReadText(): Promise<void> {
ensureSetup()
let afs: FileSystemAsync = new FileSystemAsync()
let fpath: string = TMPDIR + "/async.txt"
await afs.writeText(fpath, "async write")
let content: string = await afs.readText(fpath)
arktest.assertEQ(content, "async write")
le... | https://gitcode.com/egavrin/arkts_agent_kit | 3c7dadc69de0348f09880ed23f0bc3a93a5d99df | gitcode |
openharmony/codelabs | ETSUI/RoundThreadScheduler/entry/src/main/ets/pages/Index.ets | arkts | build | ======================
UI 构建
====================== | build() {
Column() {
Text('ArkTS 多任务轮次安全调度示例')
.fontSize(22)
.fontWeight(FontWeight.Bold)
.margin({ bottom: 20 })
Text(`状态:${this.statusText}`)
.fontSize(16)
.fontColor(this.getStatusColor())
.margin({ bottom: 10 })
Text(`当前轮次:${this.currentRound... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Text('ArkTS 多任务轮次安全调度示例')
.fontSize(22)
.fontWeight(FontWeight.Bold)
.margin({ bottom: 20 })
Text(`状态:${this.statusText}`)
.fontSize(16)
.fontColor(this.getStatusColor())
.margin({ bottom: 10 })
Text(`当前轮次:${this.currentRound... | https://gitcode.com/openharmony/codelabs | cc9da182d428b4b0081aa578b6e1aed190d82a0d | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleFeedback.ets | arkts | onFeedbackClosedByUser | Called by the overlay when the user dismisses via SDK-drawn close. | public onFeedbackClosedByUser(): void {
this.closeOverlayFromProtocol();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onFeedbackClosedByUser 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... | public onFeedbackClosedByUser(): void {
this.closeOverlayFromProtocol();
} | https://github.com/Countly/countly-sdk-hos | 558275064e190ed63886e8ef05e69768c437edd8 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | set | Copies all elements of arr to the current Uint8Array starting from insertPos.
@param arr array to copy data from
@param insertPos start index where data from arr will be inserted
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} | public set(arr: number[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8Array.length")
}
for (let i = ... | 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: number[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8Array.length")
}
for (let i = ... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7a13c25d0f0df88b4d099f74433e8efb2c7a6134 | gitee |
codelably/HCompass | core/module/src/main/ets/ModuleRegistry.ets | arkts | destroy | 销毁所有模块 | destroy(): void {
for (const entry of this.modules.entries()) {
const moduleId = entry[0];
const info = entry[1];
if (info.module.onDestroy) {
try {
info.module.onDestroy();
this.log(`Module destroyed: ${moduleId}`);
} catch (error) {
this.logError(`... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left destroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | destroy(): void {
for (const entry of this.modules.entries()) {
const moduleId = entry[0];
const info = entry[1];
if (info.module.onDestroy) {
try {
info.module.onDestroy();
this.log(`Module destroyed: ${moduleId}`);
} catch (error) {
this.logError(`... | https://github.com/codelably/HCompass | 9c7d934673f888e4c4efd474696a2e95f93b0f74 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | $_invoke | Constructs a new AggregateError instance with provided message and error specific information
@param { Error[] } errors - Errors to be aggregated
@param { String } [message] - Error text
@param { ErrorOptions } [options] - Error options
@returns { AggregateError } - Newly created AggregateError instance
@static
@syscap... | static $_invoke(errors: Error[], message?: String, options?: ErrorOptions): AggregateError {
return new AggregateError(errors, message, options)
} | 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#ERROR#Left AST#identifier#Left errors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#... | static $_invoke(errors: Error[], message?: String, options?: ErrorOptions): AggregateError {
return new AggregateError(errors, message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 0f6fda2c3749ae0f3e5c21c13609ee71e58e8870 | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/SessionApi.ets | arkts | addUserToSession | addUserToSession
@summary Adds an additional user to a session.
@param {SessionApiAddUserToSessionRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof SessionApi | public async addUserToSession(requestParameters: SessionApiAddUserToSessionRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.userId)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/User/${requestParameters.userId}`, param... | 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 addUserToSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ... | public async addUserToSession(requestParameters: SessionApiAddUserToSessionRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.userId)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/User/${requestParameters.userId}`, param... | https://github.com/OHPG/FinSdk | d37b9698919227ab7f499f12bfa702ad13f1da66 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | having | 设置 HAVING 子句
@param clause HAVING 条件(使用 ? 作为占位符)
@param args 参数数组
@returns 当前实例(支持链式调用) | having(clause: string, args: Array<ValueType> = []): QueryBuilder {
const normalizedClause = validateAndNormalizeHavingClause(clause, args)
this.havingClause = normalizedClause
this.havingArgs = args.slice()
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left having AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left clause AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#... | having(clause: string, args: Array<ValueType> = []): QueryBuilder {
const normalizedClause = validateAndNormalizeHavingClause(clause, args)
this.havingClause = normalizedClause
this.havingArgs = args.slice()
return this
} | https://github.com/offlinecat-dev/OCNetORM | 97747e09c65510cdcb755037b087cb7a505e98b3 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | resetZoom | Zooms out to original size. | public resetZoom(): void {
this.mViewPortHandler.resetZoom(this.mZoomMatrixBuffer);
this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false);
// Range might have changed, which means that Y-axis labels
// could have changed in size, affecting Y-axis size.
// So we need to recalculate o... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetZoom 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 resetZoom(): void {
this.mViewPortHandler.resetZoom(this.mZoomMatrixBuffer);
this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false);
// Range might have changed, which means that Y-axis labels
// could have changed in size, affecting Y-axis size.
// So we need to recalculate o... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0e17d2dc6627a74315c65ca05d1fcbd134523757 | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | removeTag | 移除标签
@param documentId 文档ID
@param tag 标签名 | async removeTag(documentId: string, tag: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/knowledge/documents/${documentId}/tags/${encodeURIComponent(tag)}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeTag AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documentId AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async removeTag(documentId: string, tag: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/knowledge/documents/${documentId}/tags/${encodeURIComponent(tag)}`)
} | https://github.com/David8Idira/AI-OA | d31ed77a6a4acef5374c3bbc0bc1fac2f0529b6c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an array-like or iterable object.
@param { ArrayLike<number> } arrayLike - An array-like or iterable object to convert to an array.
@returns { Int8Array } - A new Int8Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arrayLike: ArrayLike<number>): Int8Array {
return Int8Array.from<number>(arrayLike, (x: number, k: number): number => x)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arrayLike AST#identifie... | public static from(arrayLike: ArrayLike<number>): Int8Array {
return Int8Array.from<number>(arrayLike, (x: number, k: number): number => x)
} | https://gitcode.com/iop123123/arkts-static-skills | 075e46e7659cdab813dd95e4d3be6e4f7c4c4b7f | gitcode |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/bridge/MockWriterCoreBridge.ets | arkts | resolveScreenPolicy | Screen Policy methods — mock 返回与 Core 一致的策略 | resolveScreenPolicy(screenRole: ScreenRole, shellMode: ShellMode): Promise<ResultEnvelope<ScreenPolicy>> {
const policy = this.mockResolveScreenPolicy(screenRole, shellMode)
return Promise.resolve(this.success(policy))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resolveScreenPolicy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left screenRole AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ScreenRole AST#identifier#Righ... | resolveScreenPolicy(screenRole: ScreenRole, shellMode: ShellMode): Promise<ResultEnvelope<ScreenPolicy>> {
const policy = this.mockResolveScreenPolicy(screenRole, shellMode)
return Promise.resolve(this.success(policy))
} | https://github.com/Xiwei753/xiezuoruanjian | 30744f23ea5c793552c2735deecba968bcc81bf0 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | in | 字段的值,在给定的集合中
@param field 字段
@param value 值的数组
@returns Wrapper | in(field: string, value: relationalStore.ValueType[], condition: boolean = true): Wrapper {
if (condition) {
const str = new Array(value.length).fill('?').join(',')
this.whereList.push(`and ${field} in (${str})`)
this.valueList.push(...value)
}
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left in AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right... | in(field: string, value: relationalStore.ValueType[], condition: boolean = true): Wrapper {
if (condition) {
const str = new Array(value.length).fill('?').join(',')
this.whereList.push(`and ${field} in (${str})`)
this.valueList.push(...value)
}
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L68-L75 | c095821b1c3e030b2553c7c76baa97834866a115 | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | customScanCallback | 扫码结果回调
@param {Array<scanBarcode.ScanResult>} result 扫码结果数据
@returns {void} | customScanCallback(result: scanBarcode.ScanResult[]): void {
if (!this.isScanned) {
this.scanResult.code = 0;
this.scanResult.data = result || [];
let resultLength: number = result ? result.length : 0;
if (resultLength) {
// 停止扫描
this.stopCustomScan();
// 标记扫描状态,触发U... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left customScanCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#member_expression#Lef... | customScanCallback(result: scanBarcode.ScanResult[]): void {
if (!this.isScanned) {
this.scanResult.code = 0;
this.scanResult.data = result || [];
let resultLength: number = result ? result.length : 0;
if (resultLength) {
// 停止扫描
this.stopCustomScan();
// 标记扫描状态,触发U... | https://gitcode.com/arkui-x/samples | e146c71aa4eea7c48f3e0a468b139b426d6fc070 | gitcode |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/LyricManager.ets | arkts | setContext | 在 EntryAbility 或程序入口调用 | setContext(ctx: common.UIAbilityContext) {
this.context = ctx
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left comm... | setContext(ctx: common.UIAbilityContext) {
this.context = ctx
} | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/LyricManager.ets#L9-L11 | 8c28d0d6bf1f97e5eb460af207051c5d7813b0d0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Network/ProxyManager.ets | arkts | testSingleUrl | 测试单个URL
@param url 要测试的URL | async testSingleUrl(url: string): Promise<ProxyTestResult> {
return await this.testProxy(url);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left testSingleUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async testSingleUrl(url: string): Promise<ProxyTestResult> {
return await this.testProxy(url);
} | https://github.com/DaLongZhuaZi/manxia | daaef9acb42b26955dd9244c817ee22c32776dba | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets | arkts | build | 构建屏幕适配示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_screen_adapt_title"),
viewModel: this.vm
}) {
this.ScreenAdaptContent();
}
} | 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: $r("app.string.demo_screen_adapt_title"),
viewModel: this.vm
}) {
this.ScreenAdaptContent();
}
} | https://github.com/Joker-x-dev/HarmonyKit | 23ab60d79969b0642496e843ecb94f9d9b79c0a2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | saveUserSetting | 保存用户设置
@param userId 用户ID
@param key 设置键名
@param value 设置值(JSON字符串) | public async saveUserSetting(userId: string, key: string, value: string): Promise<void> {
try {
const now = Date.now();
// 使用INSERT OR REPLACE确保设置能被更新
const sql = `
INSERT OR REPLACE INTO user_settings
(userId, settingKey, settingValue, settingType, createTime, updateTime... | 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 saveUserSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left :... | public async saveUserSetting(userId: string, key: string, value: string): Promise<void> {
try {
const now = Date.now();
// 使用INSERT OR REPLACE确保设置能被更新
const sql = `
INSERT OR REPLACE INTO user_settings
(userId, settingKey, settingValue, settingType, createTime, updateTime... | https://github.com/DaLongZhuaZi/manxia | c0d69aa3444fdb1206a28d4c22065498dca3b2e8 | github |
openharmony/arkui_ace_engine | examples/Accessibility/AccessibilityCapi/entry/src/main/ets/pages/Index.ets | arkts | ScenarioDestinationBuilder | 场景页面构建器
根据路由名称匹配并渲染对应的场景页面 | @Builder
function ScenarioDestinationBuilder(name: string) {
if (name.startsWith(SCENARIO_ROUTE_PREFIX)) {
ScenarioPage({ routeName: name });
}
} | 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 ScenarioDestinationBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#... | @Builder
function ScenarioDestinationBuilder(name: string) {
if (name.startsWith(SCENARIO_ROUTE_PREFIX)) {
ScenarioPage({ routeName: name });
}
} | https://gitcode.com/openharmony/arkui_ace_engine | 796f53afb935e5776efff1cacc09078cd1c5d166 | gitcode |
openharmony-sig/arkui_composite_component | source/TreeView/TreeView.ets | arkts | addNode | Initialize the interface of the tree view. This interface is used to generate ListNodeDataSource data.
addNode is only designed for initialization. It can only be invoked during initialization.
A maximum of 50 directory levels can be added.
@param parentNodeId ID of the parent node.
@param currentNodeId ID of the new n... | public addNode(nodeParam?: NodeParam): TreeController {
if (nodeParam == null) {
this.add();
} else {
if (nodeParam.primaryTitle != null &&
!this.listNodeUtils.checkMainTitleIsValid(nodeParam.primaryTitle)) {
throw new Error('ListTreeNode[addNode]: ' +
'Th... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeParam AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Righ... | public addNode(nodeParam?: NodeParam): TreeController {
if (nodeParam == null) {
this.add();
} else {
if (nodeParam.primaryTitle != null &&
!this.listNodeUtils.checkMainTitleIsValid(nodeParam.primaryTitle)) {
throw new Error('ListTreeNode[addNode]: ' +
'Th... | https://gitee.com/openharmony-sig/arkui_composite_component.git | 7b14c014aeea69219f36f9faf8b1b1d2e310857a | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<number> } items - a set of elements to include in the new array object.
@returns { Uint16Array } - a new Uint16Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<number>): Uint16Array {
let res = new Uint16Array(items.length.toInt())
res.ofNumber(stub.toValueArray(items))
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<number>): Uint16Array {
let res = new Uint16Array(items.length.toInt())
res.ofNumber(stub.toValueArray(items))
return res
} | https://gitcode.com/iop123123/arkts-static-skills | a6c8062b76a02446d07c32aa59850d10694f30c8 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getSourceIconCacheDir | 获取图源图标缓存目录 | private getSourceIconCacheDir(): string {
return DownloadDirManager.ensureDirectory('suwayomi/source_icons');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSourceIconCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left s... | private getSourceIconCacheDir(): string {
return DownloadDirManager.ensureDirectory('suwayomi/source_icons');
} | https://github.com/DaLongZhuaZi/manxia | 6c0cd9561fb043c211f2205d5b897ba31fc6d9a4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | handleShareImport | 处理系统分享导入 | private handleShareImport(want: Want): void {
if (!want.parameters) {
return;
}
const shareFiles = want.parameters['share_import_files'] as string[];
const shareType = want.parameters['share_import_type'] as string;
const shareSource = want.parameters['share_import_source'] as string;
c... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleShareImport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private handleShareImport(want: Want): void {
if (!want.parameters) {
return;
}
const shareFiles = want.parameters['share_import_files'] as string[];
const shareType = want.parameters['share_import_type'] as string;
const shareSource = want.parameters['share_import_source'] as string;
c... | https://github.com/DaLongZhuaZi/manxia | 2f21fb94e78fc2603bb59a1dc4ea9c8ca5591384 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/products/phone/src/main/ets/view/HomeView.ets | arkts | changeTabStatus | 改变标签栏状态
@param index number | changeTabStatus(index: number) {
AppStorage.setOrCreate(StorageKeyEnum.CURRENT_TAB, index)
const selectedIndex = index
const isSystemDark: boolean = (this.systemColorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK)
if (selectedIndex === TabBarTypeEnum.SETTINGS || this.globalInfoModel.currentB... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeTabStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Ri... | changeTabStatus(index: number) {
AppStorage.setOrCreate(StorageKeyEnum.CURRENT_TAB, index)
const selectedIndex = index
const isSystemDark: boolean = (this.systemColorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK)
if (selectedIndex === TabBarTypeEnum.SETTINGS || this.globalInfoModel.currentB... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | c73a3fbf4ca59ebfdc794938cadc435948eb3595 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets | arkts | applyModePreset | ---------------------------------------------------------------------------
内部
--------------------------------------------------------------------------- | private applyModePreset(mode: string): void {
switch (mode) {
case 'quality':
// 画质优先:高下限,慢降快升
this.minBitrate = Math.max(5000, this.initialBitrate * 0.5);
this.maxBitrate = Math.min(150000, this.initialBitrate * 1.5);
break;
case 'lowLatency':
// 低延迟优先:低下限,快降慢升... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyModePreset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private applyModePreset(mode: string): void {
switch (mode) {
case 'quality':
// 画质优先:高下限,慢降快升
this.minBitrate = Math.max(5000, this.initialBitrate * 0.5);
this.maxBitrate = Math.min(150000, this.initialBitrate * 1.5);
break;
case 'lowLatency':
// 低延迟优先:低下限,快降慢升... | https://github.com/AlkaidLab/moonlight-harmony | 5a6b34d80ca1ebce97588f4053d20b7feab7d971 | github |
openharmony/xts_tools | sample/AppSampleD/entry/src/main/ets/component/SearchComponent.ets | arkts | build | 点击Item改变此值以展示搜索结果页面 | build() {
Column() {
Scroll(this.scroller) {
Column({ space: 4 }) {
ForEach(this.searchArr, (item: string, index: number) => {
Row() {
Image($r('app.media.app_icon'))
.width(18)
.height(18)
.objectFit(ImageFit.Contai... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Scroll(this.scroller) {
Column({ space: 4 }) {
ForEach(this.searchArr, (item: string, index: number) => {
Row() {
Image($r('app.media.app_icon'))
.width(18)
.height(18)
.objectFit(ImageFit.Contai... | https://gitee.com/openharmony/xts_tools.git | 9ab416aba7ca03ff2e7026ee9c620afe05c683fe | gitee |
CLMC2025/Vignette | entry/src/main/ets/ui/Animations.ets | arkts | Bounce | 弹跳动画组件 | @Builder
function Bounce(
key: string,
duration: number = 500,
progress: number
): void {
Column() {
// 内容直接嵌入
}
.scale({
x: 1 + Math.sin(progress * Math.PI * 2) * 0.1,
y: 1 + Math.sin(progress * Math.PI * 2) * 0.1
})
.animation({
duration: duration,
curve: Curve.EaseOut,
iterati... | 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 Bounce AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_p... | @Builder
function Bounce(
key: string,
duration: number = 500,
progress: number
): void {
Column() {
// 内容直接嵌入
}
.scale({
x: 1 + Math.sin(progress * Math.PI * 2) * 0.1,
y: 1 + Math.sin(progress * Math.PI * 2) * 0.1
})
.animation({
duration: duration,
curve: Curve.EaseOut,
iterati... | https://github.com/CLMC2025/Vignette | f8563bb5d3c5775bcbc783482b65d7e66b48cffb | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationListController.ets | arkts | getSettingFlagForConvListPage | Obtains the switch value for integrating notification information and displaying contact avatars. | getSettingFlagForConvListPage() {
let that = this;
let result = SettingService.getSettingFlagForConvListPage();
if (result) {
that.hasAggregate = result.hasAggregate;
that.isShowContactHeadIcon = result.isShowContactHeadIcon;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSettingFlagForConvListPage 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#stat... | getSettingFlagForConvListPage() {
let that = this;
let result = SettingService.getSettingFlagForConvListPage();
if (result) {
that.hasAggregate = result.hasAggregate;
that.isShowContactHeadIcon = result.isShowContactHeadIcon;
}
} | https://gitee.com/openharmony/applications_mms.git | 48d91f19fbbfdc3924e13340745639b3b8d81cba | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets | arkts | getPageManager | 获取页面管理器 | getPageManager(pageId: string): IPageManager | undefined {
return this.pageManagers.get(pageId);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getPageManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | getPageManager(pageId: string): IPageManager | undefined {
return this.pageManagers.get(pageId);
} | https://github.com/DaLongZhuaZi/manxia | 4c3938e60b927f0c4bb102e2e277b30b20a670a6 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setCustomYAxisLabels | Set Y-axis custom labels
@param numbers labels | public setCustomYAxisLabels(numbers: number[]): void {
this.customYAxisLabels = numbers;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCustomYAxisLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscrip... | public setCustomYAxisLabels(numbers: number[]): void {
this.customYAxisLabels = numbers;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f3af892fa749d684cacd07b279034bc9a4b59009 | gitee |
openharmony/codelabs | Data/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets | arkts | jumpToAppHomePage | Jump to app home page. | jumpToAppHomePage(): void {
router.pushUrl({
url: CommonConstants.APP_HOME_PAGE_URL
}).catch((error: Error) => {
Logger.error(CommonConstants.ADVERTISING_PAGE_TAG, 'AdvertisingPage pushUrl error ' + JSON.stringify(error));
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left jumpToAppHomePage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_... | jumpToAppHomePage(): void {
router.pushUrl({
url: CommonConstants.APP_HOME_PAGE_URL
}).catch((error: Error) => {
Logger.error(CommonConstants.ADVERTISING_PAGE_TAG, 'AdvertisingPage pushUrl error ' + JSON.stringify(error));
});
} | https://gitee.com/openharmony/codelabs.git | 2a79781e38f08130ad7869fb688a26ccbd47e590 | gitee |
openharmony/applications_notes | features/src/main/ets/components/NoteListComp.ets | arkts | deleteData | 删除列表中的对象 | public deleteData(data: NoteData): void {
LogUtil.info(TAG, `delete data , data = ${data.id}}`);
let index = this.indexOf(data);
this.deleteDataByIndex(index);
}; | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NoteD... | public deleteData(data: NoteData): void {
LogUtil.info(TAG, `delete data , data = ${data.id}}`);
let index = this.indexOf(data);
this.deleteDataByIndex(index);
}; | https://gitee.com/openharmony/applications_notes.git | 9cbcbe035665bfea9630c8bf90b53bdc11abde9a | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setMinutes | Sets the minutes for a specified date according to local time.
@param { int } value new minutes
@param { int } sec
@param { int } ms
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setMinutes(value: int, sec: int, ms: int): long {
this.setMinutes(value);
this.setSeconds(sec);
this.setMilliseconds(ms);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinutes 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#R... | public setMinutes(value: int, sec: int, ms: int): long {
this.setMinutes(value);
this.setSeconds(sec);
this.setMilliseconds(ms);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | ae917f6b1043c9877394aef62b812981083fcc06 | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/view/PlaybackPage.ets | arkts | getImageColor | Entry point: kicks off async album-color extraction without blocking UI. | getImageColor(): void {
void this.getImageColorAsync();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getImageColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | getImageColor(): void {
void this.getImageColorAsync();
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | a73ad25086cbe0843b5dc2d2f5d82201664263a5 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | AvoidTimeComsume/entry/src/main/ets/views/NegativeOfGrid.ets | arkts | count | [Start negative_of_grid]
[StartExclude negative_of_grid]
[EndExclude negative_of_grid]
Simulate time-consuming operations with loop functions | count(): number {
let temp: number = 0;
for (let index = 0; index < 1000000; index++) {
temp += 1;
}
return temp;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left count AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block#... | count(): number {
let temp: number = 0;
for (let index = 0; index < 1000000; index++) {
temp += 1;
}
return temp;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 9821256a3136218e0a3c797d12bcb2e828cac6a3 | gitcode |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/SshClient.ets | arkts | sftpDelete | Delete a remote file. | async sftpDelete(path: string): Promise<void> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
await ssh.sftpDelete(this.handle, path);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP delete failed';
const error = new SshError(msg, th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpDelete AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Lef... | async sftpDelete(path: string): Promise<void> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
await ssh.sftpDelete(this.handle, path);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP delete failed';
const error = new SshError(msg, th... | https://github.com/UnbalancedCat/ohos-ssh-core | 015dbf34c51077d11772765af72d517ce3d769c3 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RomParser.ets | arkts | parseRom | 解析 ROM 文件获取元数据
@param filePath ROM 文件路径
@returns ROM 元数据,解析失败返回 null | static async parseRom(filePath: string): Promise<RomMetadata | null> {
let file: fileIo.File | null = null;
try {
// 打开文件
file = fileIo.openSync(filePath, fileIo.OpenMode.READ_ONLY);
// 读取 header (前 0x200 字节)
const headerBuffer = new ArrayBuffer(0x200);
const headerRead = fileI... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseRom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async parseRom(filePath: string): Promise<RomMetadata | null> {
let file: fileIo.File | null = null;
try {
// 打开文件
file = fileIo.openSync(filePath, fileIo.OpenMode.READ_ONLY);
// 读取 header (前 0x200 字节)
const headerBuffer = new ArrayBuffer(0x200);
const headerRead = fileI... | https://github.com/richshaw2015/nds | c2ec84c65caf836bdb23757b3c71cc041643a0ce | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/EventSourcingDAO.ets | arkts | deleteOldSnapshots | 删除旧快照 | static async deleteOldSnapshots(
aggregateType: string,
aggregateId: number,
keepLatestN: number = 5
): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
// 获取要保留的版本号
const sql = `
SELECT version FROM ${AggregateSnapshot.tableName}
WHERE aggregat... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left deleteOldSnapshots AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left AS... | static async deleteOldSnapshots(
aggregateType: string,
aggregateId: number,
keepLatestN: number = 5
): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
// 获取要保留的版本号
const sql = `
SELECT version FROM ${AggregateSnapshot.tableName}
WHERE aggregat... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 2a0a15683292db6dd5cb0b577e18b71941d247e8 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/CryptoDemo.ets | arkts | signRsa | rsa 私钥签名
注:如果源数据较大,可以对源数据的哈希值做签名 | public static signRsa(plainData: Uint8Array, privateKeyData: Uint8Array): Uint8Array {
let plainBlog: cryptoFramework.DataBlob = { data: plainData };
let privateKey = CryptoHelper.getRsaKeyPair(null, privateKeyData).priKey
let sign = cryptoFramework.createSign("RSA1024|PKCS1|SHA256");
sign.initSync(p... | 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 signRsa AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left plainData AST#identifier#Right AST#:#Left : AST... | public static signRsa(plainData: Uint8Array, privateKeyData: Uint8Array): Uint8Array {
let plainBlog: cryptoFramework.DataBlob = { data: plainData };
let privateKey = CryptoHelper.getRsaKeyPair(null, privateKeyData).priKey
let sign = cryptoFramework.createSign("RSA1024|PKCS1|SHA256");
sign.initSync(p... | https://github.com/webabcd/HarmonyDemo | ad0698492a154d4f796a08a8e5d74004a3421a60 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/MainShell.ets | arkts | build | 渲染主壳层页面与底部导航栏。 | build() {
SafeAreaInsetLayout({
includeTop: false,
includeBottom: false,
surfaceColor: this.app.theme.palette.background
}) {
Column() {
Column() {
this.buildCurrentTabPage();
}
.layoutWeight(1)
.width('100%');
BottomTabBar({
... | 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() {
SafeAreaInsetLayout({
includeTop: false,
includeBottom: false,
surfaceColor: this.app.theme.palette.background
}) {
Column() {
Column() {
this.buildCurrentTabPage();
}
.layoutWeight(1)
.width('100%');
BottomTabBar({
... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/MainShell.ets#L47-L74 | a6165c1fd4119556fbca2b6dd7a9cf9cee8b6e82 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/OCRRecognitionService.ets | arkts | generateSuggestedBill | ==================== 账单生成 ====================
根据OCR结果生成建议账单 | static async generateSuggestedBill(recordId: number): Promise<SuggestedBillData | null> {
try {
const record = await OCRRecognitionRecordDAO.getById(recordId);
if (!record) {
throw new Error('识别记录不存在');
}
const reviewReasons: string[] = [];
// 检查需要人工审核的情况
if (record.c... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left generateSuggestedBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#... | static async generateSuggestedBill(recordId: number): Promise<SuggestedBillData | null> {
try {
const record = await OCRRecognitionRecordDAO.getById(recordId);
if (!record) {
throw new Error('识别记录不存在');
}
const reviewReasons: string[] = [];
// 检查需要人工审核的情况
if (record.c... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 98a5ccb7b2d4ce1f8c2f6b14c0a3a84938cab9ff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | getJSON | 获取JSON对象设置 | getJSON<T>(key: string, defaultValue: T): T {
const value = this.settingsCache.get(key);
if (!value) {
return defaultValue;
}
try {
return SafeUtils.parseObj(value) as T;
} catch (error) {
logger.error(TAG, `解析JSON设置失败: ${key}`, String(error));
return defaultValue;
}
... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left getJSON AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identif... | getJSON<T>(key: string, defaultValue: T): T {
const value = this.settingsCache.get(key);
if (!value) {
return defaultValue;
}
try {
return SafeUtils.parseObj(value) as T;
} catch (error) {
logger.error(TAG, `解析JSON设置失败: ${key}`, String(error));
return defaultValue;
}
... | https://github.com/DaLongZhuaZi/manxia | 402d4c7565a3cb24358cc9ffe77996bc20df8efe | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Float32Array using range [begin, this.length).
@param begin start index to be taken into slice
@returns a new Float32Array with elements of current Float32Array[begin, this.length) | public slice(begin: number): Float32Array {
return this.slice(begin as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number): Float32Array {
return this.slice(begin as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f16bd1a6dd0e6e2b9e0d1ecc242112a78f5b4796 | gitee |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets | arkts | executeDartCallback | Starts executing Dart code based on the given {@code dartCallback}.
<p>See {@link DartCallback} for configuration options.
@param dartCallback specifies which Dart callback to run, and where to find it | executeDartCallback(dartCallback: DartCallback): void {
if (this.isApplicationRunning) {
Log.w(TAG, "Attempted to run a DartExecutor that is already running.");
return;
}
let traceId: number = TraceSection.begin("DartExecutor#executeDartCallback");
try {
Log.d(TAG, "Executing Dart c... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left executeDartCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dartCallback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DartCallback AST#identifier#... | executeDartCallback(dartCallback: DartCallback): void {
if (this.isApplicationRunning) {
Log.w(TAG, "Attempted to run a DartExecutor that is already running.");
return;
}
let traceId: number = TraceSection.begin("DartExecutor#executeDartCallback");
try {
Log.d(TAG, "Executing Dart c... | https://gitee.com/openharmony-sig/flutter_engine.git | 5631aa5cedeb4c5d2ed730c14d275d21853a6a7c | gitee |
zhangmeng1847/RDB | entry/src/main/ets/views/TaskItem.ets | arkts | card | 统一的卡片样式 | @Styles function card(){
.width('95%')
.padding(20)
.backgroundColor(Color.White)
.borderRadius(15)
.shadow({radius: 6, color: '#1F000000', offsetX: 2, offsetY: 4})
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Styles AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left card AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#... | @Styles function card(){
.width('95%')
.padding(20)
.backgroundColor(Color.White)
.borderRadius(15)
.shadow({radius: 6, color: '#1F000000', offsetX: 2, offsetY: 4})
} | https://github.com/zhangmeng1847/RDB | 13e181b557b8dc9a72b25eb687c61a79e840b5f6 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets | arkts | setValueAt | Sets the value at the specified index in the LightWeightMap
@param index the index to set the value at
@param newValue the new value to set at the specified index
@returns true if the value was set
@throws BusinessError if the index is out of range, the container is empty or the index exceeds Int.MAX_VALUE. | setValueAt(index: int, newValue: V): boolean {
this.checkEmptyContainer();
this.checkRange(index, this.buckets.actualLength.toInt());
this.buckets.entryValues[index] = newValue;
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setValueAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#... | setValueAt(index: int, newValue: V): boolean {
this.checkEmptyContainer();
this.checkRange(index, this.buckets.actualLength.toInt());
this.buckets.entryValues[index] = newValue;
return true;
} | https://gitcode.com/iop123123/arkts-static-skills | 4348720d515e3a3260f3fb53f4b0cc2a8a5135a5 | gitcode |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets | arkts | listenCallStateChange | listen call state Change | listenCallStateChange(): void {
const SLOT_TWO = 1;
const SLOT_ONE = 0;
observer.on('callStateChange', { slotId: SLOT_TWO }, value => {
LogUtil.info(TAG, 'on slot two callStateChange, state:' + value.state + ', number:' + value.number);
this.callRingSnoozeCallBack(value.state);
});
obs... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left listenCallStateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statem... | listenCallStateChange(): void {
const SLOT_TWO = 1;
const SLOT_ONE = 0;
observer.on('callStateChange', { slotId: SLOT_TWO }, value => {
LogUtil.info(TAG, 'on slot two callStateChange, state:' + value.state + ', number:' + value.number);
this.callRingSnoozeCallBack(value.state);
});
obs... | https://gitee.com/openharmony-sig/applications_clock.git | b78d58502b3aa59046a9c3eb70d2166af5292eea | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | allocateSlotForGCDevice | 为 Game Controller Kit 设备分配槽位 | private allocateSlotForGCDevice(deviceId: string): number {
return this.allocateSlot(deviceId, this.gcDeviceIdToSlot, 'GAMEPAD-GC');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left allocateSlotForGCDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | private allocateSlotForGCDevice(deviceId: string): number {
return this.allocateSlot(deviceId, this.gcDeviceIdToSlot, 'GAMEPAD-GC');
} | https://github.com/AlkaidLab/moonlight-harmony | 1963765719fe0dfc29660c85a2a20bfbdb625ff0 | github |
azhu0001/localsend-harmony | entry/src/main/ets/utils/FileProvider.ets | arkts | moveFilesToDownload | 移动文件到Download/package文件夹
@param context
@param fileNames 移动的文件名
@returns | static async moveFilesToDownload(context: Context, fileInfos: IMoveFile[], onMoved?: (info: IMoveFile) => void): Promise<number> {
let succeed: number = 0
try {
const documentSaveResult: string[] = await FileProvider.getDownloadSandboxDir(context)
if (documentSaveResult && documentSaveResult.lengt... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left moveFilesToDownload AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | static async moveFilesToDownload(context: Context, fileInfos: IMoveFile[], onMoved?: (info: IMoveFile) => void): Promise<number> {
let succeed: number = 0
try {
const documentSaveResult: string[] = await FileProvider.getDownloadSandboxDir(context)
if (documentSaveResult && documentSaveResult.lengt... | https://gitcode.com/azhu0001/localsend-harmony | 02650f91e8fb9a1aeeac9488b1bcde59d1cdb69d | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | getById | 根据ID查询规则 | static async getById(ruleId: number): Promise<SmartCategoryRule | null> {
try {
await SmartCategoryRuleDAO.ensureSchema();
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SmartCategoryRule.tableName);
predicates.equalTo('rule_id', ruleId).a... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ruleId AST#identifier#Right AST#:#Left : AST#:#R... | static async getById(ruleId: number): Promise<SmartCategoryRule | null> {
try {
await SmartCategoryRuleDAO.ensureSchema();
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SmartCategoryRule.tableName);
predicates.equalTo('rule_id', ruleId).a... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7211eac1472e68a1d644ac704f376e39b5d88692 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets | arkts | decryptManwaImage | 解密 Manwa 加密图片
使用 AES-CBC 解密,密钥和IV都是 "my2ecret782ecret" | private async decryptManwaImage(encryptedBuffer: ArrayBuffer): Promise<ArrayBuffer> {
const keyStr = 'my2ecret782ecret';
const keyData = this.stringToUint8Array(keyStr);
// 创建对称密钥生成器
const symKeyGenerator = cryptoFramework.createSymKeyGenerator('AES128');
const keyBlob: cryptoFramework.DataBl... | 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 decryptManwaImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encryptedBuffer AST#identifier#Right AST#ERROR#Lef... | private async decryptManwaImage(encryptedBuffer: ArrayBuffer): Promise<ArrayBuffer> {
const keyStr = 'my2ecret782ecret';
const keyData = this.stringToUint8Array(keyStr);
// 创建对称密钥生成器
const symKeyGenerator = cryptoFramework.createSymKeyGenerator('AES128');
const keyBlob: cryptoFramework.DataBl... | https://github.com/DaLongZhuaZi/manxia | 64a6963aebb609b86fead2b60bed592ddae151ba | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets | arkts | createDefaultCategory | 创建默认分类 | private async createDefaultCategory(): Promise<void> {
const defaultCategory: BookshelfCategory = {
id: 'default',
name: '默认书架',
order: 0,
isDefault: true,
coverImages: [],
itemCount: 0,
createTime: Date.now(),
updateTime: Date.now()
};
this.categories = [de... | 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 createDefaultCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async createDefaultCategory(): Promise<void> {
const defaultCategory: BookshelfCategory = {
id: 'default',
name: '默认书架',
order: 0,
isDefault: true,
coverImages: [],
itemCount: 0,
createTime: Date.now(),
updateTime: Date.now()
};
this.categories = [de... | https://github.com/DaLongZhuaZi/manxia | cf5d5aa6308fcb85ad3bf782e27b2bfbcc77d887 | github |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/FileService.ets | arkts | sandboxDownloadDir | Rust 下载落地的沙箱目录(永远可写、无需权限)。 | static sandboxDownloadDir(context: common.UIAbilityContext): string {
return `${context.filesDir}/downloads`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sandboxDownloadDir 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_exp... | static sandboxDownloadDir(context: common.UIAbilityContext): string {
return `${context.filesDir}/downloads`;
} | https://github.com/picklerick422/zju-learning-assistant-OH | 03b3231b1ab2f61d204a958d30cc691f239d0dbf | github |
darcycui/DarcyHarmonyNext | entry/src/main/ets/pages/entry/render_control/LazyForEachReusablePage.ets | arkts | aboutToReuse | 对复用的组件进行数据更新 | aboutToReuse(params: Record<string, Object>): void {
this.data = params.data as StringData;
Log.log('aboutToReuse: ' + this.data.message);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToReuse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record ... | aboutToReuse(params: Record<string, Object>): void {
this.data = params.data as StringData;
Log.log('aboutToReuse: ' + this.data.message);
} | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/render_control/LazyForEachReusablePage.ets#L96-L99 | ec268e05b5d455b563fe9218fe20fde7ca68638b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets | arkts | getStaticMethods | Get static methods declared in the class.
@returns { FixedArray<reflect.StaticMethod> } a fixed array of static methods.
@syscap SystemCapability.Utils.Lang | public getStaticMethods(): FixedArray<reflect.StaticMethod> {
if (this.isInterface()) {
return []
}
return this.getStaticMethodsInternal(true)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStaticMethods AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Lef... | public getStaticMethods(): FixedArray<reflect.StaticMethod> {
if (this.isInterface()) {
return []
}
return this.getStaticMethodsInternal(true)
} | https://gitcode.com/iop123123/arkts-static-skills | d82a9e544972e422f12b041d93cb886bc9b28212 | gitcode |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/HttpUtil.ets | arkts | upload | 文件上传
@param url 上传URL
@param filePath 文件路径
@param fileName 文件名
@param formData 表单数据
@param progressCallback 进度回调 | static async upload<T>(
url: string,
filePath: string,
fileName: string = 'file',
formData?: Record<string, string>,
progressCallback?: (progress: number) => void
): Promise<ApiResponse<T>> {
// 检查网络状态
if (!HttpUtil.checkNetworkStatus()) {
throw new Error('网络不可用');
}
con... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left upload AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#E... | static async upload<T>(
url: string,
filePath: string,
fileName: string = 'file',
formData?: Record<string, string>,
progressCallback?: (progress: number) => void
): Promise<ApiResponse<T>> {
// 检查网络状态
if (!HttpUtil.checkNetworkStatus()) {
throw new Error('网络不可用');
}
con... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 6fe767943288b9097f28a58eedff1ae8af875cd8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/DownloadManager.ets | arkts | saveTaskToDatabase | 保存任务到数据库
注意:在线漫画下载任务不保存到download_task表,因为主要数据在online_page表中 | private async saveTaskToDatabase(task: DownloadTaskInfo): Promise<void> {
// 在线漫画下载任务跳过download_task表操作
if (task.isOnlineManga) {
logger.debug(TAG, `在线漫画下载任务跳过数据库保存: ${task.id}`);
return;
}
try {
const taskInput: DownloadTaskInput = {
comicId: task.mangaId,
chapt... | 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 saveTaskToDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Le... | private async saveTaskToDatabase(task: DownloadTaskInfo): Promise<void> {
// 在线漫画下载任务跳过download_task表操作
if (task.isOnlineManga) {
logger.debug(TAG, `在线漫画下载任务跳过数据库保存: ${task.id}`);
return;
}
try {
const taskInput: DownloadTaskInput = {
comicId: task.mangaId,
chapt... | https://github.com/DaLongZhuaZi/manxia | b74411e0950365ff6a6bd2929dca14ae0b7a65bb | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/model/SongDataSource.ets | arkts | notifyDataMove | Notifies listeners that a row moved from one index to another.
@param from Source index before the move.
@param to Target index after the move. | public notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyDataMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | public notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
});
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | f20b020c5e3e21f7e647befbacf82f1164825a9b | gitcode |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/AvPlayManager.ets | arkts | getDurationTime | 获取总时间 | getDurationTime(): number {
return this.durationTime;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDurationTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statem... | getDurationTime(): number {
return this.durationTime;
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 68bb9caafeeeedb101b64578a756ddb3626fe16a | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | fill | Fills the BigInt64Array with specified value
@param { BigInt } value - new value
@param { int } [start] - start index to begin fill from
@param { int } [end] - last index to end fill from, excluded
@returns { this } - modified BigInt64Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public fill(value: BigInt, start?: int, end?: int): this {
this.fill(value.getLong(), start, end)
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public fill(value: BigInt, start?: int, end?: int): this {
this.fill(value.getLong(), start, end)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 76eb2dca032fe839c645bebdc2313e280268c1dc | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component/dialog/source/dialog.ets | arkts | getNumberByResourceId | get resource size
@param resourceId resource id
@param defaultValue default value
@returns resource size | function getNumberByResourceId(resourceId: number, defaultValue: number, allowZero?: boolean): number {
try {
let currentDeviceType: resourceManager.DeviceType | undefined =
resourceManager.getSysResourceManager()?.getConfigurationSync()?.deviceType;
let systemConfiguration: resourceManager.Configurati... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getNumberByResourceId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resourceId AST#identifier#Right AST#type_annotation#Left AST#:#L... | function getNumberByResourceId(resourceId: number, defaultValue: number, allowZero?: boolean): number {
try {
let currentDeviceType: resourceManager.DeviceType | undefined =
resourceManager.getSysResourceManager()?.getConfigurationSync()?.deviceType;
let systemConfiguration: resourceManager.Configurati... | https://gitcode.com/openharmony/arkui_ace_engine | 3d06fc31af7941fdd696c91024ffe818ead68465 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets | arkts | get | The get() method returns a specified element from a WeakMap object
@param { K } key - The key to get the value for
@returns { V | undefined } Returns the value associated with the key, or undefined if the key does not exist
@syscap SystemCapability.Utils.Lang | get(key: K): V | undefined {
const keyHash = Runtime.getHashCode(key)
const keyRefs = this.keyHashToKeyRefs.get(keyHash)
if (keyRefs === undefined) {
return undefined
}
const keyRef = this.findKeyRef(keyRefs, key)
if (keyRef === undefined) {
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#... | get(key: K): V | undefined {
const keyHash = Runtime.getHashCode(key)
const keyRefs = this.keyHashToKeyRefs.get(keyHash)
if (keyRefs === undefined) {
return undefined
}
const keyRef = this.findKeyRef(keyRefs, key)
if (keyRef === undefined) {
... | https://gitcode.com/iop123123/arkts-static-skills | f595cb7abb17ab73d190c4dcafb6a8a21a5f709c | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/StateManagement/entry/src/main/ets/segment/segment4.ets | arkts | appendMsg | Define methods for changing state variables (multiple modifications of state variables) | appendMsg(newMsg: string) {
this.message += newMsg;
this.message += ';';
this.message += '<br/>';
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left appendMsg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newMsg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | appendMsg(newMsg: string) {
this.message += newMsg;
this.message += ';';
this.message += '<br/>';
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | a1406c8bc26cdd9c39eb389c0a8656913dae031c | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | getComputer | 根据 UUID 获取电脑 | getComputer(uuid: string): ComputerInfo | undefined {
const computer = this.computers.get(uuid);
return computer ? ComputerPersistence.cloneComputer(computer) : undefined;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getComputer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uuid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | getComputer(uuid: string): ComputerInfo | undefined {
const computer = this.computers.get(uuid);
return computer ? ComputerPersistence.cloneComputer(computer) : undefined;
} | https://github.com/AlkaidLab/moonlight-harmony | 37ba089ac046456611eed3923ffcf1c6351aadb9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets | arkts | getGuideStatus | 获取当前引导状态
用于调试和状态检查 | public static async getGuideStatus(): Promise<string> {
try {
await this.guideManager.initialize();
const config = this.guideManager.getGuideConfig();
const status = `
引导状态信息:
- 是否首次启动: ${this.guideManager.isFirstTimeLaunch()}
- 是否需要显示引导: ${this.guideManager.shouldShowGuide()}
- 引导是否完成: $... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getGuideStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments... | public static async getGuideStatus(): Promise<string> {
try {
await this.guideManager.initialize();
const config = this.guideManager.getGuideConfig();
const status = `
引导状态信息:
- 是否首次启动: ${this.guideManager.isFirstTimeLaunch()}
- 是否需要显示引导: ${this.guideManager.shouldShowGuide()}
- 引导是否完成: $... | https://github.com/DaLongZhuaZi/manxia | 73ae68f7b5ee2a050fb53968ad3a694ab2982233 | github |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets | arkts | isCollected | 4.Calculate whether the current article is favorite or not according to the favorite information array | isCollected(): boolean {
return !!this.userData && this.userData.collectedIds.some((id: string) => id === this.articleItem.id);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCollected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isCollected(): boolean {
return !!this.userData && this.userData.collectedIds.some((id: string) => id === this.articleItem.id);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 02662320247482272fd7debb4e8ee9e19312df98 | gitcode |
erosTeam/NextE | shared/src/main/ets/network/EhErrorClassifier.ets | arkts | dev | --- helpers (all cookie-free; only host + status + sentinels are logged, never headers/cookies) --- | private static dev(label: string, page: string, status: number, host: string): string {
return `${page} ${label} status=${status} host=${host}`
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left dev AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#i... | private static dev(label: string, page: string, status: number, host: string): string {
return `${page} ${label} status=${status} host=${host}`
} | https://github.com/erosTeam/NextE | d5c4e9cf7522fb79048ded0cdaaed1d7a0b2e655 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | executeToolCallLoop | 工具调用循环
重要: 这里曾经是"onComplete 内 await this.executeToolCallLoop(...)"的递归实现,
每多一轮工具调用就多一层 await + 一份闭包(roundStreamingToolCalls/upsertRoundToolPart 等),
20+ 轮时栈和闭包累积可导致 native OOM kill(无日志的应用闪退)以及 UI 刷新调度阻塞。
现在改成 while 迭代: 把每轮 streamChatRequestWithTools 的 callback 包装成
Promise<ToolStreamRoundOutcome>, 上层根据 outcome 决定继续工具/fina... | private async executeToolCallLoop(
apiConfig: AIApiConfig,
requestMessages: RequestMessage[],
modelId: string,
aiMessage: ChatMessage,
onAIMessageUpdated: (message: ChatMessage) => void,
onComplete: () => void,
onError: (error: string) => void | Promise<void>,
tools: ToolDefinition[],
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left executeToolCallLoop AST#identifier#Right AST#arguments#Left AST#(#Left ( ... | private async executeToolCallLoop(
apiConfig: AIApiConfig,
requestMessages: RequestMessage[],
modelId: string,
aiMessage: ChatMessage,
onAIMessageUpdated: (message: ChatMessage) => void,
onComplete: () => void,
onError: (error: string) => void | Promise<void>,
tools: ToolDefinition[],
... | https://github.com/LongLiveY96/chatcube | d075ec49025731af2b5ee9f3ba6752bf2f99b7cd | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets | arkts | getCurrentColumns | 获取当前数据库列信息
@returns Promise<string[]> 列名数组 | async getCurrentColumns(): Promise<string[]> {
try {
const value = await this.dao.get(AppConstants.PREF_KEY_CURRENT_VERSION, '[]');
return JSON.parse(value.toString());
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get current columns: ${JSON.stringify(err)}`);
return [];
}... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCurrentColumns AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getCurrentColumns(): Promise<string[]> {
try {
const value = await this.dao.get(AppConstants.PREF_KEY_CURRENT_VERSION, '[]');
return JSON.parse(value.toString());
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get current columns: ${JSON.stringify(err)}`);
return [];
}... | https://github.com/Kira-Yagami-Light/Kira-Projects | 7115888e84942ee2c04417fd2c874350adcb8e68 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | subarray | Creates a Uint8Array with the same underlying Buffer
@param { int } [begin] - start index, inclusive
@param { int } [end] - last index, exclusive
@returns { Uint8Array } - a new Uint8Array with the same underlying Buffer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public subarray(begin?: int, end?: int): Uint8Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le... | public subarray(begin?: int, end?: int): Uint8Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | https://gitcode.com/iop123123/arkts-static-skills | 1ba1560887432cae7f42401bdfa845753c20c386 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/storage/WrongQuestionStorageService.ets | arkts | cleanupMasteredQuestions | 清理已掌握的旧错题
@param daysAgo 多少天前掌握的可以清理 | static async cleanupMasteredQuestions(daysAgo: number = 30): Promise<number> {
try {
const records = await WrongQuestionStorageService.loadWrongQuestions();
const cleaned = WrongQuestionService.cleanupMasteredQuestions(records, daysAgo);
const removedCount = records.length - cleaned.length;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left cleanupMasteredQuestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left daysAgo AST#identifier#Right AS... | static async cleanupMasteredQuestions(daysAgo: number = 30): Promise<number> {
try {
const records = await WrongQuestionStorageService.loadWrongQuestions();
const cleaned = WrongQuestionService.cleanupMasteredQuestions(records, daysAgo);
const removedCount = records.length - cleaned.length;
... | https://github.com/the-wwyang/kids-learning-app | efece787041e4bda4470e9d3076319652e11245d | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/common/Function/commonFn.ets | arkts | getRandomLikes | 随机点赞量 | getRandomLikes(): number {
return this.getRandom(10000)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRandomLikes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getRandomLikes(): number {
return this.getRandom(10000)
} | https://github.com/SMAT-Lab/PhantomRendering | fa033a598c08061c1edcedede40dfa1bf9b403da | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/Retrofit.ets | arkts | configService | Create an implementation of the API defined by the provided ApiServiceConfig.
@param config The ApiServiceConfig defining the API service to create.
@return An implementation of the API service interface. | configService<T>(config: ApiServiceConfig<T>): T {
if (!config || !config.methods) {
throw new Error('Valid ApiServiceConfig must be provided');
}
const currentServiceName = config.serviceName
// Check if serviceName is provided and valid
if (!currentServiceName || currentServiceName.trim... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left configService AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameters#Left A... | configService<T>(config: ApiServiceConfig<T>): T {
if (!config || !config.methods) {
throw new Error('Valid ApiServiceConfig must be provided');
}
const currentServiceName = config.serviceName
// Check if serviceName is provided and valid
if (!currentServiceName || currentServiceName.trim... | https://github.com/killetom/ktretrofit | 905e28c8ed4f250541f4ad73c814d12bebda756d | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/AudioFocusManager.ets | arkts | handleInterruptEvent | Handle interrupt event (audio focus changes) | static handleInterruptEvent(event: audio.InterruptEvent): void {
currentFocusState = event;
console.info(`${TAG}: Interrupt event: type=${event.eventType}, hint=${event.hintType}`);
switch (event.eventType) {
case audio.InterruptType.INTERRUPT_TYPE_BEGIN:
// Interruption began - an... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left handleInterruptEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_exp... | static handleInterruptEvent(event: audio.InterruptEvent): void {
currentFocusState = event;
console.info(`${TAG}: Interrupt event: type=${event.eventType}, hint=${event.hintType}`);
switch (event.eventType) {
case audio.InterruptType.INTERRUPT_TYPE_BEGIN:
// Interruption began - an... | https://github.com/tangwengang-del/freerdp-harmonyos | 99d6a72180b45c79d01ff0c26bc688bea1572a06 | github |
CLMC2025/Vignette | entry/src/main/ets/utils/Logger.ets | arkts | createChild | 创建子 Logger(添加子标签) | createChild(subTag: string): Logger {
return new Logger(`${this.tag}.${subTag}`, this.config);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createChild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left subTag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | createChild(subTag: string): Logger {
return new Logger(`${this.tag}.${subTag}`, this.config);
} | https://github.com/CLMC2025/Vignette | 6139a9748670dbdacf0f8224b65e3a1ab26339cd | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/OnboardingViewModel.ets | arkts | applyTheme | 主题切换:走 SettingsManager 触发全局 callback,UI 立即变化 | async applyTheme(mode: ThemeMode): Promise<void> {
this.selectedThemeMode = mode
try {
await getSettingsManager().setThemeMode(mode)
} catch (err) {
console.error('OnboardingViewModel', `Failed to apply theme: ${JSON.stringify(err)}`)
}
} | 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 applyTheme AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left m... | async applyTheme(mode: ThemeMode): Promise<void> {
this.selectedThemeMode = mode
try {
await getSettingsManager().setThemeMode(mode)
} catch (err) {
console.error('OnboardingViewModel', `Failed to apply theme: ${JSON.stringify(err)}`)
}
} | https://github.com/LongLiveY96/chatcube | 80d7788fc60029ffffc1026a71e9999d70a0862e | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | isMapIterator | Check whether the entered value is the iterator type of map.
@param { Object } value - A Map iterator value
@returns { boolean } Returns true if the value is an iterator returned for a built-in Map instance. | isMapIterator(value: Object): boolean {
return value instanceof MapIterator;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isMapIterator 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 Object AST#identifier#Right AST#)#Left ) ... | isMapIterator(value: Object): boolean {
return value instanceof MapIterator;
} | https://gitcode.com/iop123123/arkts-static-skills | 60f6028e65fc6db539d82f83a49e9c6a72387ef6 | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/products/phone/src/main/ets/viewmodel/HomeViewModel.ets | arkts | jumpToHomeView | 跳转到首页 | private jumpToHomeView(): void {
this.pageContextManager.replacePage({
routerName: 'HomeView',
})
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left jumpToHomeView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr... | private jumpToHomeView(): void {
this.pageContextManager.replacePage({
routerName: 'HomeView',
})
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 588263e6c2865fc571e713e1855ec63149eceb5c | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleFeedback.ets | arkts | isShowing | Called by ModuleContent to check whether to defer content overlay. | public isShowing(): boolean {
return this.showing !== null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isShowing 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#boo... | public isShowing(): boolean {
return this.showing !== null;
} | https://github.com/Countly/countly-sdk-hos | 4a12fb7a8c630112520c1e99acc2dafeaec901e4 | github |
openharmony-sig/applications_compass | feature/compass/src/main/ets/controller/CompassController.ets | arkts | getAngle | Subscribe to sensor data. | public getAngle() {
LogUtil.log('subscribe to sensor data');
try {
sensor.on(
sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,
this.angleChange,
{
interval: ConfigData.SENSOR_TNTERVAL
});
} catch (err) {
LogUtil.error('sensor error: ' + err);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAngle 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#... | public getAngle() {
LogUtil.log('subscribe to sensor data');
try {
sensor.on(
sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,
this.angleChange,
{
interval: ConfigData.SENSOR_TNTERVAL
});
} catch (err) {
LogUtil.error('sensor error: ' + err);
}
} | https://gitee.com/openharmony-sig/applications_compass.git | 44615db3d1406066c2714bcfeb0b5b0a25fda93d | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/downloads/classes/meowDawnloada.ets | arkts | denyDownload | Deny the download of a webview.WebDownloadItem, and cancel the download.
@param item The webview.WebDownloadItem. | denyDownload(item: webview.WebDownloadItem) {
item.cancel();
meow(`denyDownload: [${item.getGuid()}][${item.getUrl()}]`, 'meowDawnloada][denyDownload', meowLevel.WARN);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left denyDownload 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#member_expression#Left AST#identifier#Left w... | denyDownload(item: webview.WebDownloadItem) {
item.cancel();
meow(`denyDownload: [${item.getGuid()}][${item.getUrl()}]`, 'meowDawnloada][denyDownload', meowLevel.WARN);
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | f9012e88cb2e37d756a49e31a79edb0acafbadc2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets | arkts | escapeJson | 转义JSON字符串 | private escapeJson(json: string): string {
return json
.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'");
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | private escapeJson(json: string): string {
return json
.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'");
} | https://github.com/DaLongZhuaZi/manxia | 0dd4892d72dc7d8a165fef0987055b6f95f7667d | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/EntryOhos.ets | arkts | equalTo | Compares value, xIndex and data of the entries. Returns true if entries
are equal in those points, false if not. Does not check by hash-code like
it's done by the "equals" method.
@param e
@return | public equalTo(e: EntryOhos): boolean {
if (!e)
return false;
if (e.getData() != this.getData())
return false;
if (Math.abs(e.x - this.x) > Utils.FLOAT_EPSILON)
return false;
if (Math.abs(e.getY() - this.getY()) > Utils.FLOAT_EPSILON)
return false;
return true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equalTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EntryOhos A... | public equalTo(e: EntryOhos): boolean {
if (!e)
return false;
if (e.getData() != this.getData())
return false;
if (Math.abs(e.x - this.x) > Utils.FLOAT_EPSILON)
return false;
if (Math.abs(e.getY() - this.getY()) > Utils.FLOAT_EPSILON)
return false;
return true;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ee4b6dcbfef97b0c77f0275e32a71cd35c819e9f | gitee |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | count | 统计实体数量
如果实体启用了软删除,默认只统计未删除的数据
@param includeDeleted 是否包含已删除的数据,默认 false
@returns Promise<number> | async count(includeDeleted: boolean = false): Promise<number> {
const startTime = Date.now()
return await this.withSessionStore(async (repo) => {
try {
const queryBuilder = repo.createQueryBuilder()
if (includeDeleted) {
queryBuilder.withDeleted()
}
const execut... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left includeDeleted AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async count(includeDeleted: boolean = false): Promise<number> {
const startTime = Date.now()
return await this.withSessionStore(async (repo) => {
try {
const queryBuilder = repo.createQueryBuilder()
if (includeDeleted) {
queryBuilder.withDeleted()
}
const execut... | https://github.com/offlinecat-dev/OCNetORM | a0376adc87c9178e77b6f5f03e5b1ec1b642341d | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/PlayStateApi.ets | arkts | markUnplayedItem | markUnplayedItem
@summary Marks an item as unplayed for user.
@param {PlayStateApiMarkUnplayedItemRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof PlayStateApi | public async markUnplayedItem(requestParameters: PlayStateApiMarkUnplayedItemRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.delete({path: `/UserPlayedItems/${requestParameters.itemId}`, 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 markUnplayedItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ... | public async markUnplayedItem(requestParameters: PlayStateApiMarkUnplayedItemRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.delete({path: `/UserPlayedItems/${requestParameters.itemId}`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | d4b85f0465843fad5d3bd2c5af98e79677de6837 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | removeAnimationState | 移除动画状态 | public removeAnimationState(animationId: string): void {
this.activeAnimations.delete(animationId);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeAnimationState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animationId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A... | public removeAnimationState(animationId: string): void {
this.activeAnimations.delete(animationId);
} | https://github.com/DaLongZhuaZi/manxia | e3f34fe9383a1c11c83cd84fb2288bb0585dce6a | github |
arkui-x/samples | CodeLab/ArkTSComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/MultiplexSample.ets | arkts | aboutToAppear | 当前滑动item下标 | aboutToAppear() {
this.resources.push(new MultiplexModel('1', $r('app.media.img_test_1')));
this.resources.push(new MultiplexModel('2', $r('app.media.img_test_3')));
this.resources.push(new MultiplexModel('3', $r('app.media.img_test_2')));
this.resources.push(new MultiplexModel('4', $r('app.media.img_... | 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() {
this.resources.push(new MultiplexModel('1', $r('app.media.img_test_1')));
this.resources.push(new MultiplexModel('2', $r('app.media.img_test_3')));
this.resources.push(new MultiplexModel('3', $r('app.media.img_test_2')));
this.resources.push(new MultiplexModel('4', $r('app.media.img_... | https://gitcode.com/arkui-x/samples | 0253685c7484e1048b9f8257aba46275b2d8c6ab | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.