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 |
|---|---|---|---|---|---|---|---|---|---|---|
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartCategory.ets | arkts | createRecommendation | 创建推荐结果 | static createRecommendation(
categoryId: number,
categoryName: string,
confidence: number,
matchedKeywords: string[],
score: number
): CategoryRecommendation {
const result: CategoryRecommendation = {
categoryId: categoryId,
categoryName: categoryName,
confidence: confidenc... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createRecommendation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS... | static createRecommendation(
categoryId: number,
categoryName: string,
confidence: number,
matchedKeywords: string[],
score: number
): CategoryRecommendation {
const result: CategoryRecommendation = {
categoryId: categoryId,
categoryName: categoryName,
confidence: confidenc... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0a1d5e96317b3f2318e7135737a7fb7b0a0df11b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/DeviceSensorService.ets | arkts | getLastGyroValues | 获取最后一次陀螺仪数据(用于测试/调试UI展示) | getLastGyroValues(): number[] {
return [...this.lastGyroValues];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLastGyroValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR... | getLastGyroValues(): number[] {
return [...this.lastGyroValues];
} | https://github.com/AlkaidLab/moonlight-harmony | 27bd8b712aa0bb0aaaf5bc41dafdfdc949dedf35 | github |
Countly/countly-sdk-hos | library/src/main/ets/api/CrashesApi.ets | arkts | setThreadStackProvider | Register a provider that returns Worker/background-thread stacks at
crash time. Only consulted when `recordAllThreadsWithCrash` is enabled
on `ConfigCrashes`. Pass `null` to clear a previous registration.
ArkTS isolates cannot enumerate each other's stacks from the main
thread, so the SDK can't populate these automatic... | public setThreadStackProvider(provider: ThreadStackProvider | null): void {
this.logger.i(`[Crashes] Calling setThreadStackProvider, provider=[${provider !== null}]`);
this.module.setThreadStackProvider(provider);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setThreadStackProvider AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left provider AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binar... | public setThreadStackProvider(provider: ThreadStackProvider | null): void {
this.logger.i(`[Crashes] Calling setThreadStackProvider, provider=[${provider !== null}]`);
this.module.setThreadStackProvider(provider);
} | https://github.com/Countly/countly-sdk-hos | 83beab6941e4f8a49b26175ebbb23fab37e49615 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/TotpEngine.ets | arkts | _generateCode | ==================== TOTP 核心 (RFC 6238) ==================== | function _generateCode(
secretBase32: string, algorithm: TotpAlgorithm,
digits: number, period: number): TotpCode {
const now: number = Math.floor(Date.now() / 1000);
const counterVal: number = Math.floor(now / period);
const remaining: number = period - (now % period);
const progress: number = 1.0 - (rema... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left _generateCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left secretBase32 AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | function _generateCode(
secretBase32: string, algorithm: TotpAlgorithm,
digits: number, period: number): TotpCode {
const now: number = Math.floor(Date.now() / 1000);
const counterVal: number = Math.floor(now / period);
const remaining: number = period - (now % period);
const progress: number = 1.0 - (rema... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 2b55d8651908e10b45024aa60b6b11460cb6dc7e | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | mapRowToBill | 映射数据库行到SharedBill对象 | private static mapRowToBill(resultSet: relationalStore.ResultSet): SharedBill {
const note = DAOHelper.getString(resultSet, 'note');
const splitType = DAOHelper.getString(resultSet, 'split_type');
const splitDetailsJson = DAOHelper.getString(resultSet, 'split_details_json');
const attachmentsJson = DA... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left mapRowToBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Le... | private static mapRowToBill(resultSet: relationalStore.ResultSet): SharedBill {
const note = DAOHelper.getString(resultSet, 'note');
const splitType = DAOHelper.getString(resultSet, 'split_type');
const splitDetailsJson = DAOHelper.getString(resultSet, 'split_details_json');
const attachmentsJson = DA... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3aaee244a6e85c9777a3963811efcfd71d640b9a | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/resources/classes/meowResources.ets | arkts | loadBackgroundImage | Load background image from path.
@param path The path. | async loadBackgroundImage() {
const backgroundImage = await readBackgroundImageConcurrent(this.backgroundImagePath);
if (!backgroundImage) {
meow(`NO background image read from ${this.backgroundImagePath}.`, 'meowResources][loadBackgroundImage', meowLevel.WARN);
return;
}
setTimeout(() => ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadBackgroundImage 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 { ... | async loadBackgroundImage() {
const backgroundImage = await readBackgroundImageConcurrent(this.backgroundImagePath);
if (!backgroundImage) {
meow(`NO background image read from ${this.backgroundImagePath}.`, 'meowResources][loadBackgroundImage', meowLevel.WARN);
return;
}
setTimeout(() => ... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 5e0755370e5d43d1aac3f7712b17f56400a59e35 | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/entry/src/main/ets/scan/ScanPage.ets | arkts | stopScan | 停止扫描(关闭相机闪光灯) | stopScan() {
if (this.isFlashlightOn) {
try {
//关闭相机闪光灯
customScan.closeFlashLight()
this.offLightingFlash()
this.isShowFlashlight = false
this.isFlashlightOn = false
} catch (e) {
console.error('lucy== 关闭手电筒失败', e.code)
}
try {
//暂停扫... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopScan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Lef... | stopScan() {
if (this.isFlashlightOn) {
try {
//关闭相机闪光灯
customScan.closeFlashLight()
this.offLightingFlash()
this.isShowFlashlight = false
this.isFlashlightOn = false
} catch (e) {
console.error('lucy== 关闭手电筒失败', e.code)
}
try {
//暂停扫... | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 53d2f8b925d7b6973c38a89f44103a1f2738d8dc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | reduceRight | Calls the specified callback function for all the elements in an array, in descending order.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduceR... | public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint16Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue: number = this.$_get(this... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#L... | public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint16Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue: number = this.$_get(this... | https://gitcode.com/iop123123/arkts-static-skills | c84d929a52a353ef5fbf34ff77c5c1e9bd0656d2 | gitcode |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/Options.ets | arkts | getOptionGroups | Gets the OptionGroups that are members of this Options instance.
@return a Collection of OptionGroup instances. | getOptionGroups(): Set<OptionGroup>{
return new Set<OptionGroup>(this.optionGroups.values());
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getOptionGroups 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#:#L... | getOptionGroups(): Set<OptionGroup>{
return new Set<OptionGroup>(this.optionGroups.values());
} | https://gitee.com/openharmony-sig/commons-cli.git | 62f5af9b8a9bd93ca2251f72c7ed5ef56609c4d4 | gitee |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/index.ets | arkts | setGlobalConfig | 设置全局配置 | public static setGlobalConfig(option?: Partial<TnGlobalConfigType>) {
let config = AppStorageV2.connect(TnGlobalConfig, TnAppStorageKey.GLOBAL_CONFIG, () => new TnGlobalConfig(option));
if (config) {
ObjectAssign(config, option);
} else {
AppStorageV2.connect(TnGlobalConfig, TnAppStorageKey.GL... | 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 setGlobalConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#?#Left ... | public static setGlobalConfig(option?: Partial<TnGlobalConfigType>) {
let config = AppStorageV2.connect(TnGlobalConfig, TnAppStorageKey.GLOBAL_CONFIG, () => new TnGlobalConfig(option));
if (config) {
ObjectAssign(config, option);
} else {
AppStorageV2.connect(TnGlobalConfig, TnAppStorageKey.GL... | https://github.com/codelably/tuniao-ui | 7c20854549cb806566c57ae427dad4a0c018501f | github |
arkui-x/samples | CodeLab/Cases/feature/customanimationtab/src/main/ets/utils/CustomAnimationTab.ets | arkts | baseBuilder | 默认tabContent样式 | @Builder
function baseBuilder(params: ESObject) {
Column() {
Text("Text")
.fontSize(CommonConstants.DEFAULT_TAB_CONTENT_FONT_SIZE)
}
.justifyContent(FlexAlign.Center)
.height(CommonConstants.FULL_PERCENT)
.width(CommonConstants.FULL_PERCENT)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left baseBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requi... | @Builder
function baseBuilder(params: ESObject) {
Column() {
Text("Text")
.fontSize(CommonConstants.DEFAULT_TAB_CONTENT_FONT_SIZE)
}
.justifyContent(FlexAlign.Center)
.height(CommonConstants.FULL_PERCENT)
.width(CommonConstants.FULL_PERCENT)
} | https://gitcode.com/arkui-x/samples | 0c85fd5b045815b7d5e3f0a2cfa7518b34cded52 | gitcode |
honjow/Next2V | shared/src/main/ets/network/HttpClient.ets | arkts | getTextWithHeaders | GET request for plain text with custom headers (e.g. Cookie) | async getTextWithHeaders(endpoint: string, headers: Record<string, string>): Promise<string> {
return this.requestText(endpoint, http.RequestMethod.GET, MAX_RETRIES, headers)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTextWithHeaders AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left endpoint AST#identifier#Right AST#type_annotation#Left AST#:... | async getTextWithHeaders(endpoint: string, headers: Record<string, string>): Promise<string> {
return this.requestText(endpoint, http.RequestMethod.GET, MAX_RETRIES, headers)
} | https://github.com/honjow/Next2V | 8f7797a5f0887408d980a99a8ec4284470fafca6 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | testIncrementDecrement | --- Increment / decrement patterns --- | function testIncrementDecrement(): string {
let i: number = 5;
i = i + 1;
let a: number = i;
i = i + 1;
let b: number = i;
i = i - 1;
let c: number = i;
i = i - 1;
let d: number = i;
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testIncrementDecrement 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#pred... | function testIncrementDecrement(): string {
let i: number = 5;
i = i + 1;
let a: number = i;
i = i + 1;
let b: number = i;
i = i - 1;
let c: number = i;
i = i - 1;
let d: number = i;
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | https://github.com/miaochiahao/ark-ghidra | b18150d996ef16860c65e9d5bed12339a40528de | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseTypes.ets | arkts | createReadHistoryRecord | 创建阅读历史数据库记录 | static createReadHistoryRecord(): ReadHistoryDatabaseRecord {
return {
id: '',
comicId: '',
chapterId: '',
pageNumber: 0, // 使用pageNumber字段
userId: '',
readTime: 0,
duration: 0, // 使用duration字段
createTime: 0
};
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createReadHistoryRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Lef... | static createReadHistoryRecord(): ReadHistoryDatabaseRecord {
return {
id: '',
comicId: '',
chapterId: '',
pageNumber: 0, // 使用pageNumber字段
userId: '',
readTime: 0,
duration: 0, // 使用duration字段
createTime: 0
};
} | https://github.com/DaLongZhuaZi/manxia | b968f98bf1798b2c262e4e9965d2e940354ddb81 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | getSemanticColor | ==================== 新主题色系统桥接方法 ====================
以下方法提供从旧系统到新 AppColors 系统的桥接
推荐直接使用 AppColors 或 ThemeColorState
获取语义化主题色(推荐使用)
使用新的 AppColors 系统,自动适配当前主题
@param role 颜色角色
@returns 当前主题对应的颜色字符串
@example
.fontColor(ThemeAwareHelper.getSemanticColor(ColorRole.TEXT_PRIMARY))
.backgroundColor(ThemeAwareHelper.getSemant... | public static getSemanticColor(role: ColorRole): string {
return AppColors.getColor(role);
} | 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 getSemanticColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left role AST#identifier#Right AST#:#Left :... | public static getSemanticColor(role: ColorRole): string {
return AppColors.getColor(role);
} | https://github.com/DaLongZhuaZi/manxia | 0493ecd049e04f9315bd9d8a29367212071c2c31 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/pages/ControllerTestPage.ets | arkts | aboutToDisappear | 页面销毁时恢复 GamepadManager 的完整回调链路。
子 Tab 的 aboutToDisappear 会在 Page 销毁前触发,但
UsbControllerTestView.stopDriver() 在释放设备后不再重启驱动
(避免切到 GCK Tab 时设备被立即重新独占)。
因此当整个测试页面退出时,需要在此处完整恢复 GamepadManager。 | aboutToDisappear(): void {
try {
GamepadManager.getInstance().reattachInputCallbacks();
console.info('[ControllerTestPage] 页面销毁,已恢复 GamepadManager 回调');
} catch (err) {
console.error('[ControllerTestPage] 恢复 GamepadManager 回调失败:', err);
}
} | AST#program#Left AST#ERROR#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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
try {
GamepadManager.getInstance().reattachInputCallbacks();
console.info('[ControllerTestPage] 页面销毁,已恢复 GamepadManager 回调');
} catch (err) {
console.error('[ControllerTestPage] 恢复 GamepadManager 回调失败:', err);
}
} | https://github.com/AlkaidLab/moonlight-harmony | 2f379e5fd6e97bfd253e7ce17763646ebf45c0aa | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | onTouchStart | Touch start.
@param x
@param y | onTouchStart(x: number, y: number): void {
if (this.state !== CropTouchState.NONE) {
Logger.debug(TAG, 'onTouchStart: touch state is not none!');
return;
}
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
}
Logger.debug(TAG, `onTouchStart: [x: ${x}, y: ${y}]`);
if (th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTouchStart 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#Left number AST#identifier#Right AST#,#Left , AST#,... | onTouchStart(x: number, y: number): void {
if (this.state !== CropTouchState.NONE) {
Logger.debug(TAG, 'onTouchStart: touch state is not none!');
return;
}
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
}
Logger.debug(TAG, `onTouchStart: [x: ${x}, y: ${y}]`);
if (th... | https://gitee.com/openharmony/codelabs.git | 55b6a2295a09905dbad76917e864bc872cbd23bb | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | batchSetSettingsConfig | 批量设置配置值
@param configs 配置对象 {key: value, ...}
@returns 所有设置是否成功
Requirements: 13.5 | static batchSetSettingsConfig(configs: Record<string, SettingsConfigValue>): boolean {
return MelonDSNative.native.batchSetSettingsConfig(configs);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left batchSetSettingsConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left configs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instan... | static batchSetSettingsConfig(configs: Record<string, SettingsConfigValue>): boolean {
return MelonDSNative.native.batchSetSettingsConfig(configs);
} | https://github.com/richshaw2015/nds | 01e44c66f3283f7f6ac9049eab4d24fb38174613 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneManager.ets | arkts | onMicrophoneStateChanged | MicrophoneStateListener 实现 | onMicrophoneStateChanged(state: MicrophoneState): void {
this.state = state;
if (this.externalListener) {
this.externalListener.onMicrophoneStateChanged(state);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMicrophoneStateChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MicrophoneState AST#identifier... | onMicrophoneStateChanged(state: MicrophoneState): void {
this.state = state;
if (this.externalListener) {
this.externalListener.onMicrophoneStateChanged(state);
}
} | https://github.com/AlkaidLab/moonlight-harmony | 18bf93f461970bdfbf100f832421a4017423d8fc | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseView.ets | arkts | toCreateArkUIView | @final Do not override. | public toCreateArkUIView(): ComponentContent<HybridBaseView> | null {
let node: ComponentContent<HybridBaseView> | null = this.createCompContent();
if (node === null) {
return null;
}
this.arkUINode = node;
return node;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toCreateArkUIView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr... | public toCreateArkUIView(): ComponentContent<HybridBaseView> | null {
let node: ComponentContent<HybridBaseView> | null = this.createCompContent();
if (node === null) {
return null;
}
this.arkUINode = node;
return node;
} | https://github.com/AGenUI/AGenUI | 15ee75b895a3329fa71ecdabff81051653d54da1 | github |
ibestservices/ibest-ui | library/src/main/ets/components/dateTimePicker/index.ets | arkts | getDaysList | 获取日期列表 | getDaysList(): IBestPickerOption[] {
let daysList: IBestPickerOption[] = []
let year = this.getValue("year")
let month = this.getValue("month")
let minDay = this.isMinYear(year) && this.isMinMonth(month) ? this.minDate.getDate() : 1
let maxDay = this.isMaxYear(year) && this.isMaxMonth(month) ? this.maxDate.g... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDaysList 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 IBestPickerOption AST#identifier#Right AST#[#Left ... | getDaysList(): IBestPickerOption[] {
let daysList: IBestPickerOption[] = []
let year = this.getValue("year")
let month = this.getValue("month")
let minDay = this.isMinYear(year) && this.isMinMonth(month) ? this.minDate.getDate() : 1
let maxDay = this.isMaxYear(year) && this.isMaxMonth(month) ? this.maxDate.g... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dateTimePicker/index.ets#L231-L244 | bcefe5d008d1fc7ca7fa5f03d97427393845df17 | github |
PollenWang6/HiXD | entry/src/main/ets/utils/PreferenceUtil.ets | arkts | _put | 内部方法:统一写内存缓存 + 持久化 | private static _put(key: string, value: string | boolean | number): void {
inMemoryCache.set(key, value);
const prefs = PreferenceUtil.getPrefs();
if (prefs) {
try {
(prefs.put(key, value as ValueType) as Promise<void>).then(() => prefs.flush()).catch(() => { console.warn("PreferenceUtil", "... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left _put AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#id... | private static _put(key: string, value: string | boolean | number): void {
inMemoryCache.set(key, value);
const prefs = PreferenceUtil.getPrefs();
if (prefs) {
try {
(prefs.put(key, value as ValueType) as Promise<void>).then(() => prefs.flush()).catch(() => { console.warn("PreferenceUtil", "... | https://github.com/PollenWang6/HiXD | ba5782bfda6e96966971d35f3352654994e5d20b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamLifecycleManager.ets | arkts | registerDisplayChangeListener | ==================== 屏幕旋转 ====================
注册屏幕方向变化监听
使用 display.on('change') 监听屏幕变化 | registerDisplayChangeListener(): void {
try {
this.displayChangeCallback = (displayId: number): void => {
this.handleDisplayChange(displayId);
};
display.on('change', this.displayChangeCallback);
console.info('[StreamPage] 已注册屏幕方向变化监听');
} catch (err) {
console.warn('[Str... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDisplayChangeListener 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 AS... | registerDisplayChangeListener(): void {
try {
this.displayChangeCallback = (displayId: number): void => {
this.handleDisplayChange(displayId);
};
display.on('change', this.displayChangeCallback);
console.info('[StreamPage] 已注册屏幕方向变化监听');
} catch (err) {
console.warn('[Str... | https://github.com/AlkaidLab/moonlight-harmony | 946fecc8ee342590be656585d6c13ea128e990c5 | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/SdkApiUtil.ets | arkts | isSdkApiAtLeast | @param minSdkApi Lower bound (inclusive).
@returns True when the device API level is at least minSdkApi. | public static isSdkApiAtLeast(minSdkApi: number): boolean {
return deviceInfo.sdkApiVersion >= minSdkApi;
} | 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 isSdkApiAtLeast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minSdkApi AST#identifier#Right AST#ERROR#Left AST#:#Le... | public static isSdkApiAtLeast(minSdkApi: number): boolean {
return deviceInfo.sdkApiVersion >= minSdkApi;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 8a13947ae6f45a664e5629cd748491d5a3549a22 | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/bean/OmniFilterItemBean.ets | arkts | values | 获取所有常量值的数组 | static values(): string[] {
return [OmniFilterShowType.dropList, OmniFilterShowType.dropGrid, OmniFilterShowType.more];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left string AST#iden... | static values(): string[] {
return [OmniFilterShowType.dropList, OmniFilterShowType.dropGrid, OmniFilterShowType.more];
} | https://github.com/wuba/omni-ui | 894ad96023f1ebd0b40e21a1b396501358177c7a | github |
openharmony/codelabs | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | getStillsData | Get stills data.
@return {stills} return stills Resource. | getStillsData(): Resource[] {
let stills: Resource[] = [];
STILLS_DATA.forEach((stillsItem: Resource) => {
stills.push(stillsItem);
});
return stills;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getStillsData 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#identifier#Left Resource AST#ident... | getStillsData(): Resource[] {
let stills: Resource[] = [];
STILLS_DATA.forEach((stillsItem: Resource) => {
stills.push(stillsItem);
});
return stills;
} | https://gitee.com/openharmony/codelabs.git | 2ed24ac8bc7e98dae6493241ba95d7982ada0e39 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/ThemeColors.ets | arkts | refreshAll | 强制刷新所有注册的状态 | static refreshAll(): void {
ThemeColorManager.registrations.forEach((registration, id) => {
const newState = registration.state.clone();
registration.callback(newState);
});
logger.info(TAG, `已刷新所有主题色状态,数量: ${ThemeColorManager.registrations.size}`);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left refreshAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static refreshAll(): void {
ThemeColorManager.registrations.forEach((registration, id) => {
const newState = registration.state.clone();
registration.callback(newState);
});
logger.info(TAG, `已刷新所有主题色状态,数量: ${ThemeColorManager.registrations.size}`);
} | https://github.com/DaLongZhuaZi/manxia | c9859ea8dd9885dee3825eb6fd8ec7852c78b18e | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | getQueryNames | Obtains all non-repeated keys in the query component of this URI.
@returns { string[] } Return a set of decoded names. | getQueryNames(): string[] {
return this.uriEntry.getQueryNames();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getQueryNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | getQueryNames(): string[] {
return this.uriEntry.getQueryNames();
} | https://gitcode.com/iop123123/arkts-static-skills | 958831227fea13cc4cee4c735bd47ab710102d2a | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | logTaskPool | 记录 TaskPool 任务执行日志
仅在 DEBUG 级别记录,包含任务执行耗时和数据量
@param taskName 任务名称
@param duration 执行耗时(毫秒)
@param dataCount 处理的数据量
@param usedTaskPool 是否使用了 TaskPool(false 表示降级到主线程) | logTaskPool(taskName: string, duration: number, dataCount: number, usedTaskPool: boolean): void {
// TaskPool 日志仅在 DEBUG 级别记录
if (!this.shouldLog(LogLevel.DEBUG)) {
return
}
const threadInfo = usedTaskPool ? 'TaskPool' : '主线程(降级)'
const content = `${taskName} - 数据量: ${dataCount}, 线程: ${threa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logTaskPool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left taskName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R... | logTaskPool(taskName: string, duration: number, dataCount: number, usedTaskPool: boolean): void {
// TaskPool 日志仅在 DEBUG 级别记录
if (!this.shouldLog(LogLevel.DEBUG)) {
return
}
const threadInfo = usedTaskPool ? 'TaskPool' : '主线程(降级)'
const content = `${taskName} - 数据量: ${dataCount}, 线程: ${threa... | https://github.com/offlinecat-dev/OCNetORM | 76d2643f285781e1f253e8cf396d4a8cc7b30cf6 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets | arkts | fetchList | 获取列表数据
@returns {Promise<void>} Promise<void> | private async fetchList(): Promise<void> {
this.items = await this.demoRepository.getAll();
} | 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 fetchList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | private async fetchList(): Promise<void> {
this.items = await this.demoRepository.getAll();
} | https://github.com/Joker-x-dev/HarmonyKit | a59415b39013ce2a0d6562680d16a823b33339d2 | github |
openharmony/applications_settings | product/phone/src/main/ets/pages/passwordInput.ets | arkts | getInputMessage | Get input message
@return : message | getInputMessage(): Resource {
let inputMessage: Resource = $r("app.string.endTextEmpty");
if (this.isInputFirstTime) {
switch (this.passwordType) {
case PinSubType.PIN_SIX:
inputMessage = $r('app.string.password_message_number_6');
break;
case PinSubType.PIN_NUMBER:
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInputMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Resource AST#identifier#Right AST#ERROR#Right ... | getInputMessage(): Resource {
let inputMessage: Resource = $r("app.string.endTextEmpty");
if (this.isInputFirstTime) {
switch (this.passwordType) {
case PinSubType.PIN_SIX:
inputMessage = $r('app.string.password_message_number_6');
break;
case PinSubType.PIN_NUMBER:
... | https://gitee.com/openharmony/applications_settings.git | a2315e104718b29fd87a31123d08806b0dcc1204 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/division/division_short.ets | arkts | main | ---
desc: check division for short integer operands
--- | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a / b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a / b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9cd3b46d5cd86702ed2c436a70868b36fce6d61d | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/RadarChartModel.ets | arkts | getYChartMin | Returns the minimum value this chart can display on it's y-axis. | public getYChartMin(): number {
return this.mYAxis.mAxisMinimum;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYChartMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | public getYChartMin(): number {
return this.mYAxis.mAxisMinimum;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5d6719537e743ac0e85d42cdcb0fa7aa303d24e5 | gitee |
robotzzh/AgricultureApp | entry/src/main/ets/models/MainViewModel.ets | arkts | getFarmData | public loadFarmData(fieldId:number ,
name:string,
sensor_IP:string,
sensor_port: number,
):FarmBean{
let his_info = new History_Info(fieldId,
name,
sensor_IP,
sensor_port);
TODO 从cache把内存数据加载到这里
TODO 把最后一个历史信息装填为Farmbean
let last_farm_bean : FarmBean = his_info.to_farm_bean(his_info.history_humidity.length-1);
return l... | public async getFarmData(fieldId:number):Promise<boolean>{
let f1:FarmBean = this.farmBean[0];
let f2:FarmBean = this.farmBean[1];
//console.info('tem: '+ this.farmBean[0].temperature + " and"+ f1.temperature)
setTimeout(()=>{
//处理保存farm_bean进DB
//console.info("temp"+f1.temperature.toStr... | 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 getFarmData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fieldId AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public async getFarmData(fieldId:number):Promise<boolean>{
let f1:FarmBean = this.farmBean[0];
let f2:FarmBean = this.farmBean[1];
//console.info('tem: '+ this.farmBean[0].temperature + " and"+ f1.temperature)
setTimeout(()=>{
//处理保存farm_bean进DB
//console.info("temp"+f1.temperature.toStr... | https://github.com/robotzzh/AgricultureApp | 0be533ee3aa7607e7199d7e3342d066707e5be5c | github |
HateCodingHateCoding/Bullying-detection-system-v2-public | frontend/AnQ/entry/src/main/ets/common/WaterFlowDataSource.ets | arkts | unregisterDataChangeListener | 注销改变数据的控制器 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
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) {
this.listeners.splice(pos, 1)
}
} | https://github.com/HateCodingHateCoding/Bullying-detection-system-v2-public | a77c875fe450666fa1ac475c53ab970d0161c319 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets | arkts | keyHash | Hash of the key
@type { int }
@syscap SystemCapability.Utils.Lang | get keyHash(): int {
return this._keyHash
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left keyHash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Righ... | get keyHash(): int {
return this._keyHash
} | https://gitcode.com/iop123123/arkts-static-skills | fadf96c1e01ed99eec66743a8db81a638211b15d | gitcode |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | having | 过滤分组后的结果
@param sql having后面的sql条件
@returns Wrapper | having(sql: string, condition: boolean = true): Wrapper {
if (condition) {
this.havingSql = `having ${sql}`
}
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left having AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sql AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig... | having(sql: string, condition: boolean = true): Wrapper {
if (condition) {
this.havingSql = `having ${sql}`
}
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L279-L284 | 3d8710b30e93f041e2ce0e26fccf51d45a91c3a7 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a Uint8Array with the same underlying ArrayBuffer
@param begin start index, inclusive
@param end last index, exclusive
@returns new Uint8Array with the same underlying ArrayBuffer
public | /* public */ internal subarray(begin: int, end: int): Uint8Array {
return new Uint8Array(this.buffer, begin * Uint8Array.BYTES_PER_ELEMENT, end - begin)
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Lef... | /* public */ internal subarray(begin: int, end: int): Uint8Array {
return new Uint8Array(this.buffer, begin * Uint8Array.BYTES_PER_ELEMENT, end - begin)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2a81747600bd37e3437b389b3be89b25e24d25a0 | gitee |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/service/AlgorithmService.ets | arkts | setDetailsToPreference | 设置详情到首选项
@param details ComponentDetailModel[]
@returns Promise<void> | public setDetailsToPreference(details: ComponentDetailModel[]): Promise<void> {
return new Promise((resolve: () => void) => {
PreferenceUtil.getInstance().hasValue(AlgorithmService.COMPONENT_DETAIL_DATA)
.then((result) => {
if (result) {
PreferenceUtil.getInstance()
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDetailsToPreference AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left details AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr... | public setDetailsToPreference(details: ComponentDetailModel[]): Promise<void> {
return new Promise((resolve: () => void) => {
PreferenceUtil.getInstance().hasValue(AlgorithmService.COMPONENT_DETAIL_DATA)
.then((result) => {
if (result) {
PreferenceUtil.getInstance()
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 4699dc24933902f972c5dbd0789bacab7773cc84 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MultiAgentOrchestrator.ets | arkts | extractKnowledgeRefs | 提取知识引用
@param answers 智能体回答列表
@returns 知识引用列表 | private extractKnowledgeRefs(answers: AgentAnswer[]): any[] {
const refs: any[] = [];
for (const answer of answers) {
for (const ref of answer.knowledgeUsed) {
if (!refs.find(r => r.id === ref.id)) {
refs.push(ref);
}
}
}
return refs;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractKnowledgeRefs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left answers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subsc... | private extractKnowledgeRefs(answers: AgentAnswer[]): any[] {
const refs: any[] = [];
for (const answer of answers) {
for (const ref of answer.knowledgeUsed) {
if (!refs.find(r => r.id === ref.id)) {
refs.push(ref);
}
}
}
return refs;
} | https://github.com/LJ666-ui/harmony-health-care | f1f622e4537b9a1df401f0cdc83ccef3f1e28ad5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets | arkts | set | Puts a pair of key and value into the Map
@param { K } key the key to put into the Map
@param { V } val the value to put into the Map
@returns { this } return this. | public set(key: K, val: V): this {
// insert into buckets
ConcurrencyHelpers.mutexLock(this.bucketsMutex);
this.setVal.increase();
const buck = this.getOrCreateBucket(key);
const buckIndex = this.getBucketIndex(key);
ConcurrencyHelpers.mute... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identi... | public set(key: K, val: V): this {
// insert into buckets
ConcurrencyHelpers.mutexLock(this.bucketsMutex);
this.setVal.increase();
const buck = this.getOrCreateBucket(key);
const buckIndex = this.getBucketIndex(key);
ConcurrencyHelpers.mute... | https://gitcode.com/iop123123/arkts-static-skills | 944aa3e77d76630cc354632814628401aa45f265 | gitcode |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/StyleUtil.ets | arkts | getShadowStyle | 获取阴影样式 | static getShadowStyle(elevation: number = 1) {
const theme = ThemeUtil.getCurrentThemeConfig();
return {
shadow: `0 ${elevation}px ${elevation + 2}px ${theme.colors.shadow}`,
borderRadius: `${theme.borderRadius.md}px`
};
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getShadowStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elevation AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_e... | static getShadowStyle(elevation: number = 1) {
const theme = ThemeUtil.getCurrentThemeConfig();
return {
shadow: `0 ${elevation}px ${elevation + 2}px ${theme.colors.shadow}`,
borderRadius: `${theme.borderRadius.md}px`
};
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | fdfbec706211ac9c4ae26b68f07b091b29fd584b | github |
openharmony/testfwk_arkxtest | jsunit/src_static/module/assert/deepEquals/DeepTypeUtils.ets | arkts | isDomNoded | 是否是Node
@param obj | static isDomNoded(obj: DomNode): boolean {
return (
obj !== null && typeof obj === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string'
);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isDomNoded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DomNod... | static isDomNoded(obj: DomNode): boolean {
return (
obj !== null && typeof obj === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string'
);
} | https://gitee.com/openharmony/testfwk_arkxtest.git | 16cfc6618e813affe5eb75cacc067b6166c1fdc5 | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/ProfilePage.ets | arkts | getDirectionLabel | 获取目标方向标签 | getDirectionLabel(direction: GoalDirection): string {
switch (direction) {
case GoalDirection.DECREASE:
return '减少目标';
case GoalDirection.INCREASE:
return '增加目标';
case GoalDirection.REACH:
return '达到目标';
default:
return '增加目标';
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDirectionLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left direction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GoalDirection AST#identifier#Righ... | getDirectionLabel(direction: GoalDirection): string {
switch (direction) {
case GoalDirection.DECREASE:
return '减少目标';
case GoalDirection.INCREASE:
return '增加目标';
case GoalDirection.REACH:
return '达到目标';
default:
return '增加目标';
}
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | cc215bc8280063d07d4d0610fb2ea124b711f8bd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ConsolePanel.ets | arkts | clearMemoryCache | 清理内存缓存 | clearMemoryCache(): void {
try {
// 清理日志缓存
if (this.logs.length > 100) {
this.logs = this.logs.slice(-100); // 只保留最新100条
}
// 垃圾回收功能已移除(ArkTools模块不可用)
logger.info('ConsolePanel', '垃圾回收功能不可用');
logger.info('ConsolePanel', '内存缓存已清理');
this.loadData();
} catch ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearMemoryCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | clearMemoryCache(): void {
try {
// 清理日志缓存
if (this.logs.length > 100) {
this.logs = this.logs.slice(-100); // 只保留最新100条
}
// 垃圾回收功能已移除(ArkTools模块不可用)
logger.info('ConsolePanel', '垃圾回收功能不可用');
logger.info('ConsolePanel', '内存缓存已清理');
this.loadData();
} catch ... | https://github.com/DaLongZhuaZi/manxia | a1db35d1a4f5d141c4cd393b5440b4c56c5e89f2 | github |
arkui-x/samples | CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets | arkts | getBottomAvoidHeight | 获取主窗口底部导航条高度
@returns {callback: ((bottomAvoidHeight: number) => void)} | getBottomAvoidHeight(callback: ((bottomAvoidHeight: number) => void)): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to o... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBottomAvoidHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#L... | getBottomAvoidHeight(callback: ((bottomAvoidHeight: number) => void)): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to o... | https://gitcode.com/arkui-x/samples | edaca4ad597a1600ce50424b371157e17897c152 | gitcode |
SMAT-Lab/ArkAnalyzer-HapRay | test_hap/test_suite/src/main/ets/testcases/imageknife/pages/ImageCacheUtil.ets | arkts | getCacheFilePath | 获取缓存文件路径 | private static getCacheFilePath(fileName: string): string {
return ImageCacheUtil.cacheDir + '/' + fileName;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCacheFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:... | private static getCacheFilePath(fileName: string): string {
return ImageCacheUtil.cacheDir + '/' + fileName;
} | https://github.com/SMAT-Lab/ArkAnalyzer-HapRay | 3bb739cc0fa12a9a7c0d5abf02f362455fcfec6f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | generateInstructions | 生成导航指令
@param pathNodes 路径节点列表 | private generateInstructions(pathNodes: GraphNode[]): NavigationInstruction[] {
const instructions: NavigationInstruction[] = [];
for (let i = 0; i < pathNodes.length - 1; i++) {
const current = pathNodes[i];
const next = pathNodes[i + 1];
const distance = this.getDistance(current.position,... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateInstructions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pathNodes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#sub... | private generateInstructions(pathNodes: GraphNode[]): NavigationInstruction[] {
const instructions: NavigationInstruction[] = [];
for (let i = 0; i < pathNodes.length - 1; i++) {
const current = pathNodes[i];
const next = pathNodes[i + 1];
const distance = this.getDistance(current.position,... | https://github.com/LJ666-ui/harmony-health-care | fd794d1ea089a76872801aa40b4e2996e58bf6b4 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/RcpSessionPool.ets | arkts | size | 当前池中 session 数量(仅用于调试/测试) | static size(): number {
return RcpSessionPool.entries.size;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | static size(): number {
return RcpSessionPool.entries.size;
} | https://github.com/AlkaidLab/moonlight-harmony | 0fb5708093e39c511691b95455eae2bc483662f6 | github |
openharmony-sig/ohos_webrtc | sdk/ohos/har_hap/ohos_webrtc/src/ohosTest/ets/test/DataChannel.test.ets | arkts | listenToConnected | 等待pc.connectionState变为'connected'. | async function listenToConnected(pc: webrtc.RTCPeerConnection) {
while (pc.connectionState != 'connected') {
await new Promise<webrtc.Event>((resolve) => {
pc.onconnectionstatechange = resolve;
});
pc.onconnectionstatechange = null;
}
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left listenToConnected AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pc AST#identifier#Right AST#typ... | async function listenToConnected(pc: webrtc.RTCPeerConnection) {
while (pc.connectionState != 'connected') {
await new Promise<webrtc.Event>((resolve) => {
pc.onconnectionstatechange = resolve;
});
pc.onconnectionstatechange = null;
}
} | https://gitee.com/openharmony-sig/ohos_webrtc.git | e1286e92378ee30374260b5559e42e4f09b565dd | gitee |
xiebyapps/ClipLink | entry/src/main/ets/services/HttpClient.ets | arkts | get | GET request | async get<T>(path: string): Promise<T> {
console.info(`[HttpClient] GET ${this.baseUrl}${path}`);
const resultText = await this.request(path, http.RequestMethod.GET);
return this.parseJson<T>(resultText);
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#Right AST... | async get<T>(path: string): Promise<T> {
console.info(`[HttpClient] GET ${this.baseUrl}${path}`);
const resultText = await this.request(path, http.RequestMethod.GET);
return this.parseJson<T>(resultText);
} | https://github.com/xiebyapps/ClipLink | e1a407cdfac6bf737f30f7734334a1b8fe45ff54 | github |
richshaw2015/nds | ohos/entry/src/test/ThemeManager.test.ets | arkts | generateRandomThemeSequence | 生成随机主题 ID 序列用于属性测试
@param count 生成数量
@returns NDSThemeId 数组 | function generateRandomThemeSequence(count: number): NDSThemeId[] {
const sequence: NDSThemeId[] = [];
for (let i = 0; i < count; i++) {
sequence.push(getRandomThemeId());
}
return sequence;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateRandomThemeSequence AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left count AST#identifier#Right AST#type_annotation#Left AST#:#... | function generateRandomThemeSequence(count: number): NDSThemeId[] {
const sequence: NDSThemeId[] = [];
for (let i = 0; i < count; i++) {
sequence.push(getRandomThemeId());
}
return sequence;
} | https://github.com/richshaw2015/nds | b9bca1e1f26283c38df81dba85cbfee477a36399 | github |
openharmony-tpc/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | serHeaderOptions | 全局设置请求头header
@param options 请求头数组 | serHeaderOptions(options: Array<HeaderOptions>) {
options.forEach((value) => {
this.headerMap.set(value.key, value.value)
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left serHeaderOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left options AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Arr... | serHeaderOptions(options: Array<HeaderOptions>) {
options.forEach((value) => {
this.headerMap.set(value.key, value.value)
})
} | https://gitee.com/openharmony-tpc/ImageKnife.git | fe112a77930e99c37192d0ddd27319031fece121 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test29_original_index.ets | arkts | testBitwiseFlags | --- Bitwise flag patterns --- | function testBitwiseFlags(): string {
let READ: number = 1;
let WRITE: number = 2;
let EXEC: number = 4;
let perms: number = READ | WRITE;
let canRead: boolean = (perms & READ) !== 0;
let canWrite: boolean = (perms & WRITE) !== 0;
let canExec: boolean = (perms & EXEC) !== 0;
return String(canRead) + ','... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testBitwiseFlags AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testBitwiseFlags(): string {
let READ: number = 1;
let WRITE: number = 2;
let EXEC: number = 4;
let perms: number = READ | WRITE;
let canRead: boolean = (perms & READ) !== 0;
let canWrite: boolean = (perms & WRITE) !== 0;
let canExec: boolean = (perms & EXEC) !== 0;
return String(canRead) + ','... | https://github.com/miaochiahao/ark-ghidra | 402624906fe9408d312b86085280f2661b6fa7df | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/ComputerCard.ets | arkts | build | ========== 主构建方法 ========== | build() {
Column() {
Row() {
// 头像区域
this.AvatarSection()
// 信息区域
this.InfoSection()
// 快速串流按钮(仅在线且配对时显示)
if (this.canQuickStream()) {
this.QuickStreamButton()
} else {
// 箭头指示器
Image($r('app.media.ic_arrow_right'))
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Row() {
// 头像区域
this.AvatarSection()
// 信息区域
this.InfoSection()
// 快速串流按钮(仅在线且配对时显示)
if (this.canQuickStream()) {
this.QuickStreamButton()
} else {
// 箭头指示器
Image($r('app.media.ic_arrow_right'))
... | https://github.com/AlkaidLab/moonlight-harmony | 10196bc6e3e1fe8c4dc40607b85b38d931d96eb9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | escapeString | 转义字符串 | private escapeString(str: string): string {
return str
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\t/g, '\\t');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | private escapeString(str: string): string {
return str
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\t/g, '\\t');
} | https://github.com/DaLongZhuaZi/manxia | 6787d8b89c82e8838fc2ee4bd0f5857c9b02756b | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/location/LocationManager.ets | arkts | checkAndApplyPermissions | 校验并申请权限,如果申请权限返回false,则抛出异常,使用者需要使用catch接收。 | async checkAndApplyPermissions(context: Context): Promise<boolean> {
let isGranted = await this.checkLocationPermissions();
if (isGranted) {
return true;
}
try {
let userGranted = await permissionManager.reqPermissionsFromUser(PermissionConst.locationPermissions, context);
if (userGr... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left checkAndApplyPermissions AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotat... | async checkAndApplyPermissions(context: Context): Promise<boolean> {
let isGranted = await this.checkLocationPermissions();
if (isGranted) {
return true;
}
try {
let userGranted = await permissionManager.reqPermissionsFromUser(PermissionConst.locationPermissions, context);
if (userGr... | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 115983b2546ab055c761df1ff68d82712f407877 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | notifyLoadProgress | 通知加载进度 | private notifyLoadProgress(request: ImageRequestInfo, progress: number): void {
this.loadListeners.forEach(listener => {
try {
listener.onLoadProgress(request, progress);
} catch (error) {
logger.error(TAG, `通知加载进度失败: ${error instanceof Error ? error.message : String(error)}`);
}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyLoadProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private notifyLoadProgress(request: ImageRequestInfo, progress: number): void {
this.loadListeners.forEach(listener => {
try {
listener.onLoadProgress(request, progress);
} catch (error) {
logger.error(TAG, `通知加载进度失败: ${error instanceof Error ? error.message : String(error)}`);
}... | https://github.com/DaLongZhuaZi/manxia | 8e1ebb308b36960d4327cada8dcaa700d331893e | github |
fbinba3955/Flymby | main/src/main/ets/pages/collection/MyFavoritePage.ets | arkts | aboutToAppear | 单集收藏数据 | aboutToAppear(): void {
this.init()
} | 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 {
this.init()
} | https://github.com/fbinba3955/Flymby | 464f9ec72e515d3d3f5b2b95ddf2f2b636afb884 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | pushToRemoteAsync | 异步推送到远端
@param path 原始文件路径
@param content 文件内容 | private async pushToRemoteAsync(path: string, content: ArrayBuffer): Promise<void> {
try {
hilog.debug(DOMAIN, TAG, 'Push to remote async: %{public}s', path);
await this.decoratedStorage.write(path, content);
hilog.debug(DOMAIN, TAG, 'Push to remote async success: %{public}s', path);
} catch... | 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 pushToRemoteAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Lef... | private async pushToRemoteAsync(path: string, content: ArrayBuffer): Promise<void> {
try {
hilog.debug(DOMAIN, TAG, 'Push to remote async: %{public}s', path);
await this.decoratedStorage.write(path, content);
hilog.debug(DOMAIN, TAG, 'Push to remote async success: %{public}s', path);
} catch... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L296-L305 | 6e5e85e2efeb82668022406beb456732a5c8b776 | github |
openharmony-tpc/mp4parser | library/src/main/ets/mp4parser/MP4Parser.ets | arkts | getFrameAtTimeRang | get video frames
@param timeUs
@param option
@param callBack
@returns | static getFrameAtTimeRang(stimeUs: string, etimeUs: string, option: string, frameCallBack: IFrameCallBack) {
let messageCallBack = (data: ArrayBuffer, timeUs: number) => {
frameCallBack.callBackResult(data, timeUs);
}
mp4parser_napi.getFrameAtTimeRang(stimeUs, etimeUs, option, messageCallBack)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFrameAtTimeRang AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stimeUs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | static getFrameAtTimeRang(stimeUs: string, etimeUs: string, option: string, frameCallBack: IFrameCallBack) {
let messageCallBack = (data: ArrayBuffer, timeUs: number) => {
frameCallBack.callBackResult(data, timeUs);
}
mp4parser_napi.getFrameAtTimeRang(stimeUs, etimeUs, option, messageCallBack)
} | https://gitee.com/openharmony-tpc/mp4parser.git | 7b514564b22cff8943159c992385be12c057109c | gitee |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/CominLog/PlayerManager.ets | arkts | playPreviousMusic | 播放前一首音乐 | playPreviousMusic() {
if (this.currentMusicIndex == 0) {
this.currentMusicIndex = this.musicList.length - 1
} else {
this.currentMusicIndex--
}
this.play(-1)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playPreviousMusic 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#... | playPreviousMusic() {
if (this.currentMusicIndex == 0) {
this.currentMusicIndex = this.musicList.length - 1
} else {
this.currentMusicIndex--
}
this.play(-1)
} | https://gitee.com/openharmony-sig/online_event.git | f05dae45d038da78de637f4b7bc51466c70b76d6 | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitRepeatedFixed32 | 访问 repeated fixed32 字段 | visitRepeatedFixed32(value: number[], fieldNumber: number): void {
for (const item of value) {
this.visitFixed32(item, fieldNumber)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedFixed32 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#subscript_expression#Left AST#identifier#Left numb... | visitRepeatedFixed32(value: number[], fieldNumber: number): void {
for (const item of value) {
this.visitFixed32(item, fieldNumber)
}
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 4c2091450a5d4a1e83a772a1d73e78ddaf4a2d9b | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/PlaylistsApi.ets | arkts | updatePlaylist | @summary Updates a playlist.
@param {PlaylistsApiUpdatePlaylistRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof PlaylistsApi | public updatePlaylist(requestParameters: PlaylistsApiUpdatePlaylistRequest): Promise<void> {
return this.apiClient.post({path: `/Playlists/${requestParameters.playlistId}`, data: requestParameters.updatePlaylistDto})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updatePlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | public updatePlaylist(requestParameters: PlaylistsApiUpdatePlaylistRequest): Promise<void> {
return this.apiClient.post({path: `/Playlists/${requestParameters.playlistId}`, data: requestParameters.updatePlaylistDto})
} | https://github.com/OHPG/FinSdk | 1fd6cfbbcc25bc52079bbb4aadcf47fa53a69295 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | clone | Clone an PlainArray
@returns a new PlainArray object | public clone(): PlainArray<T> {
const clone: PlainArray<T> = new PlainArray<T>()
this.buckets.forEach((value: T, key: int) => {
clone.add(key, value);
})
return clone;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clone AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right... | public clone(): PlainArray<T> {
const clone: PlainArray<T> = new PlainArray<T>()
this.buckets.forEach((value: T, key: int) => {
clone.add(key, value);
})
return clone;
} | https://gitcode.com/iop123123/arkts-static-skills | 3616de6018a9225de3a6a0b366a9f053ec83e982 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | convertToArray | Converts the list to an array.
@returns An array containing all elements of the list. | public convertToArray(): Array<T> {
let array = new Array<T>();
let currentNode: ListNode<T> | undefined = this.head;
while (currentNode !== undefined) {
array.push(currentNode!.element);
currentNode = currentNode!.next;
}
return array;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left convertToArray 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#express... | public convertToArray(): Array<T> {
let array = new Array<T>();
let currentNode: ListNode<T> | undefined = this.head;
while (currentNode !== undefined) {
array.push(currentNode!.element);
currentNode = currentNode!.next;
}
return array;
} | https://gitcode.com/iop123123/arkts-static-skills | 18b69ba87552160205df65e51b5903494602920c | gitcode |
the-wwyang/kids-learning-app | src/main/ets/storage/LearningRecordStorageService.ets | arkts | getLastSyncTime | 获取最后同步时间 | private static async getLastSyncTime(): Promise<string> {
try {
return await dataStorage.getString(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_LAST_SYNC,
''
);
} catch (error) {
return '';
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getLastSyncTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum... | private static async getLastSyncTime(): Promise<string> {
try {
return await dataStorage.getString(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_LAST_SYNC,
''
);
} catch (error) {
return '';
}
} | https://github.com/the-wwyang/kids-learning-app | b4d1d3bc8ce7244991a1c9b1519fcc4a881bd00a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets | arkts | getDownloadStatus | 获取下载状态 | private static getDownloadStatus(
isDownloaded?: boolean,
downloadPath?: string
): OnlineChapterDownloadStatus {
if (isDownloaded && downloadPath) {
return OnlineChapterDownloadStatus.DOWNLOADED;
}
return OnlineChapterDownloadStatus.NOT_DOWNLOADED;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getDownloadStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isDownloaded AST#identifier#Right AST#ERROR#Left ... | private static getDownloadStatus(
isDownloaded?: boolean,
downloadPath?: string
): OnlineChapterDownloadStatus {
if (isDownloaded && downloadPath) {
return OnlineChapterDownloadStatus.DOWNLOADED;
}
return OnlineChapterDownloadStatus.NOT_DOWNLOADED;
} | https://github.com/DaLongZhuaZi/manxia | 7cd4b798dccf55168c9543ecf5c0488d5556cdff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CacheConfigManager.ets | arkts | removeListener | 移除配置变更监听器 | public removeListener(listener: (config: CacheConfig) => void): void {
const index = this.listeners.indexOf(listener);
if (index > -1) {
this.listeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left removeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#... | public removeListener(listener: (config: CacheConfig) => void): void {
const index = this.listeners.indexOf(listener);
if (index > -1) {
this.listeners.splice(index, 1);
}
} | https://github.com/DaLongZhuaZi/manxia | 5786c2b1435a6035e191cf976071b31353b617b3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets | arkts | execute | 执行Rhino脚本
@param script JavaScript代码
@param context 执行上下文
@param timeout 超时时间(毫秒),默认30秒
@returns 执行结果 | async execute(script: string, context: RhinoContext = {}, timeout: number = 30000): Promise<RhinoExecuteResult> {
// 确保沙箱已初始化
if (!this.sandboxReady) {
const initialized = await this.initialize();
if (!initialized) {
return {
success: false,
result: '',
error:... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left execute AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left script AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async execute(script: string, context: RhinoContext = {}, timeout: number = 30000): Promise<RhinoExecuteResult> {
// 确保沙箱已初始化
if (!this.sandboxReady) {
const initialized = await this.initialize();
if (!initialized) {
return {
success: false,
result: '',
error:... | https://github.com/DaLongZhuaZi/manxia | 16442ffadec20330ca105c29209e1d84db0922ae | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/AccessibilityUtils.ets | arkts | isWCAGAACompliant | 验证WCAG AA级标准
@param foregroundColor 前景色(文字颜色)
@param backgroundColor 背景色
@param isLargeText 是否为大文字(字体≥18pt或粗体≥14pt)
@returns 验证结果 | public static isWCAGAACompliant(
foregroundColor: string,
backgroundColor: string,
isLargeText: boolean = false
): WCAGValidationResult {
const contrastRatio = this.calculateContrastRatio(foregroundColor, backgroundColor);
// WCAG AA级标准:
// - 普通文字:对比度 ≥ 4.5:1
// - 大文字:对比度 ≥ 3:1
... | 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 isWCAGAACompliant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left foregroundColor AST#identifier#Right AST#ERROR#Left ... | public static isWCAGAACompliant(
foregroundColor: string,
backgroundColor: string,
isLargeText: boolean = false
): WCAGValidationResult {
const contrastRatio = this.calculateContrastRatio(foregroundColor, backgroundColor);
// WCAG AA级标准:
// - 普通文字:对比度 ≥ 4.5:1
// - 大文字:对比度 ≥ 3:1
... | https://github.com/LJ666-ui/harmony-health-care | 907b2530b30bc8d156b91e7c2e3bf39d45b556dc | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | getAppVersion | 获取应用版本号 | private async getAppVersion(): Promise<void> {
try {
const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleFlags);
this.appVersion = bundleInfo.versionName;
} catch (error) {
const err = error as... | 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 getAppVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async getAppVersion(): Promise<void> {
try {
const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleFlags);
this.appVersion = bundleInfo.versionName;
} catch (error) {
const err = error as... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L62-L72 | 179b67d060320ea706edc228d0801de820cb50db | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginatedResult.ets | arkts | hasPreviousPage | 检查是否有上一页
@returns 是否有上一页 | hasPreviousPage(): boolean {
return this.page > 1
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasPreviousPage 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... | hasPreviousPage(): boolean {
return this.page > 1
} | https://github.com/offlinecat-dev/OCNetORM | b06bc291c2e108fc69880be792815d7f3b59cc31 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | generateCoverFileName | 生成封面文件名 | private generateCoverFileName(externalId: string, coverUrl: string): string {
// 从URL提取扩展名
let ext = '.jpg';
const urlLower = coverUrl.toLowerCase();
if (urlLower.includes('.png')) {
ext = '.png';
} else if (urlLower.includes('.webp')) {
ext = '.webp';
} else if (urlLower.includes(... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateCoverFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left externalId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | private generateCoverFileName(externalId: string, coverUrl: string): string {
// 从URL提取扩展名
let ext = '.jpg';
const urlLower = coverUrl.toLowerCase();
if (urlLower.includes('.png')) {
ext = '.png';
} else if (urlLower.includes('.webp')) {
ext = '.webp';
} else if (urlLower.includes(... | https://github.com/DaLongZhuaZi/manxia | f570cc2a62b504e883c08cc7361024e4825cac86 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Console.ets | arkts | println | Prints a short to the console and puts newline
@param i value to print | public println(i: short): void {
this.print(i);
this.println();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left short AST#i... | public println(i: short): void {
this.print(i);
this.println();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9fbb22816d1423ef1fc36ab5a3556603c09ec5a4 | gitee |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/pages/RustDeskRelayPage.ets | arkts | build | ==================== Build ==================== | build() {
Stack() {
if (this.isPC()) {
// PC: fixed-height layout — left list + right detail each scroll independently
Column() {
Column().height(this.contentTopSpacer())
if (this.relays.length > 0) {
this.statsBar()
}
if (this.relays.lengt... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#ERROR#Left AST#method_definitio... | build() {
Stack() {
if (this.isPC()) {
// PC: fixed-height layout — left list + right detail each scroll independently
Column() {
Column().height(this.contentTopSpacer())
if (this.relays.length > 0) {
this.statsBar()
}
if (this.relays.lengt... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 1528f5ef46fd81d41ffbbef5114341535242fad9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | yieldToEventLoop | 主动让出事件循环,降低长任务阻塞风险 | private async yieldToEventLoop(): Promise<void> {
return new Promise(resolve => setTimeout(resolve, 0));
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left yieldToEventLoop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private async yieldToEventLoop(): Promise<void> {
return new Promise(resolve => setTimeout(resolve, 0));
} | https://github.com/DaLongZhuaZi/manxia | e213c12eb874227ddcf5b68002c7ce40e01c23e4 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets | arkts | convertResultSetToContact | 将ResultSet转换为ContactsItem对象 | private convertResultSetToContact(resultSet: relationalStore.ResultSet): ContactsItem | null {
try {
const id = resultSet.getLong(resultSet.getColumnIndex('id'));
const name = resultSet.getString(resultSet.getColumnIndex('name'));
const phone = resultSet.getString(resultSet.getColumnIndex('phone... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertResultSetToContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | private convertResultSetToContact(resultSet: relationalStore.ResultSet): ContactsItem | null {
try {
const id = resultSet.getLong(resultSet.getColumnIndex('id'));
const name = resultSet.getString(resultSet.getColumnIndex('name'));
const phone = resultSet.getString(resultSet.getColumnIndex('phone... | https://gitcode.com/openharmony/codelabs | 726f0466141244b44e3c47499120094b2c1dba3f | gitcode |
HunZiLei/ArkTS_PokePomodoro | entry/src/main/ets/common/database/TaskTable.ets | arkts | basic_query | supports multiple type all-in-one | basic_query(query_type: string, queryData: TaskData, callback: Function, isAll: boolean = true) {
Logger.debug(`TaskTable query_type: ${query_type}, query_data: ${JSON.stringify(queryData)}, visit: ${queryData[query_type]}`)
let predicates = new relationalStore.RdbPredicates(CommonConstants.TASK_TABLE_INIT.ta... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left basic_query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left query_type AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST... | basic_query(query_type: string, queryData: TaskData, callback: Function, isAll: boolean = true) {
Logger.debug(`TaskTable query_type: ${query_type}, query_data: ${JSON.stringify(queryData)}, visit: ${queryData[query_type]}`)
let predicates = new relationalStore.RdbPredicates(CommonConstants.TASK_TABLE_INIT.ta... | https://github.com/HunZiLei/ArkTS_PokePomodoro | 9fbd5a2b52bd7630344b78ab31452e0dcb39733e | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoadResult.ets | arkts | getErrorMessages | 获取所有错误信息
@returns 错误信息数组 | getErrorMessages(): Array<string> {
const messages: Array<string> = []
for (let i = 0; i < this.results.length; i++) {
if (!this.results[i].success && this.results[i].errorMessage !== '') {
messages.push(this.results[i].getFormattedError())
}
}
return messages
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getErrorMessages 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#:#... | getErrorMessages(): Array<string> {
const messages: Array<string> = []
for (let i = 0; i < this.results.length; i++) {
if (!this.results[i].success && this.results[i].errorMessage !== '') {
messages.push(this.results[i].getFormattedError())
}
}
return messages
} | https://github.com/offlinecat-dev/OCNetORM | 92f9e0fb14c728365052b600babe569b9ac2f65b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | constructor | Constructs a new RegExp using pattern and flags
@param { String } pattern description of a pattern
@param { String } [flags] description of flags to be used
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(pattern: String, flags?: String) {
RegExp.init(this, pattern, flags === undefined ? "" : flags!)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pattern AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | public constructor(pattern: String, flags?: String) {
RegExp.init(this, pattern, flags === undefined ? "" : flags!)
} | https://gitcode.com/iop123123/arkts-static-skills | 54c9ef9b2d7f563fdec1352619f3c54e04c4b7ee | gitcode |
banggx/account_app_harmonyos | entry/src/main/ets/service/account.ets | arkts | statsConsumeByType | 按类型统计消费 | statsConsumeByType(records: AccountPO[]) {
const expensesStats: Record<number, StatsByType> = {};
const incomeStats: Record<number, StatsByType> = {};
records.forEach((item) => {
const activeStats = item.accountType === AccountType.EXPENSES ? expensesStats : incomeStats;
let current: StatsByTy... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left statsConsumeByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#ident... | statsConsumeByType(records: AccountPO[]) {
const expensesStats: Record<number, StatsByType> = {};
const incomeStats: Record<number, StatsByType> = {};
records.forEach((item) => {
const activeStats = item.accountType === AccountType.EXPENSES ? expensesStats : incomeStats;
let current: StatsByTy... | https://github.com/banggx/account_app_harmonyos | 47b74553fccbf35d49f412236d4227e5d2d8b729 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/StringUtil.ets | arkts | generateUUID | 生成 UUID(使用加密安全的随机数)
@returns UUID 字符串 | static generateUUID(): string {
// 使用加密安全的随机数生成 16 字节
const randomBytes = CryptoUtil.generateRandomBytes(16);
// 设置版本号 (4) 和变体位
randomBytes[6] = (randomBytes[6] & 0x0f) | 0x40; // version 4
randomBytes[8] = (randomBytes[8] & 0x3f) | 0x80; // variant 1
// 转换为 UUID 格式
const hex =... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateUUID 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#st... | static generateUUID(): string {
// 使用加密安全的随机数生成 16 字节
const randomBytes = CryptoUtil.generateRandomBytes(16);
// 设置版本号 (4) 和变体位
randomBytes[6] = (randomBytes[6] & 0x0f) | 0x40; // version 4
randomBytes[8] = (randomBytes[8] & 0x3f) | 0x80; // variant 1
// 转换为 UUID 格式
const hex =... | https://github.com/AlkaidLab/moonlight-harmony | 0135b312b84bfabdc1d3c1069fd39a5eea1e3029 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/RegExp.ets | arkts | test | Executes a search for a match between a regular expression and specified string
@param str the string against which to match the regular expression
@returns true if match was found | public test(str: String): boolean {
return this.exec(str).isCorrect;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left test AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | public test(str: String): boolean {
return this.exec(str).isCorrect;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6e29832064dc4f51a6592b25d85c7d048a65eee7 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | getBottomTabBarHeight | 获取底部导航栏高度 | public static getBottomTabBarHeight(): number {
// 平板设备使用更高的底部栏
return ResponsiveLayoutHelper.isExpandedLayout() ? 64 : 56;
} | 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 getBottomTabBarHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public static getBottomTabBarHeight(): number {
// 平板设备使用更高的底部栏
return ResponsiveLayoutHelper.isExpandedLayout() ? 64 : 56;
} | https://github.com/DaLongZhuaZi/manxia | a2ec6eb5929c28ff759f865628c40e75df4ac04f | github |
CLMC2025/Vignette | entry/src/main/ets/context/TemplateManager.ets | arkts | clearExternalTemplatePack | Remove persisted external pack and clear in-memory external templates. | clearExternalTemplatePack(): void {
this.loader.clearExternalTemplatesInMemory(this.templates);
AppStorage.setOrCreate<string>(TemplateLoader.EXTERNAL_PACK_KEY, '');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearExternalTemplatePack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#st... | clearExternalTemplatePack(): void {
this.loader.clearExternalTemplatesInMemory(this.templates);
AppStorage.setOrCreate<string>(TemplateLoader.EXTERNAL_PACK_KEY, '');
} | https://github.com/CLMC2025/Vignette | a30f2e17ede1f0ff2ea452aec8c34f7f879c1c9d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | includes | The includes() method performs a case-sensitive search to determine whether one string may
be found within another string, returning true or false as appropriate.
@param { String } searchString to be searched
@param { int } [position] within the string at which to begin searching for searchString
@returns { boolean } t... | public includes(searchString: String, position?: int): boolean {
return this.indexOf(searchString, position) != -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 searchString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left String AST#iden... | public includes(searchString: String, position?: int): boolean {
return this.indexOf(searchString, position) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | 1b7ad19f72ddb8d6d85bda0cb4816be78040c414 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setPaint | set a new paint object for the specified parameter in the chart e.g.
Chart.PAINT_VALUES
@param p the new paint object
@param which Chart.PAINT_VALUES, Chart.PAINT_GRID, Chart.PAINT_VALUES,
... | public setPaint(p: Paint, which: number) {
switch (which) {
case ChartModel.PAINT_INFO:
// case 7:
this.mInfoPaint = p;
break;
case ChartModel.PAINT_DESCRIPTION:
// case 11:
this.mDescPaint = p;
break;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPaint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Paint AST#... | public setPaint(p: Paint, which: number) {
switch (which) {
case ChartModel.PAINT_INFO:
// case 7:
this.mInfoPaint = p;
break;
case ChartModel.PAINT_DESCRIPTION:
// case 11:
this.mDescPaint = p;
break;
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a5a2ed9e86437e3921461eb3bdbf35a35fca146d | gitee |
erosTeam/NextE | shared/src/main/ets/services/TagTranslationService.ets | arkts | statCache | Row count + translated-name bytes of the tag-translation table, for the cache page. | static async statCache(context: common.UIAbilityContext): Promise<CacheStat> {
const out: CacheStat = new CacheStat()
try {
const store: relationalStore.RdbStore = await LocalDataStore.open(context)
const rs: relationalStore.ResultSet = await store.querySql(
'SELECT COUNT(*) AS c, COALESCE... | 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 statCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#... | static async statCache(context: common.UIAbilityContext): Promise<CacheStat> {
const out: CacheStat = new CacheStat()
try {
const store: relationalStore.RdbStore = await LocalDataStore.open(context)
const rs: relationalStore.ResultSet = await store.querySql(
'SELECT COUNT(*) AS c, COALESCE... | https://github.com/erosTeam/NextE | f90aac1b0eec16ec0d2e013b12b399d1285e8366 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/LifecycleObserver.ets | arkts | isRegistered | Test/diagnostic helper. | public isRegistered(): boolean {
return this.appStateObserver !== null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isRegistered 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 isRegistered(): boolean {
return this.appStateObserver !== null;
} | https://github.com/Countly/countly-sdk-hos | 8db268f322a586ef9ad1814aaa9be3d2d511e748 | github |
IoTAccessControl/ArkTSAnalysis | TestApps1/2.AdsKit_Codelab_Interstitial_ArkTS/entry/src/main/ets/pages/Index.ets | arkts | getPhoneNumber | Phone Information Methods | getPhoneNumber() {
this.phoneInfoText = 'getShowNumber not supported in API 12';
hilog.warn(0x0000, TAG, 'getShowNumber not supported in API 12');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getPhoneNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | getPhoneNumber() {
this.phoneInfoText = 'getShowNumber not supported in API 12';
hilog.warn(0x0000, TAG, 'getShowNumber not supported in API 12');
} | https://github.com/IoTAccessControl/ArkTSAnalysis | 26b324dc4ffb2659e810b4f0ad0ababe366f0252 | github |
dingzhilin1990/zhilinclaw | src/security/SandboxedExecutor.ets | arkts | executeTool | 执行工具函数(沙箱隔离)
@param toolName 工具名称
@param args 工具参数 | public async executeTool(toolName: string, args: any[]): Promise<SandboxResult> {
console.log(`[SandboxedExecutor] 执行工具:${toolName}`);
// 检查工具是否在白名单中
if (!this.isToolAllowed(toolName)) {
return {
success: false,
output: null,
error: `工具未被允许:${toolName}`,
executionTim... | 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 executeTool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left toolName AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public async executeTool(toolName: string, args: any[]): Promise<SandboxResult> {
console.log(`[SandboxedExecutor] 执行工具:${toolName}`);
// 检查工具是否在白名单中
if (!this.isToolAllowed(toolName)) {
return {
success: false,
output: null,
error: `工具未被允许:${toolName}`,
executionTim... | https://github.com/dingzhilin1990/zhilinclaw | 04260f7a23af9b6b9f2918c1126c6245264cf9fb | github |
mybricks/comlib-harmony-normal | packages/rt-arkts/comlib/src/main/ets/_ChooseFile.ets | arkts | persistPermission | 授权持久化 | function persistPermission(uris: string[]): Promise<boolean> {
return new Promise((resolve: Function, reject: Function) => {
if (canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization')) {
const policies: fileShare.PolicyInfo[] = uris.map(uri => ({
uri,
operationMode: fi... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left persistPermission AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uris AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function persistPermission(uris: string[]): Promise<boolean> {
return new Promise((resolve: Function, reject: Function) => {
if (canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization')) {
const policies: fileShare.PolicyInfo[] = uris.map(uri => ({
uri,
operationMode: fi... | https://github.com/mybricks/comlib-harmony-normal | c96a3b44a399d02324989a5c5a3a193e1b3649c0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | getChapterFilePath | 获取章节文件路径
格式: /files/novels/{safeBookId}/chapters/{chapterIndex}.txt | private getChapterFilePath(bookId: string, chapterIndex: number): string {
const bookDir = this.getBookCacheDir(bookId);
// 使用4位数字格式化章节索引,如 0001.txt, 0002.txt
const chapterFileName = String(chapterIndex + 1).padStart(4, '0') + '.txt';
return `${bookDir}/chapters/${chapterFileName}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getChapterFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private getChapterFilePath(bookId: string, chapterIndex: number): string {
const bookDir = this.getBookCacheDir(bookId);
// 使用4位数字格式化章节索引,如 0001.txt, 0002.txt
const chapterFileName = String(chapterIndex + 1).padStart(4, '0') + '.txt';
return `${bookDir}/chapters/${chapterFileName}`;
} | https://github.com/DaLongZhuaZi/manxia | eac44b987282c858f749bd1ce65a80ac925ce3f3 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | getCurrentModelId | ============ 便捷方法 ============
获取当前选中的模型ID | async getCurrentModelId(): Promise<string> {
return await this.getString(PreferenceKeys.CURRENT_MODEL_ID, '')
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCurrentModelId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getCurrentModelId(): Promise<string> {
return await this.getString(PreferenceKeys.CURRENT_MODEL_ID, '')
} | https://github.com/LongLiveY96/chatcube | 740b5533648d5cd5d2384d3a7578bf09e8880db1 | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/features/mydemo/src/main/ets/Video/components/Content.ets | arkts | videoInfoStyle | 视频信息文本样式 | @Extend(Text)
function videoInfoStyle() {
.fontSize(14)
.fontColor('rgba(255, 255, 255, 0.80)')
} | 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 Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function videoInfoStyle() {
.fontSize(14)
.fontColor('rgba(255, 255, 255, 0.80)')
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | b3cdf9b2382da3c88dc588ef50ec8cc393957dd8 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getActualTheme | 获取实际显示的主题(考虑AUTO模式)(异步) | public async getActualTheme(): Promise<ThemeType> {
await this.ensureInitialized();
if (this.currentTheme === ThemeType.AUTO) {
return this.actualTheme;
}
return this.currentTheme;
} | 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 getActualTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async getActualTheme(): Promise<ThemeType> {
await this.ensureInitialized();
if (this.currentTheme === ThemeType.AUTO) {
return this.actualTheme;
}
return this.currentTheme;
} | https://github.com/DaLongZhuaZi/manxia | 83d2c75fde99c573b0bb2f6b6dfdde4679bfdaae | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test9_original_index.ets | arkts | testNumberConversions | --- Number conversions --- | function testNumberConversions(): string {
let fromStr: number = Number('42');
let fromInt: number = parseInt('255', 10);
let fromHex: number = parseInt('0xFF', 16);
let floatStr: number = parseFloat('3.14');
let fixed: string = floatStr.toFixed(1);
return String(fromStr) + ',' + String(fromInt) + ',' + Str... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNumberConversions 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#prede... | function testNumberConversions(): string {
let fromStr: number = Number('42');
let fromInt: number = parseInt('255', 10);
let fromHex: number = parseInt('0xFF', 16);
let floatStr: number = parseFloat('3.14');
let fixed: string = floatStr.toFixed(1);
return String(fromStr) + ',' + String(fromInt) + ',' + Str... | https://github.com/miaochiahao/ark-ghidra | 4eff1fe9d8f060ac83616e7cf30601304aac835c | github |
azhu0001/localsend-harmony | entry/src/main/ets/utils/FileProvider.ets | arkts | createTextMessages | 60kb
创建文本消息
@param textMessage 文本内容
@returns | static createTextMessages(textMessage: string): Array<FileInfoModel> {
const textArray = Strings.getSliceByBytes([], textMessage, FileProvider.TEXT_MESSAGE_MAX_SIZE)
const files: FileInfoModel[] = []
for (const text of textArray) {
const size = buffer.byteLength(text, 'utf-8')
files.push({
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createTextMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left textMessage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | static createTextMessages(textMessage: string): Array<FileInfoModel> {
const textArray = Strings.getSliceByBytes([], textMessage, FileProvider.TEXT_MESSAGE_MAX_SIZE)
const files: FileInfoModel[] = []
for (const text of textArray) {
const size = buffer.byteLength(text, 'utf-8')
files.push({
... | https://gitcode.com/azhu0001/localsend-harmony | 28ffd22a0aa8227f09a1d0f8e499c52bd0e05469 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setHours | Sets the hours for a specified date according to local time.
@param { int } value new hours
@param { int } min
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setHours(value: int, min: int): long {
this.setHours(value);
this.setMinutes(min);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig... | public setHours(value: int, min: int): long {
this.setHours(value);
this.setMinutes(min);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | 5de12d384c23ea5e18bcc46fe6a121f486ac32d6 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.