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 |
|---|---|---|---|---|---|---|---|---|---|---|
harmonyos/codelabs | HarmonyOS_NEXT/LoginDemo/entry/src/main/ets/view/MinePage.ets | arkts | logout | Log out | logout() {
Logger.info(CommonConstants.TAG_MINE_PAGE, 'Logout');
CommonUtils.routerPage(CommonConstants.LOGIN_PAGE_URL);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#... | logout() {
Logger.info(CommonConstants.TAG_MINE_PAGE, 'Logout');
CommonUtils.routerPage(CommonConstants.LOGIN_PAGE_URL);
} | https://gitee.com/harmonyos/codelabs.git | 72a2ac12a09d422e7a16946b26d500978d4bfcf5 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test4_original_index.ets | arkts | testArrayChain | === Array Method Chain === | function testArrayChain(): number {
let nums: number[] = [5, 3, 8, 1, 9, 2, 7, 4, 6];
let sorted: number[] = nums.sort((a: number, b: number): number => a - b);
let top5: number[] = sorted.slice(0, 5);
let sum: number = top5.reduce((acc: number, n: number): number => acc + n, 0);
return sum;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayChain 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_t... | function testArrayChain(): number {
let nums: number[] = [5, 3, 8, 1, 9, 2, 7, 4, 6];
let sorted: number[] = nums.sort((a: number, b: number): number => a - b);
let top5: number[] = sorted.slice(0, 5);
let sum: number = top5.reduce((acc: number, n: number): number => acc + n, 0);
return sum;
} | https://github.com/miaochiahao/ark-ghidra | 991ea766a5887d013e81de5c78112f8bf6c76427 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | setCrashEventParams | 设置崩溃事件自定义参数 | private setCrashEventParams(): void {
try {
// 构建崩溃事件的自定义参数
const crashParams: Record<string, hiAppEvent.ParamType> = {
'app_name': 'KeePassHO',
'app_version': this.appVersion
};
// 设置崩溃事件的自定义参数
hiAppEvent.setEventParam(crashParams, hiAppEvent.domain.OS, hiAppEvent.e... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setCrashEventParams 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 ... | private setCrashEventParams(): void {
try {
// 构建崩溃事件的自定义参数
const crashParams: Record<string, hiAppEvent.ParamType> = {
'app_name': 'KeePassHO',
'app_version': this.appVersion
};
// 设置崩溃事件的自定义参数
hiAppEvent.setEventParam(crashParams, hiAppEvent.domain.OS, hiAppEvent.e... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L96-L114 | 6e92dee057a8cd4e4cd843ca0d96dbe7dfbb8a23 | github |
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | entry/src/main/ets/pages/HomePage.ets | arkts | silentLogin | Silent sign-in. | silentLogin() {
// Create a sign-in request and set parameters.
const loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
/*
* false: If the user has not signed in to the HUAWEI ID, the HUAWEI ID sign-in screen will not be displayed.
* Instead, error code 10015... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left silentLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | silentLogin() {
// Create a sign-in request and set parameters.
const loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
/*
* false: If the user has not signed in to the HUAWEI ID, the HUAWEI ID sign-in screen will not be displayed.
* Instead, error code 10015... | https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | ed45fc0a7a25ca16980c3a112ae5a58a43f8f6d9 | gitcode |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/AvPlayManager.ets | arkts | setSourceInfo | 视频信息上报函数 | async setSourceInfo(): Promise<void> {
if (this.avPlayer === null) {
Logger.info(this.tag, 'this.avPlayer is null')
}
// 音量变化回调函数
this.avPlayer?.on('volumeChange', (vol: number) => {
Logger.info(this.tag, 'volumeChange success,and new volume is :' + vol);
});
// 视频播放结束触发回调
thi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setSourceInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left A... | async setSourceInfo(): Promise<void> {
if (this.avPlayer === null) {
Logger.info(this.tag, 'this.avPlayer is null')
}
// 音量变化回调函数
this.avPlayer?.on('volumeChange', (vol: number) => {
Logger.info(this.tag, 'volumeChange success,and new volume is :' + vol);
});
// 视频播放结束触发回调
thi... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 84b711ad9db0f0777751608d73e0d3761822e468 | gitee |
arkui-x/samples | CodeLab/Cases/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets | arkts | addData | 在指定索引位置增加一个元素
@param index 数组索引
@param data 元素对象 | public addData(index: number, data: ESObject): void {
this.originDataArray.splice(index, 0, data);
this.notifyDataReload();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | public addData(index: number, data: ESObject): void {
this.originDataArray.splice(index, 0, data);
this.notifyDataReload();
} | https://gitcode.com/arkui-x/samples | 7d56b117a3bdb4f583fd7da0c65188b979c465af | gitcode |
openharmony-tpc/ohos_mpchart | entry/src/main/ets/pages/customCharts/CursorPage.ets | arkts | aboutToAppear | 数据初始化 | aboutToAppear() {
/** 创建一个 JArrayList 对象,用于存储 EntryOhos 类型的数据 */
let values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
/** 循环生成 1 到 20 的随机数据,并添加到 values 中 */
for (let i = 1; i <= 20; i++) {
values.add(new EntryOhos(i, Math.random() * 100));
}
/** 创建 LineDataSet 对象,使用 values 数据... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
/** 创建一个 JArrayList 对象,用于存储 EntryOhos 类型的数据 */
let values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
/** 循环生成 1 到 20 的随机数据,并添加到 values 中 */
for (let i = 1; i <= 20; i++) {
values.add(new EntryOhos(i, Math.random() * 100));
}
/** 创建 LineDataSet 对象,使用 values 数据... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e6278c1bed477e49c698e3cb57d3d8da35dd9120 | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/DeviceBindingService.ets | arkts | start | Drive the full scan → redeem → bound flow. | async start(): Promise<void> {
this.transition('scanning');
let payload: string = '';
try {
payload = await this.scanner.scan();
} catch (err) {
if (err instanceof CancelledScanError) {
this.transition('idle');
return;
}
this.fail('NETWORK');
return;
}... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#typ... | async start(): Promise<void> {
this.transition('scanning');
let payload: string = '';
try {
payload = await this.scanner.scan();
} catch (err) {
if (err instanceof CancelledScanError) {
this.transition('idle');
return;
}
this.fail('NETWORK');
return;
}... | https://github.com/terryma2024/happyword | 705eb1f6f9d8456151a3cdcde9a48a7640b6bffe | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | sendKeyEvent | Send a key event | static sendKeyEvent(inst: number, keycode: number, down: boolean): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
return freerdpNative!.freerdpSendKeyEvent(inst, keycode, down);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendKeyEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static sendKeyEvent(inst: number, keycode: number, down: boolean): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
return freerdpNative!.freerdpSendKeyEvent(inst, keycode, down);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 47fde6fb76bb3602c20ce62de5dcac5ef48aee1c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | buildHighlights | An array of `Highlight` objects corresponding to the selected xValue and dataSetIndex.
@param set
@param dataSetIndex
@param xVal
@param rounding
@return | protected buildHighlights(set: IDataSet<EntryOhos>, dataSetIndex: number, xVal: number, rounding: Rounding): JArrayList<Highlight> {
let highlights: JArrayList<Highlight> = new JArrayList<Highlight>();
//noinspection unchecked
let entries: JArrayList<EntryOhos> | null = set.getEntriesForXValue(xVal);
... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left buildHighlights AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instanti... | protected buildHighlights(set: IDataSet<EntryOhos>, dataSetIndex: number, xVal: number, rounding: Rounding): JArrayList<Highlight> {
let highlights: JArrayList<Highlight> = new JArrayList<Highlight>();
//noinspection unchecked
let entries: JArrayList<EntryOhos> | null = set.getEntriesForXValue(xVal);
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 42ea0b916933c3f54931c33bb574d07505070ace | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/EventSourcingService.ets | arkts | rebuildAllReadModels | 重建所有读模型 | static async rebuildAllReadModels(aggregateType: string): Promise<number> {
try {
// 获取所有该类型的聚合ID
const events = await DomainEventDAO.getByAggregateType(aggregateType, 10000);
const aggregateIds = new Set<number>();
for (let i = 0; i < events.length; i++) {
aggregateIds.add(events... | 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 rebuildAllReadModels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left ... | static async rebuildAllReadModels(aggregateType: string): Promise<number> {
try {
// 获取所有该类型的聚合ID
const events = await DomainEventDAO.getByAggregateType(aggregateType, 10000);
const aggregateIds = new Set<number>();
for (let i = 0; i < events.length; i++) {
aggregateIds.add(events... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a3b965b8cc8d5e2ff80e70ba4090d292c76f1377 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosEngineHost.ets | arkts | notifySurfaceLoaded | Called by CocosBattlePage's XComponent onLoad handler when the surface
is ready. Posts 'onXCLoad' to the CocosWorker at most once per process
lifetime — re-entering the page does not reinitialise the engine.
This is also the resume point for the render loop on page re-entry:
onLoad fires AFTER the native surface-create... | notifySurfaceLoaded(): void {
if (!this.surfaceLoadNotified) {
this.surfaceLoadNotified = true;
WorkerPort.getInstance().postMessage('onXCLoad');
}
this.surfaceAlive = true;
this.pageActive = true;
this.updateVisibility();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifySurfaceLoaded 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#statemen... | notifySurfaceLoaded(): void {
if (!this.surfaceLoadNotified) {
this.surfaceLoadNotified = true;
WorkerPort.getInstance().postMessage('onXCLoad');
}
this.surfaceAlive = true;
this.pageActive = true;
this.updateVisibility();
} | https://github.com/terryma2024/happyword | a10d07303da349ca134150d7ccfe61580604f2b6 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | parseURL | Replaces the original constructor to process arguments and return a url object.
@param { string } inputUrl - Absolute or relative input URL to resolve.
Base is required if input is relative.
If input is an absolute value, base ignores the value.
@param { string | URL } [base] - Base URL to parse if input is not absolu... | static parseURL(inputUrl: string, inputBase?: string | URL): URL {
let nativeUrl: URL;
if (inputBase == undefined) {
nativeUrl = URL.parseSingleInput(fixIllegalString(inputUrl));
} else {
if (inputBase instanceof string) {
n... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseURL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inputUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right... | static parseURL(inputUrl: string, inputBase?: string | URL): URL {
let nativeUrl: URL;
if (inputBase == undefined) {
nativeUrl = URL.parseSingleInput(fixIllegalString(inputUrl));
} else {
if (inputBase instanceof string) {
n... | https://gitcode.com/iop123123/arkts-static-skills | 0c24bbb7cfeeb3e8f77a0af950ab43398a6f0d39 | gitcode |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/uiTheme/facades/ComponentThemeOverrideFacade.ets | arkts | getOverrideOrDefault | 获取具名主题覆盖,不存在则返回 fallback | getOverrideOrDefault(name: string, fallback: NGFComponentThemeOverride): NGFComponentThemeOverride {
const found = this.overrides.get(name);
return found !== undefined ? found : fallback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOverrideOrDefault AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#L... | getOverrideOrDefault(name: string, fallback: NGFComponentThemeOverride): NGFComponentThemeOverride {
const found = this.overrides.get(name);
return found !== undefined ? found : fallback;
} | https://github.com/DaLongZhuaZi/NGF | f6ab10ee1ea4eda4cc86cfb1f438eb88c139fa48 | github |
harmonyos/codelabs | HarmonyOS_NEXT/TransitionAnimation/entry/src/main/ets/pages/FullCustomTransition.ets | arkts | pageTransition | Page transition parameters are configured using the global pageTransition method.
Enter: During the entry process, the onEnter callback is triggered frame by frame.
The input parameter is the normalization progress of the dynamic effect (0–1).
Exit: The onExit callback is triggered frame by frame during entry.
The inpu... | pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.onEnter((type?: RouteType, progress?: number) => {
if (!progress) {
return;
}
this.animValue = progress;
});
PageTransitionExit({ duration: TRANSITION_ANIMATI... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition 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... | pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.onEnter((type?: RouteType, progress?: number) => {
if (!progress) {
return;
}
this.animValue = progress;
});
PageTransitionExit({ duration: TRANSITION_ANIMATI... | https://gitee.com/harmonyos/codelabs.git | c1b21edaead1f5f23133994b6271dfba0894e49a | gitee |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/settings/src/main/ets/service/UpdateService.ets | arkts | updateVersion | 更新版本
@returns Promise<boolean> | public updateVersion(): Promise<boolean> {
const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext
const context: common.UIAbilityContext = uiContext.getHostContext() as common.UIAbilityContext
return new Promise((resolve: Function, reject: Function) => {
try {... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateVersion 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#expressi... | public updateVersion(): Promise<boolean> {
const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext
const context: common.UIAbilityContext = uiContext.getHostContext() as common.UIAbilityContext
return new Promise((resolve: Function, reject: Function) => {
try {... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 61820116596352f03181d4f7e16501bbdc31588f | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Privacy/Auth/AuthPatternLockPage.ets | arkts | aboutToAppear | 测试用的代码
aboutToAppear(): void {
// 测试
const hash = CryptoJS.MD5('123456')
const hash2 = CryptoJS.MD5('123456')
AlertDialog.show({ message: 'hash:' + hash.toString() })
AlertDialog.show({ message: 'hash2:' + hash2.toString() })
} | aboutToAppear() {
// 页面加载完毕,开始生物识别认证
this.startUserAuth()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 页面加载完毕,开始生物识别认证
this.startUserAuth()
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 8ae57eab635ef015e180acfac37d8a21ac35623f | gitcode |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | getWordsByUserBook | 获取用户词书中的单词 | getWordsByUserBook(userBookId: string): string[] {
const wordIds: string[] = [];
const keys: string[] = Array.from(this.userProgress.keys());
for (let i: number = 0; i < keys.length; i++) {
const wordId: string = keys[i];
const progress: UserWordProgress | undefined = this.userProgress.get(wor... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWordsByUserBook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userBookId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Ri... | getWordsByUserBook(userBookId: string): string[] {
const wordIds: string[] = [];
const keys: string[] = Array.from(this.userProgress.keys());
for (let i: number = 0; i < keys.length; i++) {
const wordId: string = keys[i];
const progress: UserWordProgress | undefined = this.userProgress.get(wor... | https://github.com/CLMC2025/Vignette | c5a107fe27ea98f61155245d161193a4d6263ab7 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets | arkts | getFullFps | 方法描述 计算满帧
@param maxFps maxFps
@return java.lang.Integer get full fps | static getFullFps(maxFps: number): number {
/*关于满帧判定,把所有帧率做一次遍历:
* 1、只要有>=100帧,则判断为120帧
* 2、否则只要有>=70 且所有帧都小于100,则判断为90帧
* 1、否则只要有>=44 并且 所有帧都小于70的情况,就按照满帧60帧
* 2、只要有>=34,且所有帧率均小于44的,就按照满帧40帧
* 3、如果所有帧率均小于34帧的,就按照满帧30
*/
if (maxFps >= 100) {
return 120;
} else if (maxF... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFullFps AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left maxFps AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static getFullFps(maxFps: number): number {
/*关于满帧判定,把所有帧率做一次遍历:
* 1、只要有>=100帧,则判断为120帧
* 2、否则只要有>=70 且所有帧都小于100,则判断为90帧
* 1、否则只要有>=44 并且 所有帧都小于70的情况,就按照满帧60帧
* 2、只要有>=34,且所有帧率均小于44的,就按照满帧40帧
* 3、如果所有帧率均小于34帧的,就按照满帧30
*/
if (maxFps >= 100) {
return 120;
} else if (maxF... | https://gitee.com/openharmony/developtools_profiler.git | bd774ec331083ac3b686245ccc13b3593f69d792 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an BigInt64Array with respect to data accessed via Iterable<Number> interface
@param { Iterable<BigInt> } elements - an iterable object
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(elements: Iterable<BigInt>) {
const items: Object = elements as Object
if (items instanceof ArrayLike) {
const arr = reflect.internals.Types.identity_cast<BigInt>(items as ArrayLike<BigInt>)
this.byteLength = arr.length * BigInt64Array.BYTES_PER_ELEMENT
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex... | public constructor(elements: Iterable<BigInt>) {
const items: Object = elements as Object
if (items instanceof ArrayLike) {
const arr = reflect.internals.Types.identity_cast<BigInt>(items as ArrayLike<BigInt>)
this.byteLength = arr.length * BigInt64Array.BYTES_PER_ELEMENT
... | https://gitcode.com/iop123123/arkts-static-skills | a0bde2c2f6f3b31d3a17fa73dd1df475a4d21a88 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/ConversationMemory.ets | arkts | getSessionStats | 获取会话统计信息
@param sessionId 会话ID | async getSessionStats(sessionId: string): Promise<{
messageCount: number;
userMessageCount: number;
assistantMessageCount: number;
duration: number;
} | null> {
const context = await this.retrieve(sessionId);
if (!context) {
return null;
}
const userMessages = context.message... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSessionStats AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sessionId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async getSessionStats(sessionId: string): Promise<{
messageCount: number;
userMessageCount: number;
assistantMessageCount: number;
duration: number;
} | null> {
const context = await this.retrieve(sessionId);
if (!context) {
return null;
}
const userMessages = context.message... | https://github.com/LJ666-ui/harmony-health-care | 89e8515a5ce5008451e4fc2d9c64bb12debd4f6e | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoadResult.ets | arkts | getTotalLoadedCount | 获取加载的总数据数量
@returns 总数据数量 | getTotalLoadedCount(): number {
let count = 0
for (let i = 0; i < this.results.length; i++) {
count += this.results[i].loadedCount
}
return count
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTotalLoadedCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#st... | getTotalLoadedCount(): number {
let count = 0
for (let i = 0; i < this.results.length; i++) {
count += this.results[i].loadedCount
}
return count
} | https://github.com/offlinecat-dev/OCNetORM | d8903c51648bc104103b917e4d3603ba8bc0b497 | github |
PollenWang6/HiXD | entry/src/main/ets/utils/ThemeColors.ets | arkts | applyFollowSystem | 切换为跟随系统 | static applyFollowSystem(ctx: Object): void {
_prefMode = ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET;
const appCtx: ESObject = (ctx as ESObject)['getApplicationContext']() as ESObject;
appCtx['setColorMode'](ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left applyFollowSystem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static applyFollowSystem(ctx: Object): void {
_prefMode = ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET;
const appCtx: ESObject = (ctx as ESObject)['getApplicationContext']() as ESObject;
appCtx['setColorMode'](ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} | https://github.com/PollenWang6/HiXD | 7259431bdf35c8952eed483757775047b00b1370 | github |
tdcare/tdwebrtc | src/main/ets/MediaStream.ets | arkts | handleReceivedMediaFrame | handleEncodedVideoFrame 已移除 — Phase 3: 编码输出留在 Rust 层内部
encodeAndSendVideo 单次 NAPI 调用完成编码 + RTP + 发送
处理 Rust 层 RTP 解包 + 帧重组后的完整媒体帧
NapiMediaFrame 字段:
trackId: string, data: ArrayBuffer, timestamp: number,
isKeyFrame: boolean, isAudio: boolean, payloadType: number, ssrc: number
旧路径:ETS 层逐 RTP 包解析 → VP8/H264 帧重组 → 入队解码(~7... | private handleReceivedMediaFrame(frame: NapiMediaFrame): void {
if (frame.isAudio) {
// 音频 PCM 数据(Rust FrameAssembler 已自动完成 G.711 解码)→ 直接播放
this.audioRtpRecvCount++;
this.audioPlayback?.write(frame.data);
this.onAudioFrameDecoded?.(new DecodedFrame(frame.data, frame.timestamp));
} else... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleReceivedMediaFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left frame AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | private handleReceivedMediaFrame(frame: NapiMediaFrame): void {
if (frame.isAudio) {
// 音频 PCM 数据(Rust FrameAssembler 已自动完成 G.711 解码)→ 直接播放
this.audioRtpRecvCount++;
this.audioPlayback?.write(frame.data);
this.onAudioFrameDecoded?.(new DecodedFrame(frame.data, frame.timestamp));
} else... | https://github.com/tdcare/tdwebrtc | 4b72117504e1c1778bcd0f7efb046ec0ada56e50 | github |
PollenWang6/HiXD | entry/src/main/ets/services/ClassService.ets | arkts | parseUnscheduledCourses | 解析未排课列表 | static parseUnscheduledCourses(body: string): UnscheduledCourse[] {
const out: UnscheduledCourse[] = [];
try {
const obj: Record<string, Object> = JSON.parse(body) as Record<string, Object>;
const datas: Record<string, Object> = obj['datas'] as Record<string, Object>;
const cxxsllsywpk: Reco... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseUnscheduledCourses AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left body AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | static parseUnscheduledCourses(body: string): UnscheduledCourse[] {
const out: UnscheduledCourse[] = [];
try {
const obj: Record<string, Object> = JSON.parse(body) as Record<string, Object>;
const datas: Record<string, Object> = obj['datas'] as Record<string, Object>;
const cxxsllsywpk: Reco... | https://github.com/PollenWang6/HiXD | c4db1a2876e76a4519010cb226fc21feef557097 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | getCurrentStackName | 获取当前路由栈名称
@returns | public static getCurrentStackName(): string {
return ZRouter.getRouterMgr().currentStackName
} | 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 getCurrentStackName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public static getCurrentStackName(): string {
return ZRouter.getRouterMgr().currentStackName
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L347-L349 | ac90aae7fddfb133f2a54d74c64ec80b63ecc1be | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | resumeConsumersIfQueueWasEmpty | Wakes one waiting consumer after a transition from empty to non-empty.
This notification is performed after releasing the push-side mutex.
@param { int } previousSize The queue size before the append.
@returns { void } No return value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private resumeConsumersIfQueueWasEmpty(previousSize: int): void {
if (previousSize == 0) {
this.resumePopQueue();
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resumeConsumersIfQueueWasEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left previousSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identi... | private resumeConsumersIfQueueWasEmpty(previousSize: int): void {
if (previousSize == 0) {
this.resumePopQueue();
}
} | https://gitcode.com/iop123123/arkts-static-skills | 60f881da069ae62b14e9a99d8d36a110164e1b04 | gitcode |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/system/HarmonyThemeAdapter.ets | arkts | onConfigurationUpdate | 外部(如 EntryAbility.onConfigurationUpdate)注入系统 colorMode 变化。
colorMode: 0 = COLOR_MODE_LIGHT, 1 = COLOR_MODE_DARK | onConfigurationUpdate(colorMode: number): void {
this.systemColorMode = colorMode
this.applySystemColorMode(colorMode)
if (this.currentTheme.mode === 'system') {
this.notifyObservers()
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onConfigurationUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left colorMode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Lef... | onConfigurationUpdate(colorMode: number): void {
this.systemColorMode = colorMode
this.applySystemColorMode(colorMode)
if (this.currentTheme.mode === 'system') {
this.notifyObservers()
}
} | https://github.com/Xiwei753/xiezuoruanjian | 12f944c797fd0377d4cc48db3e07834b6a8cf6c9 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates an Float64Array with respect to length.
@param length data initializer | public constructor(length: int) {
this.length = length
this.byteLength = length * Float64Array.BYTES_PER_ELEMENT
this.byteOffset = 0
this.buffer = new ArrayBuffer(this.byteLength)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left length AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier... | public constructor(length: int) {
this.length = length
this.byteLength = length * Float64Array.BYTES_PER_ELEMENT
this.byteOffset = 0
this.buffer = new ArrayBuffer(this.byteLength)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 87b56e3fce7b09d331961fd1732d567fc7b84ff3 | gitee |
arkui-x/samples | CodeLab/Cases/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets | arkts | rgbToNumber | RGB颜色转为整数值
@param color RGB像素值
@returns 整数 | public static rgbToNumber(color: ColorRgb): number {
return ((color.alpha << 24) | (color.red << 16) | (color.green << 8) | color.blue);
} | 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 rgbToNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST... | public static rgbToNumber(color: ColorRgb): number {
return ((color.alpha << 24) | (color.red << 16) | (color.green << 8) | color.blue);
} | https://gitcode.com/arkui-x/samples | c3533b883d8092fa67d8cbd13adbe35d65703426 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Assigns val as element on insertPos.
@param { int } insertPos - index to change
@param { int } val - value to set
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(insertPos: int, val: int): void {
this.$_set(insertPos, val)
} | 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 insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | public set(insertPos: int, val: int): void {
this.$_set(insertPos, val)
} | https://gitcode.com/iop123123/arkts-static-skills | fc1fd3adfcc2860c2e20a723508da7bd1832309b | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationListController.ets | arkts | resetTouch | Reset touch event, which is used to reset an item that has been moved by sliding left
when other buttons are pressed. | resetTouch() {
if (this.itemTouchedIdx !== -1) {
let itemTouched = this.messageList[this.itemTouchedIdx];
if (itemTouched == undefined) {
return false;
}
if (itemTouched.isDelShow) {
itemTouched.isDelShow = false;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resetTouch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | resetTouch() {
if (this.itemTouchedIdx !== -1) {
let itemTouched = this.messageList[this.itemTouchedIdx];
if (itemTouched == undefined) {
return false;
}
if (itemTouched.isDelShow) {
itemTouched.isDelShow = false;
... | https://gitee.com/openharmony/applications_mms.git | 6180dd71ff7eae45735696069b36f344bbe98977 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | restoreChapterImages | 恢复章节图片 | private async restoreChapterImages(sourceDir: string): Promise<void> {
const cacheDir = this.sandboxManager.getDirectory('cache');
try {
// 恢复漫画章节图片
const mangaSource = `${sourceDir}/manga`;
if (SafeFileUtils.accessSync(mangaSource)) {
const mangaTarget = `${cacheDir}/manga_imag... | 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 restoreChapterImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceDir AST#identifier#Right AST#ERROR#Left A... | private async restoreChapterImages(sourceDir: string): Promise<void> {
const cacheDir = this.sandboxManager.getDirectory('cache');
try {
// 恢复漫画章节图片
const mangaSource = `${sourceDir}/manga`;
if (SafeFileUtils.accessSync(mangaSource)) {
const mangaTarget = `${cacheDir}/manga_imag... | https://github.com/DaLongZhuaZi/manxia | 75263aa366075def6b71a3abedb83eb674d09923 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | push | Adds the specified elements to the end of an array and returns the new length of the array.
@returns new length | public push(val: T): int {
let arr = new T[this.data.length + 1]
for(let i = 0; i < this.data.length; i++) {
arr[i] = this.data[i]
}
arr[this.data.length] = val
this.data = arr
return this.data.length
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left push AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left val AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident... | public push(val: T): int {
let arr = new T[this.data.length + 1]
for(let i = 0; i < this.data.length; i++) {
arr[i] = this.data[i]
}
arr[this.data.length] = val
this.data = arr
return this.data.length
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 0e44f618bdaa417f2db66b41a4a2f62ae4262820 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPInputHandler.ets | arkts | toggleScrollMode | 切换滚动模式 | toggleScrollMode() {
this.isScrollMode = !this.isScrollMode
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleScrollMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | toggleScrollMode() {
this.isScrollMode = !this.isScrollMode
} | https://github.com/AetheriumSimulator/qemu-hmos | 45ebd59f810e27f5a50df678b5be526b4107b3c9 | github |
tdcare/tdwebrtc | src/main/ets/MediaStream.ets | arkts | switchVideoDecoder | v08: 动态切换视频解码器
当检测到远端实际编解码器与当前解码器不匹配时调用。
释放旧解码器,创建并启动新的正确类型解码器。 | private async switchVideoDecoder(codec: 'H264' | 'VP8'): Promise<void> {
this.decoderSwitchInProgress = true;
LogUtil.info(`[MediaStream] v08 开始切换解码器 → ${codec}`);
// 1. 释放旧解码器
if (this.videoDecoder !== null) {
try {
await this.videoDecoder.release();
} catch (e) {
LogUtil... | 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 switchVideoDecoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left codec AST#identifier#Right AST#:#L... | private async switchVideoDecoder(codec: 'H264' | 'VP8'): Promise<void> {
this.decoderSwitchInProgress = true;
LogUtil.info(`[MediaStream] v08 开始切换解码器 → ${codec}`);
// 1. 释放旧解码器
if (this.videoDecoder !== null) {
try {
await this.videoDecoder.release();
} catch (e) {
LogUtil... | https://github.com/tdcare/tdwebrtc | 3af8f6355ed7d2bfa99aaa2a7226c3c235bfc7c6 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | auto_save | 自动保存数据 // | private async auto_save() {setInterval(async () => {this.save_data()}, 30000)} | 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 auto_save AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR... | private async auto_save() {setInterval(async () => {this.save_data()}, 30000)} | https://github.com/Nekofox-POT/LinMusic | 5bac3808bb72879af769a53f66fc0fed7f38ecb1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets | arkts | setGlobalWebViewController | 设置全局WebView控制器(由SourceDetailPage提供) | setGlobalWebViewController(controller: webview.WebviewController): void {
logger.info(TAG, '设置全局WebView控制器');
this.globalWebViewController = controller;
// 更新所有已缓存的Engine的WebView控制器
this.updateAllEnginesWebView(controller);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setGlobalWebViewController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left controller AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left webview AST#... | setGlobalWebViewController(controller: webview.WebviewController): void {
logger.info(TAG, '设置全局WebView控制器');
this.globalWebViewController = controller;
// 更新所有已缓存的Engine的WebView控制器
this.updateAllEnginesWebView(controller);
} | https://github.com/DaLongZhuaZi/manxia | 6a948183ff225ead9c5fffb5360f30b003c0eeeb | github |
751496032/ZRouter | RouterApi/src/main/ets/model/NavDestBuilder.ets | arkts | replace | 将当前NavDestination替换为特定NavDestination。当前的NavDestination将被销毁。
@param name | public replace(name: string) {
this.updateCurrentStackName()
this.routerMgr.replacePathByName(name, this.mergeParams(), this.optionsImpl.animated, this)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | public replace(name: string) {
this.updateCurrentStackName()
this.routerMgr.replacePathByName(name, this.mergeParams(), this.optionsImpl.animated, this)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L227-L230 | 719d63207afc7de67347568f31fe4772100542c9 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginatedResult.ets | arkts | calculateTotalPages | 计算总页数
@param total 总记录数
@param pageSize 每页数量
@returns 总页数 | static calculateTotalPages(total: number, pageSize: number): number {
if (pageSize <= 0) {
return 0
}
if (total <= 0) {
return 0
}
return Math.ceil(total / pageSize)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateTotalPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left total AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static calculateTotalPages(total: number, pageSize: number): number {
if (pageSize <= 0) {
return 0
}
if (total <= 0) {
return 0
}
return Math.ceil(total / pageSize)
} | https://github.com/offlinecat-dev/OCNetORM | 5538bfd17f1124aebb4c6bbcb81b4ca7d4cfb873 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/SearchHistoryRepository.ets | arkts | clearAllSearchHistory | 清空所有搜索历史记录
@returns {Promise<void>} Promise<void> | clearAllSearchHistory(): Promise<void> {
return this.dataSource.clearAllSearchHistory();
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left clearAllSearchHistory 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#:#Ri... | clearAllSearchHistory(): Promise<void> {
return this.dataSource.clearAllSearchHistory();
} | https://github.com/Joker-x-dev/CoolMallArkTS | f040e45eea428e1afac76e600296c86866b8d011 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/DownloadManager.ets | arkts | getTasksByManga | 获取指定漫画的所有任务 | public getTasksByManga(mangaId: string): DownloadTaskInfo[] {
return Array.from(this.tasks.values()).filter((task: DownloadTaskInfo) => task.mangaId === mangaId);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTasksByManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | public getTasksByManga(mangaId: string): DownloadTaskInfo[] {
return Array.from(this.tasks.values()).filter((task: DownloadTaskInfo) => task.mangaId === mangaId);
} | https://github.com/DaLongZhuaZi/manxia | 57a687f1c20187f023c902673b45aa6ad86bbcdc | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/ParentBindingFlow.ui.test.ets | arkts | waitForBoundButton | Attempt to find the bound-device button on ConfigPage by polling for
up to `maxMs` since the binding state is loaded asynchronously in
`aboutToAppear` (`refreshBindingState` reads from preferences via an
await chain). Returns true if the button surfaces in time. | async function waitForBoundButton(driver: Driver, maxMs: number): Promise<boolean> {
try {
const stepMs: number = 250;
let waited: number = 0;
while (waited < maxMs) {
const c: Component | null =
await driver.findComponent(ON.id('ConfigBoundDeviceInfoButton'));
if (c !== 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 waitForBoundButton AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AS... | async function waitForBoundButton(driver: Driver, maxMs: number): Promise<boolean> {
try {
const stepMs: number = 250;
let waited: number = 0;
while (waited < maxMs) {
const c: Component | null =
await driver.findComponent(ON.id('ConfigBoundDeviceInfoButton'));
if (c !== null) {
... | https://github.com/terryma2024/happyword | 8b2784d1e2d55f5fd8ec52d6d71b7ea1591f8068 | github |
richshaw2015/nds | ohos/entry/src/test/InputMappingProperty.test.ets | arkts | generateUnmappedButtonCode | Generate a buttonCode that is NOT in the given mappings. | function generateUnmappedButtonCode(rng: PRNG, mappings: GamepadMappingEntry[]): number {
const mappedCodes = new Set(mappings.map((m: GamepadMappingEntry) => m.buttonCode));
let code: number;
do {
code = rng.nextInt(2000, 3999);
} while (mappedCodes.has(code));
return code;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateUnmappedButtonCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rng AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | function generateUnmappedButtonCode(rng: PRNG, mappings: GamepadMappingEntry[]): number {
const mappedCodes = new Set(mappings.map((m: GamepadMappingEntry) => m.buttonCode));
let code: number;
do {
code = rng.nextInt(2000, 3999);
} while (mappedCodes.has(code));
return code;
} | https://github.com/richshaw2015/nds | 657857bb16ff2c9214610286513bd1d0cc590d3d | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CategoryDAO.ets | arkts | getChildren | 获取某个父分类的子分类 | static async getChildren(userId: number, parentId: number): Promise<Category[]> {
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FROM categories WHERE user_id = ? AND parent_category_id = ? AND is_deleted = 0 ORDER BY sort_order ASC, category_id ASC`;
const categories: Category[] = [];... | 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 getChildren AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST... | static async getChildren(userId: number, parentId: number): Promise<Category[]> {
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FROM categories WHERE user_id = ? AND parent_category_id = ? AND is_deleted = 0 ORDER BY sort_order ASC, category_id ASC`;
const categories: Category[] = [];... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5a7cbe337536866b25809ccebca77b1a3c5c1ee9 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | removeAllFileCache | 清除所有文件缓存
@param cacheName 需要操作的文件缓存名称,默认名称为空即操作大端文件缓存, 不为空则匹配小端文件缓存 | async removeAllFileCache(cacheName?:string): Promise<void> {
await nativeNode.removeAllFileCache(cacheName);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeAllFileCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left cacheName AST#identifier#Right AST#?#Left ? AST#?#Right AST#... | async removeAllFileCache(cacheName?:string): Promise<void> {
await nativeNode.removeAllFileCache(cacheName);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L485-L487 | 345386230333f931be7409cc9f5e1098a439e339 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | toString | Returns a string representation of the Set.
@returns { String } - A string representation of the Set.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | override toString(): String {
if(this.elements.size == 0) {
return "[object Set]"
}
return "Set[" + this.toStringVals() + "]"
} | AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String ... | override toString(): String {
if(this.elements.size == 0) {
return "[object Set]"
}
return "Set[" + this.toStringVals() + "]"
} | https://gitcode.com/iop123123/arkts-static-skills | cdf12969fab7c112d6af380fe92ba5ebdffb509a | gitcode |
iop123123/arkts-static-skills | linter/linter/examples/types/union_binop.fail.ets | arkts | describe | expect: fail
expect-code: ESE0106
evidence: BINOP_ON_UNION — Bad operand type: multiple types left in the normalized union type (...) | function describe(x: int | string): string {
return (x + 1) as string;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left describe AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function describe(x: int | string): string {
return (x + 1) as string;
} | https://gitcode.com/iop123123/arkts-static-skills | e3fe0bd1a047f4abf4ffabac100bf4c12110bc06 | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/viewmodel/ProductItem.ets | arkts | constructor | Added for Cart Discount | constructor(props: IProductItem) {
this.id = props.id;
this.image_url = props.image_url;
this.name = props.name;
this.discount = props.discount;
this.price = props.price;
this.promotion = props.promotion;
this.bonus_points = props.bonus_points;
this.categoryId = props.categoryId;
t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left props AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IProductItem AST#identifier#... | constructor(props: IProductItem) {
this.id = props.id;
this.image_url = props.image_url;
this.name = props.name;
this.discount = props.discount;
this.price = props.price;
this.promotion = props.promotion;
this.bonus_points = props.bonus_points;
this.categoryId = props.categoryId;
t... | https://github.com/Harrisonls2004/WaterFlow | 2f61e8ba3806db05621dabcf65f9856ac97a09c5 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/PromptTemplateManager.ets | arkts | renderTemplate | 渲染模板(替换参数) | renderTemplate(templateId: string, parameters: Record<string, string>): string {
const templates = this.getTemplateHistory(templateId);
if (templates.length === 0) {
throw new Error(`Template ${templateId} not found`);
}
const template = templates[templates.length - 1];
let rendered = t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left renderTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left templateId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AS... | renderTemplate(templateId: string, parameters: Record<string, string>): string {
const templates = this.getTemplateHistory(templateId);
if (templates.length === 0) {
throw new Error(`Template ${templateId} not found`);
}
const template = templates[templates.length - 1];
let rendered = t... | https://github.com/CLMC2025/Vignette | 5a79101bb3b039bfb027812d296855b06ffdcde8 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readInt16 | Reads the next signed short.
@param littleEndian If the value is little endian.
@returns The value. | readInt16(littleEndian?: boolean): number {
const value = this.getInt16(this.mByteOffset, littleEndian)
this.mByteOffset += 2
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readInt16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left littleEndian AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ER... | readInt16(littleEndian?: boolean): number {
const value = this.getInt16(this.mByteOffset, littleEndian)
this.mByteOffset += 2
return value
} | https://gitee.com/openharmony-sig/flutter_engine.git | 63f7acd1060b5cab6b7c8417933458232848155e | gitee |
openharmony-tpc/openharmony_tpc_samples | EspBlufiForHarmony/entry/src/main/ets/pages/ConfigureOptions.ets | arkts | checkStation | Station | checkStation(params: BlufiConfigureParams): boolean {
if (this.ssid !== null && this.password !== null) {
params.setOpMode(BlufiParameter.OP_MODE_STA);
let ssid: string = this.ssid;
let ssidByte: Uint8Array = BlufiUtil.stringToUint8Array(ssid);
let ssidUint8: Uint8Array = new util.Base64He... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkStation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BlufiConfigureParams AST#identifier#Right... | checkStation(params: BlufiConfigureParams): boolean {
if (this.ssid !== null && this.password !== null) {
params.setOpMode(BlufiParameter.OP_MODE_STA);
let ssid: string = this.ssid;
let ssidByte: Uint8Array = BlufiUtil.stringToUint8Array(ssid);
let ssidUint8: Uint8Array = new util.Base64He... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 3d2075f3fd9db63cedb33ea3d00bda8c10fa4f24 | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | setAutoReconnect | Configure auto-reconnect settings
@param enabled Enable auto-reconnect
@param maxRetries Maximum reconnect attempts
@param delayMs Initial delay between attempts | static setAutoReconnect(inst: number, enabled: boolean, maxRetries: number, delayMs: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpSetAutoReconnect(inst, enabled, maxRetries, delayMs)... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setAutoReconnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static setAutoReconnect(inst: number, enabled: boolean, maxRetries: number, delayMs: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpSetAutoReconnect(inst, enabled, maxRetries, delayMs)... | https://github.com/tangwengang-del/freerdp-harmonyos | 39597a591cca5094832ca1d815f4ea3c89f3655f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | getUTCDay | Returns the day of the week in the specified date according to universal time, where 0 represents Sunday.
@returns An integer number, between 0 and 6, corresponding to the day of the week
for the given date, according to local time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. | public getUTCDay(): byte {
return ecmaWeekDay(this.ms);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCDay 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 byte AST#ide... | public getUTCDay(): byte {
return ecmaWeekDay(this.ms);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f7668fcfa6fff81de3ab6360caa3717420fbbedb | gitee |
kumaleap/ArkLuban | library/src/main/ets/luban/Luban.ets | arkts | setFocusAlpha | 设置是否保留透明通道
@param focusAlpha 是否保留透明通道
@returns 构建器实例 | setFocusAlpha(focusAlpha: boolean): LubanBuilder {
this.config.focusAlpha = focusAlpha;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFocusAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left focusAlpha AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ) ... | setFocusAlpha(focusAlpha: boolean): LubanBuilder {
this.config.focusAlpha = focusAlpha;
return this;
} | https://github.com/kumaleap/ArkLuban | cbe9d2009e3375ca5352df6ffeaef820e24f62af | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getDownloadTasks | 获取下载任务列表 | public async getDownloadTasks(status?: string): Promise<DownloadTask[]> {
try {
const whereClause = status ? 'status = ?' : undefined;
const whereArgs = status ? [status] : undefined;
const records = await this.databaseManager.query(
'download_task',
undefined,
whereClaus... | 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 getDownloadTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#?#Left ... | public async getDownloadTasks(status?: string): Promise<DownloadTask[]> {
try {
const whereClause = status ? 'status = ?' : undefined;
const whereArgs = status ? [status] : undefined;
const records = await this.databaseManager.query(
'download_task',
undefined,
whereClaus... | https://github.com/DaLongZhuaZi/manxia | 4d4452b1480cad92835ac81aaecfe25f0e10cc69 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets | arkts | startContinuousTask | 启动后台任务
@returns {void} | startContinuousTask(): void {
// 避免重新启动后台任务
if (this.isBackgroundTaskRunning) {
return;
}
// TODO:知识点:创建WantAgent实例,在后台任务时拉起应用
let wantAgentInfo: wantAgent.WantAgentInfo = {
// 点击通知后,将要执行的动作列表
// 添加需要被拉起应用的bundleName和abilityName
wants: [
{
bundleName: "co... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startContinuousTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expres... | startContinuousTask(): void {
// 避免重新启动后台任务
if (this.isBackgroundTaskRunning) {
return;
}
// TODO:知识点:创建WantAgent实例,在后台任务时拉起应用
let wantAgentInfo: wantAgent.WantAgentInfo = {
// 点击通知后,将要执行的动作列表
// 添加需要被拉起应用的bundleName和abilityName
wants: [
{
bundleName: "co... | https://gitcode.com/arkui-x/samples | c3b83ac0aaae85d673ca3759bcb2e8dbfb150236 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayAsListInt.ets | arkts | at | Returns an element at the specified index
@param index element position
@returns an element | public override at(index: int): Int {
return this.data[index];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#identifier#Left at AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right... | public override at(index: int): Int {
return this.data[index];
} | https://gitcode.com/iop123123/arkts-static-skills | fe9f2e3728e0f499b21303b6d87409d6951f2654 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | getSensorCapabilities | 检查是否需要在控制器到达事件中报告传感器能力
@returns 传感器能力标志位 (LI_CCAP_ACCEL | LI_CCAP_GYRO) | getSensorCapabilities(): number {
if (!this.gamepadMotionSensorsEnabled) {
return 0;
}
let capabilities = 0;
// USB 手柄传感器能力由驱动层(如 DS4)自行上报,此处仅处理设备传感器回退
// 检查设备传感器回退
if (this.sensorFallbackEnabled) {
if (this.deviceSensorService.hasAccelerometer()) {
capabilities |= 0x10;... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSensorCapabilities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#... | getSensorCapabilities(): number {
if (!this.gamepadMotionSensorsEnabled) {
return 0;
}
let capabilities = 0;
// USB 手柄传感器能力由驱动层(如 DS4)自行上报,此处仅处理设备传感器回退
// 检查设备传感器回退
if (this.sensorFallbackEnabled) {
if (this.deviceSensorService.hasAccelerometer()) {
capabilities |= 0x10;... | https://github.com/AlkaidLab/moonlight-harmony | 95b5c24803407293d5c28cd58c9e382a21e74984 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitMapInt32Int32 | 访问 map<int32, int32> 字段
JSON: object with string keys (int32 转为 string) | visitMapInt32Int32(value: Map<number, number>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
obj[k.toString()] = v as Object
})
this.json[fieldName] = obj as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapInt32Int32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifier... | visitMapInt32Int32(value: Map<number, number>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
obj[k.toString()] = v as Object
})
this.json[fieldName] = obj as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | b9f2b8b3e93a941013ee8c8eb1ea3dd7c81f7f36 | gitcode |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/debug/EventAlgoTestCase.ets | arkts | checkStatus | 辅助函数:状态检查 | private checkStatus(event: Event, expectedLabel: string) {
const now = Date.now();
let status = '';
if (now > event.endTime) {
status = '已结束';
} else if (now >= event.startTime) {
status = '进行中';
} else {
status =
'未开始';
}
if (status === expectedLabel) {
th... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private checkStatus(event: Event, expectedLabel: string) {
const now = Date.now();
let status = '';
if (now > event.endTime) {
status = '已结束';
} else if (now >= event.startTime) {
status = '进行中';
} else {
status =
'未开始';
}
if (status === expectedLabel) {
th... | https://gitcode.com/openharmony/codelabs | ed5e38e3c9ac5041d6a454800002a5276d41266f | gitcode |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/utils/PreferenceUtil.ets | arkts | savePinCode | --- 密码锁相关 --- | async savePinCode(pin: string): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put(PreferenceUtil.KEY_PIN_CODE, pin);
await this.preferences.put(PreferenceUtil.KEY_IS_LOCK_ENABLED, true);
await this.preferences.flush();
} catch (e) {
console.error('Save... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left savePinCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pin AS... | async savePinCode(pin: string): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put(PreferenceUtil.KEY_PIN_CODE, pin);
await this.preferences.put(PreferenceUtil.KEY_IS_LOCK_ENABLED, true);
await this.preferences.flush();
} catch (e) {
console.error('Save... | https://gitcode.com/openharmony/codelabs | 6a628b596904b7fa4802b631be006b104ec1d26a | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/22.relational_expressions/01.numerical_comparison_operators/float_comparison.ets | arkts | main | ---
desc: Integer comparison {{fc.xvalue}} {{fc.op}} {{fc.yvalue}}
--- | function main(): void {
let x: {{fc.xtype}} = {{fc.xvalue}}; | 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 {
let x: {{fc.xtype}} = {{fc.xvalue}}; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3c944dc2517c305fd34961d35926fc9c887e9549 | gitee |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/pages/Index.ets | arkts | aboutToAppear | 首页出现时先准备派生数据,再异步拉取最新账单。 | aboutToAppear(): void {
if (this.billSyncListenerId < 0) {
this.billSyncListenerId = billSyncController.register(async () => {
await this.loadBillData();
await this.loadAssetAccounts();
await this.loadBudgetData();
})
}
this.refreshStaticDerivedState();
this.loadBil... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
if (this.billSyncListenerId < 0) {
this.billSyncListenerId = billSyncController.register(async () => {
await this.loadBillData();
await this.loadAssetAccounts();
await this.loadBudgetData();
})
}
this.refreshStaticDerivedState();
this.loadBil... | https://github.com/ZestBox-18/kitebook-frontend | faf875715d294befc015fee22a106d9c1f720eff | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/crypto/CryptoService.ets | arkts | isFieldEncrypted | 判断字段值是否已经是密文 | static isFieldEncrypted(value: string): boolean {
if (value.length === 0) {
return false
}
if (value.startsWith(FIELD_ENCRYPTION_PREFIX)) {
return true
}
return CryptoService.isEncrypted(value)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isFieldEncrypted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static isFieldEncrypted(value: string): boolean {
if (value.length === 0) {
return false
}
if (value.startsWith(FIELD_ENCRYPTION_PREFIX)) {
return true
}
return CryptoService.isEncrypted(value)
} | https://github.com/encorexin/WordPressCMS | 1669d633a6ab0fbfdb9fc69cdbab378fee341f43 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartCategory.ets | arkts | updateStats | 更新规则统计信息 | updateStats(isMatch: boolean): void {
if (isMatch) {
this.matchCount += 1;
this.lastMatchedAt = new Date().toISOString();
}
this.updatedAt = new Date().toISOString();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isMatch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left )... | updateStats(isMatch: boolean): void {
if (isMatch) {
this.matchCount += 1;
this.lastMatchedAt = new Date().toISOString();
}
this.updatedAt = new Date().toISOString();
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | de3a73457f237f77e57df769d74f59f30107b34b | github |
HarmonyOS_Samples/MusicHome | products/watch/src/main/ets/watchability/WatchAbility.ets | arkts | onCreate | Stores ability context on app runtime and logs creation.
@param want Launch want info.
@param launchParam System launch parameters. | onCreate(): void {
getAppRuntime().context = this.context;
Logger.info('WatchAbility: Ability onCreate');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | onCreate(): void {
getAppRuntime().context = this.context;
Logger.info('WatchAbility: Ability onCreate');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | b63fd297c20b154b6387df14ebf9ce41ce9b96ab | gitcode |
HarmonyOS_Samples/MultiVideoApplication | features/multivideodetail/src/main/ets/view/SelfComment.ets | arkts | setSelfCommentHeight | Updates the self comment bar height based on current scroll offset. | setSelfCommentHeight() {
if (this.currentYOffset === 0) {
this.selfCommentHeight = DetailConstants.SELF_COMMENT_MAX_HEIGHT;
} else if (this.currentYOffset > 0 &&
this.currentYOffset <= DetailConstants.SELF_COMMENT_SCROLL_HIDE_THRESHOLD) {
this.selfCommentHeight = DetailConstants.SELF_COMMENT... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSelfCommentHeight 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_blo... | setSelfCommentHeight() {
if (this.currentYOffset === 0) {
this.selfCommentHeight = DetailConstants.SELF_COMMENT_MAX_HEIGHT;
} else if (this.currentYOffset > 0 &&
this.currentYOffset <= DetailConstants.SELF_COMMENT_SCROLL_HIDE_THRESHOLD) {
this.selfCommentHeight = DetailConstants.SELF_COMMENT... | https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication | ce03444220e2f703a09377e952fa2108a161a3f5 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | tryAsInteger | Attempts to get an integer value from an object by key.
Returns undefined if the key is not found or if the value is not an integer.
@param {string} key - The key to look up
@returns {int} The integer value if found, undefined otherwise | tryAsInteger(): int | undefined {
if (this.maybeLongValue == undefined) {
return undefined
}
if (this.maybeLongValue! > Int.MAX_VALUE || this.maybeLongValue! < Int.MIN_VALUE) {
return undefined
}
return this.maybeLongVal... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left tryAsInteger 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#identifi... | tryAsInteger(): int | undefined {
if (this.maybeLongValue == undefined) {
return undefined
}
if (this.maybeLongValue! > Int.MAX_VALUE || this.maybeLongValue! < Int.MIN_VALUE) {
return undefined
}
return this.maybeLongVal... | https://gitcode.com/iop123123/arkts-static-skills | 929d3a151f26ab0e3aa63cc3596d821d6c3ed6f1 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | filter | creates a new Float32Array from current Float32Array based on a condition fn
@param fn the condition to apply for each element
@returns a new Float32Array with elements from current Float32Array that satisfy condition fn | public filter(fn: (val: float) => boolean): Float32Array {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.filter(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: float) => boolean): Float32Array {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.filter(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 40a165a2c488212861a3df88429fce03f29a040e | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets | arkts | constructor | Creates a new instance of Array with a specific length and initializes each element using a function.
@param { int } arrayLen The amount of elements in the array.
@param { function } initializer A function that generates an element for a given index.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(arrayLen: int, initializer: (index: int) => T) {
this.buffer = new FixedArray<Any>(arrayLen)
this.actualLength = arrayLen
for (let k: int = 0; k < arrayLen; k++) {
this.$_set_unsafe(k, initializer(k))
}
} | 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 arrayLen AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifi... | public constructor(arrayLen: int, initializer: (index: int) => T) {
this.buffer = new FixedArray<Any>(arrayLen)
this.actualLength = arrayLen
for (let k: int = 0; k < arrayLen; k++) {
this.$_set_unsafe(k, initializer(k))
}
} | https://gitcode.com/iop123123/arkts-static-skills | b9a7be8f0c822b968f9dcfcad9c77130a5da51ef | gitcode |
Yebingiscn/SweetVideo | entry/src/main/ets/component/PlayerComponent/AudioTrackComponent.ets | arkts | isAudioTrack | 检查是否是 AudioTrack | isAudioTrack(item: TrackType): boolean {
const track = item as AudioTrack
return track.index !== undefined && track.language !== undefined
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAudioTrack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TrackType AST#identifier#Right AST#)#Left )... | isAudioTrack(item: TrackType): boolean {
const track = item as AudioTrack
return track.index !== undefined && track.language !== undefined
} | https://github.com/Yebingiscn/SweetVideo | 12b79d246deb01153d46aec9e1a8d03a21fb36f0 | github |
Joker-x-dev/CoolMallArkTS | core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets | arkts | getCarts | 读取选中的购物车项
@returns {Promise<Cart[] | null>} 购物车列表 | async getCarts(): Promise<Cart[] | null> {
const value: preferences.ValueType =
await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_CARTS, "");
if (typeof value === "string" && value.length > 0) {
try {
const parsed: CartJson[] = JSON.parse(value) as CartJson[];
return this.pars... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCarts AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async getCarts(): Promise<Cart[] | null> {
const value: preferences.ValueType =
await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_CARTS, "");
if (typeof value === "string" && value.length > 0) {
try {
const parsed: CartJson[] = JSON.parse(value) as CartJson[];
return this.pars... | https://github.com/Joker-x-dev/CoolMallArkTS | 0acbafed2dc97d011fc137fd5615e8a061aee530 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | articleList | 首页文章列表
https://www.wanandroid.com/article/list/0/json
@param index 下标,从0开始
@returns | public articleList(index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<IArticle>>>> {
return this.getRequest("/article/list/" + index + "/json")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left articleList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | public articleList(index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<IArticle>>>> {
return this.getRequest("/article/list/" + index + "/json")
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 224eebdc92225466f1b96e10a2f174080a18ca73 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/SafeUtils.ets | arkts | stringifyJson | 安全地序列化对象为JSON字符串。 | static stringifyJson(obj: Object | undefined | null, fallback: string = ''): string {
if (obj === undefined || obj === null) return fallback;
try {
return JSON.stringify(obj);
} catch (error) {
logger.error(TAG, `JSON stringify error: ${String(error)}`);
return fallback;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left stringifyJson 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#binary_expression#L... | static stringifyJson(obj: Object | undefined | null, fallback: string = ''): string {
if (obj === undefined || obj === null) return fallback;
try {
return JSON.stringify(obj);
} catch (error) {
logger.error(TAG, `JSON stringify error: ${String(error)}`);
return fallback;
}
} | https://github.com/DaLongZhuaZi/manxia | 6a4f8ad177a0c391aec08a39b2f2727d5303f628 | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | getAddItemRightMove | When an item is deleted, other items in the addition area are moved rightwards. | getAddItemRightMove(index: number): PositionXY {
let x: number = this.blockWidth;
let y: number = 0;
let lastCol: boolean = (index + 1) % this.colNum === 0;
if (lastCol) {
x = -this.blockWidth * (this.colNum - 1);
y = this.imageText ? this.blockHeight : this.blockHeight - 8;
}
retu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAddItemRightMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#L... | getAddItemRightMove(index: number): PositionXY {
let x: number = this.blockWidth;
let y: number = 0;
let lastCol: boolean = (index + 1) % this.colNum === 0;
if (lastCol) {
x = -this.blockWidth * (this.colNum - 1);
y = this.imageText ? this.blockHeight : this.blockHeight - 8;
}
retu... | https://gitcode.com/openharmony/arkui_ace_engine | 483ca2ee8a0a2bcf19bdbbade5462755b5d6b3f7 | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setAttachCenter | 设置依附组件、气泡组件与原始点击组件的相对居中
@param attachMargin
@returns | setAttachCenter(isAttachCenter: boolean): Builder {
this.popupConfig.isAttachCenter = isAttachCenter
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAttachCenter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isAttachCenter AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#L... | setAttachCenter(isAttachCenter: boolean): Builder {
this.popupConfig.isAttachCenter = isAttachCenter
return this
} | https://github.com/wuba/omni-ui | 4a5fd490a8d86720e983e2fdb8162d1a4623dc0f | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CloudWishlistService.ets | arkts | refreshList | Pull the active items for the bound child profile. Returns true on a
successful refresh (cache populated). Unbound returns false; transport
failures also return false but leave the previous cache in place. | async refreshList(): Promise<boolean> {
const snap: CloudCredentialsSnapshot = await this.credentials.load();
if (!snap.isBound() || snap.deviceToken.length === 0) {
return false;
}
const base: string = CloudWishlistService.trim(this.resolveBaseUrl());
const fid: string = snap.familyId.trim(... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left refreshList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async refreshList(): Promise<boolean> {
const snap: CloudCredentialsSnapshot = await this.credentials.load();
if (!snap.isBound() || snap.deviceToken.length === 0) {
return false;
}
const base: string = CloudWishlistService.trim(this.resolveBaseUrl());
const fid: string = snap.familyId.trim(... | https://github.com/terryma2024/happyword | 748d5a9cd5789913d619da3ae5b96a3fbd1db024 | github |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/WebDownloadFileImpl.ets | arkts | executeDownload | *
实例执行下载 | private executeDownload(path: string) {
try {
this.prepareDirectory(path)
WebDownloadFileHelper._webDownloadItem!.start(path)
WebDownloadFileHelper._downloadProgress = 0
} catch (error) {
this.handleError(error as BusinessError)
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private executeDownload(path: string) {
try {
this.prepareDirectory(path)
WebDownloadFileHelper._webDownloadItem!.start(path)
WebDownloadFileHelper._downloadProgress = 0
} catch (error) {
this.handleError(error as BusinessError)
}
} | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | 37aa580071979d4d5c516b2a6cf398d452f27a85 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets | arkts | registerPromise | 注册可取消的 Promise
@param promise 原始 Promise
@returns 可取消的 Promise | registerPromise<T>(promise: Promise<T>): CancellablePromise<T> {
this.checkDestroyed('registerPromise');
this.checkPromiseLimit();
const cancellable = new CancellablePromise<T>((resolve, reject, signal) => {
promise.then(
value => {
if (!signal.aborted) {
resolve(v... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left registerPromise AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameters#Left... | registerPromise<T>(promise: Promise<T>): CancellablePromise<T> {
this.checkDestroyed('registerPromise');
this.checkPromiseLimit();
const cancellable = new CancellablePromise<T>((resolve, reject, signal) => {
promise.then(
value => {
if (!signal.aborted) {
resolve(v... | https://github.com/DaLongZhuaZi/manxia | 3e1dadb1d115703433008ec8b956b6e1bffa93d6 | github |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/request/ReadMessageRequest.ets | arkts | constructor | @param {ReadMessageRequest} init - 初始化数据 | constructor(init: ReadMessageRequest) {
this.ids = init.ids;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReadMessageRequest AST#identi... | constructor(init: ReadMessageRequest) {
this.ids = init.ids;
} | https://github.com/Joker-x-dev/CoolMallArkTS | d37ef94e38301aa4c8b0293719fcb0e5b66a3134 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | getOffsetValue | 获取 OFFSET 值
@returns OFFSET 值 | getOffsetValue(): number {
return this.offsetValue
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOffsetValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getOffsetValue(): number {
return this.offsetValue
} | https://github.com/offlinecat-dev/OCNetORM | e2ca3c62498e15e67e5c0850515dfbb074945a4a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | setWebviewController | 设置WebView控制器 | setWebviewController(controller: webview.WebviewController): void {
this.webviewController = controller;
this.isReady = true;
getLegadoRuntimeV2().setWebviewController(controller);
logger.info(TAG, 'WebView控制器已设置');
// 处理等待中的任务
this.processPendingTasks();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWebviewController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left controller AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left webview AST#identi... | setWebviewController(controller: webview.WebviewController): void {
this.webviewController = controller;
this.isReady = true;
getLegadoRuntimeV2().setWebviewController(controller);
logger.info(TAG, 'WebView控制器已设置');
// 处理等待中的任务
this.processPendingTasks();
} | https://github.com/DaLongZhuaZi/manxia | 6c5fd1360f23a7603ca643e09ee5c220ea78e7ae | github |
wuba/omni-ui | omni_component/src/main/ets/components/toast/OmniToast.ets | arkts | setTheme | 设置全局 toast 主题
@param theme | public static setTheme(theme: ToastTheme) {
OmniToast.globalTheme = theme;
} | 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 setTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#:#Left : AST#:#... | public static setTheme(theme: ToastTheme) {
OmniToast.globalTheme = theme;
} | https://github.com/wuba/omni-ui | 31f6f8353780e1f867d51daefc6a26c37c578108 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toFloat | Returns value of this instance
@returns { float }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toFloat(): float {
return this.value.toFloat();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toFloat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public override toFloat(): float {
return this.value.toFloat();
} | https://gitcode.com/iop123123/arkts-static-skills | ca802c6451f5bb409d932fab5ed1530fad362991 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/CryptoService.ets | arkts | encrypt | v2 加密:PBKDF2 派生密钥 + AES-256-GCM | static async encrypt(plaintext: string, password?: string): Promise<Uint8Array> {
const pwd = password || DEFAULT_PASSWORD;
// 生成随机盐和 Nonce
const rand = cryptoFramework.createRandom();
const salt = new Uint8Array(rand.generateRandomSync(PBKDF2_SALT_SIZE).data);
const nonce = new Uint8Array(rand.g... | 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 encrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left plaintext AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async encrypt(plaintext: string, password?: string): Promise<Uint8Array> {
const pwd = password || DEFAULT_PASSWORD;
// 生成随机盐和 Nonce
const rand = cryptoFramework.createRandom();
const salt = new Uint8Array(rand.generateRandomSync(PBKDF2_SALT_SIZE).data);
const nonce = new Uint8Array(rand.g... | https://github.com/AlkaidLab/moonlight-harmony | 0ea0ed48074b8309d674b40668937df356e6d364 | github |
trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS | sensitiveinput/src/main/ets/module/SensitiveWordChecker.ets | arkts | loadTypes | 加载敏感词类型 | private loadTypes(mode : SensitiveWordMode): void {
try {
this.types = mode2list(mode);
// 注意:在实际应用中,需要使用正确的资源路径加载文件
// 这里暂时使用模拟数据
console.info('SensitiveWordChecker: Types loaded');
} catch (error) {
console.error('Failed to load types:', error);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadTypes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Sen... | private loadTypes(mode : SensitiveWordMode): void {
try {
this.types = mode2list(mode);
// 注意:在实际应用中,需要使用正确的资源路径加载文件
// 这里暂时使用模拟数据
console.info('SensitiveWordChecker: Types loaded');
} catch (error) {
console.error('Failed to load types:', error);
}
} | https://github.com/trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS | e1b202fd8cd0f8c25b0b4343dc56be5286b2a7aa | github |
CLMC2025/Vignette | entry/src/main/ets/manager/ReviewTimeManager.ets | arkts | getActiveReview | 获取活动的复习记录 | getActiveReview(word: WordItem): ReviewTimeRecord | null {
const wordKey = `${word.id}_${word.word}`;
return this.activeReviews.get(wordKey) || null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getActiveReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | getActiveReview(word: WordItem): ReviewTimeRecord | null {
const wordKey = `${word.id}_${word.word}`;
return this.activeReviews.get(wordKey) || null;
} | https://github.com/CLMC2025/Vignette | ab3daab89fcd934bf0ff7f92cd64932cd9e392cb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | $_invoke | Creates a new instance of a Double
@param { String | Number | BigInt | undefined | null } value The value to be converted to a number.
Can be a string, number, or BigInt (optional).
@returns { Number } A new Double instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: String | Number | BigInt | undefined | null): Number {
if (value instanceof String) {
return new Double(value as String);
} else if (value instanceof Number) {
return new Double(value as Number);
} else if (value instanceof BigInt) {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left... | static $_invoke(value: String | Number | BigInt | undefined | null): Number {
if (value instanceof String) {
return new Double(value as String);
} else if (value instanceof Number) {
return new Double(value as Number);
} else if (value instanceof BigInt) {
... | https://gitcode.com/iop123123/arkts-static-skills | f451a016314d2ea99682b60dccd7eaaee65816ad | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | from | Creates a new ArrayBuffer from a Uint8Array.
@param { Uint8Array } u8arr Source typed array.
@returns { ArrayBuffer } The new ArrayBuffer.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(u8arr: Uint8Array): ArrayBuffer {
const arrBuff = u8arr.buffer as ArrayBuffer
if (arrBuff.detached) {
return new ArrayBuffer(0)
}
const result = new ArrayBuffer(arrBuff.byteLength)
result.setValues(arrBuff, 0)
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left u8arr AST#identifier#Ri... | public static from(u8arr: Uint8Array): ArrayBuffer {
const arrBuff = u8arr.buffer as ArrayBuffer
if (arrBuff.detached) {
return new ArrayBuffer(0)
}
const result = new ArrayBuffer(arrBuff.byteLength)
result.setValues(arrBuff, 0)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 071b9c21468e798fa167496e71c523585c0e3f71 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/PermissionManager.ets | arkts | canManageRules | 检查是否可以管理规则 | public canManageRules(): boolean {
if (!this.currentUser) {
return false;
}
// 只有护士长可以管理规则
return this.currentUser.role === UserRole.HEAD_NURSE;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left canManageRules 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 AS... | public canManageRules(): boolean {
if (!this.currentUser) {
return false;
}
// 只有护士长可以管理规则
return this.currentUser.role === UserRole.HEAD_NURSE;
} | https://github.com/LJ666-ui/harmony-health-care | 0b7829abd4973ae57b4b61ab684e500967d08f5b | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/material_alpha.ets | arkts | toggleAlphaCutoff | Toggle alpha-cutoff threshold for the non-blended material | toggleAlphaCutoff(): void {
if (!this.alphaMaterial) {
return;
}
if (this.alphaMaterial.alphaCutoff && this.alphaMaterial.alphaCutoff < 1.0) {
// If the current cutoff value is less than 1.0, switch to fully opaque
this.alphaMaterial.alphaCutoff = 1.0;
} else {
// Currently set... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleAlphaCutoff 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_... | toggleAlphaCutoff(): void {
if (!this.alphaMaterial) {
return;
}
if (this.alphaMaterial.alphaCutoff && this.alphaMaterial.alphaCutoff < 1.0) {
// If the current cutoff value is less than 1.0, switch to fully opaque
this.alphaMaterial.alphaCutoff = 1.0;
} else {
// Currently set... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | c8e87fa64bff46621d14232cb66b9e0dddce9675 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/KeyMappingSettings.ets | arkts | getEmuItems | 模拟控制 (参考 ppsspp "Emulator controls") | function getEmuItems(): MappingItemDef[] {
return [
{ id: 'pause', name: I18n.t('action_pause'), targetType: 'frontend_action', targetValue: FrontendAction.PAUSE },
{ id: 'fast_forward', name: I18n.t('action_fast_forward'), targetType: 'frontend_action', targetValue: FrontendAction.FAST_FORWARD },
{ id: '... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getEmuItems 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#array_type#Left... | function getEmuItems(): MappingItemDef[] {
return [
{ id: 'pause', name: I18n.t('action_pause'), targetType: 'frontend_action', targetValue: FrontendAction.PAUSE },
{ id: 'fast_forward', name: I18n.t('action_fast_forward'), targetType: 'frontend_action', targetValue: FrontendAction.FAST_FORWARD },
{ id: '... | https://github.com/richshaw2015/nds | 1ee691a779a8ca8cd58129dd85958f2a02385f2e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/TxtParser.ets | arkts | isChapterTitle | 判断是否是章节标题
优先使用TXT目录规则管理器的规则 | private isChapterTitle(line: string): boolean {
if (line.length === 0 || line.length > 100) {
return false;
}
// 优先使用规则管理器的编译模式
if (this.compiledPattern) {
// 重置正则表达式的lastIndex
this.compiledPattern.lastIndex = 0;
if (this.compiledPattern.test(line)) {
return true;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isChapterTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private isChapterTitle(line: string): boolean {
if (line.length === 0 || line.length > 100) {
return false;
}
// 优先使用规则管理器的编译模式
if (this.compiledPattern) {
// 重置正则表达式的lastIndex
this.compiledPattern.lastIndex = 0;
if (this.compiledPattern.test(line)) {
return true;
... | https://github.com/DaLongZhuaZi/manxia | 1bb574e16d78ff77cc2351fc5a89ca0ff6a3e289 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarEntry.ets | arkts | getNegativeSum | Returns the sum of all negative values this entry (if stacked) contains. (this is a positive number)
@return | public getNegativeSum(): number {
return this.mNegativeSum;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNegativeSum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | public getNegativeSum(): number {
return this.mNegativeSum;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 594a61b4e8ccf2a764b4b7b0024ce234624fc89d | gitee |
XXYoLoong/SchoolSmart | entry/src/main/ets/pages/Timetable.ets | arkts | build | build 方法用于构建当前页面的 UI 布局 | build() {
// 外层容器使用 Column 布局,垂直排列各个子组件
Column() {
// 标题栏区域,包含返回按钮和页面标题
Row() {
// 返回按钮图标,点击后调用 router.back() 返回到上一个页面
Image($r('app.media.back_left'))
.width("20%") // 占据当前行宽度的20%
.height("30vp") // 高度设置为30vp单位
// .backgroun... | 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 布局,垂直排列各个子组件
Column() {
// 标题栏区域,包含返回按钮和页面标题
Row() {
// 返回按钮图标,点击后调用 router.back() 返回到上一个页面
Image($r('app.media.back_left'))
.width("20%") // 占据当前行宽度的20%
.height("30vp") // 高度设置为30vp单位
// .backgroun... | https://github.com/XXYoLoong/SchoolSmart | 8c573c41aa5c030d2c1869dc70dee792292ce20b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | setFloat32 | Sets bytes as they represent given type
@param { int } byteOffset zero index to write
@param { float } value
@param { boolean } littleEndian read as little or big endian
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setFloat32(byteOffset: int, value: float, littleEndian: boolean): void {
if (littleEndian) {
this.setFloat32Little(byteOffset, value)
} else {
this.setFloat32Big(byteOffset, value)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFloat32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identif... | public setFloat32(byteOffset: int, value: float, littleEndian: boolean): void {
if (littleEndian) {
this.setFloat32Little(byteOffset, value)
} else {
this.setFloat32Big(byteOffset, value)
}
} | https://gitcode.com/iop123123/arkts-static-skills | 8463c54e716767d925a931666287e20ac92cefa0 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | ln | Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
rounded to `precision` significant digits using rounding mode `rounding`.
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | public ln(): Decimal {
return this.naturalLogarithm(this);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left ln 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#:#Right ... | public ln(): Decimal {
return this.naturalLogarithm(this);
} | https://gitcode.com/iop123123/arkts-static-skills | b1a9e65326c94b909aa6cb78d230839ade9706f8 | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/DownloadManager.ets | arkts | handleDownloadError | 处理下载错误 | private handleDownloadError(task: DownloadTask, error: any) {
task.retryCount++;
task.error = error.message || error.toString();
task.updatedAt = new Date().toISOString();
if (task.retryCount < task.maxRetries) {
// 重试
task.status = DownloadStatus.PENDING;
this.downloadQueue.unshift... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleDownloadError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private handleDownloadError(task: DownloadTask, error: any) {
task.retryCount++;
task.error = error.message || error.toString();
task.updatedAt = new Date().toISOString();
if (task.retryCount < task.maxRetries) {
// 重试
task.status = DownloadStatus.PENDING;
this.downloadQueue.unshift... | https://github.com/AetheriumSimulator/qemu-hmos | a5af92f6ecf2827044f8eb989c18ba1728bb951b | github |
openharmony-sig/FastBle | library/src/main/ets/BleManager.ets | arkts | getMaxConnectCount | Get the maximum number of connections
@return | public getMaxConnectCount(): number {
return this.maxConnectCount;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMaxConnectCount 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 ... | public getMaxConnectCount(): number {
return this.maxConnectCount;
} | https://gitee.com/openharmony-sig/FastBle.git | 2047bec899f758d7982529c1348bc3117eb91e46 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.