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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | find | Finds the first element in the Uint8Array that satisfies the condition
@param fn condition
@returns the first element that satisfies fn | public find(fn: (val: number, index: int) => boolean): number {
let newF: (val: number, index: int, array: Uint8Array) => boolean =
(val: number, index: int, array: Uint8Array): boolean => { return fn(val, index) }
return this.find(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public find(fn: (val: number, index: int) => boolean): number {
let newF: (val: number, index: int, array: Uint8Array) => boolean =
(val: number, index: int, array: Uint8Array): boolean => { return fn(val, index) }
return this.find(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bedc3062cb68115a23ce5ed154b84a0d8384ec22 | gitee |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | clearAllStates | 清空所有用户状态 | clearAllStates(): void {
this.userProgress.clear();
this.stateChangeListeners = [];
console.log('[UserStateManager] All user states cleared');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAllStates 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_blo... | clearAllStates(): void {
this.userProgress.clear();
this.stateChangeListeners = [];
console.log('[UserStateManager] All user states cleared');
} | https://github.com/CLMC2025/Vignette | 27fe297ce41374cc5197921a801a9e4db42c3b2a | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | showErrorDialog | 显示错误提示对话框
@param errorMessage 错误信息 | private showErrorDialog(errorMessage: string): void {
try {
DialogHelper.showToast(errorMessage, {
duration: 3000,
fontColor: $r('app.color.button_text_blue'),
backgroundColor: $r('app.color.error')
})
} catch (error) {
hilog.error(DOMAIN, TAG, 'Show error dialog fail... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showErrorDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorMessage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | private showErrorDialog(errorMessage: string): void {
try {
DialogHelper.showToast(errorMessage, {
duration: 3000,
fontColor: $r('app.color.button_text_blue'),
backgroundColor: $r('app.color.error')
})
} catch (error) {
hilog.error(DOMAIN, TAG, 'Show error dialog fail... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L311-L321 | b08b6212c879d466f034a2dc46342562236929de | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DeepLinkRouter.ets | arkts | parseNovelRoute | ── 内部解析方法 ──
解析小说路由: manxia://novel/{subRoute}/... | private parseNovelRoute(pathSegments: string[], queryParams: DeepLinkQueryParams): DeepLinkResult | null {
if (pathSegments.length < 2) {
logger.warn(TAG, '小说路由缺少子路由');
return null;
}
const subRoute: string = pathSegments[1];
// manxia://novel/search/{source}?q={keyword}
if (subRoute... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseNovelRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pathSegments AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | private parseNovelRoute(pathSegments: string[], queryParams: DeepLinkQueryParams): DeepLinkResult | null {
if (pathSegments.length < 2) {
logger.warn(TAG, '小说路由缺少子路由');
return null;
}
const subRoute: string = pathSegments[1];
// manxia://novel/search/{source}?q={keyword}
if (subRoute... | https://github.com/DaLongZhuaZi/manxia | a7b50bf2f2cc5b627c9c6836ce5bdf13420fa01b | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | updateState | 更新播放状态 | private updateState(avState: string): void {
switch (avState) {
case 'playing':
this.state = PlayerState.PLAYING;
break;
case 'paused':
this.state = PlayerState.PAUSED;
break;
case 'stopped':
this.state = PlayerState.STOPPED;
break;
case 'err... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left avState AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | private updateState(avState: string): void {
switch (avState) {
case 'playing':
this.state = PlayerState.PLAYING;
break;
case 'paused':
this.state = PlayerState.PAUSED;
break;
case 'stopped':
this.state = PlayerState.STOPPED;
break;
case 'err... | https://github.com/pangpang20/antennaPodHM | 916e0110c18bcfe4f52b7e3ff1fa4db58720a89b | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | resultSetToRow | 将 ResultSet 当前行转换为 ResultSetRow | private resultSetToRow(resultSet: relationalStore.ResultSet): ResultSetRow {
return this.resultSetSupport.resultSetToRow(resultSet)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resultSetToRow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_ex... | private resultSetToRow(resultSet: relationalStore.ResultSet): ResultSetRow {
return this.resultSetSupport.resultSetToRow(resultSet)
} | https://github.com/offlinecat-dev/OCNetORM | 0c3c0aa81de402645c9bfa2859d7bf106d21a313 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test14_original_index.ets | arkts | testSortAscending | --- Array.sort ascending and descending --- | function testSortAscending(): string {
let nums: number[] = [5, 3, 8, 1, 9, 2];
let sorted: number[] = nums.sort((a: number, b: number): number => {
return a - b;
});
return String(sorted[0]) + ',' + String(sorted[sorted.length - 1]);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSortAscending 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#predefine... | function testSortAscending(): string {
let nums: number[] = [5, 3, 8, 1, 9, 2];
let sorted: number[] = nums.sort((a: number, b: number): number => {
return a - b;
});
return String(sorted[0]) + ',' + String(sorted[sorted.length - 1]);
} | https://github.com/miaochiahao/ark-ghidra | f29f5089c7569a51f05ae13735e531c1ff35697a | github |
Countly/countly-sdk-hos | library/src/main/ets/Countly.ets | arkts | sharedInstance | Throws if initShared() hasn't run. | public static sharedInstance(): CountlyInstance {
if (!Countly.shared) {
throw new Error('[Countly] sharedInstance called before initShared');
}
return Countly.shared;
} | 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 sharedInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static sharedInstance(): CountlyInstance {
if (!Countly.shared) {
throw new Error('[Countly] sharedInstance called before initShared');
}
return Countly.shared;
} | https://github.com/Countly/countly-sdk-hos | 2f4fd442a426e948a5ab2f352b719944a943f73d | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/heima/zhihu/ZhiHuIndexPage.ets | arkts | reply | 回复的方法 | reply() {
const reply: ReplyItem = new ReplyItem(this.list[this.list.length - 1].id + 1,
'https://upfile-drcn.platform.hicloud.com/dEEzDI03EVVYvLqbw3JW0w.x2cpqjRntys1QsBB8J6c63hr-d6RT8ZSvcAnhqoZoJJsyhUP2IRZhNmauzpS92bvn3LYXWc4V434dbiYs2bhbCUEd74L-6BHI9B7dLAXfnE1gdK8XQ.6099200.jpg',
'钝子生',
this.t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reply 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#lexical_declaration#Left AST#co... | reply() {
const reply: ReplyItem = new ReplyItem(this.list[this.list.length - 1].id + 1,
'https://upfile-drcn.platform.hicloud.com/dEEzDI03EVVYvLqbw3JW0w.x2cpqjRntys1QsBB8J6c63hr-d6RT8ZSvcAnhqoZoJJsyhUP2IRZhNmauzpS92bvn3LYXWc4V434dbiYs2bhbCUEd74L-6BHI9B7dLAXfnE1gdK8XQ.6099200.jpg',
'钝子生',
this.t... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 5c689242fd50d304a0576844a0e73984057dcb81 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/LimitLine.ets | arkts | getDashPathEffect | returns the DashPathEffect that is set for this LimitLine
@return | public getDashPathEffect(): DashPathEffect | null {
return this.mDashPathEffect;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDashPathEffect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Le... | public getDashPathEffect(): DashPathEffect | null {
return this.mDashPathEffect;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f9fb91ceff304bd87483ad8180158b7134e2ca87 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | startNavigationLoop | 启动导航循环 | private startNavigationLoop(): void {
this.navigationLoopTimer = setInterval(() => {
this.navigationLoop();
}, this.navigationLoopInterval);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startNavigationLoop 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... | private startNavigationLoop(): void {
this.navigationLoopTimer = setInterval(() => {
this.navigationLoop();
}, this.navigationLoopInterval);
} | https://github.com/LJ666-ui/harmony-health-care | 27d8cb783f9460a14cfb61b2b75a7ea814ed4fee | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets | arkts | networkObserve | 监听网络状态
@param netType 监听的网络类型(WI-FI、蜂窝数据等) | networkObserve(netType: connection.NetBearType) {
// TODO:根据网络类型,设置不同的网络监听,用于WI-FI和蜂窝网络切换时判断各自网络状态的变化。
let netConnection: connection.NetConnection = connection.createNetConnection({
netCapabilities: {
bearerTypes: [netType]
}
})
// 注册网络监听,注册成功后才能监听到对应类型的网络状态变化
netConnection.reg... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left networkObserve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left netType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#L... | networkObserve(netType: connection.NetBearType) {
// TODO:根据网络类型,设置不同的网络监听,用于WI-FI和蜂窝网络切换时判断各自网络状态的变化。
let netConnection: connection.NetConnection = connection.createNetConnection({
netCapabilities: {
bearerTypes: [netType]
}
})
// 注册网络监听,注册成功后才能监听到对应类型的网络状态变化
netConnection.reg... | https://github.com/openharmony/applications_app_samples | aa5b9c74c76c12976baf2fdc9c64085ad2966e50 | github |
arkui-x/samples | CodeLab/Cases/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets | arkts | transitionFromDown | 底部弹出动画
@param duration 动画时间
@returns | static transitionFromDown(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ de... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left transitionFromDown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignmen... | static transitionFromDown(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ de... | https://gitcode.com/arkui-x/samples | e438f2b61a21281be3a737ab884858b08079bd83 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getNonPrivateComics | [新增] 获取非隐私漫画列表(本地漫画)
@returns Promise<ComicInfo[]> 非隐私漫画列表 | public async getNonPrivateComics(): Promise<ComicInfo[]> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'(isPrivate = ? OR isPrivate IS NULL)',
[0],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条非隐私本地... | 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 getNonPrivateComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public async getNonPrivateComics(): Promise<ComicInfo[]> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'(isPrivate = ? OR isPrivate IS NULL)',
[0],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条非隐私本地... | https://github.com/DaLongZhuaZi/manxia | 48a4534d5daee1d2da067712558b1dba59d5f568 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | clampIndex | 校验侧边栏索引合法性
@param {number} index - 原始索引
@returns {number} 合法索引,不合法返回 -1 | private clampIndex(index: number): number {
const total: number = this.categoryTrees.length;
if (total <= 0) {
return 0;
}
if (index < 0) {
return 0;
}
if (index >= total) {
return total - 1;
}
return index;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left clampIndex 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 n... | private clampIndex(index: number): number {
const total: number = this.categoryTrees.length;
if (total <= 0) {
return 0;
}
if (index < 0) {
return 0;
}
if (index >= total) {
return total - 1;
}
return index;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 58d153b3803c96b8b1d7969710ef07938fe208a0 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | forEach | Applies a function over all elements of BigUint64Array
@param fn function to apply
@returns undefined | public forEach(fn: (val: BigInt, index: int, array: BigUint64Array) => BigInt): void {
for (let i = 0; i < this.length; ++i) {
this.set(i, fn(this.at(i), i, this))
}
throw new Error("BigUint64Array.forEach: has to return undefined, but returns void for now")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public forEach(fn: (val: BigInt, index: int, array: BigUint64Array) => BigInt): void {
for (let i = 0; i < this.length; ++i) {
this.set(i, fn(this.at(i), i, this))
}
throw new Error("BigUint64Array.forEach: has to return undefined, but returns void for now")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b30eea407bc319e53f5b0d7ab50a258fbb7faf9d | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/EventSourcingService.ets | arkts | generateEventId | ==================== 工具方法 ====================
生成事件ID | private static generateEventId(): string {
const timestamp = Date.now();
const random = Math.floor(Math.random() * 10000);
return `evt_${timestamp}_${random}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left generateEventId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private static generateEventId(): string {
const timestamp = Date.now();
const random = Math.floor(Math.random() * 10000);
return `evt_${timestamp}_${random}`;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | af3eeb4d673c68c15350cb5241af010bca5fe9b1 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/SupportService.ets | arkts | initAppInstallTime | 初始化安装时间 | public static initAppInstallTime() {
if (SettingsService.getSync(SettingsService.KEY_APP_INSTALL_TIME, -1) > 0) {
return;
}
SettingsService.put(SettingsService.KEY_APP_INSTALL_TIME, new Date().getTime());
} | 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 initAppInstallTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public static initAppInstallTime() {
if (SettingsService.getSync(SettingsService.KEY_APP_INSTALL_TIME, -1) > 0) {
return;
}
SettingsService.put(SettingsService.KEY_APP_INSTALL_TIME, new Date().getTime());
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SupportService.ets#L36-L41 | acb5d38aff76ac057f66ddcad675f1dc423d24da | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ObjectPool.ets | arkts | get | Returns an instance of Poolable. If get() is called with an empty pool, the pool will be
replenished. If the pool capacity is sufficiently large, this could come at a performance
cost.
@return An instance of Poolable object T | public get(): T {
if (this.objectsPointer == -1 && this.replenishPercentage > 0.0) {
this.refillPool();
}
if (!this.objects) {
this.objects = new Array<Poolable>(this.desiredCapacity);
}
let result: T = this.objects[this.objectsPointer] as T;
result.currentOwnerId = Poolable.NO_O... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get 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 get(): T {
if (this.objectsPointer == -1 && this.replenishPercentage > 0.0) {
this.refillPool();
}
if (!this.objects) {
this.objects = new Array<Poolable>(this.desiredCapacity);
}
let result: T = this.objects[this.objectsPointer] as T;
result.currentOwnerId = Poolable.NO_O... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 4ebddffb1786f825147401d83810ad21627d4d92 | gitee |
honjow/Next2V | shared/src/main/ets/components/reply/ReplyCardLayoutPolicy.ets | arkts | estTextWidth | Rough rendered width of a string: CJK / full-width glyphs ~= the font size, Latin/ASCII ~= 0.56x.
Approximate by design — it only needs to decide a layout fit, and the username's
flexShrink + ellipsis is the safety net when a borderline row is kept inline. | static estTextWidth(text: string, fontSizeVp: number): number {
let width = 0
for (let i = 0; i < text.length; i++) {
width += text.charCodeAt(i) > 0x2e7f ? fontSizeVp : fontSizeVp * 0.56
}
return width
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left estTextWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | static estTextWidth(text: string, fontSizeVp: number): number {
let width = 0
for (let i = 0; i < text.length; i++) {
width += text.charCodeAt(i) > 0x2e7f ? fontSizeVp : fontSizeVp * 0.56
}
return width
} | https://github.com/honjow/Next2V | 26a7c9ee5ecbab88c5a4454d73d555da6f4d0c64 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityAndEntryDelegate.ets | arkts | onCreate | 生命周期回调 | onCreate() {
this.ensureAlive();
if (this.shouldDispatchAppLifecycleState()) {
this.flutterEngine?.getLifecycleChannel()?.appIsResumed();
}
} | 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#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS... | onCreate() {
this.ensureAlive();
if (this.shouldDispatchAppLifecycleState()) {
this.flutterEngine?.getLifecycleChannel()?.appIsResumed();
}
} | https://gitee.com/openharmony-sig/flutter_engine.git | 73b231e316a01e401cd512d514fd3beb0eb3a2dc | gitee |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets | arkts | get_peq | 获取当前 PEQ 参数 | get_peq(): [boolean, number, number, number, number][] {
return nativeModule.get_peq()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left get_peq AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | get_peq(): [boolean, number, number, number, number][] {
return nativeModule.get_peq()
} | https://github.com/Nekofox-POT/LinMusic | b0907e974ad74b189aeb596920750fc49455e77a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets | arkts | getResultByLastRule | 根据最后一个规则获取结果 | private getResultByLastRule(elements: HTMLElement[], lastRule: string): string {
const attrNames = ['text', 'href', 'src', 'html', 'textnodes', 'owntext', 'all',
'title', 'alt', 'value', 'content', 'data-src', 'data-original',
'class', 'id', 'name', 'type', 'placehold... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getResultByLastRule 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#subsc... | private getResultByLastRule(elements: HTMLElement[], lastRule: string): string {
const attrNames = ['text', 'href', 'src', 'html', 'textnodes', 'owntext', 'all',
'title', 'alt', 'value', 'content', 'data-src', 'data-original',
'class', 'id', 'name', 'type', 'placehold... | https://github.com/DaLongZhuaZi/manxia | cb9dcf3ca09ffbf5273008f0f9f56b6847e9c3f5 | github |
din0sauria/audio-deepfake-detection | entry/src/main/ets/utils/WindowManager.ets | arkts | disableFullScreen | 关闭沉浸式显示 | static async disableFullScreen() {
const context = getContext()
const win = await window.getLastWindow(context)
win.setWindowLayoutFullScreen(false)
AppStorage.setOrCreate("topHeight", 0)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left disableFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | static async disableFullScreen() {
const context = getContext()
const win = await window.getLastWindow(context)
win.setWindowLayoutFullScreen(false)
AppStorage.setOrCreate("topHeight", 0)
} | https://github.com/din0sauria/audio-deepfake-detection | a945b838ad95df0242319b3e3e6f975d9af9cfe5 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/KeyboardMapper.ets | arkts | sendAltTab | Send Alt+Tab sequence | sendAltTab(): void {
if (this.listener) {
this.listener.onKeyEvent(VK_MENU, true);
this.listener.onKeyEvent(VK_TAB, true);
this.listener.onKeyEvent(VK_TAB, false);
this.listener.onKeyEvent(VK_MENU, false);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendAltTab 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_expression#Left... | sendAltTab(): void {
if (this.listener) {
this.listener.onKeyEvent(VK_MENU, true);
this.listener.onKeyEvent(VK_TAB, true);
this.listener.onKeyEvent(VK_TAB, false);
this.listener.onKeyEvent(VK_MENU, false);
}
} | https://github.com/tangwengang-del/freerdp-harmonyos | 8652d319c7c83fc27820e65163b3b9135452aba8 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets | arkts | createSocket | 创建Socket
@param localIp
@param port | async createSocket(localIp: string, port: number): Promise<boolean> {
Logger.info(`${TAG} tcp bind localIp: ${localIp}`);
try {
if (this.tcpSocket) {
this.tcpSocket.close();
this.tcpSocket = null;
}
this.tcpSocket = socket.constructTCPSocketInstance();
await this.tcpS... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createSocket AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left localIp AST#identifier#Right AST#type_annotation#Left AST... | async createSocket(localIp: string, port: number): Promise<boolean> {
Logger.info(`${TAG} tcp bind localIp: ${localIp}`);
try {
if (this.tcpSocket) {
this.tcpSocket.close();
this.tcpSocket = null;
}
this.tcpSocket = socket.constructTCPSocketInstance();
await this.tcpS... | https://github.com/openharmony/applications_app_samples | 54c632aeb77b4ff5d2125a98ef5bc5357dcdd9b6 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setZeroLineWidth | Sets the width of the zero line in vp
@param width | public setZeroLineWidth(width: number): void {
this.mZeroLineWidth = Utils.handleDataValues(width);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setZeroLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public setZeroLineWidth(width: number): void {
this.mZeroLineWidth = Utils.handleDataValues(width);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e81763bc7f336f786bf66b93ce3c3af46257366a | gitee |
HarmonyOS_Samples/BestPracticeSnippets | WaterFlowSample/entry/src/main/ets/utils/WindowUtil.ets | arkts | setAvoidArea | Get status bar height and indicator height. | private static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void {
try {
let uiContext: UIContext = WindowUtil.windowClass.getUIContext();
if (type === window.AvoidAreaType.TYPE_SYSTEM) {
AppStorage.setOrCreate(CommonConstants.AS_KEY_STATUS_BAR_HEIGHT, uiContext.px2vp(area... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left setAvoidArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : ... | private static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void {
try {
let uiContext: UIContext = WindowUtil.windowClass.getUIContext();
if (type === window.AvoidAreaType.TYPE_SYSTEM) {
AppStorage.setOrCreate(CommonConstants.AS_KEY_STATUS_BAR_HEIGHT, uiContext.px2vp(area... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 11be4e6347d991e0a67b77664ee6613cf25fc53d | gitcode |
openharmony-sig/qr-code-generator | library/src/main/ets/components/MainPage/qrcodegen.ets | arkts | reedSolomonComputeRemainder | Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials. | private static reedSolomonComputeRemainder(data: Array<byte>, divisor: Array<byte>): Array<byte> {
let result: Array<byte> = divisor.map(_ => 0);
for (const b of data) { // Polynomial division
const factor: byte = b ^ (result.shift() as byte);
result.push(0);
divisor.forEach((coe... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left reedSolomonComputeRemainder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Righ... | private static reedSolomonComputeRemainder(data: Array<byte>, divisor: Array<byte>): Array<byte> {
let result: Array<byte> = divisor.map(_ => 0);
for (const b of data) { // Polynomial division
const factor: byte = b ^ (result.shift() as byte);
result.push(0);
divisor.forEach((coe... | https://gitee.com/openharmony-sig/qr-code-generator.git | f0a2306361d74549a33befdf04f1a21489ead17c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewMangaLoader.ets | arkts | loadImage | 加载单个图片 - IWebViewImageLoader接口实现 | loadImage(request: ImageRequestInfo): WebViewLoadingResult {
try {
logger.debug(TAG, `加载单个图片: ${request.url}`);
// 委托给图片拦截器处理
return this.imageInterceptor.interceptImageRequest(request);
} catch (error) {
logger.error(TAG, `加载图片失败: ${request.url}, 错误: ${error instanceof E... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageRequestInfo AST#identifier#Right AST#)... | loadImage(request: ImageRequestInfo): WebViewLoadingResult {
try {
logger.debug(TAG, `加载单个图片: ${request.url}`);
// 委托给图片拦截器处理
return this.imageInterceptor.interceptImageRequest(request);
} catch (error) {
logger.error(TAG, `加载图片失败: ${request.url}, 错误: ${error instanceof E... | https://github.com/DaLongZhuaZi/manxia | e0585b040d179a6e7f95a53bb8cd603ed178d23a | github |
tdcare/tdwebrtc | example/SignalingClientExample.ets | arkts | sendVideoSosHangup | 挂断视频 SOS | public sendVideoSosHangup(toMac: string): void {
if (!this.signaling) {
return;
}
this.signaling.sendVideoSosHangup(toMac, this.currentRoomId);
console.log(`[SignalingExample] 挂断视频 SOS to ${toMac}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendVideoSosHangup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public sendVideoSosHangup(toMac: string): void {
if (!this.signaling) {
return;
}
this.signaling.sendVideoSosHangup(toMac, this.currentRoomId);
console.log(`[SignalingExample] 挂断视频 SOS to ${toMac}`);
} | https://github.com/tdcare/tdwebrtc | 32cdd215e399ea80591913a833b26c4b61996675 | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | getWordCounts | Get word counts by status - optimized with SQL COUNT | async getWordCounts(): Promise<Map<WordStatus, number>> {
this.ensureInitialized();
const counts = new Map<WordStatus, number>();
const statuses: WordStatus[] = [
WordStatus.NEW,
WordStatus.LEARNING,
WordStatus.REVIEW,
WordStatus.RELEARNING,
WordStatus.KNOWN
];
for ... | 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 getWordCounts AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right... | async getWordCounts(): Promise<Map<WordStatus, number>> {
this.ensureInitialized();
const counts = new Map<WordStatus, number>();
const statuses: WordStatus[] = [
WordStatus.NEW,
WordStatus.LEARNING,
WordStatus.REVIEW,
WordStatus.RELEARNING,
WordStatus.KNOWN
];
for ... | https://github.com/CLMC2025/Vignette | fbff1a04dcbecbc4762ee6fc334266eba620a07d | github |
HarmonyOS_Codelabs/arkts-basic-syntax-demo | entry/src/main/ets/pages/BasicPage.ets | arkts | compareLoose | 比较运算符 | function compareLoose(a: string | number, b: string | number) {
return a == b;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left compareLoose AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function compareLoose(a: string | number, b: string | number) {
return a == b;
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo | 5e4e3e8118c0f22a2064338ea37c9c8315c58eb2 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | moreSelected | In the selection mode, tap More. In the displayed menu, select | moreSelected(e) {
HiLog.i(TAG, 'moreSelected, e: ' + JSON.stringify(e))
switch (e) {
case '0':
// duplicating
this.copyText();
break;
case 1:
// Share
this.share();
break;
case 2:
// Select Text
this.gotoTextSelect(this.mmsIndex);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left moreSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left e AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expressio... | moreSelected(e) {
HiLog.i(TAG, 'moreSelected, e: ' + JSON.stringify(e))
switch (e) {
case '0':
// duplicating
this.copyText();
break;
case 1:
// Share
this.share();
break;
case 2:
// Select Text
this.gotoTextSelect(this.mmsIndex);
... | https://gitee.com/openharmony/applications_mms.git | 05a792b47d7cf226791b069a385f791a912dc17b | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | openMangaDetail | 打开漫画详情页 | private async openMangaDetail(manga: Manga) {
try {
if (this.isRemoteProviderManga(manga)) {
this.openRemoteProviderMangaDetail(manga);
return;
}
let sourceId = this.getParsedMangaSourceId(manga);
await this.resolveMangaIdentityForNavigation(
manga,
manga.r... | 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 openMangaDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right AST#:#Left... | private async openMangaDetail(manga: Manga) {
try {
if (this.isRemoteProviderManga(manga)) {
this.openRemoteProviderMangaDetail(manga);
return;
}
let sourceId = this.getParsedMangaSourceId(manga);
await this.resolveMangaIdentityForNavigation(
manga,
manga.r... | https://github.com/DaLongZhuaZi/manxia | f00e236a026345fa69dc83121e53e3541e2257d5 | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | mmsListLongPress | Event of pressing and holding an SMS message | mmsListLongPress(index) {
for (let i = 0; i < this.mmsList.length; i++) {
if (index == i) {
this.mmsList[index].isShowMsgLongMenu = true;
} else {
this.mmsList[i].isShowMsgLongMenu = false;
}
}
this.refresh = !this.refresh
this.mmsIndex = index;
if (this.isSelectS... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left mmsListLongPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#e... | mmsListLongPress(index) {
for (let i = 0; i < this.mmsList.length; i++) {
if (index == i) {
this.mmsList[index].isShowMsgLongMenu = true;
} else {
this.mmsList[i].isShowMsgLongMenu = false;
}
}
this.refresh = !this.refresh
this.mmsIndex = index;
if (this.isSelectS... | https://gitee.com/openharmony/applications_mms.git | 880ebb96ef5744263ee6b3792784e936b5b335a4 | gitee |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/PipManager.ets | arkts | isSupported | Capability gate. Hosts MUST use this to decide whether to show the
"minimize" button — no in-app fallback overlay is provided. PiP is gated
by Window SessionManager and only available on phones (not tablet 2-in-1
/ TV / car). | isSupported(): boolean {
if (PIP_DISABLED) {
return false;
}
try {
return canIUse('SystemCapability.Window.SessionManager');
} catch (e) {
Logger.warn('PipManager.isSupported: canIUse threw, treating as unsupported', e);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isSupported(): boolean {
if (PIP_DISABLED) {
return false;
}
try {
return canIUse('SystemCapability.Window.SessionManager');
} catch (e) {
Logger.warn('PipManager.isSupported: canIUse threw, treating as unsupported', e);
return false;
}
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 0b550af33b066f6abc15d2c8c1b8f5891ef5f7a0 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/AuthService.ets | arkts | checkFingerprintSupport | 检查设备是否支持指纹功能 | import { userAuth } from '@kit.UserAuthenticationKit'; | AST#program#Left AST#import_statement#Left AST#import#Left import AST#import#Right AST#import_clause#Left AST#named_imports#Left AST#{#Left { AST#{#Right AST#import_specifier#Left AST#identifier#Left userAuth AST#identifier#Right AST#import_specifier#Right AST#}#Left } AST#}#Right AST#named_imports#Right AST#import_cla... | import { userAuth } from '@kit.UserAuthenticationKit'; | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/AuthService.ets#L1-L1 | 534422a0a0c890b4090c5c271a477645fa2fdd26 | github |
openharmony-sig/ohos-beacon-library | library/src/main/ets/components/beacon/logging/LogManager.ets | arkts | i | Send a info log message to the logger.
@param message The message you would like logged. This message may contain string formatting
which will be replaced with values from args.
@param args Arguments for string formatting. | public static i(message: string, ...args: Object[]): void {
LogManager.sLogger.i(message, args);
} | 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#identifier#Left i AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right ... | public static i(message: string, ...args: Object[]): void {
LogManager.sLogger.i(message, args);
} | https://gitee.com/openharmony-sig/ohos-beacon-library.git | a981fd27ad403b3b341be7ee8b9628e6da0b90a5 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MedicalAgent.ets | arkts | constructor | 构造函数
@param config 智能体配置
@param llmClient LLM客户端
@param ragRetriever RAG检索器 | constructor(
config: AgentConfig,
llmClient: LLMClient,
ragRetriever: RAGRetriever
) {
this.config = config;
this.agentId = config.agentId;
this.agentName = config.agentName;
this.specialty = config.specialty;
this.llmClient = llmClient;
this.ragRetriever = ragRetriever;
} | 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 config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AgentConfig AST#identifier#... | constructor(
config: AgentConfig,
llmClient: LLMClient,
ragRetriever: RAGRetriever
) {
this.config = config;
this.agentId = config.agentId;
this.agentName = config.agentName;
this.specialty = config.specialty;
this.llmClient = llmClient;
this.ragRetriever = ragRetriever;
} | https://github.com/LJ666-ui/harmony-health-care | a594e587720a45f2c0f10d1da90d198db3e4618d | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/MonotonicClock.ets | arkts | nowMs | Strictly-monotonic millisecond timestamp. Two calls within the same
wall-clock millisecond return distinct values: the second one is
`Date.now() + 1` (and the third `+2`, etc.). Under sustained
high-rate calls this can drift past wall clock; the drift is
bounded by THIS clock's own call rate, not the process-wide rate. | public nowMs(): number {
const ts: number = Date.now();
if (this.lastMsTs >= ts) {
this.lastMsTs++;
} else {
this.lastMsTs = ts;
}
return this.lastMsTs;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left nowMs AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public nowMs(): number {
const ts: number = Date.now();
if (this.lastMsTs >= ts) {
this.lastMsTs++;
} else {
this.lastMsTs = ts;
}
return this.lastMsTs;
} | https://github.com/Countly/countly-sdk-hos | 17f61fca07ee3d351b82ff49f309c6275d937b7b | github |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/SettingsUtil.ets | arkts | saveThemeColor | 保存主题颜色 | static async saveThemeColor(color: string): Promise<void> {
if (!SettingsUtil.prefs) {
promptAction.showToast({ message: '设置未初始化,请重启应用' });
return;
}
try {
await SettingsUtil.prefs.put(STORAGE_KEYS.THEME_COLOR, color);
await SettingsUtil.prefs.flush();
AppStorage.setOrCreate... | 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 saveThemeColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : A... | static async saveThemeColor(color: string): Promise<void> {
if (!SettingsUtil.prefs) {
promptAction.showToast({ message: '设置未初始化,请重启应用' });
return;
}
try {
await SettingsUtil.prefs.put(STORAGE_KEYS.THEME_COLOR, color);
await SettingsUtil.prefs.flush();
AppStorage.setOrCreate... | https://github.com/Coke0807/NewsAPP-HarmonyOS | 0faec386c3820f005f5c4d3e890af3f877644b77 | github |
arkui-x/samples | CodeLab/Cases/feature/customcalendarpickerdialog/src/main/ets/view/CalendarView.ets | arkts | onCancel | 点击遮障层退出时的回调 | onCancel() {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCancel 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#}#Left } AST#}#Right AST#sta... | onCancel() {
} | https://gitcode.com/arkui-x/samples | 7b3862a77ce3deb397c79780afd0ccfcb3aa435b | gitcode |
XHXYT/Pixark | entry/src/main/ets/common/entity/DownloadTask.ets | arkts | updateProgressInfo | 内部方法:更新进度数据和计算速度 | private updateProgressInfo(progress: request.agent.Progress) {
if (!progress) return;
// 总大小取 sizes 数组的第一个元素 (单文件下载场景)
// 如果是多文件任务,需要累加 sizes,
const totalBytes = (progress.sizes && progress.sizes.length > 0) ? progress.sizes[0] : 0;
const processedBytes = progress.processed;
// 计算百分比
if (... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateProgressInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left progress AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member... | private updateProgressInfo(progress: request.agent.Progress) {
if (!progress) return;
// 总大小取 sizes 数组的第一个元素 (单文件下载场景)
// 如果是多文件任务,需要累加 sizes,
const totalBytes = (progress.sizes && progress.sizes.length > 0) ? progress.sizes[0] : 0;
const processedBytes = progress.processed;
// 计算百分比
if (... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/entity/DownloadTask.ets#L112-L140 | 370127860c43bb51e33035891530b52d7f41abf4 | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/model/repository/RecordRepository.ets | arkts | getAllRecordDates | =================================================================
📊 统计页 (StatsPage) 专用 (🟢 重点修复区)
=================================================================
🟢 [修复] 获取所有记录日期,增加日志,防止静默失败 | async getAllRecordDates(): Promise<string[]> {
const store = RdbHelper.getRdbStore();
if (!store) {
console.error('[RecordRepo] DB store is null');
return [];
}
try {
let predicates = new relationalStore.RdbPredicates(CommonConstants.RECORD_TABLE_NAME);
// 🟢 关键:按时间排序,确保连续性计算正... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllRecordDates AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getAllRecordDates(): Promise<string[]> {
const store = RdbHelper.getRdbStore();
if (!store) {
console.error('[RecordRepo] DB store is null');
return [];
}
try {
let predicates = new relationalStore.RdbPredicates(CommonConstants.RECORD_TABLE_NAME);
// 🟢 关键:按时间排序,确保连续性计算正... | https://gitcode.com/openharmony/codelabs | c892e00d2eaf8da8ada2d71798999c8d5ed74aaf | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/pages/Index.ets | arkts | onPageShow | 页面重新显示时恢复全屏模式
从 GameView 返回时,GameView.aboutToDisappear 会恢复状态栏,
需要在此重新隐藏以保持首页全屏沉浸式体验。 | onPageShow(): void {
FullscreenController.getInstance().enableFullscreen().then((success: boolean) => {
if (success) {
hilog.info(DOMAIN, TAG, 'Fullscreen restored on page show');
}
}).catch((err: Error) => {
hilog.error(DOMAIN, TAG, 'Failed to restore fullscreen: %{public}s', err.me... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow 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#L... | onPageShow(): void {
FullscreenController.getInstance().enableFullscreen().then((success: boolean) => {
if (success) {
hilog.info(DOMAIN, TAG, 'Fullscreen restored on page show');
}
}).catch((err: Error) => {
hilog.error(DOMAIN, TAG, 'Failed to restore fullscreen: %{public}s', err.me... | https://github.com/richshaw2015/nds | ce49605f46abe7622775bd6f28d5c0d41f6ef43c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | getEntryCount | Returns the total entry count across all DataSet objects this data object contains.
@return | public getEntryCount(): number {
let count: number = 0;
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
count += data.getEntryCount();
}
}
return count;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEntryCount 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#n... | public getEntryCount(): number {
let count: number = 0;
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
count += data.getEntryCount();
}
}
return count;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 3ea664e20aa1593371bd7f6e324da2d84c32e3c1 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getFontScale | 获取当前字号缩放倍率 | public static getFontScale(): number {
return FontAwareHelper.globalState.fontScale;
} | 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 getFontScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public static getFontScale(): number {
return FontAwareHelper.globalState.fontScale;
} | https://github.com/DaLongZhuaZi/manxia | 6e939b3f8a4a9bb5d2ef3aa47430af2af00a21cc | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | markSucceeded | 标记为成功 | markSucceeded(): void {
this.status = COMMAND_STATUS_SUCCEEDED;
this.processedAt = new Date().toISOString();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markSucceeded 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... | markSucceeded(): void {
this.status = COMMAND_STATUS_SUCCEEDED;
this.processedAt = new Date().toISOString();
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 639ec06e836aab9e40af601d01f485a401c2a891 | github |
Countly/countly-sdk-hos | library/src/main/ets/Countly.ets | arkts | createInstance | Creates (or returns) a named instance. Instance name is separate from app key. | public static async createInstance(
name: string,
config: CountlyConfig,
storageOverride?: Storage,
networkOverride?: Network
): Promise<CountlyInstance> {
const existing: CountlyInstance | undefined = Countly.namedInstances.get(name);
if (existing) return existing;
const instance: Count... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left createInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nam... | public static async createInstance(
name: string,
config: CountlyConfig,
storageOverride?: Storage,
networkOverride?: Network
): Promise<CountlyInstance> {
const existing: CountlyInstance | undefined = Countly.namedInstances.get(name);
if (existing) return existing;
const instance: Count... | https://github.com/Countly/countly-sdk-hos | 0107bfc1e5e2e23b521fcec1274220bb3dbf78bb | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrCodeGenerator.ets | arkts | rsGeneratorPoly | ─── Reed-Solomon ───────────────────────────────────────────────────────────── | function rsGeneratorPoly(nsym: number): number[] {
const g: number[] = new Array(nsym + 1).fill(0);
g[0] = 1;
for (let i = 0; i < nsym; i++) {
for (let j = nsym; j > 0; j--) {
g[j] = g[j] ^ gfMul(g[j - 1], GF_EXP[i]);
}
}
return g;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left rsGeneratorPoly AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nsym AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function rsGeneratorPoly(nsym: number): number[] {
const g: number[] = new Array(nsym + 1).fill(0);
g[0] = 1;
for (let i = 0; i < nsym; i++) {
for (let j = nsym; j > 0; j--) {
g[j] = g[j] ^ gfMul(g[j - 1], GF_EXP[i]);
}
}
return g;
} | https://github.com/AlkaidLab/moonlight-harmony | d52a268144df3fa24d506860289c010291761d8f | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/components/BottomPlayer.ets | arkts | aboutToAppear | 组件即将显示 | aboutToAppear(): void {
this.initializePlayer();
this.setupEventListeners();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
this.initializePlayer();
this.setupEventListeners();
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | e80593222e5872f8631d0006d72efbe83ecfc358 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/StatusEnums.ets | arkts | isValidStatusTransition | 验证状态转换是否合法 | static isValidStatusTransition(from: DownloadStatus, to: DownloadStatus): boolean {
// 定义合法的状态转换规则
const validTransitions: Record<DownloadStatus, DownloadStatus[]> = {
[DownloadStatus.PENDING]: [DownloadStatus.DOWNLOADING, DownloadStatus.CANCELLED],
[DownloadStatus.DOWNLOADING]: [DownloadStatus.CO... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidStatusTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | static isValidStatusTransition(from: DownloadStatus, to: DownloadStatus): boolean {
// 定义合法的状态转换规则
const validTransitions: Record<DownloadStatus, DownloadStatus[]> = {
[DownloadStatus.PENDING]: [DownloadStatus.DOWNLOADING, DownloadStatus.CANCELLED],
[DownloadStatus.DOWNLOADING]: [DownloadStatus.CO... | https://github.com/DaLongZhuaZi/manxia | a31013d6c134ee99ec1be0bd9595d6548e6b3cd5 | github |
silence17/harmonydemo | entry/src/main/ets/view/BuiCustomDialog.ets | arkts | empty | 作为全局弹窗组件封装 内容完全由外部slot定义 | @Builder function empty(){} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left empty AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AS... | @Builder function empty(){} | https://github.com/silence17/harmonydemo | 55209b25e3b0c4b2af96c27fbc9893f88d6bbb20 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/historyrecord/HistoryRecordController.ets | arkts | shown | call on HistoryRecord show | public shown(): void {
this.expDataSource.shown();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left shown AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public shown(): void {
this.expDataSource.shown();
} | https://gitee.com/openharmony-sig/applications_calculator.git | 65404a265763b8cac168a93c5775e3d594798502 | gitee |
Nekofox-POT/LinMusic | entry/src/main/ets/package/files_manager/class_files_manager.ets | arkts | update_data | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
内部函数 //
//////////
整合更新数据库 // | private update_data() {
// 整合 所有歌曲 //
this.all_songs_list = nativeModule.sortStringArray([...(this.download_manager!.all_songs_list), ...(this.external_manager!.all_songs_list)])
// 导入 外部歌曲 //
this.external_songs_list = this.external_manager!.all_songs_list
// 整合 dsd //
this.dsd_songs_list = ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left update_data 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 ... | private update_data() {
// 整合 所有歌曲 //
this.all_songs_list = nativeModule.sortStringArray([...(this.download_manager!.all_songs_list), ...(this.external_manager!.all_songs_list)])
// 导入 外部歌曲 //
this.external_songs_list = this.external_manager!.all_songs_list
// 整合 dsd //
this.dsd_songs_list = ... | https://github.com/Nekofox-POT/LinMusic | bdbf1d9e3f5c3d05f090c2db3a8c687c8cffee39 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/StringBuilder.ets | arkts | append | Appends a float as string to the builder's internal buffer
@param i value to be appended
@returns builder with updated internal buffer | public append(i: float): StringBuilder {
this.append(StringBuilder.toString(i));
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left append AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left float AST#id... | public append(i: float): StringBuilder {
this.append(StringBuilder.toString(i));
return this;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4b7790b646a9b8da2504bf245c72deba7ca8122a | gitee |
veaba/EsptouchForHarmony | entry/src/main/ets/esptouch/provision/APProvisioner.ets | arkts | closeTCPSocket | Close TCP socket if open | private closeTCPSocket(): void {
if (this.tcpSocket != null) {
try {
this.tcpSocket.off('connect');
this.tcpSocket.off('message');
this.tcpSocket.off('error');
this.tcpSocket.close();
} catch (e) {
console.warn(TAG, `closeTCPSocket error: ${e.message}`);
}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left closeTCPSocket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr... | private closeTCPSocket(): void {
if (this.tcpSocket != null) {
try {
this.tcpSocket.off('connect');
this.tcpSocket.off('message');
this.tcpSocket.off('error');
this.tcpSocket.close();
} catch (e) {
console.warn(TAG, `closeTCPSocket error: ${e.message}`);
}... | https://github.com/veaba/EsptouchForHarmony | 3373e3503d7e4caf530d31b9fa491112cf18af81 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/i18n/facades/I18nManagerFacade.ets | arkts | getLayoutDirection | 获取当前布局方向字符串
@returns 'RTL' 或 'LTR' | getLayoutDirection(): string {
return this.isRtl() ? 'RTL' : 'LTR';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLayoutDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta... | getLayoutDirection(): string {
return this.isRtl() ? 'RTL' : 'LTR';
} | https://github.com/DaLongZhuaZi/NGF | 48ef7dcaf69cb93624cf4a03f3b6e93c357a5419 | github |
azhu0001/localsend-harmony | entry/src/main/ets/utils/FileProvider.ets | arkts | getFilePortLength | 根据文件大小返回分片大小
@param size
@returns | static getFilePortLength(size: number): number {
if (size < 500 * FileProvider.ONE_MB) {
return 1075 * FileProvider.ONE_KB
} else if (size < FileProvider.ONE_GB) {
return 825 * FileProvider.ONE_KB
} else {
return 1150 * FileProvider.ONE_KB
// return 1075 * FileProvider.ONE_KB
}... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFilePortLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static getFilePortLength(size: number): number {
if (size < 500 * FileProvider.ONE_MB) {
return 1075 * FileProvider.ONE_KB
} else if (size < FileProvider.ONE_GB) {
return 825 * FileProvider.ONE_KB
} else {
return 1150 * FileProvider.ONE_KB
// return 1075 * FileProvider.ONE_KB
}... | https://gitcode.com/azhu0001/localsend-harmony | c2211bcbf35c2905651d5a44e330cb382f986873 | gitcode |
StarHeartY/CalculatorX | entry/src/main/ets/database/HistoryRepository.ets | arkts | clearHistory | 清空指定模块的历史记录 | public static async clearHistory(moduleType?: string): Promise<number> {
if (!HistoryRepository.rdbStore) {
return 0;
}
try {
const predicates = new relationalStore.RdbPredicates('history');
if (moduleType && moduleType !== 'all') {
// 清空时也支持多模块联合清空
if (moduleType.include... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left clearHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleType AST#ident... | public static async clearHistory(moduleType?: string): Promise<number> {
if (!HistoryRepository.rdbStore) {
return 0;
}
try {
const predicates = new relationalStore.RdbPredicates('history');
if (moduleType && moduleType !== 'all') {
// 清空时也支持多模块联合清空
if (moduleType.include... | https://github.com/StarHeartY/CalculatorX | f4369e944af752b7182c661ddfebdfa3b920c3d1 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Int8Array that satisfies the condition
@param fn condition
@returns the index of the last element that satisfies fn, -1 otherwise | public findLastIndex(fn: (val: byte) => boolean): int {
let newF: (val: byte, index: int, array: Int8Array) => boolean =
(val: byte, index: int, array: Int8Array): boolean => { return fn(val) }
return this.findLastIndex(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex 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 : ... | public findLastIndex(fn: (val: byte) => boolean): int {
let newF: (val: byte, index: int, array: Int8Array) => boolean =
(val: byte, index: int, array: Int8Array): boolean => { return fn(val) }
return this.findLastIndex(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2ca5bc7466932572f7304bfc3e1e2c74cbb24a13 | gitee |
honjow/Next2V | shared/src/main/ets/backup/BackupCrypto.ets | arkts | seal | Encrypt UTF-8 plaintext under a password. Returns the base64 ciphertext (with the GCM tag
appended) plus the cipher metadata needed to decrypt later (algorithm, KDF params, salt, iv). | static seal(plaintext: string, password: string): BackupSealResult {
const salt = BackupCrypto.randomBytes(BACKUP_CIPHER_SALT_BYTES)
const iv = BackupCrypto.randomBytes(BACKUP_CIPHER_IV_BYTES)
const keyBytes = BackupCrypto.deriveKey(password, salt)
const symKey = BackupCrypto.importKey(keyBytes)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left seal AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left plaintext AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST... | static seal(plaintext: string, password: string): BackupSealResult {
const salt = BackupCrypto.randomBytes(BACKUP_CIPHER_SALT_BYTES)
const iv = BackupCrypto.randomBytes(BACKUP_CIPHER_IV_BYTES)
const keyBytes = BackupCrypto.deriveKey(password, salt)
const symKey = BackupCrypto.importKey(keyBytes)
... | https://github.com/honjow/Next2V | 4a646c4fd50d62a5455833404a299ef674ff6d70 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/CategoryRepository.ets | arkts | getAllCategories | 获取所有分类
@returns Promise<Array<TaskCategoryData>> 分类模型数组 | async getAllCategories(): Promise<Array<TaskCategoryData>> {
try {
const records = await this.dao.queryAll();
return records.map(r => this.recordToModel(r));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get all categories: ${JSON.stringify(err)}`);
return [];
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllCategories 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#gen... | async getAllCategories(): Promise<Array<TaskCategoryData>> {
try {
const records = await this.dao.queryAll();
return records.map(r => this.recordToModel(r));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get all categories: ${JSON.stringify(err)}`);
return [];
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | 37faf9c27e84ced991a68fbb123906b6af494ab9 | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets | arkts | monthChange | 当前月份信息,用于自动化用例 | monthChange() {
// 当前显示的月份
let month = this.currentShowMonth;
emitter.emit({ eventId: 0, priority: 0 }, {
data: {
month: month
}
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left monthChange 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... | monthChange() {
// 当前显示的月份
let month = this.currentShowMonth;
emitter.emit({ eventId: 0, priority: 0 }, {
data: {
month: month
}
});
} | https://gitcode.com/arkui-x/samples | dc8e828c4592f099370275418138a7c21aad0374 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/UnknownFields.ets | arkts | isEmpty | 判断是否为空(无未知字段)
@returns true 如果没有未知字段 | isEmpty(): boolean {
return this.data.length === 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b... | isEmpty(): boolean {
return this.data.length === 0
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 26bba66a0c78d524eb2320bac836600ab2cc29b5 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | loadCheats | ============================================================================
金手指 (Cheats)
============================================================================
加载金手指代码到 AREngine
@param cheats 金手指代码数组,每个元素是一组 u32 指令码 | static loadCheats(cheats: Array<Array<number>>): boolean {
return MelonDSNative.native.loadCheats(cheats);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left loadCheats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cheats AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre... | static loadCheats(cheats: Array<Array<number>>): boolean {
return MelonDSNative.native.loadCheats(cheats);
} | https://github.com/richshaw2015/nds | 62c2521b2f610b597a16e7fe81f04d9722e255be | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/multiplication/multiplication_long.ets | arkts | main | ---
desc: check multiplication of two long integers
--- | function main(): void {
const a: long = {{v.left}}
const b: long = {{v.right}}
assert (a * b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: long = {{v.left}}
const b: long = {{v.right}}
assert (a * b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 52f6c9e1c6495bc5727c392eb2c5540e5622a118 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/ScopeRegistry.ets | arkts | removeAllScopes | 移除实体的所有作用域
@param entityName 实体名称 | removeAllScopes(entityName: string): void {
this.scopes.delete(entityName)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeAllScopes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | removeAllScopes(entityName: string): void {
this.scopes.delete(entityName)
} | https://github.com/offlinecat-dev/OCNetORM | 0dcc8d247e8436c219e15d1a0fb288085708b7f4 | github |
popsiclelmlm/Hey | entry/src/main/ets/services/DelayTester.ets | arkts | measureNodeOutbound | socksPort:本次测速用的本地 socks 端口。并发测速时由调用方给每个并发槽分配一个
固定且互不相同的端口(见 Index 的流式测速池),避免并发 ping 撞端口/撞配置文件。
单点测速不传则用默认端口。 | static async measureNodeOutbound(outboundJson: string, datDir: string, url: string, timeoutMs: number = 8000, configType?: XrayConfigType, socksPort: number = DELAY_TEST_SOCKS_PORT): Promise<DelayTestResult> {
const timeoutSeconds = Math.max(1, Math.floor(timeoutMs / 1000));
let result: NativePingResult;
... | 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 measureNodeOutbound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left outboundJson AST#identifier#Right AST#ERROR#Left AS... | static async measureNodeOutbound(outboundJson: string, datDir: string, url: string, timeoutMs: number = 8000, configType?: XrayConfigType, socksPort: number = DELAY_TEST_SOCKS_PORT): Promise<DelayTestResult> {
const timeoutSeconds = Math.max(1, Math.floor(timeoutMs / 1000));
let result: NativePingResult;
... | https://github.com/popsiclelmlm/Hey | f0ca2d9e5e40bd46c2c26e8edc71aa31e777d28e | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | listOneDriveCacheFiles | 列出 OneDrive 缓存内容 | public async listOneDriveCacheFiles(): Promise<string[]> {
try {
const files: string[] = [];
const dir = fs.opendirSync(this.config.oneDrivePath);
let dirent = dir.readSync();
while (dirent) {
files.push(dirent.name);
dirent = dir.readSync();
}
dir.closeS... | 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 listOneDriveCacheFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public async listOneDriveCacheFiles(): Promise<string[]> {
try {
const files: string[] = [];
const dir = fs.opendirSync(this.config.oneDrivePath);
let dirent = dir.readSync();
while (dirent) {
files.push(dirent.name);
dirent = dir.readSync();
}
dir.closeS... | https://github.com/AetheriumSimulator/qemu-hmos | 000c4f98f601057b00ac67123a9c83c0fdc71115 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets | arkts | openEndDatePicker | 打开结束日期选择器 | openEndDatePicker(): void {
const date = new Date(this.scheduleEndTime)
this.tempYear = date.getFullYear()
this.tempMonth = date.getMonth() + 1
this.tempDay = date.getDate()
this.showEndDatePicker = true
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openEndDatePicker 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_... | openEndDatePicker(): void {
const date = new Date(this.scheduleEndTime)
this.tempYear = date.getFullYear()
this.tempMonth = date.getMonth() + 1
this.tempDay = date.getDate()
this.showEndDatePicker = true
} | https://gitcode.com/openharmony/codelabs | bf7873ddd2287b78c80fddbc84e068b3b3268f9b | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/settings/src/main/ets/service/UpdateService.ets | arkts | checkUpdate | 检查更新
@returns Promise<boolean> | public checkUpdate(): 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 checkUpdate 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... | public checkUpdate(): 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 | 3bf22481d9374f86eda6ce5638699c6fd4062a53 | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/managers/QemuVMManager.ets | arkts | destroy | 销毁 Worker | destroy() {
if (this.worker) {
this.worker.terminate()
this.worker = null
}
this.vmStatusCallbacks.clear()
this.pendingPromises.clear()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left destroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left... | destroy() {
if (this.worker) {
this.worker.terminate()
this.worker = null
}
this.vmStatusCallbacks.clear()
this.pendingPromises.clear()
} | https://github.com/AetheriumSimulator/qemu-hmos | 8495cb8940f4456ca88a83876fa23b588296cd62 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | isBlurEffectEnabled | 检查是否启用模糊效果 | public isBlurEffectEnabled(): boolean {
try {
return UserThemeConfigManager.getInstance().blurEnabled;
} catch {
return true;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isBlurEffectEnabled 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 boole... | public isBlurEffectEnabled(): boolean {
try {
return UserThemeConfigManager.getInstance().blurEnabled;
} catch {
return true;
}
} | https://github.com/DaLongZhuaZi/manxia | 8646aa9d92f3d8eee48b0b8545d58274fc9bb7d4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current Int32Array using range [begin, this.length).
@param { int } begin - start index to be taken into slice
@returns { Int32Array } - a new Int32Array with elements of current Int32Array[begin, this.length)
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public slice(begin: int): Int32Array {
return this.sliceFromTo(begin, this.lengthInt)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public slice(begin: int): Int32Array {
return this.sliceFromTo(begin, this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | 79abcdc26d76d3e72be77ac667f36ec85854a302 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/services/BinaryFileHandler.ets | arkts | compareBinaryMetadata | 对比两个二进制文件的元数据 | static compareBinaryMetadata(
pathA: string,
metadataA: FileMetadata,
pathB: string,
metadataB: FileMetadata
): BinaryDiffEntry {
const isIdentical =
metadataA.size === metadataB.size &&
metadataA.modifiedTime === metadataB.modifiedTime;
return {
path: pathA,
side: '... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left compareBinaryMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pathA AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | static compareBinaryMetadata(
pathA: string,
metadataA: FileMetadata,
pathB: string,
metadataB: FileMetadata
): BinaryDiffEntry {
const isIdentical =
metadataA.size === metadataB.size &&
metadataA.modifiedTime === metadataB.modifiedTime;
return {
path: pathA,
side: '... | https://github.com/XJTUWYD/ArkDiff | 4def059b6b5dc044ea5cd42ed571c7e15c86aeea | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/MangaDataLoader.ets | arkts | shouldLoadFromNetwork | 判断是否需要从网络加载 | private shouldLoadFromNetwork(
manga: Manga,
cachedChapters: Chapter[],
forceRefresh: boolean
): boolean {
// 强制刷新
if (forceRefresh) {
logger.debug(TAG, '用户手动刷新,需要从网络加载');
return true;
}
// 本地漫画不需要网络加载
if (!isOnlineManga(manga)) {
logger.debug(TAG, '本地漫画,不需要网络加... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldLoadFromNetwork AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private shouldLoadFromNetwork(
manga: Manga,
cachedChapters: Chapter[],
forceRefresh: boolean
): boolean {
// 强制刷新
if (forceRefresh) {
logger.debug(TAG, '用户手动刷新,需要从网络加载');
return true;
}
// 本地漫画不需要网络加载
if (!isOnlineManga(manga)) {
logger.debug(TAG, '本地漫画,不需要网络加... | https://github.com/DaLongZhuaZi/manxia | 23e550c5fa07627eab881100502d2d68dfecdb22 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/HistoryViewModel.ets | arkts | clearAllHistory | 清空所有历史 | clearAllHistory() {
if (this.allList.length === 0) return;
const typeStr = this.isNovelMode() ? $r('app.string.novel') : $r('app.string.illust');
toastUtil.showAlertDialog({
title: $r('app.string.clear_browse_history'),
message: `确定要清空所有${typeStr}浏览历史吗?此操作不可恢复。`,
alignment: DialogAlignme... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearAllHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | clearAllHistory() {
if (this.allList.length === 0) return;
const typeStr = this.isNovelMode() ? $r('app.string.novel') : $r('app.string.illust');
toastUtil.showAlertDialog({
title: $r('app.string.clear_browse_history'),
message: `确定要清空所有${typeStr}浏览历史吗?此操作不可恢复。`,
alignment: DialogAlignme... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/HistoryViewModel.ets#L179-L194 | 120baa61b69f5603c1e17180b49dfa24e3ca2ab9 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/utils/DAOHelper.ets | arkts | convertToReadModel | 转换为ReadModel | static convertToReadModel(resultSet: relationalStore.ResultSet): ReadModel {
const model = new ReadModel();
model.modelId = DAOHelper.getNumberValue(resultSet, 'model_id');
model.modelType = DAOHelper.getStringValue(resultSet, 'model_type');
model.aggregateId = DAOHelper.getNumberValue(resultSet, 'agg... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToReadModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_e... | static convertToReadModel(resultSet: relationalStore.ResultSet): ReadModel {
const model = new ReadModel();
model.modelId = DAOHelper.getNumberValue(resultSet, 'model_id');
model.modelType = DAOHelper.getStringValue(resultSet, 'model_type');
model.aggregateId = DAOHelper.getNumberValue(resultSet, 'agg... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7cf37b47d149ce613ae75d95264b2356c29a85f0 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | getFloorPlan | 获取楼层平面图
@buildingId 建筑ID
@floor 楼层号 | public getFloorPlan(buildingId: string, floor: number): FloorPlan | null {
const key = `${buildingId}_${floor}`;
return this.floorPlans.get(key) ?? null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFloorPlan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buildingId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | public getFloorPlan(buildingId: string, floor: number): FloorPlan | null {
const key = `${buildingId}_${floor}`;
return this.floorPlans.get(key) ?? null;
} | https://github.com/LJ666-ui/harmony-health-care | 3912901c0ee253916eeb4750af77f5fd3863e5d8 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/MyWrapper.ets | arkts | getGroup | 得到分组sql | getGroup(): string {
if (this.groupSql == '') {
return ''
} else {
let sql = this.groupSql
if (this.havingSql != '') {
sql += ` ${this.havingSql}`
}
return sql
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | getGroup(): string {
if (this.groupSql == '') {
return ''
} else {
let sql = this.groupSql
if (this.havingSql != '') {
sql += ` ${this.havingSql}`
}
return sql
}
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/MyWrapper.ets#L59-L69 | c923b7c1e8b3e6d9b4ca28bba314a7da2888d6bf | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | timeString | Returns string representation | private timeString(): String {
if (!this.isDateValid()) {
throw new Error("Invalid Date");
}
let sb = new StringBuilder();
let h = this.getHours();
if (h < 10) {
sb.append("0");
}
sb.append(h);
sb.append(":");
let m = t... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left timeString 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 A... | private timeString(): String {
if (!this.isDateValid()) {
throw new Error("Invalid Date");
}
let sb = new StringBuilder();
let h = this.getHours();
if (h < 10) {
sb.append("0");
}
sb.append(h);
sb.append(":");
let m = t... | https://gitcode.com/iop123123/arkts-static-skills | 27017658d54836577995c6317b98a1e0f2b77ab6 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | getTimeSinceLastUpdate | Get time since last update in milliseconds | getTimeSinceLastUpdate(): number {
if (this.lastUpdateTime === 0) {
return 0;
}
return Date.now() - this.lastUpdateTime;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTimeSinceLastUpdate 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... | getTimeSinceLastUpdate(): number {
if (this.lastUpdateTime === 0) {
return 0;
}
return Date.now() - this.lastUpdateTime;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 7786474e259d3e83131762dd2284fbbd65b0945d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | getSha256WithRsaAlgorithm | SHA-256 with RSA 签名算法 OID | private static getSha256WithRsaAlgorithm(): Uint8Array {
// AlgorithmIdentifier for sha256WithRSAEncryption (1.2.840.113549.1.1.11)
const oid = new Uint8Array([
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B
]);
const nullParam = new Uint8Array([0x05, 0x00]);
return CryptoU... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getSha256WithRsaAlgorithm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express... | private static getSha256WithRsaAlgorithm(): Uint8Array {
// AlgorithmIdentifier for sha256WithRSAEncryption (1.2.840.113549.1.1.11)
const oid = new Uint8Array([
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B
]);
const nullParam = new Uint8Array([0x05, 0x00]);
return CryptoU... | https://github.com/AlkaidLab/moonlight-harmony | f74f2d8dd08e5d62b9dd3b575519e1c5bf4a92cf | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets | arkts | getPendingEventInstances | 获取所有未完成的实例 | async getPendingEventInstances(): Promise<EventInstance[]> {
const rdbStore = await this.initDatabase();
const instances: EventInstance[] = [];
try {
const predicates = new relationalStore.RdbPredicates('event_instances');
predicates.equalTo('completed', 0);
predicates.orderByAsc('insta... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPendingEventInstances 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... | async getPendingEventInstances(): Promise<EventInstance[]> {
const rdbStore = await this.initDatabase();
const instances: EventInstance[] = [];
try {
const predicates = new relationalStore.RdbPredicates('event_instances');
predicates.equalTo('completed', 0);
predicates.orderByAsc('insta... | https://gitcode.com/openharmony/codelabs | e40923bfcb7ec58eed0fa9709987e7574aceb53a | gitcode |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/StringUtils.ets | arkts | containsIgnoreCase | 忽略大小写判断 haystack 是否包含 needle | static containsIgnoreCase(haystack: string, needle: string): boolean {
if (needle.length === 0) {
return true;
}
if (haystack.length === 0) {
return false;
}
return haystack.toLowerCase().indexOf(needle.toLowerCase()) >= 0;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left containsIgnoreCase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left haystack AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | static containsIgnoreCase(haystack: string, needle: string): boolean {
if (needle.length === 0) {
return true;
}
if (haystack.length === 0) {
return false;
}
return haystack.toLowerCase().indexOf(needle.toLowerCase()) >= 0;
} | https://github.com/DaLongZhuaZi/NGF | caf3b3cbf77767e929a4c1d07fc3b6b25cd8d61c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | getWebViewUA | 获取WebView UA | getWebViewUA(): string {
return 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWebViewUA AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement... | getWebViewUA(): string {
return 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36';
} | https://github.com/DaLongZhuaZi/manxia | 8b77b608bbf5900cff7e212e4eee591e996bc2f3 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RdpConnectionManager.ets | arkts | forceCleanup | 强制清理连接(用于卡死情况)
注意:这会强制重置状态,即使后台线程还在运行
可能会有少量资源泄漏,但能让用户继续使用应用 | forceCleanup(): boolean {
try {
if (qemuModule.rdpForceCleanup) {
qemuModule.rdpForceCleanup()
return true
}
} catch (e) {
console.error('[RdpConnectionManager] forceCleanup error:', e)
}
return false
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left forceCleanup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem... | forceCleanup(): boolean {
try {
if (qemuModule.rdpForceCleanup) {
qemuModule.rdpForceCleanup()
return true
}
} catch (e) {
console.error('[RdpConnectionManager] forceCleanup error:', e)
}
return false
} | https://github.com/AetheriumSimulator/qemu-hmos | 27645fcced62aab9b7cc83de8225aee273a70e81 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartCategory.ets | arkts | createHabitFromBill | 创建用户习惯记录 | static createHabitFromBill(
bill: Bill,
userId: number
): UserCategoryHabit {
const now = new Date().toISOString();
// 创建金额范围(上下浮动20%)
const amountMin = bill.amount * 0.8;
const amountMax = bill.amount * 1.2;
return new UserCategoryHabit(
0, // habitId会由数据库生成
userId,
b... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createHabitFromBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bill AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static createHabitFromBill(
bill: Bill,
userId: number
): UserCategoryHabit {
const now = new Date().toISOString();
// 创建金额范围(上下浮动20%)
const amountMin = bill.amount * 0.8;
const amountMax = bill.amount * 1.2;
return new UserCategoryHabit(
0, // habitId会由数据库生成
userId,
b... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e55884319ed965f61be3c455e8293394265d17a6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Float64 with all elements.
@returns a new Float64Array with elements of current Float64Array | public slice(): Float64Array {
return new Float64Array(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public slice(): Float64Array {
return new Float64Array(this)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ac14bb8551aeadbef28463dcec4f1cdbfbac2242 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | includes | Determines whether BigInt64Array includes a certain element, returning true or false as appropriate
@param { long } searchElement - The element to search for. The search starts at index 0.
@returns { boolean } - true if searchElement is in BigInt64Array, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageMo... | public includes(searchElement: long): boolean {
return this.includes(searchElement, 0)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#ident... | public includes(searchElement: long): boolean {
return this.includes(searchElement, 0)
} | https://gitcode.com/iop123123/arkts-static-skills | ec18efeba3376495579dee1449869e8b838861e7 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | name | Sets the name of the error.
@param { string } val - New name for the Error
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | set name(val: string) {
this.name_ = val
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left name AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier... | set name(val: string) {
this.name_ = val
} | https://gitcode.com/iop123123/arkts-static-skills | 46ce3d20e2cf7d61195f1e1ba4dfdb9b09905468 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | openMangaReaderWithAnimation | 打开漫画阅读器(带翻开动画)
@param manga 漫画对象
@param componentId 封面组件ID(用于获取位置) | private async openMangaReaderWithAnimation(manga: Manga, componentId: string): Promise<void> {
logger.info(TAG, `打开漫画阅读器(带翻开动画): ${manga.title}`);
try {
if (this.isRemoteProviderManga(manga)) {
const target = await this.determineResumeTarget(manga);
const remoteParams = await this.build... | 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 openMangaReaderWithAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Rig... | private async openMangaReaderWithAnimation(manga: Manga, componentId: string): Promise<void> {
logger.info(TAG, `打开漫画阅读器(带翻开动画): ${manga.title}`);
try {
if (this.isRemoteProviderManga(manga)) {
const target = await this.determineResumeTarget(manga);
const remoteParams = await this.build... | https://github.com/DaLongZhuaZi/manxia | ab8eaef37bdc69bdc300bb9db43a4aa8b01f46f1 | github |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnCalendarPage.ets | arkts | build | 构建日历展示页面 | build() {
AppNavDestination({
title: "日历",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "日历",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | https://github.com/codelably/tuniao-ui | c277bebaed17d2aa4da9692dd134a3cd496ca3b4 | github |
arkui-x/samples | CodeLab/Cases/feature/groupavatar/src/main/ets/utils/ImageCombination.ets | arkts | divideGroupBySize | 根据群组数量判断排列方式
当群成员人数大于4人,则成员头像为整体区域的1/3,按照九宫格排列
当群成员人数小于等于5人,则成员头像为整体区域的1/2,按照四宫格排列
@param images
@param rowSize
@returns | function divideGroupBySize(personData: (ResourceStr | image.PixelMap)[], rowSize: number): GroupAvatarModel[][] {
const imageCount: number = personData.length;
const imageGroup: GroupAvatarModel[][] = [];
let imageWidth: number = 0;
let imageHeight: number = 0;
let rowCount: number = 0;
let firstRowCount: n... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left divideGroupBySize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left personData AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | function divideGroupBySize(personData: (ResourceStr | image.PixelMap)[], rowSize: number): GroupAvatarModel[][] {
const imageCount: number = personData.length;
const imageGroup: GroupAvatarModel[][] = [];
let imageWidth: number = 0;
let imageHeight: number = 0;
let rowCount: number = 0;
let firstRowCount: n... | https://gitcode.com/arkui-x/samples | e95b48a909432668852b5a3c25b52bdccadaeb24 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | write | 写入文件内容
优先写入本地缓存,完成后异步推送到远端
@param path 文件路径
@param content 文件内容
@throws 如果读取失败则抛出异常 | public async write(path: string, content: ArrayBuffer): Promise<void> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.write(path, content);
}
const cachePath: string = CacheConstants.getCacheFilePath(path);
const onlyUseCache: boolean = CacheConstants.ge... | 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 write AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right... | public async write(path: string, content: ArrayBuffer): Promise<void> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.write(path, content);
}
const cachePath: string = CacheConstants.getCacheFilePath(path);
const onlyUseCache: boolean = CacheConstants.ge... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L84-L111 | 0c31cfb3ab323e910f93a9caed72bc4cbb57460b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets | arkts | updateCanvasSize | 更新Canvas尺寸 | public updateCanvasSize(width: number, height: number): void {
this.canvasWidth = width;
this.canvasHeight = height;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateCanvasSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public updateCanvasSize(width: number, height: number): void {
this.canvasWidth = width;
this.canvasHeight = height;
} | https://github.com/DaLongZhuaZi/manxia | c802a74bfb48cf9f681aea9b93f2633862c91884 | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/FolderUtil.ets | arkts | isFolderMoveIn | Is the folder can be moved into notes
@param folderDataUuid - Folder uuid
@return boolean - can be moved into notes return true. else return false | isFolderMoveIn(folderData: FolderData): boolean {
if (folderData === undefined || folderData === null) {
LogUtil.info(TAG, "isFolderMoveIn folderData undefined")
}
if (folderData.uuid! === undefined || folderData.uuid! === null) {
LogUtil.info(TAG, "isFolderMoveIn folderData uuid undefined")
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isFolderMoveIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left folderData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FolderData AST#identifier#Right AST... | isFolderMoveIn(folderData: FolderData): boolean {
if (folderData === undefined || folderData === null) {
LogUtil.info(TAG, "isFolderMoveIn folderData undefined")
}
if (folderData.uuid! === undefined || folderData.uuid! === null) {
LogUtil.info(TAG, "isFolderMoveIn folderData uuid undefined")
... | https://gitee.com/openharmony/applications_notes.git | 9e4301abfd82decf4a843a2589ab4e6a2061b30d | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | setCdata | Sets the CDATA section for the XML content.
@param {string} data - The string data to be wrapped in a Cdata section.
@throws {BusinessError} Throws an error if the `text` parameter is an empty string. | public setCdata(text: string): void {
let stringBuilder = this.prepareBufferForNewItem(text);
text = text.replaceAll(']]>', ']]]]><![CDATA[>');
stringBuilder.append(`<![CDATA[${text}]]>`);
this.type = XmlDynamicType.OTHERS;
this.writeToBuffer(stringBu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCdata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | public setCdata(text: string): void {
let stringBuilder = this.prepareBufferForNewItem(text);
text = text.replaceAll(']]>', ']]]]><![CDATA[>');
stringBuilder.append(`<![CDATA[${text}]]>`);
this.type = XmlDynamicType.OTHERS;
this.writeToBuffer(stringBu... | https://gitcode.com/iop123123/arkts-static-skills | d12339939e45168a6e56ae2785491bbf519f534c | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.