nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | writeInt32BE | Writes a signed 32-bit integer to the buffer at the specified offset using big-endian format
@param {long} value - Value to write
@param {int} [offset=0] - Number of bytes to skip before writing
@returns {int} Offset plus the number of bytes written | public writeInt32BE(value: long, offset: int = 0): int {
this.checkOffset(offset, 4);
this.checkValue(value, (-Math.pow(2, 31).toLong()), (Math.pow(2, 31).toLong() - 1), (-Math.pow(2, 31)).toString(), (Math.pow(2, 31) - 1).toString());
this.getDataView().setInt32(offset, valu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeInt32BE 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 long AST#identifie... | public writeInt32BE(value: long, offset: int = 0): int {
this.checkOffset(offset, 4);
this.checkValue(value, (-Math.pow(2, 31).toLong()), (Math.pow(2, 31).toLong() - 1), (-Math.pow(2, 31)).toString(), (Math.pow(2, 31) - 1).toString());
this.getDataView().setInt32(offset, valu... | https://gitcode.com/iop123123/arkts-static-skills | 5115e66609e288f013105ffd8c0f764a65dd9e37 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartCategory.ets | arkts | matchesBill | 检查规则是否匹配账单 | matchesBill(billNote: string, billAmount: number): boolean {
if (this.isActive !== 1) {
return false;
}
// 金额范围检查
if (billAmount < this.amountMin || billAmount > this.amountMax) {
return false;
}
// 关键词匹配
if (this.ruleType === 'keyword' && this.keywords.trim().length > 0) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left matchesBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left billNote AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R... | matchesBill(billNote: string, billAmount: number): boolean {
if (this.isActive !== 1) {
return false;
}
// 金额范围检查
if (billAmount < this.amountMin || billAmount > this.amountMax) {
return false;
}
// 关键词匹配
if (this.ruleType === 'keyword' && this.keywords.trim().length > 0) {
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0a493c30585fa29ae005dfb51d6ddc657e77033b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Exception.ets | arkts | toString | Converts this excepiton to a string
Result includes exception message and the stacktrace
@returns result of the conversion | override toString(): String {
let s: String = "";
if (this.msg != "") {
s += this.msg + "\n";
}
for (let i: int = (this.stackLines.length > 2 ? 2 : 0); i < this.stackLines.length; i++) {
s += this.stackLines[i];
if (i != this.stackLines.length-1) {
s += "\n";
}
}
... | AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String ... | override toString(): String {
let s: String = "";
if (this.msg != "") {
s += this.msg + "\n";
}
for (let i: int = (this.stackLines.length > 2 ? 2 : 0); i < this.stackLines.length; i++) {
s += this.stackLines[i];
if (i != this.stackLines.length-1) {
s += "\n";
}
}
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a29d1214fda73625dde7d10e5eebe8d3de6c436c | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | setCurrentModelId | 设置当前选中的模型ID | async setCurrentModelId(modelId: string): Promise<void> {
await this.setString(PreferenceKeys.CURRENT_MODEL_ID, modelId)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setCurrentModelId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modelId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async setCurrentModelId(modelId: string): Promise<void> {
await this.setString(PreferenceKeys.CURRENT_MODEL_ID, modelId)
} | https://github.com/LongLiveY96/chatcube | d83412a228050f65a97b206d6527bd608276d5d9 | github |
YANGZX22/Voot | entry/src/main/ets/workers/NonStreamingAsrWithVadWorker.ets | arkts | handleFlush | -------- flush -> decode -------- | function handleFlush(): void {
if (!recognizer) {
postError('flush: recognizer not initialized (ASR init failed)');
return;
}
const merged = mergePcm();
if (!merged || merged.length === 0) {
console.info('ASR worker: flush with empty PCM; nothing to decode');
return;
}
const f32 = new Floa... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left handleFlush AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type... | function handleFlush(): void {
if (!recognizer) {
postError('flush: recognizer not initialized (ASR init failed)');
return;
}
const merged = mergePcm();
if (!merged || merged.length === 0) {
console.info('ASR worker: flush with empty PCM; nothing to decode');
return;
}
const f32 = new Floa... | https://github.com/YANGZX22/Voot | 5b8e91608e53d0d38f620804a1b20dbf8376b015 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/ThemeManager.ets | arkts | getCurrentTheme | 获取当前主题
@returns 当前 NDSTheme 对象
Requirements: 2.2 | public getCurrentTheme(): NDSTheme {
const theme = NDS_THEMES.find(t => t.id === this.currentThemeId);
if (theme) {
return theme;
}
// 如果找不到当前主题,返回默认主题
console.warn(`${TAG} Theme '${this.currentThemeId}' not found, using default`);
const defaultTheme = NDS_THEMES.find(t => t.id === NDST... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentTheme 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 NDSThe... | public getCurrentTheme(): NDSTheme {
const theme = NDS_THEMES.find(t => t.id === this.currentThemeId);
if (theme) {
return theme;
}
// 如果找不到当前主题,返回默认主题
console.warn(`${TAG} Theme '${this.currentThemeId}' not found, using default`);
const defaultTheme = NDS_THEMES.find(t => t.id === NDST... | https://github.com/richshaw2015/nds | 007f8cf13eeebb47b0d20e479ebcc3e76e1d2369 | github |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/DragAndDropSorting/ListItemGroup.ets | arkts | unregisterDataChangeListener | 该方法为框架侧调用,为对应的LazyForEach组件在数据源处去除listener监听 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
console.info('remove listener');
this.listeners.splice(pos, 1);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
console.info('remove listener');
this.listeners.splice(pos, 1);
}
} | https://gitee.com/openharmony/arkui_ace_engine.git | 41965c8a7ef042d957ef38e455c62bd0e28956e6 | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets | arkts | toggleWithLoading | 点击加载演示开关,进入加载状态并在指定时间后完成切换
@param value 期望切换到的目标值 | toggleWithLoading(value: boolean): void {
if (this.isLoading) {
return;
}
this.isLoading = true;
this.loadingTimerId = setTimeout(() => {
this.switchLoading = value;
this.isLoading = false;
this.loadingTimerId = -1;
}, LOADING_DURATION);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleWithLoading 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 boolean AST#identifier#Right AST#)#Le... | toggleWithLoading(value: boolean): void {
if (this.isLoading) {
return;
}
this.isLoading = true;
this.loadingTimerId = setTimeout(() => {
this.switchLoading = value;
this.isLoading = false;
this.loadingTimerId = -1;
}, LOADING_DURATION);
} | https://github.com/codelably/tuniao-ui | 4fa9966232720f92a697c857f3feaee0654b74a2 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/model/ExpressionsModel.ets | arkts | queryAllRecords | query all history records
@param callback callback for resultSet | queryAllRecords(callback: Function): void {
LogUtil.info(TAG, 'queryAllRecords start');
this.rdbHelper.queryAll((resultSet: Array<LooseObject>) => {
callback(resultSet);
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left queryAllRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#)#... | queryAllRecords(callback: Function): void {
LogUtil.info(TAG, 'queryAllRecords start');
this.rdbHelper.queryAll((resultSet: Array<LooseObject>) => {
callback(resultSet);
});
} | https://gitee.com/openharmony-sig/applications_calculator.git | 211a2bdff711839d13943280c3cd7b86a1f1f3d7 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an object of FixedArray<int>.
@param { FixedArray<int> } arr - An instance of the FixedArray type to convert to an array.
@returns { Uint16Array } - A new Uint16Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: FixedArray<int>): Uint16Array {
let result = new Uint16Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: FixedArray<int>): Uint16Array {
let result = new Uint16Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | https://gitcode.com/iop123123/arkts-static-skills | d7e0993e5b53020b31a6535251cdd9d7a167946d | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | addWithDefault | --- Default parameters --- | function addWithDefault(a: number, b: number): number {
if (b === 0) {
return a + 10;
}
return a + b;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left addWithDefault AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function addWithDefault(a: number, b: number): number {
if (b === 0) {
return a + 10;
}
return a + b;
} | https://github.com/miaochiahao/ark-ghidra | 1dc8749ce5e71875bbdc0dfb11a2656ca7b78169 | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | createCallback | 创建标准异步错误回调:统一日志格式,避免重复代码
@param methodName 方法名,用于日志标识 | private static createCallback(methodName: string): (error: BusinessError) => void {
return (error: BusinessError) => {
if (error) {
VibratorManager.logError(methodName, error);
}
};
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left createCallback AST#identifier#Right AST#arguments#Left... | private static createCallback(methodName: string): (error: BusinessError) => void {
return (error: BusinessError) => {
if (error) {
VibratorManager.logError(methodName, error);
}
};
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | e6ed94e144165cfe3037e5607cae1a22f54c4aee | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets | arkts | getInstanceFields | Get instance fields declared in the class.
@returns { FixedArray<reflect.InstanceField> } a fixed array of instance fields.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getInstanceFields(): FixedArray<reflect.InstanceField> {
if (this.isInterface()) {
return []
}
return this.getInstanceFieldsInternal(true)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInstanceFields 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#Le... | public getInstanceFields(): FixedArray<reflect.InstanceField> {
if (this.isInterface()) {
return []
}
return this.getInstanceFieldsInternal(true)
} | https://gitcode.com/iop123123/arkts-static-skills | 06bc66976d8b1e5d9a2efebfa3df4bf85ed0aab1 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RAManager.ets | arkts | unloadCurrentGame | 卸载当前游戏的 RA 数据 | unloadCurrentGame(): void {
this.stopHeartbeat();
if (this.currentSession) {
try {
MelonDSNative.unloadRetroAchievementsData();
} catch (err) {
hilog.warn(DOMAIN, TAG, 'unloadRetroAchievementsData failed: %{public}s', (err as Error).message);
}
this.currentSession = nul... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unloadCurrentGame 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_... | unloadCurrentGame(): void {
this.stopHeartbeat();
if (this.currentSession) {
try {
MelonDSNative.unloadRetroAchievementsData();
} catch (err) {
hilog.warn(DOMAIN, TAG, 'unloadRetroAchievementsData failed: %{public}s', (err as Error).message);
}
this.currentSession = nul... | https://github.com/richshaw2015/nds | c10b613ccfb79733b2a4e669d2beabfd18ea18fb | github |
azhu0001/localsend-harmony | entry/src/main/ets/service/FileReceptionService.ets | arkts | getPrepareReceptionData | 返回允许接收的文件
@param upload
@returns | static getPrepareReceptionData(upload: PrepareUploadModel): PrepareTransferModel {
const session = SessionProvider.generateSessionId()
const ids = Object.keys(upload.files)
const files: StringPair = {}
for (const id of ids) {
files[id] = SessionProvider.generateToken(session, id)
}
retur... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPrepareReceptionData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left upload AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | static getPrepareReceptionData(upload: PrepareUploadModel): PrepareTransferModel {
const session = SessionProvider.generateSessionId()
const ids = Object.keys(upload.files)
const files: StringPair = {}
for (const id of ids) {
files[id] = SessionProvider.generateToken(session, id)
}
retur... | https://gitcode.com/azhu0001/localsend-harmony | 1f3df370bf3aedee2fc9fb2ca6dc22ee9e0d8411 | gitcode |
openharmony/applications_photos | common/src/main/ets/default/model/common/HistogramManager.ets | arkts | extractPixels | 图像解码,读取pixel map存入ArrayBuffer
@param mediaItem | public async extractPixels(uri: string): Promise<ArrayBuffer> {
TraceControllerUtils.startTrace('extractPixels');
this.startTime = Date.now();
Log.info(TAG, 'extract pixels, start time: ' + this.startTime);
let dataImpl = BrowserDataFactory.getFeature(BrowserDataFactory.TYPE_PHOTO);
let fileAsset:... | 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 extractPixels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#... | public async extractPixels(uri: string): Promise<ArrayBuffer> {
TraceControllerUtils.startTrace('extractPixels');
this.startTime = Date.now();
Log.info(TAG, 'extract pixels, start time: ' + this.startTime);
let dataImpl = BrowserDataFactory.getFeature(BrowserDataFactory.TYPE_PHOTO);
let fileAsset:... | https://gitee.com/openharmony/applications_photos.git | 6da3e8dcbd1a8af7ba9b8b1bca26a46b371dde48 | gitee |
openharmony/codelabs | ETSUI/ContactManager/entry/src/main/ets/pages/ContactListPage.ets | arkts | handleSearchChange | 处理搜索输入变化 | handleSearchChange(value: string): void {
this.searchText = value
this.filterContacts()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleSearchChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Le... | handleSearchChange(value: string): void {
this.searchText = value
this.filterContacts()
} | https://gitcode.com/openharmony/codelabs | 8f67064fd215da8f84b61a93f5ca3ebfad6afe7b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets | arkts | buildBackgroundOwner | 构建后台任务持有者标识 | private buildBackgroundOwner(taskId: string): string {
return `background_task_${taskId}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildBackgroundOwner AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private buildBackgroundOwner(taskId: string): string {
return `background_task_${taskId}`;
} | https://github.com/DaLongZhuaZi/manxia | 5fd3ce698c6c3ad3885a5e4c1836dbe37419f4d6 | github |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/RepeatList/RepeatList1.ets | arkts | aboutToAppear | 向Repeat的数据源中添加数据,本用例初始化时真实数据源(50)小于预期数据源(70) | aboutToAppear(): void {
for(let i = 0; i < 50; i++) {
this.simpleList.push(new Repeat001Clazz(`item_${i}`));
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
for(let i = 0; i < 50; i++) {
this.simpleList.push(new Repeat001Clazz(`item_${i}`));
}
} | https://gitee.com/openharmony/arkui_ace_engine.git | 2be72e0e1dd991e1188d4a4b91b61544d214688d | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | getValsForTouch | Returns a recyclable MPPointD instance.
Returns the corresponding xPos for a given touch-position in pixels.
@param x
@param y
@return | protected getValsForTouch(x: number, y: number): MPPointD {
// take any transformer to determine the x-axis value
let transformer: Transformer | null = this.mChart.getTransformer(AxisDependency.LEFT);
let pos: MPPointD = MPPointD.getInstance(0, 0);
if (transformer) {
pos = transformer.getValues... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getValsForTouch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | protected getValsForTouch(x: number, y: number): MPPointD {
// take any transformer to determine the x-axis value
let transformer: Transformer | null = this.mChart.getTransformer(AxisDependency.LEFT);
let pos: MPPointD = MPPointD.getInstance(0, 0);
if (transformer) {
pos = transformer.getValues... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 636cea997997ed10f78789ece62578e03aa16cc6 | gitee |
openharmony-sig/flutter_sqflite | sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/SqflitePlugin.ets | arkts | handleGetDatabasesPathCall | /获取数据库路径 | handleGetDatabasesPathCall(call: MethodCall, result: MethodResult) {
let appContext = this.context!.getApplicationContext();
let path: string = appContext.databaseDir;
result.success(path);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleGetDatabasesPathCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left call AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodCall AST... | handleGetDatabasesPathCall(call: MethodCall, result: MethodResult) {
let appContext = this.context!.getApplicationContext();
let path: string = appContext.databaseDir;
result.success(path);
} | https://gitee.com/openharmony-sig/flutter_sqflite.git | f2c8b0fd54c0b21c0868f18099c722ef0cd29c54 | gitee |
Explore-In-HMOS-Wearable/nfc-emulation-app | core/src/main/ets/services/NavigationService.ets | arkts | getCurrentRoute | Additional utilities as needed | getCurrentRoute(): string | undefined {
const routes = this.stack.getAllPathName();
return routes[routes.length - 1];
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#strin... | getCurrentRoute(): string | undefined {
const routes = this.stack.getAllPathName();
return routes[routes.length - 1];
} | https://github.com/Explore-In-HMOS-Wearable/nfc-emulation-app | c2909ccac58635a1fdb63b559e9f6b0b1c11850b | github |
Tlntin/home-cloud-shield | entry/src/main/ets/data/DnsLogDb.ets | arkts | buildWhere | Build the "WHERE ..." clause + bind args for an action filter + free-text
search (domain/qtype/action/rule). Returns clause starting with " WHERE" or ''. | private buildWhere(action: string, search: string): WhereClause {
const conds: string[] = [];
const args: Array<relationalStore.ValueType> = [];
if (action !== 'all') {
conds.push('action = ?');
args.push(action);
}
const kw: string = search.trim().toLowerCase();
if (kw.length > 0)... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildWhere AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private buildWhere(action: string, search: string): WhereClause {
const conds: string[] = [];
const args: Array<relationalStore.ValueType> = [];
if (action !== 'all') {
conds.push('action = ?');
args.push(action);
}
const kw: string = search.trim().toLowerCase();
if (kw.length > 0)... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/data/DnsLogDb.ets#L216-L231 | 250e1d378f236be6d1e9c8201c8a7aade36b5352 | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/navigation/RouteParamStore.ets | arkts | peek | 仅 peek 不清除——用于调试 / 异常时恢复。 | peek(name: RouteName | string): Object | null {
const v: Object | undefined = AppStorage.get<Object>(ROUTE_PARAM_PREFIX + String(name));
return v !== undefined && v !== null ? v : null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left peek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AS... | peek(name: RouteName | string): Object | null {
const v: Object | undefined = AppStorage.get<Object>(ROUTE_PARAM_PREFIX + String(name));
return v !== undefined && v !== null ? v : null;
} | https://github.com/CarGuo/GSYGithubAppOH | 3d2cd8bb9e42315e9a4e60155135cefd1450bbc9 | github |
arkui-x/samples | CodeLab/Cases/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets | arkts | formatEntityResult | 格式化识别结果
@param entities | formatEntityResult(entities: textProcessing.Entity[]): void {
if (!entities || !entities.length) {
// 清除loading
setTimeout(() => {
promptAction.showToast({
message: $r('app.string.addressrecognize_recognize_fail_text'),
duration: CommonConstants.TOAST_DURATION
});
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatEntityResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entities AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#member_expression#L... | formatEntityResult(entities: textProcessing.Entity[]): void {
if (!entities || !entities.length) {
// 清除loading
setTimeout(() => {
promptAction.showToast({
message: $r('app.string.addressrecognize_recognize_fail_text'),
duration: CommonConstants.TOAST_DURATION
});
... | https://gitcode.com/arkui-x/samples | 970c9710f0bda6897b5dda292602e73a0a420a8e | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakSet.ets | arkts | delete | The delete() method removes the specified element from a WeakSet object
@param { K } v - The object to remove
@returns { boolean } Returns true if the object was successfully removed,
returns false if the object does not exist or removal failed
@syscap SystemCapability.Utils.Lang | delete(v: K): boolean {
return this.elements.delete(v)
} | AST#program#Left AST#ERROR#Left AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left v AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left K AST#type_identifier#Right AST#type_annotation#Ri... | delete(v: K): boolean {
return this.elements.delete(v)
} | https://gitcode.com/iop123123/arkts-static-skills | a47d959cfcfd982c22737dfb8eb9cb107bd5ac98 | gitcode |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/AdbKeyManager.ets | arkts | convertRsaPublicKeyToAdbFormat | 将RSA公钥转换为ADB格式(524字节) | private convertRsaPublicKeyToAdbFormat(): ArrayBuffer | null {
try {
if (!this.cachedKeyPair || !this.cachedKeyPair.pubKey) {
return null;
}
// 从PKCS#8格式公钥中提取modulus和exponent
const pubKeyBlob = this.cachedKeyPair.pubKey.getEncoded();
const keyData = new Uint8Array(pubK... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertRsaPublicKeyToAdbFormat 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#bina... | private convertRsaPublicKeyToAdbFormat(): ArrayBuffer | null {
try {
if (!this.cachedKeyPair || !this.cachedKeyPair.pubKey) {
return null;
}
// 从PKCS#8格式公钥中提取modulus和exponent
const pubKeyBlob = this.cachedKeyPair.pubKey.getEncoded();
const keyData = new Uint8Array(pubK... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | e4d35c570983a8179ac036426515bca4c229381a | github |
XJTUWYD/ArkDiff | entry/src/main/ets/utils/PatchExporter.ets | arkts | exportStatsToClipboard | 将差异统计摘要导出到剪贴板 | static exportStatsToClipboard(chunks: DiffChunk[]): boolean {
const stats = this.generateStats(chunks);
return this.exportToClipboard(stats);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left exportStatsToClipboard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri... | static exportStatsToClipboard(chunks: DiffChunk[]): boolean {
const stats = this.generateStats(chunks);
return this.exportToClipboard(stats);
} | https://github.com/XJTUWYD/ArkDiff | cd6981ca2e831837b17f1936c4554c85c54b945c | github |
arkui-x/samples | CodeLab/Cases/feature/imageviewer/src/main/ets/utils/Constrain.ets | arkts | constrainOffset | 约束图片偏移,确保不超出视口边界
@param offset -- 当前偏移量
@param winSize -- 视口大小
@param imageSize -- 图片大小
@param scale -- 缩放 | function constrainOffset(offset: number, winSize: number, imageSize: number, scale: number): number {
let maxAllowedOffset = getMaxAllowedOffset(winSize, imageSize, scale);
return Math.min(Math.max(offset, -maxAllowedOffset), maxAllowedOffset);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left constrainOffset AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left offset AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function constrainOffset(offset: number, winSize: number, imageSize: number, scale: number): number {
let maxAllowedOffset = getMaxAllowedOffset(winSize, imageSize, scale);
return Math.min(Math.max(offset, -maxAllowedOffset), maxAllowedOffset);
} | https://gitcode.com/arkui-x/samples | e80169f01c768030484e1dcf595f38a565c16432 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalSettingViewModel.ets | arkts | clearAppCache | 清除应用缓存
@returns | public clearAppCache(): Promise<void> {
return fs.rmdir(getContext().cacheDir)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearAppCache 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#instantiation_expression... | public clearAppCache(): Promise<void> {
return fs.rmdir(getContext().cacheDir)
} | https://github.com/RedRackham-R/WanAndroidHarmoney | bddcb13a186a2b1867119803bfe88c7b56ff83a7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/NamingConventions.ets | arkts | validateFieldName | 验证字段名称是否符合规范
@param name - 字段名称
@returns 是否符合规范 | static validateFieldName(name: string): boolean {
// camelCase 规则:首字母小写,后续单词首字母大写
const camelCaseRegex = /^[a-z][a-zA-Z0-9]*$/;
return camelCaseRegex.test(name);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateFieldName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static validateFieldName(name: string): boolean {
// camelCase 规则:首字母小写,后续单词首字母大写
const camelCaseRegex = /^[a-z][a-zA-Z0-9]*$/;
return camelCaseRegex.test(name);
} | https://github.com/DaLongZhuaZi/manxia | d2139435dc09cbd7c713b9af356f016514a0b4fb | github |
IoTAccessControl/ArkTSAnalysis | TestApps1/1.AccountKit_Codelab_QuickLogin_Clientdemo_ArkTS/entry/src/main/ets/pages/PermissionsPage.ets | arkts | stopAudioCapturing | 停止AudioCapturer采集 | stopAudioCapturing() {
if (!this.audioCapturer || !this.isAudioCapturing) {
return;
}
try {
// 停止采集
this.audioCapturer.stop();
this.showToast('音频采集已停止');
console.info(`${this.logTag}: AudioCapturing stopped`);
this.isAudioCapturing = false;
// 释放资源
this.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left stopAudioCapturing 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... | stopAudioCapturing() {
if (!this.audioCapturer || !this.isAudioCapturing) {
return;
}
try {
// 停止采集
this.audioCapturer.stop();
this.showToast('音频采集已停止');
console.info(`${this.logTag}: AudioCapturing stopped`);
this.isAudioCapturing = false;
// 释放资源
this.... | https://github.com/IoTAccessControl/ArkTSAnalysis | dae607d2ad9ac200062d05f0f21ee2817e61f56a | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnPickerViewModel.ets | arkts | onPickerConfirm | 选择器确认回调
@param values 选中值数组 | onPickerConfirm(values: string | string[]): void {
if (typeof values === "string") {
this.pickerValue = values;
this.selectedLabel = values;
} else if (Array.isArray(values) && values.length > 0) {
this.pickerValue = values[0];
this.selectedLabel = values.join(", ");
}
this.pic... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPickerConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left string AST#... | onPickerConfirm(values: string | string[]): void {
if (typeof values === "string") {
this.pickerValue = values;
this.selectedLabel = values;
} else if (Array.isArray(values) && values.length > 0) {
this.pickerValue = values[0];
this.selectedLabel = values.join(", ");
}
this.pic... | https://github.com/codelably/tuniao-ui | 7beb91e36660ec1d67e0bb50def27aa181ca5940 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SharedLedgerService.ets | arkts | calculateSettlement | ==================== 结算计算 ====================
计算账本结算方案 | static async calculateSettlement(ledgerId: number): Promise<SettlementResult[]> {
try {
// 获取此次账本所有账单 (确保包含自动审批的账单)
const allBills = await SharedBillDAO.getByLedgerId(ledgerId, 1000);
const bills = allBills.filter(b =>
b.approvalStatus === 'approved' ||
b.approvalStatus === ... | 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 calculateSettlement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#... | static async calculateSettlement(ledgerId: number): Promise<SettlementResult[]> {
try {
// 获取此次账本所有账单 (确保包含自动审批的账单)
const allBills = await SharedBillDAO.getByLedgerId(ledgerId, 1000);
const bills = allBills.filter(b =>
b.approvalStatus === 'approved' ||
b.approvalStatus === ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 330c4d2a6262951bbd431faf2421938a7d41d01b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/AudioVibrationService.ets | arkts | getSceneModeInt | 获取当前场景模式对应的 C++ sceneMode 整数值
游戏/电影=0, 音乐/节奏=1, 自动=2 | getSceneModeInt(): number {
switch (this.sceneMode) {
case '音乐/节奏': return 1;
case '自动': return 2;
case '游戏/电影':
default: return 0;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSceneModeInt 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... | getSceneModeInt(): number {
switch (this.sceneMode) {
case '音乐/节奏': return 1;
case '自动': return 2;
case '游戏/电影':
default: return 0;
}
} | https://github.com/AlkaidLab/moonlight-harmony | dadd9c73a757f0ee6d4dc311915c0d9060237aa3 | github |
PollenWang6/HiXD | entry/src/main/ets/services/SportService.ets | arkts | getScoreDetail | 获取学期成绩构成明细
API: POST /app/stuTermScore/isLookScoreFX | async getScoreDetail(stuTermScoreId: string): Promise<SportScoreComponent[]> {
const result: SportScoreComponent[] = [];
if (stuTermScoreId.length === 0) return result;
const body: Record<string, string> = {
'stuTermScoreid': stuTermScoreId,
};
const resp: Record<string, Object> = await thi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getScoreDetail AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stuTermScoreId AST#identifier#Right AST#type_annotation#Left AST... | async getScoreDetail(stuTermScoreId: string): Promise<SportScoreComponent[]> {
const result: SportScoreComponent[] = [];
if (stuTermScoreId.length === 0) return result;
const body: Record<string, string> = {
'stuTermScoreid': stuTermScoreId,
};
const resp: Record<string, Object> = await thi... | https://github.com/PollenWang6/HiXD | 7a3d7e946916e1ba0d2beb432df7ec7966ec6ac0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | setDisplayModeWithTransition | 获取当前显示模式 | static setDisplayModeWithTransition(mode: DisplayMode, uiContext?: UIContext): void {
const currentMode = WindowManager.getCurrentMode();
if (currentMode === mode) {
return;
}
const profile = WindowManager.resolvePageShowTransitionProfile(currentMode, mode);
if (profile.strategy !== Display... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDisplayModeWithTransition 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#ide... | static setDisplayModeWithTransition(mode: DisplayMode, uiContext?: UIContext): void {
const currentMode = WindowManager.getCurrentMode();
if (currentMode === mode) {
return;
}
const profile = WindowManager.resolvePageShowTransitionProfile(currentMode, mode);
if (profile.strategy !== Display... | https://github.com/DaLongZhuaZi/manxia | c8de1fa30855d35a8037eee674c4004ad574fa04 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets | arkts | of | Get the class of an object.
@param { Object | null } obj The object to get the class from.
@returns { Class } the class of the object.
@static
@syscap SystemCapability.Utils.Lang | public static of(obj: Object | null): Class {
if (obj instanceof Object) {
return Class.ofObject(obj)
}
return Class.from<null>()
} | 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#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#... | public static of(obj: Object | null): Class {
if (obj instanceof Object) {
return Class.ofObject(obj)
}
return Class.from<null>()
} | https://gitcode.com/iop123123/arkts-static-skills | 05faaab7f6b0de5a0c0f3fe0b94b0b60ae1f74cb | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/SettingsService.ets | arkts | setAutoDeletePlayed | 设置自动删除已播放 | async setAutoDeletePlayed(enabled: boolean): Promise<void> {
this.settings.autoDeletePlayed = enabled;
await this.saveSettings();
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setAutoDeletePlayed AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_... | async setAutoDeletePlayed(enabled: boolean): Promise<void> {
this.settings.autoDeletePlayed = enabled;
await this.saveSettings();
} | https://github.com/pangpang20/antennaPodHM | 0924be4ae2e5d24d97816381726fe1531e322f3e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets | arkts | stopStatsUpdate | 停止统计更新定时器 | private stopStatsUpdate(): void {
if (this.statsUpdateTimer !== -1) {
clearInterval(this.statsUpdateTimer);
this.statsUpdateTimer = -1;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopStatsUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp... | private stopStatsUpdate(): void {
if (this.statsUpdateTimer !== -1) {
clearInterval(this.statsUpdateTimer);
this.statsUpdateTimer = -1;
}
} | https://github.com/DaLongZhuaZi/manxia | bcca0dab56560aea8ac51feb24cf9bc951a40173 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | map | Creates a new BigInt64Array using fn(arr[i]) over all elements of current BigInt64Array.
@param fn a function to apply for each element of current BigInt64Array
@returns a new BigInt64Array where for each element from current BigInt64Array fn was applied | public map(fn: (val: long, index: int) => long): BigInt64Array {
let resBuf = new ArrayBuffer(this.length * BigInt64Array.BYTES_PER_ELEMENT)
let res = new BigInt64Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: long, index: int) => long): BigInt64Array {
let resBuf = new ArrayBuffer(this.length * BigInt64Array.BYTES_PER_ELEMENT)
let res = new BigInt64Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 0367103614e396115819d118de6ef2c4f00ecd00 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | getByCategoryId | 根据分类ID查询规则 | static async getByCategoryId(
userId: number,
categoryId: number
): Promise<SmartCategoryRule[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${SmartCategoryRule.tableName}
WHERE user_id = ? AND category_id = ? AND is_deleted = 0
... | 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 getByCategoryId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left :... | static async getByCategoryId(
userId: number,
categoryId: number
): Promise<SmartCategoryRule[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${SmartCategoryRule.tableName}
WHERE user_id = ? AND category_id = ? AND is_deleted = 0
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 187e055fa979c980d362a1b570e3d7fb39e64607 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/RadarData.ets | arkts | setLabels | Sets the labels that should be drawn around the RadarChart at the end of each web line.
@param labels | setLabels(labels: string[] | string): void {
this.mLabels = Array.isArray(labels) ? labels : [labels];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left labels AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#subscript_expression#Left AST#ide... | setLabels(labels: string[] | string): void {
this.mLabels = Array.isArray(labels) ? labels : [labels];
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | df47da22e92fc994580b47f1e37da084b4bece0e | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/base/BaseChart.ets | arkts | zoom | 处理缩放
@param scale 缩放比例 | public zoom(scale: number): void {
this.interaction.zoom = Math.max(0.5, Math.min(3, scale));
this.interaction.isInteracting = true;
this.refresh();
this.emitEvent({
type: 'zoom',
timestamp: Date.now()
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left zoom AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public zoom(scale: number): void {
this.interaction.zoom = Math.max(0.5, Math.min(3, scale));
this.interaction.isInteracting = true;
this.refresh();
this.emitEvent({
type: 'zoom',
timestamp: Date.now()
});
} | https://github.com/LJ666-ui/harmony-health-care | e94f63a8f1fc588f298e9c5a5995d95ec859baab | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/PageRepository.ets | arkts | getConfirmOrder | 获取确认订单页面数据
@returns 确认订单页面数据 | async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> {
return this.networkDataSource.getConfirmOrder();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getConfirmOrder 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#gene... | async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> {
return this.networkDataSource.getConfirmOrder();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 40951d42a52e79730b1c0316bfea4350b2a78368 | github |
revalue-o/HarmonyOS-Next-Hook-demo | source_codes/ArkTS-inject/entry/src/main/ets/utils/SecurityCheckUtil.ets | arkts | init | 初始化安全检测服务 | static init(context: Context): void {
SecurityCheckUtil.context = context;
console.log('[SecurityCheckUtil] Initialized with context');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#E... | static init(context: Context): void {
SecurityCheckUtil.context = context;
console.log('[SecurityCheckUtil] Initialized with context');
} | https://github.com/revalue-o/HarmonyOS-Next-Hook-demo | deedb3ac8deb501660ab43e3e68ae8005e626396 | github |
ibestservices/ibest-ui | library/src/main/ets/components/slider/index.ets | arkts | calcMainAxis | 计算选中条的长度百分比 | calcMainAxis(){
let scope = this.getScopeValue()
if (Array.isArray(this.value)) {
this.barOffset = (this.value[0] - this.min) / scope
this.percentage = ((this.value[1] - this.value[0]) * 100) / scope
}else{
this.barOffset = 0
this.percentage = ((this.value - this.min) * 100) / scope
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calcMainAxis 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 ... | calcMainAxis(){
let scope = this.getScopeValue()
if (Array.isArray(this.value)) {
this.barOffset = (this.value[0] - this.min) / scope
this.percentage = ((this.value[1] - this.value[0]) * 100) / scope
}else{
this.barOffset = 0
this.percentage = ((this.value - this.min) * 100) / scope
}
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/slider/index.ets#L215-L224 | 020aef6f7055cab3569bf4cd30b9e3aa2ad14965 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamLifecycleManager.ets | arkts | unregisterDisplayChangeListener | 取消屏幕方向变化监听 | unregisterDisplayChangeListener(): void {
if (this.displayChangeCallback) {
try {
display.off('change', this.displayChangeCallback);
console.info('[StreamPage] 已取消屏幕方向变化监听');
} catch (err) {
console.warn('[StreamPage] 取消屏幕方向监听失败:', err);
}
this.displayChangeCallback... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDisplayChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#... | unregisterDisplayChangeListener(): void {
if (this.displayChangeCallback) {
try {
display.off('change', this.displayChangeCallback);
console.info('[StreamPage] 已取消屏幕方向变化监听');
} catch (err) {
console.warn('[StreamPage] 取消屏幕方向监听失败:', err);
}
this.displayChangeCallback... | https://github.com/AlkaidLab/moonlight-harmony | 17d7704d10ff442b0fa80e761a4cd14e687a2bc2 | github |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | getTempDirPath | 获取临时目录下的文件夹路径或文件路径
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns 临时目录路径 | static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
try {
const context = LubanUtils.getContext();
let filePath = blHap ? context.tempDir : context.getApplicationContext().tempDir; // 根目录
if (dirPath && dirPath.trim() !== "") {
if (LubanUt... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTempDirPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dirPath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_exp... | static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
try {
const context = LubanUtils.getContext();
let filePath = blHap ? context.tempDir : context.getApplicationContext().tempDir; // 根目录
if (dirPath && dirPath.trim() !== "") {
if (LubanUt... | https://github.com/kumaleap/ArkLuban | f36c4033f060922b16a92a5fb4cd7bbd675bc7de | github |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/image/types.ets | arkts | stash | 暂存本次偏移量以备后用(以备下次拖动手势触发使用) | stash(): void {
this.positionX = this.offsetX
this.positionY = this.offsetY
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | stash(): void {
this.positionX = this.offsetX
this.positionY = this.offsetY
} | https://github.com/itrainhub/wu-ui | 80cbde5f8294442c0d26dbd8a475a190d769913f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | setPermissions | 设置权限列表 | setPermissions(permissions: string[]): void {
this.permissionsJson = JSON.stringify(permissions);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left permissions AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#[#Left [ AST#[#Right AST#]... | setPermissions(permissions: string[]): void {
this.permissionsJson = JSON.stringify(permissions);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | bcb125fcbef0120c4b58654bac0492062806dff8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | includes | Determines whether Uint8ClampedArray includes a certain element, returning true or false as appropriate
@param { number } searchElement - The element to search for.
@param { int } [fromIndex] - The position in this array at which to begin searching for searchElement
If fromIndex is undefined, the search starts at index... | public includes(searchElement: number, fromIndex?: int): boolean {
return this.indexOf(searchElement, asIntOrDefault(fromIndex, 0)) != -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | public includes(searchElement: number, fromIndex?: int): boolean {
return this.indexOf(searchElement, asIntOrDefault(fromIndex, 0)) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | a4487e522442682353ebc6c454de68b0b093e967 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/OCRRecognitionService.ets | arkts | markAsUsed | 标记识别记录为已使用 | static async markAsUsed(recordId: number, billId: number): Promise<boolean> {
try {
return await OCRRecognitionRecordDAO.markAsUsed(recordId, billId);
} catch (error) {
console.error('[OCRRecognitionService] 标记为已使用失败:', error);
throw error instanceof Error ? error : new Error(String(error));... | 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 markAsUsed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | static async markAsUsed(recordId: number, billId: number): Promise<boolean> {
try {
return await OCRRecognitionRecordDAO.markAsUsed(recordId, billId);
} catch (error) {
console.error('[OCRRecognitionService] 标记为已使用失败:', error);
throw error instanceof Error ? error : new Error(String(error));... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 92625107494c6cdf167e36d7c328b80df510c389 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | setMaxPreCreateNodeCount | 设置预创建组件的最大数量,默认最大数量为10个
预创建组件关联成功后会从记录中移除,转为正常组件进行管理
当预创建组件数量到达设定的最大数量时,会按先后顺序,销毁最早的预创建组件
@param maxCount 最大数量 | public setMaxPreCreateNodeCount(maxCount: number) {
nativeNode.setMaxPreCreateNodeCount(maxCount);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaxPreCreateNodeCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxCount AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | public setMaxPreCreateNodeCount(maxCount: number) {
nativeNode.setMaxPreCreateNodeCount(maxCount);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L59-L61 | f7fad7d48060e1c179f7baceaed35d73e8e1659c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceTester.ets | arkts | testPopular | 测试热门列表 | private async testPopular(sourceId: number): Promise<TestItemResult> {
const startTime = Date.now();
try {
const comics = await this.executor.getPopular(sourceId, 1, 5);
if (!comics || comics.length === 0) {
return {
name: '热门列表',
feature: 'popular',
... | 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 testPopular AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left ... | private async testPopular(sourceId: number): Promise<TestItemResult> {
const startTime = Date.now();
try {
const comics = await this.executor.getPopular(sourceId, 1, 5);
if (!comics || comics.length === 0) {
return {
name: '热门列表',
feature: 'popular',
... | https://github.com/DaLongZhuaZi/manxia | 1baf9a4b4e08f79dc31303f49ca6458bb7b8553f | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/CommonUtil.ets | arkts | getStringByFile | 获取指定JSON文件的对象
@param context 上下文 | public static getStringByFile(resourceManager: resmgr.ResourceManager | undefined,
fileName: string): Promise<string> {
return new Promise((resolve, reject) => {
LogUtil.info(TAG, `getFileContent. fileName: ${fileName}`);
if (!resourceManager || !fileName) {
Log... | 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 getStringByFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left ... | public static getStringByFile(resourceManager: resmgr.ResourceManager | undefined,
fileName: string): Promise<string> {
return new Promise((resolve, reject) => {
LogUtil.info(TAG, `getFileContent. fileName: ${fileName}`);
if (!resourceManager || !fileName) {
Log... | https://gitee.com/openharmony-sig/applications_clock.git | 2e01137a4d7882fa861365424353905890f075f6 | gitee |
apap6628114/nga_oh | entry/src/main/ets/parser/nga/html-thread/PostArgScanner.ets | arkts | extractTotalReplies | 从 commonui.postArg.setDefault(fid,stid,tid,...,totalReplies,lastPostTs,pageSize) 提取总回复数。
倒数第 3 个参数 = 全楼总回复数,倒数第 1 个 = 每页帖子数。
@param html NGA 帖子页 HTML
@returns 总回复数;未找到或参数不足时返回 -1 | function extractTotalReplies(html: string): number {
const idx: number = html.indexOf(SETDEFAULT_MARKER);
if (idx < 0) {
return -1;
}
const openPos: number = idx + SETDEFAULT_MARKER.length - 1;
const matched = scanBalanced(html, openPos, '(', ')');
if (!matched.value) {
return -1;
}
const argsSt... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractTotalReplies AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | function extractTotalReplies(html: string): number {
const idx: number = html.indexOf(SETDEFAULT_MARKER);
if (idx < 0) {
return -1;
}
const openPos: number = idx + SETDEFAULT_MARKER.length - 1;
const matched = scanBalanced(html, openPos, '(', ')');
if (!matched.value) {
return -1;
}
const argsSt... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/nga/html-thread/PostArgScanner.ets#L188-L210 | 0ae645fd31cf9c28dd21ca39caf5b5eadfbe569a | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | getCurrentSessionTitle | 获取当前会话标题 | getCurrentSessionTitle(): string {
return this.sessionStore.getCurrentSessionTitle()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentSessionTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST... | getCurrentSessionTitle(): string {
return this.sessionStore.getCurrentSessionTitle()
} | https://github.com/LongLiveY96/chatcube | a9d1182c5536dc26c0b63244e6bd7fb72a620d0e | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | calcMinMax1 | Adjusts the minimum and maximum values based on the given DataSet.
@param d | protected calcMinMax1(d: T): void {
if (this.mYMax < d.getYMax())
this.mYMax = d.getYMax();
if (this.mYMin > d.getYMin())
this.mYMin = d.getYMin();
if (this.mXMax < d.getXMax())
this.mXMax = d.getXMax();
if (this.mXMin > d.getXMin())
this.mXMin = d.getXMin();
if (d.getAx... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left calcMinMax1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | protected calcMinMax1(d: T): void {
if (this.mYMax < d.getYMax())
this.mYMax = d.getYMax();
if (this.mYMin > d.getYMin())
this.mYMin = d.getYMin();
if (this.mXMax < d.getXMax())
this.mXMax = d.getXMax();
if (this.mXMin > d.getXMin())
this.mXMin = d.getXMin();
if (d.getAx... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0b1fd345df4a45fec1e42a2220ddd9f4aa4a3eb6 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveClient.ets | arkts | upload | 上传文件
@param path 文件路径(支持多种格式::/path, /path, /drive/root:/path, /drive/root/path, path)
@param fileBuffer 文件内容
@returns Promise<HttpResponse> 结果信息 | public async upload(path: string, fileBuffer: ArrayBuffer): Promise<HttpResponse> {
if (!this.axiosInstance) {
throw new Error('Axios instance not initialized');
}
try {
// 使用 normalizePath 构建正确的 API 路径
const apiPath = this.normalizePath(path, OneDrivePathType.UPLOAD);
hilog.info(D... | 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 upload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Righ... | public async upload(path: string, fileBuffer: ArrayBuffer): Promise<HttpResponse> {
if (!this.axiosInstance) {
throw new Error('Axios instance not initialized');
}
try {
// 使用 normalizePath 构建正确的 API 路径
const apiPath = this.normalizePath(path, OneDrivePathType.UPLOAD);
hilog.info(D... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L596-L617 | ef2e4284a90584bbd6fe61744f51b550ca6d5a4c | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/settings/classes/meowSettingsEntry.ets | arkts | setValueFromString | Sets the value of the setting entry based on the provided string.
@param newValue The string representation of the value.
@param compareMode Use compare mode or not. If set true, then
@returns An array containing the key, old value, and new value (if changes are made). | setValueFromString(newValue: string, compareMode: boolean = false) {
let thisValue = '';
let compareNewValue = '';
if (compareMode) {
thisValue = this.valueToString();
compareNewValue = newValue.replaceAll('\n', '\\n');
if (compareNewValue == thisValue) {
// meow(`Skipped [${this... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setValueFromString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Righ... | setValueFromString(newValue: string, compareMode: boolean = false) {
let thisValue = '';
let compareNewValue = '';
if (compareMode) {
thisValue = this.valueToString();
compareNewValue = newValue.replaceAll('\n', '\\n');
if (compareNewValue == thisValue) {
// meow(`Skipped [${this... | https://github.com/awaLiny2333/LinysBrowser_NEXT | a529a07e65300c4a8215c9de0d6557441b4995ad | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/JMap.ets | arkts | removeByValue | 删除指定VALUE的元素,成功返回True,失败返回False | removeByValue(_value:T2):Boolean { //removeByValueAndKey
let bln = false;
try {
for (let i = 0; i < this.elements.length; i++) {
if (this.elements[i].value == _value) {
this.elements.splice(i, 1);
return true;
}
}
} catch (e) {
bln = false;
}
r... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeByValue 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 T2 AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST... | removeByValue(_value:T2):Boolean { //removeByValueAndKey
let bln = false;
try {
for (let i = 0; i < this.elements.length; i++) {
if (this.elements[i].value == _value) {
this.elements.splice(i, 1);
return true;
}
}
} catch (e) {
bln = false;
}
r... | https://gitee.com/openharmony-sig/commons-cli.git | bd9865ceb788d39cf2d52d1d740e9da512d1c2b5 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | setConfig | 设置校验配置 | setConfig(config: Partial<ValidationConfig>): void {
if (config.timeout !== undefined) this.config.timeout = config.timeout;
if (config.checkSearch !== undefined) this.config.checkSearch = config.checkSearch;
if (config.checkDiscovery !== undefined) this.config.checkDiscovery = config.checkDiscovery;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Partial AS... | setConfig(config: Partial<ValidationConfig>): void {
if (config.timeout !== undefined) this.config.timeout = config.timeout;
if (config.checkSearch !== undefined) this.config.checkSearch = config.checkSearch;
if (config.checkDiscovery !== undefined) this.config.checkDiscovery = config.checkDiscovery;
... | https://github.com/DaLongZhuaZi/manxia | 4faf5112d0cc3cf08cc5c0ecc88e5985f09aa8eb | github |
erosTeam/NextE | feature/gallery/src/main/ets/viewmodel/GalleryDetailViewModel.ets | arkts | hasMorePreviews | Whether more preview pages exist beyond the first (drives the "view all" entry). | hasMorePreviews(): boolean {
return this.previewPageCount > 1
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasMorePreviews 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#sta... | hasMorePreviews(): boolean {
return this.previewPageCount > 1
} | https://github.com/erosTeam/NextE | 47b513d94d0140079a9ac0bb5bca5273de8e21d5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ImageCropper.ets | arkts | computeCenterCropRect | 根据目标比例计算中心裁剪矩形 | function computeCenterCropRect(srcWidth: number, srcHeight: number, targetRatio: AspectRatio): CropRect {
const targetW = targetRatio.width;
const targetH = targetRatio.height;
const srcRatio = srcWidth / srcHeight;
const tgtRatio = targetW / targetH;
let cropWidth = srcWidth;
let cropHeight = srcHeight;
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left computeCenterCropRect AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left srcWidth AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | function computeCenterCropRect(srcWidth: number, srcHeight: number, targetRatio: AspectRatio): CropRect {
const targetW = targetRatio.width;
const targetH = targetRatio.height;
const srcRatio = srcWidth / srcHeight;
const tgtRatio = targetW / targetH;
let cropWidth = srcWidth;
let cropHeight = srcHeight;
... | https://github.com/DaLongZhuaZi/manxia | 39ccbbb5087de29dd0cdbb850c8584aaaff94a78 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getYMin | returns the current y-min value across all DataSets
@return | public getYMin(): number {
// 缺失方法
if (this.mData) {
return this.mData.getYMin();
}
return 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYMin 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#... | public getYMin(): number {
// 缺失方法
if (this.mData) {
return this.mData.getYMin();
}
return 0;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 933a940712cb0a4c85665e990ced5a5f57096b1d | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | toString | toString(int) converts this object to a string
@param { int } radix the radix base for string representation
@returns { string }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toString(radix: int): string {
return this.toInt().toString(radix)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left radix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig... | public toString(radix: int): string {
return this.toInt().toString(radix)
} | https://gitcode.com/iop123123/arkts-static-skills | 8ec57e6a1bc826c03105f06f223bb7f84f80fc7d | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | getStore | 获取 RdbStore 实例
@returns RdbStore 实例
@throws ExecutionError 如果数据库未初始化 | private getStore(): relationalStore.RdbStore {
if (this.leasedStore !== null) {
return this.leasedStore
}
try {
return DatabaseManager.getInstance().getStore()
} catch (e) {
const errorMessage = e instanceof Error ? e.message : String(e)
throw new ExecutionError('DATABASE', err... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#member_expression#Left AST... | private getStore(): relationalStore.RdbStore {
if (this.leasedStore !== null) {
return this.leasedStore
}
try {
return DatabaseManager.getInstance().getStore()
} catch (e) {
const errorMessage = e instanceof Error ? e.message : String(e)
throw new ExecutionError('DATABASE', err... | https://github.com/offlinecat-dev/OCNetORM | 76938e772ddad5d82374603d5531b2a502b31a6f | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | getUsageOverview | 获取总览统计数据(总会话/总消息/独立模型数/活跃天数)
rangeStartMs: 0 表示全部时间;>0 表示从该时间戳开始统计 | async getUsageOverview(rangeStartMs: number = 0): Promise<UsageOverviewStats> {
await this.waitForInitialization()
const result: UsageOverviewStats = {
sessionCount: 0,
messageCount: 0,
distinctModelCount: 0,
activeDayCount: 0,
totalTokens: 0,
inputTokens: 0,
outputTo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUsageOverview AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rangeStartMs AST#identifier#Right AST#type_annotation#Left AST... | async getUsageOverview(rangeStartMs: number = 0): Promise<UsageOverviewStats> {
await this.waitForInitialization()
const result: UsageOverviewStats = {
sessionCount: 0,
messageCount: 0,
distinctModelCount: 0,
activeDayCount: 0,
totalTokens: 0,
inputTokens: 0,
outputTo... | https://github.com/LongLiveY96/chatcube | 4183dcaf882ebdc99a76d770fcb0229dd5d63db6 | github |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | validateExportData | 驗證導出數據 | validateExportData(data: ExportData): boolean {
// 檢查必要字段
if (data.version === undefined || data.version === '') {
return false;
}
if (data.timestamp === undefined || data.timestamp <= 0) {
return false;
}
if (data.words === undefined || !Array.isArray(data.words)) {
return f... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left validateExportData 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 ExportData AST#identifier#Right AST#)... | validateExportData(data: ExportData): boolean {
// 檢查必要字段
if (data.version === undefined || data.version === '') {
return false;
}
if (data.timestamp === undefined || data.timestamp <= 0) {
return false;
}
if (data.words === undefined || !Array.isArray(data.words)) {
return f... | https://github.com/CLMC2025/Vignette | 014b42dbf1c4ce171a8601016e4575d62dc9d494 | github |
arkui-x/samples | CodeLab/Cases/feature/imagetheft/src/main/ets/view/ImageTheft.ets | arkts | sendRequest | 发送请求
@param url 图片url
@param ref 图片来源 | sendRequest(url: string, ref: string): void {
const imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife();
if (imageKnife !== undefined) {
imageKnife.removeAllMemoryCache() // 清理全部缓存
imageKnife.removeAllFileCache() // 清理全部缓存
// TODO: 知识点:自定义RequestOption来获取image... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#... | sendRequest(url: string, ref: string): void {
const imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife();
if (imageKnife !== undefined) {
imageKnife.removeAllMemoryCache() // 清理全部缓存
imageKnife.removeAllFileCache() // 清理全部缓存
// TODO: 知识点:自定义RequestOption来获取image... | https://gitcode.com/arkui-x/samples | 8d8ef3801653e7c76ad530304d91bbae472b1f45 | gitcode |
honjow/Next2V | shared/src/main/ets/backup/BackupCrypto.ets | arkts | open | Decrypt a base64 ciphertext blob produced by seal(). Throws on a wrong password or tampering
(GCM tag verification failure). Returns the original UTF-8 plaintext. | static open(ciphertextBase64: string, password: string, meta: BackupCipherMeta): string {
const salt = BackupCrypto.fromBase64(meta.salt)
const iv = BackupCrypto.fromBase64(meta.iv)
const sealed = BackupCrypto.fromBase64(ciphertextBase64)
if (sealed.length < BACKUP_CIPHER_TAG_BYTES) {
throw new ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left open AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ciphertextBase64 AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | static open(ciphertextBase64: string, password: string, meta: BackupCipherMeta): string {
const salt = BackupCrypto.fromBase64(meta.salt)
const iv = BackupCrypto.fromBase64(meta.iv)
const sealed = BackupCrypto.fromBase64(ciphertextBase64)
if (sealed.length < BACKUP_CIPHER_TAG_BYTES) {
throw new ... | https://github.com/honjow/Next2V | a7586515fce977351db78194b1cd1b829adef3d2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | lastIndexOf | Returns the index of the last occurrence of a value in Int8Array.
@param { number } searchElement - The value to locate in the array. The search begins at index length - 1.
@returns { int } - right-most index of searchElement. It must be less than length. -1 if not found
@syscap SystemCapability.Utils.Lang
@FaAndStageM... | public lastIndexOf(searchElement: number): int {
return this.lastIndexOf(searchElement, this.lengthInt - 1)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | public lastIndexOf(searchElement: number): int {
return this.lastIndexOf(searchElement, this.lengthInt - 1)
} | https://gitcode.com/iop123123/arkts-static-skills | 8176ffb122b50c361611f3e41c2a7e035db9faaf | gitcode |
openharmony/codelabs | ETSUI/ChatAppDemo/entry/src/main/ets/utils/UserHandler.ets | arkts | updateUser | 在处理用户表的类中增加 | async updateUser(user: UserModel): Promise<number> {
const valueBucket: relationalStore.ValuesBucket = {
'nickName': user.nickName,
'avatarPath': user.avatarPath,
'password': user.password,
'country': user.country
// 手机号通常作为查询条件,不轻易修改
};
let predicates = new relationalStore.... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left user AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async updateUser(user: UserModel): Promise<number> {
const valueBucket: relationalStore.ValuesBucket = {
'nickName': user.nickName,
'avatarPath': user.avatarPath,
'password': user.password,
'country': user.country
// 手机号通常作为查询条件,不轻易修改
};
let predicates = new relationalStore.... | https://gitcode.com/openharmony/codelabs | ff8d6c6d800277cbde955b7beba8dab416455acc | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | getCurrentUrl | 获取WebView当前URL | public async getCurrentUrl(): Promise<string> {
return new Promise<string>((resolve, reject) => {
try {
const timeout = setTimeout(() => {
reject(new Error('WebView URL获取超时'));
}, 3000);
this.engineConfig.webViewController.runJavaScript(
'location.href',
... | 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 getCurrentUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public async getCurrentUrl(): Promise<string> {
return new Promise<string>((resolve, reject) => {
try {
const timeout = setTimeout(() => {
reject(new Error('WebView URL获取超时'));
}, 3000);
this.engineConfig.webViewController.runJavaScript(
'location.href',
... | https://github.com/DaLongZhuaZi/manxia | b5d68b99adedd16433ad2ab210065dabea4a6ba6 | github |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets | arkts | getAnimateSelectIndex | 获取动画控制的下标
用于切换选项时,先让标签回到底部,然后让当前选项在上移 | getAnimateSelectIndex() {
// 动画等待时间 - 用于等待上一个选项动画结束
let animateDelay = 500;
animateTo({
duration: this.animateTime,
delay: animateDelay
}, () => {
this.animateSelectIndex = this.selectIndex
})
// 绘制canvas 用于兼容点击 凸起时,canvas 同时移动
this.createAnimation()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAnimateSelectIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl... | getAnimateSelectIndex() {
// 动画等待时间 - 用于等待上一个选项动画结束
let animateDelay = 500;
animateTo({
duration: this.animateTime,
delay: animateDelay
}, () => {
this.animateSelectIndex = this.selectIndex
})
// 绘制canvas 用于兼容点击 凸起时,canvas 同时移动
this.createAnimation()
} | https://gitcode.com/arkui-x/samples | 263a41a65ffad553490dd0535f324c393ffab395 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ArkWebSecurity/arkwebsecurity/src/main/ets/pages/ErrorSamples/LoadURLWithSensitiveData.ets | arkts | build | Any URL to be loaded | build() {
Column() {
Web({ src: this.untrustedURL + '?token=' + this.accessToken, controller: this.webviewController })
}
} | 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#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
Web({ src: this.untrustedURL + '?token=' + this.accessToken, controller: this.webviewController })
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 799f8f50db817a5ea22e52c45f07fb52709fa4af | gitcode |
HarmonyOS_Codelabs/arkts-basic-syntax-demo | entry/src/main/ets/pages/BasicPage.ets | arkts | showContinueStatements | continue语句 | function showContinueStatements() {
let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi'];
for (let i = 0; i < students.length; i++) {
if (students[i] === 'XiaoWang') {
continue; // 跳出本次循环
}
console.log(students[i]); // 打印学生信息
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left showContinueStatements AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexi... | function showContinueStatements() {
let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi'];
for (let i = 0; i < students.length; i++) {
if (students[i] === 'XiaoWang') {
continue; // 跳出本次循环
}
console.log(students[i]); // 打印学生信息
}
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo | bc053aa7f3bd88aecca2caab88427edc86879fa5 | gitcode |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets | arkts | set_peq | 设置 10 段 PEQ 参数 [[enabled, freq, gain, q, type], ...] | set_peq(params: [boolean, number, number, number, number][]): void {
nativeModule.set_peq(params)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set_peq AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#subscript_expression#Left AST#subscript_expression#Left AST#identifier#Left params AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#[#... | set_peq(params: [boolean, number, number, number, number][]): void {
nativeModule.set_peq(params)
} | https://github.com/Nekofox-POT/LinMusic | 1b9c9755270e1aefcf4783d4394c227e947e428c | github |
din0sauria/audio-deepfake-detection | entry/src/main/ets/Audio/AudioDB.ets | arkts | createStore | 创建数据库 * | async createStore() {
this.store = await relationalStore.getRdbStore(getContext(), {
name: this.tableName + '.db',
securityLevel: relationalStore.SecurityLevel.S1
})
this.store?.executeSql(`
CREATE TABLE IF NOT EXISTS ${this.tableName} (
id INTEGER PRIMARY KEY AUTOINCREMENT,
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createStore AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Ri... | async createStore() {
this.store = await relationalStore.getRdbStore(getContext(), {
name: this.tableName + '.db',
securityLevel: relationalStore.SecurityLevel.S1
})
this.store?.executeSql(`
CREATE TABLE IF NOT EXISTS ${this.tableName} (
id INTEGER PRIMARY KEY AUTOINCREMENT,
... | https://github.com/din0sauria/audio-deepfake-detection | c33dcdcd0be8538efeac9135413feddb6ddff037 | github |
2763981847/Clock-Alarm | entry/src/main/ets/common/util/Logger.ets | arkts | info | 记录信息级别的日志。
@param args 要记录的日志信息 | info(...args: string[]): void {
hilog.info(this.domain, this.prefix, this.format, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left info AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex... | info(...args: string[]): void {
hilog.info(this.domain, this.prefix, this.format, args);
} | https://github.com/2763981847/Clock-Alarm | a94c89f379e270b55779de91556ff20f36a1bced | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayAsListInt.ets | arkts | constructor | Constructs new ArrayAsList with respect to capacity and initial value
@param capacity
@param val | constructor(capacity: int, val: Int) {
this.init(capacity, val);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left capacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right ... | constructor(capacity: int, val: Int) {
this.init(capacity, val);
} | https://gitcode.com/iop123123/arkts-static-skills | 737ff2196baec5752abbf017894b82e1d1f12e3f | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | isSafeInteger | Checks if float is a safe integer value
@returns true if the underlying float is a safe integer | public isSafeInteger(): boolean {
return Float.isSafeInteger(this.value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSafeInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST... | public isSafeInteger(): boolean {
return Float.isSafeInteger(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | 74c0dae69397162531b64a5b60289c00687af75f | gitcode |
openeuler-mirror/arkui-linux | samples/arkui-test/CommonMethod/01_Style/entry/src/main/ets/pages/MainPage.ets | arkts | buttonStyle | button 样式 | @Extend(Button) function buttonStyle(arkTSFileName) {
.fontSize(16)
.fontColor('#191919')
.borderWidth(1)
.borderColor('#a9a9a9')
.backgroundColor('#e9e9e9')
.width('100%')
.onClick(() => {
router.replaceUrl({ url: 'pages/' + arkTSFileName });
})
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Button AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | @Extend(Button) function buttonStyle(arkTSFileName) {
.fontSize(16)
.fontColor('#191919')
.borderWidth(1)
.borderColor('#a9a9a9')
.backgroundColor('#e9e9e9')
.width('100%')
.onClick(() => {
router.replaceUrl({ url: 'pages/' + arkTSFileName });
})
} | https://github.com/openeuler-mirror/arkui-linux | c3e789c0e7f455166fd2743f9cad1b9b8b08a9bd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets | arkts | querySelectorAll | 使用 CSS 选择器查询所有元素 | querySelectorAll(selector: string): HTMLElement[] {
if (!this.root) return [];
return this.root.querySelectorAll(selector);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left querySelectorAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right ... | querySelectorAll(selector: string): HTMLElement[] {
if (!this.root) return [];
return this.root.querySelectorAll(selector);
} | https://github.com/DaLongZhuaZi/manxia | 7137fcb5d407544db097d3c16fd104a1fc565ac5 | github |
youyeyejie/ZhiXing_ActHub | entry/src/test/TodoTestDataHelper.ets | arkts | generateTestTodos | 生成测试待办数据(包含已完成和未完成)
@param count 总数量
@returns Todo[] 待办数组 | private generateTestTodos(count: number): Todo[] {
const now = Date.now();
const oneDayMs = 24 * 60 * 60 * 1000;
const testTodos: Todo[] = [
// 未完成待办(用于专注选择)
this.createTodo('1', '完成课程论文初稿', now - 2 * oneDayMs, 0),
this.createTodo('2', '学习ArkTS组件开发', now - 1 * oneDayMs, 0),
th... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateTestTodos AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private generateTestTodos(count: number): Todo[] {
const now = Date.now();
const oneDayMs = 24 * 60 * 60 * 1000;
const testTodos: Todo[] = [
// 未完成待办(用于专注选择)
this.createTodo('1', '完成课程论文初稿', now - 2 * oneDayMs, 0),
this.createTodo('2', '学习ArkTS组件开发', now - 1 * oneDayMs, 0),
th... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/test/TodoTestDataHelper.ets#L60-L94 | fca5e894b4b7eb467832cb4ca996d6c7536af837 | github |
Zhiyilang074811/enterprise-ai-assistant | harmony_app/entry/src/main/ets/services/ApiService.ets | arkts | getTenantConfig | 获取租户配置 | async getTenantConfig(phone?: string, tenantId?: string, agentId?: string): Promise<TenantConfigResponse> {
const params: Record<string, string> = {};
if (phone) params.phone = phone;
if (tenantId) params.tenant_id = tenantId;
if (agentId) params.agent_id = agentId;
return this.get<TenantConf... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTenantConfig AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left phone AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_an... | async getTenantConfig(phone?: string, tenantId?: string, agentId?: string): Promise<TenantConfigResponse> {
const params: Record<string, string> = {};
if (phone) params.phone = phone;
if (tenantId) params.tenant_id = tenantId;
if (agentId) params.agent_id = agentId;
return this.get<TenantConf... | https://github.com/Zhiyilang074811/enterprise-ai-assistant | 541b0512e2e0b2859665567d8a6d696d7409bc02 | github |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/util/PlaylistDataUtil.ets | arkts | applyPlaybackIntentForPlaylistIndex | Writes a pending play request into shared playback intent for the song at the given list index.
@param listIndex Zero-based playlist index to play.
@param playlistUis Current playlist UI rows.
@param intent Mutable global playback intent state. | public static applyPlaybackIntentForPlaylistIndex(
listIndex: number,
playlistUis: PlaylistSongUi[],
intent: PlaybackIntentState
): void {
const songId = PlaylistDataUtil.getSongIdAtPlaylistIndex(listIndex, playlistUis);
if (songId === undefined) {
return;
}
intent.pendingPlaySongI... | 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 applyPlaybackIntentForPlaylistIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left listIndex AST#identifier#Right AST... | public static applyPlaybackIntentForPlaylistIndex(
listIndex: number,
playlistUis: PlaylistSongUi[],
intent: PlaybackIntentState
): void {
const songId = PlaylistDataUtil.getSongIdAtPlaylistIndex(listIndex, playlistUis);
if (songId === undefined) {
return;
}
intent.pendingPlaySongI... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 0cc826dbccadedebbd0a6d5487e977d298a64a08 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets | arkts | changeOrientation | Changes the preferred orientation of the window.
@param orientation - The preferred orientation to set. This should be a value from the `window.Orientation` enum.
@returns void - This function does not return any value. | changeOrientation(orientation: window.Orientation) {
this.windowClass?.setPreferredOrientation(orientation);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left orientation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left windo... | changeOrientation(orientation: window.Orientation) {
this.windowClass?.setPreferredOrientation(orientation);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | c45510bcec84b6fcc6132749c09a87e0c80eef96 | gitcode |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/services/LocalDeviceService.ets | arkts | filterDevicesByLocation | 根据位置筛选设备
@param location 筛选位置('all'表示全部) | filterDevicesByLocation(location: string): void {
this.selectedLocation = location;
if (location === 'all') {
this.filteredDevices = [...this.devices];
} else {
// 筛选指定位置的设备(忽略大小写匹配)
this.filteredDevices = this.devices.filter(
device => device.location.toLowerCase() === location... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left filterDevicesByLocation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left location AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Le... | filterDevicesByLocation(location: string): void {
this.selectedLocation = location;
if (location === 'all') {
this.filteredDevices = [...this.devices];
} else {
// 筛选指定位置的设备(忽略大小写匹配)
this.filteredDevices = this.devices.filter(
device => device.location.toLowerCase() === location... | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | dc207a7d4f366b25b45d3f27fcc6290444ba00e1 | gitcode |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/components/CustomMarkdownComponent.ets | arkts | flushReportedSize | Computes the final report height (clamped by Yoga / display) and forwards it to the engine.
Dedups against the last reported (height, width) pair and ignores non-positive heights. | private flushReportedSize(): void {
const size: SizeOptions | undefined = this.latestSize;
if (size === undefined) {
return;
}
const newH: number = size.height as number;
const newW: number = size.width as number;
if (newH <= 0) {
return;
}
const yogaHeight: number = this.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left flushReportedSize 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 AS... | private flushReportedSize(): void {
const size: SizeOptions | undefined = this.latestSize;
if (size === undefined) {
return;
}
const newH: number = size.height as number;
const newW: number = size.width as number;
if (newH <= 0) {
return;
}
const yogaHeight: number = this.... | https://github.com/AGenUI/AGenUI | bc7b1ea0177ee554d1884dc7cfc8ba84176cecdf | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | preload | 预加载
如果需要预加载本地图片,请在imageKnifeOption.context上设置对应的页面context,默认的context在此接口中不可用
@param loadSrc 图片地址url
@returns 图片请求request | preload(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2): ImageKnifeRequest {
let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2;
if (typeof loadSrc === 'string') {
imageKnifeOption = {
loadSrc: loadSrc
};
} else {
imageKnifeOption = loadSrc;
}
const req... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left preload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loadSrc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression#Left AST#identif... | preload(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2): ImageKnifeRequest {
let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2;
if (typeof loadSrc === 'string') {
imageKnifeOption = {
loadSrc: loadSrc
};
} else {
imageKnifeOption = loadSrc;
}
const req... | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L100-L114 | 8df504dd3f392f8fec213a98b5cd94c6c1a50664 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/eraser/src/main/ets/pages/EraserMainPage.ets | arkts | getResponRegion | 获取线宽列表项的触摸热区,尺寸小于阈值时扩大触摸热区 | getResponRegion(size: number, threshold: number) {
const rectangle: Rectangle = {
x: size < threshold ? (size - threshold) / 2 : 0,
y: size < threshold ? (size - threshold) / 2 : 0,
width: size < threshold ? threshold : size,
height: size < threshold ? threshold : size
}
return rec... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getResponRegion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Rig... | getResponRegion(size: number, threshold: number) {
const rectangle: Rectangle = {
x: size < threshold ? (size - threshold) / 2 : 0,
y: size < threshold ? (size - threshold) / 2 : 0,
width: size < threshold ? threshold : size,
height: size < threshold ? threshold : size
}
return rec... | https://gitcode.com/arkui-x/samples | ad67fede9ab1a04196560c2018d66a65b88b7e74 | gitcode |
openharmony/codelabs | GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/DrawUtil.ets | arkts | drawScreenSelection | Draw screen selection component. | private drawScreenSelection() {
this.canvasContext.clearRect(0, 0, this.screenWidth, this.screenHeight);
this.canvasContext.beginPath();
this.canvasContext.moveTo(0, 0);
this.canvasContext.lineTo(this.screenWidth, 0);
this.canvasContext.lineTo(this.screenWidth, this.screenHeight);
this.canvas... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawScreenSelection 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... | private drawScreenSelection() {
this.canvasContext.clearRect(0, 0, this.screenWidth, this.screenHeight);
this.canvasContext.beginPath();
this.canvasContext.moveTo(0, 0);
this.canvasContext.lineTo(this.screenWidth, 0);
this.canvasContext.lineTo(this.screenWidth, this.screenHeight);
this.canvas... | https://gitee.com/openharmony/codelabs.git | 2bf700cb77009582610a86d09d9c954d76f0b309 | gitee |
Dige945/EmoCollector | entry/src/main/ets/model/DBManager.ets | arkts | getInstance | 获取数据库管理器单例
@returns DBManager 实例 | public static getInstance(): DBManager {
if (!DBManager.instance) {
DBManager.instance = new DBManager();
}
return DBManager.instance;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): DBManager {
if (!DBManager.instance) {
DBManager.instance = new DBManager();
}
return DBManager.instance;
} | https://github.com/Dige945/EmoCollector | e93ec728b8f06c6bb73a1aead0c12081b74469da | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | of | Creates a new BigUint64Array using initializer
@param data initializer
@returns a new BigUint64Array from data | public of(data: Object[]): BigUint64Array {
throw new Error("BigUint64Array.of: not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public of(data: Object[]): BigUint64Array {
throw new Error("BigUint64Array.of: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5a187e2a36802ac7e8f2e35bb2810c48437d61d8 | gitee |
JackJiang2011/harmonychat | entry/src/main/ets/pages/ChatPage.ets | arkts | aboutToDisappear | 界面被销毁时被调用。 | aboutToDisappear() {
// 取消事件通知
this.removeEvents();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | aboutToDisappear() {
// 取消事件通知
this.removeEvents();
} | https://github.com/JackJiang2011/harmonychat | 5684039c792f06931e63c1a6b1ccf76a88bbfaec | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLast | / === with element lambda functions ===
Finds the last element in the Int32Array that satisfies the condition
@param { function } fn - condition
@returns { number } - the last element that satisfies fn
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Int32Array) => boolean =
(val: number, index: int, array: Int32Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Int32Array) => boolean =
(val: number, index: int, array: Int32Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | https://gitcode.com/iop123123/arkts-static-skills | 8893323ed4ba65c3ec1e61934516393b9c9d67ef | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Settings/SettingsPermissionPage.ets | arkts | closePermission | 关闭权限,注意:鸿蒙没有关闭权限的API,需要用户自行到设置页关闭 | closePermission() {
this.promptAction.showDialog({
alignment: DialogAlignment.Center,
title: '温馨提示',
message: '关闭权限会影响应用的正常运行,您确定关闭吗?',
buttons: [
{ text: '取消', color: $r('app.color.brand') },
{ text: '狠心关闭', color: $r('app.color.font_sub') },
]
})
.then((re... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left closePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | closePermission() {
this.promptAction.showDialog({
alignment: DialogAlignment.Center,
title: '温馨提示',
message: '关闭权限会影响应用的正常运行,您确定关闭吗?',
buttons: [
{ text: '取消', color: $r('app.color.brand') },
{ text: '狠心关闭', color: $r('app.color.font_sub') },
]
})
.then((re... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 006e25e7ed8b3e606f60864e96b9b1a8dea48188 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | subarray | Creates a Int8Array with the same ArrayBuffer
@param begin start index, inclusive
@returns new Int8Array with the same ArrayBuffer | public subarray(begin: number): Int8Array {
return this.subarray(begin as int)
} | 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#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public subarray(begin: number): Int8Array {
return this.subarray(begin as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9bfa76cf4f86c8561c08fb60baffd8aef7caa52b | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.