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 |
|---|---|---|---|---|---|---|---|---|---|---|
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/SubWindowManager.ets | arkts | applyFullViewGeometry | FullView geometry: cover the entire screen, immersive (extends behind
status bar + navigation indicator). iOS analogue:
window.frame = currentScreenFrame; backgroundColor = .black. | private applyFullViewGeometry(subWin: window.Window): void {
try {
const dpy = display.getDefaultDisplaySync();
subWin.moveWindowTo(0, 0).catch((e: Object): void => {
Logger.warn('SubWindowManager.applyFullViewGeometry: moveWindowTo failed', e);
});
subWin.resize(dpy.width, dpy.hei... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyFullViewGeometry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left subWin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#membe... | private applyFullViewGeometry(subWin: window.Window): void {
try {
const dpy = display.getDefaultDisplaySync();
subWin.moveWindowTo(0, 0).catch((e: Object): void => {
Logger.warn('SubWindowManager.applyFullViewGeometry: moveWindowTo failed', e);
});
subWin.resize(dpy.width, dpy.hei... | https://github.com/Tencent-RTC/TUIKit_Harmony | 7fef65a315015be0f2c1c6bb8669395e8415156f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | calculateDistanceToPath | 计算到路径的距离 | private calculateDistanceToPath(currentPosition: Position3D): number {
if (!this.navigationState.currentPath) return Infinity;
const waypoints = this.navigationState.currentPath.waypoints;
let minDistance = Infinity;
// 计算到每个途经点的距离
for (const waypoint of waypoints) {
const distance = this.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateDistanceToPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPosition AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier... | private calculateDistanceToPath(currentPosition: Position3D): number {
if (!this.navigationState.currentPath) return Infinity;
const waypoints = this.navigationState.currentPath.waypoints;
let minDistance = Infinity;
// 计算到每个途经点的距离
for (const waypoint of waypoints) {
const distance = this.... | https://github.com/LJ666-ui/harmony-health-care | 8dfac1df865576b2f67419edf2b7b72c3d084879 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | validateEmail | 验证邮箱格式 | private static validateEmail(email: string): boolean {
// 更严格的邮箱验证
const emailRegex: RegExp = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
const maxLength = 254;
return email.length > 0 && email.length <= maxLength && emailRegex.test(email);
} | 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 validateEmail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left email AST#identifier#Right AST#:#Left ... | private static validateEmail(email: string): boolean {
// 更严格的邮箱验证
const emailRegex: RegExp = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
const maxLength = 254;
return email.length > 0 && email.length <= maxLength && emailRegex.test(email);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6a97333a661ba58d3f35c231f68dd32aa6ecb310 | github |
pangpang20/antennaPodHM | entry/src/main/ets/pages/PlayerPage.ets | arkts | shareToWeChatFriend | 分享到微信好友 | shareToWeChatFriend(): void {
if (!this.currentEpisode) {
return;
}
// HarmonyOS暂不支持直接调用微信SDK,需要通过系统分享或复制链接
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('复制链接', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'分享到微信',... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shareToWeChatFriend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statemen... | shareToWeChatFriend(): void {
if (!this.currentEpisode) {
return;
}
// HarmonyOS暂不支持直接调用微信SDK,需要通过系统分享或复制链接
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('复制链接', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'分享到微信',... | https://github.com/pangpang20/antennaPodHM | f2a6f253d81cec87a0ac19000c571bd913f2445f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | fitScreen | Resets all zooming and dragging and makes the chart fit exactly it's
bounds. Output Matrix is available for those who wish to cache the object. | public fitScreen(outputMatrix?: Matrix): Matrix {
let save: Matrix = (outputMatrix == null || outputMatrix == undefined) ? new Matrix() : outputMatrix;
this.mMinScaleX = 1;
this.mMinScaleY = 1;
save.set(this.mMatrixTouch);
let vals: number[] = save.getValues();
// reset all translations an... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fitScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left outputMatrix AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ident... | public fitScreen(outputMatrix?: Matrix): Matrix {
let save: Matrix = (outputMatrix == null || outputMatrix == undefined) ? new Matrix() : outputMatrix;
this.mMinScaleX = 1;
this.mMinScaleY = 1;
save.set(this.mMatrixTouch);
let vals: number[] = save.getValues();
// reset all translations an... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | b1c4e96a6b727402648de43ce41fdd2dd48b6fa5 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | insert | 插入训练记录 | static async insert(record: SmartCategoryTraining): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
record.createdAt = now;
record.updatedAt = now;
const values: relationalStore.ValuesBucket = {
user_id: record.userI... | 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 insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Ri... | static async insert(record: SmartCategoryTraining): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
record.createdAt = now;
record.updatedAt = now;
const values: relationalStore.ValuesBucket = {
user_id: record.userI... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 86ba709aeba5e1101389105e3b9e4b745d3c9c93 | github |
openharmony/applications_app_samples | code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets | arkts | createRouter | 通过名称注册router | public static createRouter(routerName: string, router: NavPathStack): void{
RouterModule.routerMap.set(routerName, router);
} | 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 createRouter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routerName AST#identifier#Right AST#ERROR#Left AST#:#Left... | public static createRouter(routerName: string, router: NavPathStack): void{
RouterModule.routerMap.set(routerName, router);
} | https://github.com/openharmony/applications_app_samples | 2027487c7d2ae584e08fc1d64cb5e5904552799b | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/files_manager/download_manager.ets | arkts | scan_play_list | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
内部函数 //
//////////
列表扫描保存 // | private scan_play_list() {
// 初始化列表 //
log(`files_manager: 扫描列表`)
this.play_list = new Map<string, string[]>()
// 扫描 //
for (const i of fs.listFileSync(song_path, { recursion: true, filter: { suffix: ['.m3u'] } })) {
const tmp_path = song_path + '/' + i
// 文件检查 //
try {fs.rea... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scan_play_list 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#{#Le... | private scan_play_list() {
// 初始化列表 //
log(`files_manager: 扫描列表`)
this.play_list = new Map<string, string[]>()
// 扫描 //
for (const i of fs.listFileSync(song_path, { recursion: true, filter: { suffix: ['.m3u'] } })) {
const tmp_path = song_path + '/' + i
// 文件检查 //
try {fs.rea... | https://github.com/Nekofox-POT/LinMusic | 0eb8de1bbb6ece37813b1b61a4d141a39fa49898 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | dateToUtcTime | 日期转换为 UTCTime 格式 (YYMMDDHHMMSSZ) | private static dateToUtcTime(date: Date): string {
const year = date.getUTCFullYear() % 100;
const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');
const day = date.getUTCDate().toString().padStart(2, '0');
const hours = date.getUTCHours().toString().padStart(2, '0');
const minutes = ... | 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 dateToUtcTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left :... | private static dateToUtcTime(date: Date): string {
const year = date.getUTCFullYear() % 100;
const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');
const day = date.getUTCDate().toString().padStart(2, '0');
const hours = date.getUTCHours().toString().padStart(2, '0');
const minutes = ... | https://github.com/AlkaidLab/moonlight-harmony | 83e85f556cd1f99a0734011c853c4acc97ea394a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | pageTransition | 页面过渡动画:从 SplashPage 进入时淡入 | pageTransition() {
// MainMenuPage 从透明淡入,视觉上等同于 SplashPage 淡出
PageTransitionEnter({ duration: 350, curve: Curve.EaseOut })
.opacity(0) // 从透明开始淡入
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | pageTransition() {
// MainMenuPage 从透明淡入,视觉上等同于 SplashPage 淡出
PageTransitionEnter({ duration: 350, curve: Curve.EaseOut })
.opacity(0) // 从透明开始淡入
} | https://github.com/DaLongZhuaZi/manxia | 6d8382415d56b28ba67e14be17532a26bc434397 | github |
123wensi/rnoh | tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNAbility.ets | arkts | createLogger | region RNAbility custom methods that can be safely overridden. | protected createLogger(): RNOHLogger {
return new StandardRNOHLogger((err) => {
this.rnInstancesCoordinator?.getRNOHCoreContext().reportRNOHError(err)
});
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left createLogger 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 ... | protected createLogger(): RNOHLogger {
return new StandardRNOHLogger((err) => {
this.rnInstancesCoordinator?.getRNOHCoreContext().reportRNOHError(err)
});
} | https://github.com/123wensi/rnoh | 9062e79683b3e26404bddc253400e37fa4505836 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | getCachedImageData | 获取缓存的图片数据 | getCachedImageData(): ArrayBuffer | null {
return this.cachedImageData;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCachedImageData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | getCachedImageData(): ArrayBuffer | null {
return this.cachedImageData;
} | https://github.com/AlkaidLab/moonlight-harmony | 48d8a3af4340fa8c36586afbba3c54f97c47e7b9 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/utils/ThemeColors.ets | arkts | colors | 获取当前主题颜色 Tokens(缓存,避免每次 getter 访问都重新分配对象) | get colors(): ThemeColorMap {
if (this._cached !== null) return this._cached;
this._cached = this._isMonokai ? getMonokaiColors()
: this._darkMode ? getDarkColors() : getLightColors();
return this._cached;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left colors 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 ThemeColorMap AST#identi... | get colors(): ThemeColorMap {
if (this._cached !== null) return this._cached;
this._cached = this._isMonokai ? getMonokaiColors()
: this._darkMode ? getDarkColors() : getLightColors();
return this._cached;
} | https://github.com/XJTUWYD/ArkDiff | a2ace02c4fdafddb57f30828e2b7b7a1d56ba7dd | github |
SMAT-Lab/PhantomRendering | example/entry/src/main/ets/common/DeviceUtils.ets | arkts | getAdaptiveMargin | 获取适配后的间距 | static getAdaptiveMargin(baseMargin: number): number {
return DeviceUtils.getAdaptiveSize(baseMargin, 'width')
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAdaptiveMargin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseMargin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | static getAdaptiveMargin(baseMargin: number): number {
return DeviceUtils.getAdaptiveSize(baseMargin, 'width')
} | https://github.com/SMAT-Lab/PhantomRendering | 74d675716cbf48894635141a28d11ebee3101117 | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/util/PlayerDataUtil.ets | arkts | getCurrentTrackUi | Builds a lightweight PlayerTrackUi for the currently selected queue item, if any. | public static getCurrentTrackUi(appState: MusicAppState): PlayerTrackUi | undefined {
const song = PlayerDataUtil.getCurrentSongItem(appState);
if (song === undefined) {
return undefined;
}
return PlayerDataUtil.songItemToTrackUi(song);
} | 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 getCurrentTrackUi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appState AST#identifier#Right AST#:#L... | public static getCurrentTrackUi(appState: MusicAppState): PlayerTrackUi | undefined {
const song = PlayerDataUtil.getCurrentSongItem(appState);
if (song === undefined) {
return undefined;
}
return PlayerDataUtil.songItemToTrackUi(song);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 0eb57f72636deeb4ad1e76b9dc9d5a1c5f728ff5 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getAppNet | 获取App绑定的网络信息
@returns | static getAppNet(): Promise<connection.NetHandle> {
return connection.getAppNet();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAppNet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_s... | static getAppNet(): Promise<connection.NetHandle> {
return connection.getAppNet();
} | https://github.com/tdcare/tdwebrtc | 6b0e112b819f60665b06c10ca93f07885d47d167 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/pages/ControlPage.ets | arkts | startAutoHideTimer | 启动自动隐藏定时器 | startAutoHideTimer() {
this.clearAutoHideTimer();
this.autoHideTimer = setTimeout(() => {
if (!this.showControlPanel && this.containerWidth > 0) {
// 贴边隐藏:只露出一半
const hiddenX = this.fabDockedLeft
? -this.FAB_SIZE / 2 // 左侧藏起来
: this.containerWidth - this.FAB... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAutoHideTimer 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... | startAutoHideTimer() {
this.clearAutoHideTimer();
this.autoHideTimer = setTimeout(() => {
if (!this.showControlPanel && this.containerWidth > 0) {
// 贴边隐藏:只露出一半
const hiddenX = this.fabDockedLeft
? -this.FAB_SIZE / 2 // 左侧藏起来
: this.containerWidth - this.FAB... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | c5ac8b055134aba24972e104f73e47fb64f7f1c4 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | sort | Sorts the elements of the list using a comparator function.
@param comparator The function to compare elements. | public sort(comparator: ListComparatorFn<T>): void {
if (this.length == 0) {
return;
} else {
this.quickSort(0, this.length - 1, comparator);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comparator AST#identifier#Right AST#:#Left : AST#:#Right AS... | public sort(comparator: ListComparatorFn<T>): void {
if (this.length == 0) {
return;
} else {
this.quickSort(0, this.length - 1, comparator);
}
} | https://gitcode.com/iop123123/arkts-static-skills | a38992c52c03fb77b9c39558d63e8bad61b02c1c | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartCategoryService.ets | arkts | batchLearnFromHistory | 批量学习(从历史账单)
@param userId 用户ID
@param daysBack 回溯天数
@returns 学习结果 | static async batchLearnFromHistory(userId: number, daysBack: number = 30): Promise<LearningResult> {
try {
const result: LearningResult = {
rulesCreated: 0,
rulesUpdated: 0,
trainingRecordsCreated: 0,
scannedBills: 0,
totalKeywords: 0,
categoryCount: 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 batchLearnFromHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#... | static async batchLearnFromHistory(userId: number, daysBack: number = 30): Promise<LearningResult> {
try {
const result: LearningResult = {
rulesCreated: 0,
rulesUpdated: 0,
trainingRecordsCreated: 0,
scannedBills: 0,
totalKeywords: 0,
categoryCount: 0
}... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 2be5ecda81eb5ac68c6b161d7786ba564f8f913b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | isNaN | Checks if the underlying float is NaN (not a number)
@returns true if the underlying float is NaN | public isNaN(): boolean {
return Float.isNaN(this.value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left isNaN 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 isNaN(): boolean {
return Float.isNaN(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | a1f183a00bb6c396b90bd93adfc9ae94cd587d80 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | protocol | Gets the protocol portion of the URL.
@return {string} Returns the protocol portion of the URL. | get protocol(): string {
return this.cProtocol;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left protocol 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 AS... | get protocol(): string {
return this.cProtocol;
} | https://gitcode.com/iop123123/arkts-static-skills | 3ce81104ff3476a32073482684c6052e0293cb01 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/DataManagementPage.ets | arkts | aboutToDisappear | 页面隐藏时的回调 | aboutToDisappear(): void {
logger.lifecycle(TAG, 'aboutToDisappear');
this.lifecycle.destroy();
ThemeAwareHelper.cleanupThemeAware(TAG);
FontAwareHelper.cleanupFontAware(TAG);
// 移除设备变化监听器
if (this.deviceChangeListener) {
this.deviceManager.removeListener(this.deviceChangeListener);... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
logger.lifecycle(TAG, 'aboutToDisappear');
this.lifecycle.destroy();
ThemeAwareHelper.cleanupThemeAware(TAG);
FontAwareHelper.cleanupFontAware(TAG);
// 移除设备变化监听器
if (this.deviceChangeListener) {
this.deviceManager.removeListener(this.deviceChangeListener);... | https://github.com/DaLongZhuaZi/manxia | 6bc8951a1b872bd779915116bdf5e8d69a7ae8d1 | github |
RoooyHe/toona-ohos | toona/src/main/ets/utils/ToastUtils.ets | arkts | color | 带颜色的 Toast | static color(message: string, backgroundColor: ResourceColor, textColor?: ResourceColor): void {
WdkitToast.colorToast(message, backgroundColor, textColor);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | static color(message: string, backgroundColor: ResourceColor, textColor?: ResourceColor): void {
WdkitToast.colorToast(message, backgroundColor, textColor);
} | https://github.com/RoooyHe/toona-ohos | 55d88448cdf5130da71e678fe193e2282a38408b | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/IllustDetailViewModel.ets | arkts | downloadAllImages | 下载当前插画的所有图片 (处理单图和多图) | private async downloadAllImages() {
if (!this.detailData) return;
const context: common.Context = _PixState.Context;
// 利用已有的 imageList 获取总页数
const totalPages = this.imageList.length;
if (totalPages === 0) return;
for (let i = 0; i < totalPages; i++) {
const originalUrl = this.getOrigin... | 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 downloadAllImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async downloadAllImages() {
if (!this.detailData) return;
const context: common.Context = _PixState.Context;
// 利用已有的 imageList 获取总页数
const totalPages = this.imageList.length;
if (totalPages === 0) return;
for (let i = 0; i < totalPages; i++) {
const originalUrl = this.getOrigin... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/IllustDetailViewModel.ets#L285-L300 | 0b62cc51da3069e8c1d588d08d1360aa0aa3f6a6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getComicByExternalId | 根据外部图源ID查询本地通用表中的漫画记录 | public async getComicByExternalId(externalId: string): Promise<DatabaseRecord | null> {
try {
const sql = 'SELECT * FROM comic_info WHERE externalId = ?';
const result = await this.databaseManager.querySql(sql, [externalId]);
if (result && result.length > 0) {
return result[0] as Databas... | 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 getComicByExternalId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left externalId AST#identifier#Right AST#ERROR#Left AST... | public async getComicByExternalId(externalId: string): Promise<DatabaseRecord | null> {
try {
const sql = 'SELECT * FROM comic_info WHERE externalId = ?';
const result = await this.databaseManager.querySql(sql, [externalId]);
if (result && result.length > 0) {
return result[0] as Databas... | https://github.com/DaLongZhuaZi/manxia | ca3cf72234e021af825638a2989d25dc4514d3f0 | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | mapSamplingRate | 映射采样率到系统枚举值
@param sr - 采样率(Hz)
@returns 对应的 AudioSamplingRate 枚举值
@remarks
支持的采样率:8000, 11025, 12000, 16000, 22050, 24000,
32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000
@private | private mapSamplingRate(sr: number): audio.AudioSamplingRate {
switch (sr) {
case 8000: return audio.AudioSamplingRate.SAMPLE_RATE_8000;
case 11025: return audio.AudioSamplingRate.SAMPLE_RATE_11025;
case 12000: return audio.AudioSamplingRate.SAMPLE_RATE_12000;
case 16000: return audio.Audi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapSamplingRate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private mapSamplingRate(sr: number): audio.AudioSamplingRate {
switch (sr) {
case 8000: return audio.AudioSamplingRate.SAMPLE_RATE_8000;
case 11025: return audio.AudioSamplingRate.SAMPLE_RATE_11025;
case 12000: return audio.AudioSamplingRate.SAMPLE_RATE_12000;
case 16000: return audio.Audi... | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L131-L149 | e9e0fce5e9f5cba5aad8716e8c754e2ac6a81282 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getLibrarySelectionToolbarBorderColor | 多选工具栏边框颜色 | private getLibrarySelectionToolbarBorderColor(): ResourceColor {
return this.themeState.currentTheme === ThemeType.DARK
? 'rgba(255, 255, 255, 0.14)'
: 'rgba(255, 255, 255, 0.72)';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLibrarySelectionToolbarBorderColor 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 A... | private getLibrarySelectionToolbarBorderColor(): ResourceColor {
return this.themeState.currentTheme === ThemeType.DARK
? 'rgba(255, 255, 255, 0.14)'
: 'rgba(255, 255, 255, 0.72)';
} | https://github.com/DaLongZhuaZi/manxia | 3a144409a81827ac6e06b715cee3b4c9934e545a | github |
CLMC2025/Vignette | entry/src/main/ets/utils/WordDetailCache.ets | arkts | invalidate | 使缓存失效
@param wordId 单词ID | invalidate(wordId: number): void {
const index = this.keys.indexOf(wordId);
if (index >= 0) {
this.keys.splice(index, 1);
this.values.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left invalidate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AS... | invalidate(wordId: number): void {
const index = this.keys.indexOf(wordId);
if (index >= 0) {
this.keys.splice(index, 1);
this.values.splice(index, 1);
}
} | https://github.com/CLMC2025/Vignette | 4885a9a82f5a7280c2510c3ee69faa629c1583ab | github |
daugf2527/harmonyos-libretro-emulator | deprecated/legacy/archive/entry/src/main/ets/pages/Game2048Native.ets | arkts | fallbackFoldDetection | 降级方案: 根据屏幕宽度判断折叠状态 | fallbackFoldDetection() {
try {
const defaultDisplay = display.getDefaultDisplaySync();
const widthPx = defaultDisplay.width;
const densityDPI = defaultDisplay.densityDPI || 480; // 默认 DPI
const widthVp = widthPx / densityDPI * 160;
if (widthVp < 400) {
this.currentMo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fallbackFoldDetection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl... | fallbackFoldDetection() {
try {
const defaultDisplay = display.getDefaultDisplaySync();
const widthPx = defaultDisplay.width;
const densityDPI = defaultDisplay.densityDPI || 480; // 默认 DPI
const widthVp = widthPx / densityDPI * 160;
if (widthVp < 400) {
this.currentMo... | https://github.com/daugf2527/harmonyos-libretro-emulator | 025ab3bcfd894b141328caf9881455ee1aa0abb1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringSingleAsync | 获取单个规则的字符串结果(异步版本) | private async getStringSingleAsync(ruleStr: string): Promise<string> {
const chainedParts = this.splitJsonFirstRuleChain(ruleStr);
if (chainedParts.length > 1) {
return await this.getStringFromJsonFirstRuleChainAsync(chainedParts);
}
// 检查是否是组合规则:主规则@js:JS代码
const jsPostfixMatch = ruleStr.m... | 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 getStringSingleAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleStr AST#identifier#Right AST#ERROR#Left AST... | private async getStringSingleAsync(ruleStr: string): Promise<string> {
const chainedParts = this.splitJsonFirstRuleChain(ruleStr);
if (chainedParts.length > 1) {
return await this.getStringFromJsonFirstRuleChainAsync(chainedParts);
}
// 检查是否是组合规则:主规则@js:JS代码
const jsPostfixMatch = ruleStr.m... | https://github.com/DaLongZhuaZi/manxia | 4a1db2d5ac61985b0a71729402b3b0ac435fa814 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new FormatError instance with provided message and error specific information
@param { String } [message] - Error text
@param { ErrorOptions } [options] - Error options
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(message?: String, options?: ErrorOptions) {
super("FormatError", message, options)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super("FormatError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | a1209e7d54d52c9fea6d61e25247f12e48c01896 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | getProperty | 获取属性值
@param propertyName 属性名
@returns 属性值,如果不存在返回 null | getProperty(propertyName: string): EntityPropertyValue | null {
for (let i = 0; i < this.properties.length; i++) {
if (this.properties[i].propertyName === propertyName) {
return this.properties[i]
}
}
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | getProperty(propertyName: string): EntityPropertyValue | null {
for (let i = 0; i < this.properties.length; i++) {
if (this.properties[i].propertyName === propertyName) {
return this.properties[i]
}
}
return null
} | https://github.com/offlinecat-dev/OCNetORM | b81cf91f9ade088cc6dd1d4cf6604471b4d46271 | github |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onDestroy | 6. Ability 销毁 | onDestroy(): void {
// 应用退出
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy 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#Le... | onDestroy(): void {
// 应用退出
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
} | https://github.com/OnceWeWere/Weather_HarmonyOS | ed533596dee00001dd2e698da10f458155916ebf | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/Log.ets | arkts | setLogLevel | Set log level.
@param level Indecated the log level. | public static setLogLevel(level: HiLog.LogLevel) {
Log._logLevel = level;
} | 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 setLogLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST... | public static setLogLevel(level: HiLog.LogLevel) {
Log._logLevel = level;
} | https://gitee.com/openharmony-sig/flutter_engine.git | 3142063e1c01d8cb2d3e0f6aba904baae8472297 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11CompatibilityTester.ets | arkts | getCpuArch | 获取 CPU 架构信息
由于 HarmonyOS API 没有直接的 cpuAbi 属性,通过其他方式推断 | private getCpuArch(): string {
// HarmonyOS 设备大多是 ARM64
// 可以通过 osFullName 或设备型号来推断
const osFullName = deviceInfo.osFullName || '';
const productModel = deviceInfo.productModel || '';
// 华为设备基本都是 ARM64
if (osFullName.toLowerCase().includes('harmonyos') ||
productModel.toLowerCase(... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCpuArch 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#s... | private getCpuArch(): string {
// HarmonyOS 设备大多是 ARM64
// 可以通过 osFullName 或设备型号来推断
const osFullName = deviceInfo.osFullName || '';
const productModel = deviceInfo.productModel || '';
// 华为设备基本都是 ARM64
if (osFullName.toLowerCase().includes('harmonyos') ||
productModel.toLowerCase(... | https://github.com/AetheriumSimulator/qemu-hmos | 4f0a89f5b2979fb96c94a0eabb48ea66a962a6aa | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/features/mydemo/src/main/ets/Video/components/Content.ets | arkts | onCommentButtonClick | 评论按钮点击事件
@param _event | onCommentButtonClick(_event: ClickEvent) {
this.navDialogPageInfos.pushPathByName('CommentList', null)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCommentButtonClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left _event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ClickEvent AST#ide... | onCommentButtonClick(_event: ClickEvent) {
this.navDialogPageInfos.pushPathByName('CommentList', null)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 862c55dca52a48ab5833367f6aab5904954f7284 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/services/ExternalFileOpener.ets | arkts | copyFilePathToClipboard | ==================== 工具方法 ====================
复制文件路径到系统剪贴板 | static copyFilePathToClipboard(filePath: string): boolean {
try {
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, filePath);
pasteboard.getSystemPasteboard().setData(data);
return true;
} catch (_e) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left copyFilePathToClipboard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A... | static copyFilePathToClipboard(filePath: string): boolean {
try {
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, filePath);
pasteboard.getSystemPasteboard().setData(data);
return true;
} catch (_e) {
return false;
}
} | https://github.com/XJTUWYD/ArkDiff | 3f587f5fe5d879950408844518b4735730ec3200 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/background/ReminderTaskDemo.ets | arkts | publishReminder | 发布一个闹钟提醒(到了指定的时间后会弹出一个通知) | publishReminder() {
let date = new Date()
date.setMinutes(date.getMinutes() + 1)
// 构造一个 ReminderRequestAlarm 类型的闹钟提醒
let reminderRequestAlarm: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, // 提醒类型为闹钟类型
hour: date.getHou... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left publishReminder 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... | publishReminder() {
let date = new Date()
date.setMinutes(date.getMinutes() + 1)
// 构造一个 ReminderRequestAlarm 类型的闹钟提醒
let reminderRequestAlarm: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, // 提醒类型为闹钟类型
hour: date.getHou... | https://github.com/webabcd/HarmonyDemo | 468fd0d1de506aed695a6fc3351d34d124a67d43 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/TaskConfig.ets | arkts | setHardwareDecoder | 默认不重试 | public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder {
this.useHardwareDecoder = useHardwareDecoder;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHardwareDecoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left useHardwareDecoder AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left bo... | public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder {
this.useHardwareDecoder = useHardwareDecoder;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools | a974c920ff1dca3709ee185f0a1bd8e6f69c70b2 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/EventSourcingDAO.ets | arkts | get | 获取读模型 | static async get(modelType: string, userId: number): Promise<ReadModel | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(ReadModel.tableName);
predicates.equalTo('model_typ... | 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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left modelType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | static async get(modelType: string, userId: number): Promise<ReadModel | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(ReadModel.tableName);
predicates.equalTo('model_typ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 353f827da8688184c12d1c2944c0f4037e5c438c | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | isOddRotation | Confirm whether it is an odd rotation.
@param angle
@returns true means is odd, false means is not odd. | static isOddRotation(angle: number): boolean {
if (angle == -CropAngle.ONE_QUARTER_CIRCLE_ANGLE || angle == -CropAngle.THREE_QUARTER_CIRCLE_ANGLE) {
return true;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isOddRotation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | static isOddRotation(angle: number): boolean {
if (angle == -CropAngle.ONE_QUARTER_CIRCLE_ANGLE || angle == -CropAngle.THREE_QUARTER_CIRCLE_ANGLE) {
return true;
}
return false;
} | https://gitee.com/openharmony/codelabs.git | 9c9b377ed9c3fa930a8770c1df20bcc8e6b69be9 | gitee |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | playCorrect | 播放答对音效 | static playCorrect(): void {
AudioManager.getInstance().playSound(SoundType.ANSWER_CORRECT);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left playCorrect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression... | static playCorrect(): void {
AudioManager.getInstance().playSound(SoundType.ANSWER_CORRECT);
} | https://github.com/the-wwyang/kids-learning-app | 51e70af44a12b16281c9c7c2d142ed56d1758d4a | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/utils/ChecksumHelper.ets | arkts | generateChecksum | 生成 SHA-256 校验和
@param data 要计算校验和的数据
@returns 十六进制格式的校验和字符串 | static async generateChecksum(data: string): Promise<string> {
try {
ChecksumHelper.logInfo(`开始生成校验和,数据长度: ${data.length} 字节`);
// 创建 SHA-256 消息摘要
const md = cryptoFramework.createMd('SHA256');
// 将字符串转换为字节数组
const dataBytes = ChecksumHelper.stringToUint8Array(data);
// 更新数据... | 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 generateChecksum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : ... | static async generateChecksum(data: string): Promise<string> {
try {
ChecksumHelper.logInfo(`开始生成校验和,数据长度: ${data.length} 字节`);
// 创建 SHA-256 消息摘要
const md = cryptoFramework.createMd('SHA256');
// 将字符串转换为字节数组
const dataBytes = ChecksumHelper.stringToUint8Array(data);
// 更新数据... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a11e8faa27fd50260c4b4d67774dd225fbb6f020 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getDescription | Returns the Description object of the chart that is responsible for holding all information related
to the description text that is displayed in the bottom right corner of the chart (by default).
@return | public getDescription(): Description | null {
return this.mDescription;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDescription 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#Left ... | public getDescription(): Description | null {
return this.mDescription;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 89c0a41650a0e0e67b4bbf1910dc04694705bc0c | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current Float32Array using range [begin, this.length).
@param { int } begin - start index to be taken into slice
@returns { Float32Array } - a new Float32Array with elements of current Float32Array[begin, this.length)
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public slice(begin: int): Float32Array {
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): Float32Array {
return this.sliceFromTo(begin, this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | e885b0ded6964eafc40e914016753946ded841be | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableStringArray.ets | arkts | pushBack | Pushes a value to the end of the array
@param { UndefinableString } e - Value to push
@syscap SystemCapability.Utils.Lang | public pushBack(e: UndefinableString): void {
if (this.curSize == this.data.length) {
let newData : FixedArray<UndefinableString> = new FixedArray<UndefinableString>(UndefinableStringArray.getNewCapacity(this.data.length))
for (let i = 0; i < this.curSize; ++i) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pushBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Undefinabl... | public pushBack(e: UndefinableString): void {
if (this.curSize == this.data.length) {
let newData : FixedArray<UndefinableString> = new FixedArray<UndefinableString>(UndefinableStringArray.getNewCapacity(this.data.length))
for (let i = 0; i < this.curSize; ++i) {
... | https://gitcode.com/iop123123/arkts-static-skills | f407bc3f42c9f13d8f7f19ee698d02436d32aa6a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | detectContentType | 通用:通过逐表查询检测内容类型
[修复] HarmonyOS RDB 的 UNION ALL 查询不保留列别名,改为逐表 COUNT 查询
@returns 'comic' | 'online' | 'ebook' | 'novel' | null | private async detectContentType(contentId: string): Promise<string | null> {
try {
// 按优先级顺序检查各表
const tables: [string, string][] = [
['comic_info', 'comic'],
['online_comic_info', 'online'],
['ebook_info', 'ebook'],
['novel_book', 'novel']
];
for (const ent... | 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 detectContentType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#... | private async detectContentType(contentId: string): Promise<string | null> {
try {
// 按优先级顺序检查各表
const tables: [string, string][] = [
['comic_info', 'comic'],
['online_comic_info', 'online'],
['ebook_info', 'ebook'],
['novel_book', 'novel']
];
for (const ent... | https://github.com/DaLongZhuaZi/manxia | e42809973e8f505c6f392e205994f1ff12f2de62 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messageinput/components/AudioRecorderView.ets | arkts | aboutToAppear | 60 seconds | aboutToAppear() {
this.startWaveformAnimation();
this.startRecordingTimeCheck();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.startWaveformAnimation();
this.startRecordingTimeCheck();
} | https://github.com/Tencent-RTC/TUIKit_Harmony | ca87671175546e991f9a95c95b72b310b82a754e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/SwitchProController.ets | arkts | applyStickCalibration | 应用摇杆校准 | private applyStickCalibration(value: number, stick: number, axis: number): number {
const center = this.stickCalibration[stick][axis][1];
if (value < 0) {
value += 0x1000;
}
value -= center;
if (value < this.stickExtends[stick][axis][0]) {
this.stickExtends[stick][axis][... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyStickCalibration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private applyStickCalibration(value: number, stick: number, axis: number): number {
const center = this.stickCalibration[stick][axis][1];
if (value < 0) {
value += 0x1000;
}
value -= center;
if (value < this.stickExtends[stick][axis][0]) {
this.stickExtends[stick][axis][... | https://github.com/AlkaidLab/moonlight-harmony | ff2025c7c4444104b78a774d1f877bca02812c12 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets | arkts | stopPreload | 停止预加载(离开详情页时调用) | public stopPreload(): void {
logger.info(TAG, '停止预加载,清除所有任务');
this.clearAllTasks();
this.currentMangaId = '';
this.currentSourceId = 0;
this.currentSourceName = '';
this.currentSourceHeaders = {} as RequestHeaders;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopPreload 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 stopPreload(): void {
logger.info(TAG, '停止预加载,清除所有任务');
this.clearAllTasks();
this.currentMangaId = '';
this.currentSourceId = 0;
this.currentSourceName = '';
this.currentSourceHeaders = {} as RequestHeaders;
} | https://github.com/DaLongZhuaZi/manxia | d045e31493e7201640243aed673406fa0e5948ec | github |
FadingLight9291117/vscode-arkts | examples/sample.ets | arkts | aboutToAppear | 生命周期 - 组件即将出现 | aboutToAppear() {
console.log('Index page is about to appear')
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
console.log('Index page is about to appear')
} | https://github.com/FadingLight9291117/vscode-arkts | 80949bf28b382cd1589af112e7544bd226e8ede5 | github |
erosTeam/NextE | feature/user/src/main/ets/viewmodel/FavoritesViewModel.ets | arkts | configure | Fix this VM to one favcat + order WITHOUT loading (retained per-favcat page; loadData runs on
first activation). The favcat is stable for the page's lifetime, so selectFavcat is not used. | configure(favcat: string, orderByPosted: boolean): void {
this.favcat = favcat
this.favOrder = orderByPosted ? EhConstants.FAV_ORDER_POSTED : EhConstants.FAV_ORDER_FAV
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left configure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left favcat AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | configure(favcat: string, orderByPosted: boolean): void {
this.favcat = favcat
this.favOrder = orderByPosted ? EhConstants.FAV_ORDER_POSTED : EhConstants.FAV_ORDER_FAV
} | https://github.com/erosTeam/NextE | a9c7e265bd9cfdbcafffe067736b147cb29f69f5 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ToolRegistry.ets | arkts | getAllToolIds | 获取所有已注册工具的 ID | getAllToolIds(): string[] {
const ids: string[] = []
this.tools.forEach((tool) => {
ids.push(tool.id)
})
return ids
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllToolIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig... | getAllToolIds(): string[] {
const ids: string[] = []
this.tools.forEach((tool) => {
ids.push(tool.id)
})
return ids
} | https://github.com/LongLiveY96/chatcube | 208c83a7af8afb9aa5c206635e5ce5d627c8abb3 | github |
openharmony-tpc/ImageKnife | library/src/main/ets/utils/FileUtils.ets | arkts | readFileSync | 读取路径path的文件
@param path 文件绝对路径 | readFileSync(path: string): ArrayBuffer | undefined {
try {
if (fs.accessSync(path)) {
let length = fs.statSync(path).size
let buf = new ArrayBuffer(length);
let fd = fs.openSync(path, fs.OpenMode.READ_ONLY).fd;
fs.readSync(fd, buf)
fs.closeSync(fd)
return buf... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left readFileSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | readFileSync(path: string): ArrayBuffer | undefined {
try {
if (fs.accessSync(path)) {
let length = fs.statSync(path).size
let buf = new ArrayBuffer(length);
let fd = fs.openSync(path, fs.OpenMode.READ_ONLY).fd;
fs.readSync(fd, buf)
fs.closeSync(fd)
return buf... | https://gitee.com/openharmony-tpc/ImageKnife.git | cc2f8457178acf354cf6c5abf29291f426c5e92e | gitee |
openharmony/applications_call | entry/src/main/ets/model/NotificationManager.ets | arkts | sendNotification | Send notification
@param { Object } text - text info
@param { Object } callData - call data
@param { FUnction } $t - i18n format | async sendNotification(callData) {
const {callState, accountNumber, contactName, callId} = callData;
const actionBtnKeys = this.getMapObj(callState) || [];
const {START_ABILITY, SEND_COMMON_EVENT} = wantAgent.OperationType;
const wantAgentObj = await this.getWantAgent(callData, START_ABILITY);
let... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sendNotification AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callData AST#identifier#Right AST#)#Left ) AST#)... | async sendNotification(callData) {
const {callState, accountNumber, contactName, callId} = callData;
const actionBtnKeys = this.getMapObj(callState) || [];
const {START_ABILITY, SEND_COMMON_EVENT} = wantAgent.OperationType;
const wantAgentObj = await this.getWantAgent(callData, START_ABILITY);
let... | https://gitee.com/openharmony/applications_call.git | 3a906770cb45d2aa68a0959962f6c60a4626264e | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | search | Searches for matches in the string and returns the starting index of the match.
@param { String } str The string to search.
@returns { int } If a match is found, returns its starting index; otherwise returns -1.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public search(str: String): int {
let previousLastIndex: int = this.lastIndex
this.lastIndex = 0
let result = this.exec(str)
this.lastIndex = previousLastIndex
if (result == null) {
return -1
}
return result.index
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST... | public search(str: String): int {
let previousLastIndex: int = this.lastIndex
this.lastIndex = 0
let result = this.exec(str)
this.lastIndex = previousLastIndex
if (result == null) {
return -1
}
return result.index
} | https://gitcode.com/iop123123/arkts-static-skills | ec739d52825b20985935bb85c5727f9b3aa0e1af | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneConfig.ets | arkts | setOpusBitrate | 设置 Opus 比特率
@param bitrateKbps 比特率 (Kbps) | static setOpusBitrate(bitrateKbps: number): void {
MicrophoneConfig.opusBitrateKbps = bitrateKbps;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setOpusBitrate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left bitrateKbps AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | static setOpusBitrate(bitrateKbps: number): void {
MicrophoneConfig.opusBitrateKbps = bitrateKbps;
} | https://github.com/AlkaidLab/moonlight-harmony | a1a15d9fe6da5978eb9e33f8822ddb8bf2b21ce0 | github |
1ilI/WebViewJavascriptBridge_harmony | webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets | arkts | isEmpty | 判断数据是否为空
@param value
@returns | public static isEmpty(value: Object | null | undefined): boolean {
if (value === null || value === undefined || value === '') {
return true
}
if (Array.isArray(value)) {
return value.length === 0
}
if (value instanceof Map || value instanceof Set) {
return value.size === 0
}
... | 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 isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#R... | public static isEmpty(value: Object | null | undefined): boolean {
if (value === null || value === undefined || value === '') {
return true
}
if (Array.isArray(value)) {
return value.length === 0
}
if (value instanceof Map || value instanceof Set) {
return value.size === 0
}
... | https://github.com/1ilI/WebViewJavascriptBridge_harmony | fcbac882a3f2320c00129bf0434cf65249d6c0b7 | github |
HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | entry/src/main/ets/utils/Logger.ets | arkts | error | Outputs error-level logs
@param format format Indicates the log format string
@param args args Indicates the log parameters | error(format: string, ...args: Object[]): void {
hilog.error(this.domain, this.prefix, format, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left error AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R... | error(format: string, ...args: Object[]): void {
hilog.error(this.domain, this.prefix, format, args);
} | https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | b0d32604669425cfb667065da13d308ec32a9541 | gitcode |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/components/TerminalEmulator.ets | arkts | write | 写入字符串到终端 | write(data: string): void {
const wasAtBottom: boolean = this.followBottom || this.viewOffset >= this.screenTop;
for (let i = 0; i < data.length; i++) {
this.processChar(data.charCodeAt(i));
}
this.cursorVisible = true;
if (wasAtBottom) {
if (this.screenTop !== this.viewOffset) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left write AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Rig... | write(data: string): void {
const wasAtBottom: boolean = this.followBottom || this.viewOffset >= this.screenTop;
for (let i = 0; i < data.length; i++) {
this.processChar(data.charCodeAt(i));
}
this.cursorVisible = true;
if (wasAtBottom) {
if (this.screenTop !== this.viewOffset) {
... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | b02b62088a7a5cfccb32df27ee515af379b29fa7 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/OnboardingViewModel.ets | arkts | applyColorTheme | 配色切换:走 SettingsManager 触发全局 callback,主色调实时更新 | async applyColorTheme(theme: ColorTheme): Promise<void> {
this.selectedColorTheme = theme
try {
await getSettingsManager().setColorTheme(theme)
} catch (err) {
console.error('OnboardingViewModel', `Failed to apply color theme: ${JSON.stringify(err)}`)
}
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left applyColorTheme AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L... | async applyColorTheme(theme: ColorTheme): Promise<void> {
this.selectedColorTheme = theme
try {
await getSettingsManager().setColorTheme(theme)
} catch (err) {
console.error('OnboardingViewModel', `Failed to apply color theme: ${JSON.stringify(err)}`)
}
} | https://github.com/LongLiveY96/chatcube | 44b926094dc4342d9ff02dc221efe9b5397c6a32 | github |
harmonyos/codelabs | HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/FormInfoApi.ets | arkts | insertData | Insert formInfo.
@param {FormInfo} formInfo Insert form info
@param {Function} callback Return processing callback | public insertData(formInfo: FormInfo, callback: Function): void {
const valueBucket = generateBucket(formInfo);
RdbUtils.insert('formInfo', valueBucket).then(result => {
callback(result);
});
Logger.info('FormInfoTable', 'Insert formInfo finished.');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insertData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left F... | public insertData(formInfo: FormInfo, callback: Function): void {
const valueBucket = generateBucket(formInfo);
RdbUtils.insert('formInfo', valueBucket).then(result => {
callback(result);
});
Logger.info('FormInfoTable', 'Insert formInfo finished.');
} | https://gitee.com/harmonyos/codelabs.git | 43bd0a9116a274be7649e40c06d623dc45f457a0 | gitee |
openharmony-sig/knowledge_demo_shopping | FA/DistributedShoppingCart/entry/src/main/ets/MainAbility/pages/HomePage.ets | arkts | pageTransition | 转场动画使用系统提供的多种默认效果(平移、缩放、透明度等) | pageTransition() {
PageTransitionEnter({ duration: 1000 })
.slide(SlideEffect.Left)
PageTransitionExit({ duration: 1000 })
.slide(SlideEffect.Right)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | pageTransition() {
PageTransitionEnter({ duration: 1000 })
.slide(SlideEffect.Left)
PageTransitionExit({ duration: 1000 })
.slide(SlideEffect.Right)
} | https://gitee.com/openharmony-sig/knowledge_demo_shopping.git | cb7741be4ae24c3a2d3e42ad2581627dab4d1bbc | gitee |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/arkgraphic/resource.ets | arkts | createShaderPromise | [End create_material_promise]
[Start create_shader_promise] | function createShaderPromise(): Promise<Shader> {
return new Promise((resolve, reject) => {
// Ensure the scene is loaded before accessing sceneFactory
if (globalScene) {
let sceneFactory: SceneResourceFactory = globalScene.getResourceFactory();
// Create a SceneResourceParameters object and use ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createShaderPromise 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#generic... | function createShaderPromise(): Promise<Shader> {
return new Promise((resolve, reject) => {
// Ensure the scene is loaded before accessing sceneFactory
if (globalScene) {
let sceneFactory: SceneResourceFactory = globalScene.getResourceFactory();
// Create a SceneResourceParameters object and use ... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 4633a070b057a849cef6fb89badb5ce718b37788 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/RAGRetriever.ets | arkts | rank | 结果排序(已由向量数据库完成)
@param results 检索结果
@returns 排序后的结果 | rank(results: { docId: string; similarity: number }[]): { docId: string; similarity: number }[] {
return results.sort((a, b) => b.similarity - a.similarity);
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left rank AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#{#Left { AST#{#Right AST#pair_pattern#Left AST#property_identifier#Left docId ... | rank(results: { docId: string; similarity: number }[]): { docId: string; similarity: number }[] {
return results.sort((a, b) => b.similarity - a.similarity);
} | https://github.com/LJ666-ui/harmony-health-care | 6c0f00ac5229e3abc9e90b91f4cf79bf4a054bdc | github |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/KeyMappingSettings.ets | arkts | formatTargetName | 格式化 InputTarget 为显示名称 | function formatTargetName(target: InputTarget): string {
if (target.type === 'nds_key') {
const key = (target as NdsKeyInputTarget).key
const NDS_KEY_NAMES: Record<number, string> = {
0: 'A', 1: 'B', 2: 'Select', 3: 'Start',
4: I18n.t('dir_right'), 5: I18n.t('dir_left'), 6: I18n.t('dir_up'), 7: I1... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatTargetName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left target AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function formatTargetName(target: InputTarget): string {
if (target.type === 'nds_key') {
const key = (target as NdsKeyInputTarget).key
const NDS_KEY_NAMES: Record<number, string> = {
0: 'A', 1: 'B', 2: 'Select', 3: 'Start',
4: I18n.t('dir_right'), 5: I18n.t('dir_left'), 6: I18n.t('dir_up'), 7: I1... | https://github.com/richshaw2015/nds | e59958932eba0da3e263ced4e597c083c0f761de | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | setHdsTabEffects | 设置 HdsTab 特效配置 | public async setHdsTabEffects(hdsTabEffects: Partial<HdsTabEffectsConfig>): Promise<void> {
this.currentProfile.hdsTabEffects = mergeHdsTabEffects(this.currentProfile.hdsTabEffects, hdsTabEffects);
await this.saveCurrentProfile();
this.notifyChange();
} | 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 setHdsTabEffects AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left hdsTabEffects AST#id... | public async setHdsTabEffects(hdsTabEffects: Partial<HdsTabEffectsConfig>): Promise<void> {
this.currentProfile.hdsTabEffects = mergeHdsTabEffects(this.currentProfile.hdsTabEffects, hdsTabEffects);
await this.saveCurrentProfile();
this.notifyChange();
} | https://github.com/DaLongZhuaZi/manxia | 037d6e009012dedb0ea150cd346594794f8ae25a | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/FavoritesVM.ets | arkts | add | 收藏。本地立即写 + 乐观更新 FAVORITE_BOOKS;服务端尽力。 | static async add(book: Book): Promise<void> {
await FavoritesStore.add(book.id);
await FavoritesVM.syncIdsToStorage();
// 乐观更新:将整本 Book 对象即时加到展示列表头部
const current: Book[] | undefined = AppStorage.get<Book[]>(AppStorageKeys.FAVORITE_BOOKS);
const list: Book[] = current !== undefined ? current : [];... | 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 add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left book AST#identifier#Right AST#:#Left : AST#:#Right A... | static async add(book: Book): Promise<void> {
await FavoritesStore.add(book.id);
await FavoritesVM.syncIdsToStorage();
// 乐观更新:将整本 Book 对象即时加到展示列表头部
const current: Book[] | undefined = AppStorage.get<Book[]>(AppStorageKeys.FAVORITE_BOOKS);
const list: Book[] = current !== undefined ? current : [];... | https://github.com/LZZLHY/hlib | f0499d2c03db782153cd6b9ae5c30b618bf4b849 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | getLast | Retrieves the last element in the linked list.
@returns The last element of type `T`. | public getLast(): T {
this.checkEmptyContainer();
return this.tail!.element;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLast 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 T AST#identifi... | public getLast(): T {
this.checkEmptyContainer();
return this.tail!.element;
} | https://gitcode.com/iop123123/arkts-static-skills | 6a68e40edb88eb6cb5e24a82bc11c565ff9586ec | gitcode |
openharmony-sig/ohos_checksum | library/src/main/ets/sha1.ets | arkts | sha1_ft | Perform the appropriate triplet combination function for the current
iteration
返回对应F函数的值 | sha1_ft(t: number, b: number, c: number, d: number) {
if (t < 20)
return (b & c) | ((~b) & d);
if (t < 40)
return b ^ c ^ d;
if (t < 60)
return (b & c) | (b & d) | (c & d);
return b ^ c ^ d; // t<80
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sha1_ft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Le... | sha1_ft(t: number, b: number, c: number, d: number) {
if (t < 20)
return (b & c) | ((~b) & d);
if (t < 40)
return b ^ c ^ d;
if (t < 60)
return (b & c) | (b & d) | (c & d);
return b ^ c ^ d; // t<80
} | https://gitee.com/openharmony-sig/ohos_checksum.git | f8b0a5249ad046b291bf7db47d3488ad08648e77 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxLoadService.ets | arkts | asyncLoadDatabase | 异步线程加载数据库
@param loadParam 加载参数
@param callback 回调地址 | private static asyncLoadDatabase(loadParam: LoadDatabase, callback?: KdbxLoadServiceCallback): void {
KdbxLoadService.stopWorker();
// 创建 Worker
KdbxLoadService.databaseWorker = new worker.ThreadWorker('entry/ets/workers/DatabaseLoadWorker.ets');
try {
KdbxLoadService.databaseWorker.postMessage... | 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 asyncLoadDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loadParam AST#identifier#Right AST... | private static asyncLoadDatabase(loadParam: LoadDatabase, callback?: KdbxLoadServiceCallback): void {
KdbxLoadService.stopWorker();
// 创建 Worker
KdbxLoadService.databaseWorker = new worker.ThreadWorker('entry/ets/workers/DatabaseLoadWorker.ets');
try {
KdbxLoadService.databaseWorker.postMessage... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxLoadService.ets#L32-L87 | 87fc90c7f99e6cd81f70511557a77e694b803d09 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | getPixelForValues | Returns a recyclable MPPointD instance
Transforms the given chart values into pixels. This is the opposite
method to getValuesByTouchPoint(...).
@param x
@param y
@return | public getPixelForValues(x: number, y: number, axis: AxisDependency): MPPointD {
let transformer: Transformer | null = this.getTransformer(axis);
if (!transformer) {
transformer = new Transformer(new ViewPortHandler());
}
return transformer.getPixelForValues(x, y);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPixelForValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | public getPixelForValues(x: number, y: number, axis: AxisDependency): MPPointD {
let transformer: Transformer | null = this.getTransformer(axis);
if (!transformer) {
transformer = new Transformer(new ViewPortHandler());
}
return transformer.getPixelForValues(x, y);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | aeb57f2a95ddc72b77360ebd4bef1cb67c88a26e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/UUIDGenerator.ets | arkts | generateDbId | 生成数据库友好的ID
格式:prefix_timestamp_random | public generateDbId(prefix: string = 'id'): string {
const timestamp = Date.now();
const random = Math.random().toString(36).substring(2, 10);
return `${prefix}_${timestamp}_${random}`;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateDbId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expres... | public generateDbId(prefix: string = 'id'): string {
const timestamp = Date.now();
const random = Math.random().toString(36).substring(2, 10);
return `${prefix}_${timestamp}_${random}`;
} | https://github.com/DaLongZhuaZi/manxia | 60ccd1d7c326728c02ddd9362d2743951458432e | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | registerWithResult | Register a new user with detailed result. | static async registerWithResult(user: IUser): Promise<AuthResult> {
const result = new AuthResult();
try {
if (!UserManager.dataPreferences) {
Logger.error('UserManager', 'Preferences not initialized');
result.errorType = 'unknown';
result.message = '系统初始化失败';
return resu... | 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 registerWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left ... | static async registerWithResult(user: IUser): Promise<AuthResult> {
const result = new AuthResult();
try {
if (!UserManager.dataPreferences) {
Logger.error('UserManager', 'Preferences not initialized');
result.errorType = 'unknown';
result.message = '系统初始化失败';
return resu... | https://github.com/Harrisonls2004/WaterFlow | fe0cd6c190200ccedd12ab6e35c590a4558f4a62 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int32Array with respect to length.
@param { number } length - Number of elements
@throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / Int32Array.BYTES_PER_ELEMENT).toInt()) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLength = thi... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / Int32Array.BYTES_PER_ELEMENT).toInt()) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLength = thi... | https://gitcode.com/iop123123/arkts-static-skills | b476104291517fcc0af62f50ccb9d45b995c9f15 | gitcode |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/main/MainNavigator.ets | arkts | toCategory | 跳转到分类页
@returns {void} 无返回值 | static toCategory(): void {
navigateTo(MainRoutes.Category);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static toCategory(): void {
navigateTo(MainRoutes.Category);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 9fb3e02d01fc4ab12510893a3cafcab8d509c687 | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | analyzeIncrementalInLineRange | Incrementally re-analyze and return only highlight slice for the specified visible line range
@param range Change range of the patch
@param newText Patched text
@param visibleRange Visible line range
@returns Highlight slice for the specified line range | public analyzeIncrementalInLineRange(range: TextRange, newText: string, visibleRange: LineRange): DocumentHighlightSlice {
if (this.nativeHandle == 0) {
return new DocumentHighlightSlice();
}
let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeChangesInLineRange(
this.nativeHandle... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeIncrementalInLineRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left range AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i... | public analyzeIncrementalInLineRange(range: TextRange, newText: string, visibleRange: LineRange): DocumentHighlightSlice {
if (this.nativeHandle == 0) {
return new DocumentHighlightSlice();
}
let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeChangesInLineRange(
this.nativeHandle... | https://github.com/FinalScave/SweetLine | bd2409703ed7a77eb76fd9ad2110a01f4c094bc3 | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | updateRegion | 更新省市区
@param {string} province - 省
@param {string} city - 市
@param {string} district - 区
@returns {void} 无返回值 | updateRegion(province: string, city: string, district: string): void {
this.province = province;
this.city = city;
this.district = district;
this.updateRegionValue();
this.refreshRegionDisplay();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateRegion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left province AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#... | updateRegion(province: string, city: string, district: string): void {
this.province = province;
this.city = city;
this.district = district;
this.updateRegionValue();
this.refreshRegionDisplay();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 8fe5329beda3c68af367cb9789685925330629b5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getOnlineChapterPageCounts | [懒加载优化] 批量查询在线章节的页面数量
使用单条SQL查询所有章节的页数,避免逐个章节查询
@param comicId 漫画ID
@returns Map<章节ID, 页面数量> | public async getOnlineChapterPageCounts(comicId: string): Promise<Map<string, number>> {
try {
// 使用子查询获取所有属于该漫画的章节的页面数量
const sql = `
SELECT chapterId, COUNT(*) as pageCount
FROM online_page
WHERE chapterId IN (SELECT id FROM online_chapter WHERE comicId = ?)
GROUP B... | 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 getOnlineChapterPageCounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left ... | public async getOnlineChapterPageCounts(comicId: string): Promise<Map<string, number>> {
try {
// 使用子查询获取所有属于该漫画的章节的页面数量
const sql = `
SELECT chapterId, COUNT(*) as pageCount
FROM online_page
WHERE chapterId IN (SELECT id FROM online_chapter WHERE comicId = ?)
GROUP B... | https://github.com/DaLongZhuaZi/manxia | 17419354609566dee06e9c59f8c1159d881aefbb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new instance of Box with null value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.value = null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.value = null;
} | https://gitcode.com/iop123123/arkts-static-skills | 8983e966541dafb9c71efd40af2e006f705cf9eb | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/StringUtils.ets | arkts | getFirstLetter | 获取字符串的首字母(支持中文拼音)
1、如果是字母则转成 大小
2、如果是汉字则获取第一个字符的拼音首字母
3、其他 返回 # | public static getFirstLetter(str: string): string {
if (!str || str.length === 0) {
return '#';
}
const firstChar = str.charAt(0);
// 检查是否是字母
if (/[a-zA-Z]/.test(firstChar)) {
return firstChar.toUpperCase();
}
// 检查是否是中文,使用 pinyin4js 获取拼音首字母
if (ChineseHelper.isChinese(firs... | 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 getFirstLetter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AS... | public static getFirstLetter(str: string): string {
if (!str || str.length === 0) {
return '#';
}
const firstChar = str.charAt(0);
// 检查是否是字母
if (/[a-zA-Z]/.test(firstChar)) {
return firstChar.toUpperCase();
}
// 检查是否是中文,使用 pinyin4js 获取拼音首字母
if (ChineseHelper.isChinese(firs... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/StringUtils.ets#L55-L73 | ab835676ce803e8aab601789c6c82c77e3c55ffe | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | writeCrashLog | 写入崩溃日志文件 | private writeCrashLog(eventInfo: hiAppEvent.AppEventInfo): void {
if (!this.logDirPath) {
return;
}
try {
const timestamp = Date.now();
const dateStr = this.formatDate(new Date());
const fileName = `${LOG_PREFIX}${timestamp}${LOG_EXT}`;
const filePath = `${this.logDirPath}/$... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left writeCrashLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_exp... | private writeCrashLog(eventInfo: hiAppEvent.AppEventInfo): void {
if (!this.logDirPath) {
return;
}
try {
const timestamp = Date.now();
const dateStr = this.formatDate(new Date());
const fileName = `${LOG_PREFIX}${timestamp}${LOG_EXT}`;
const filePath = `${this.logDirPath}/$... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L234-L259 | 5bbe2e6e69de36c54e5e383154e923646505ac06 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | fixLeftTopInFixedMode | In fixed mode, fix left top conner.
@param offsetHypot
@param isEnlarge | private fixLeftTopInFixedMode(offsetHypot: number, isEnlarge: boolean) {
let crop = this.getCropRect();
let rate = this.ratio.getRate();
let rect = new RectF();
if (isEnlarge) {
let limit = this.limitRect;
let size = MathUtils.getMaxFixedRectSize(rate, crop.right - limit.left, crop.bottom ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fixLeftTopInFixedMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetHypot AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb... | private fixLeftTopInFixedMode(offsetHypot: number, isEnlarge: boolean) {
let crop = this.getCropRect();
let rate = this.ratio.getRate();
let rect = new RectF();
if (isEnlarge) {
let limit = this.limitRect;
let size = MathUtils.getMaxFixedRectSize(rate, crop.right - limit.left, crop.bottom ... | https://gitee.com/openharmony/codelabs.git | ac89fb3f1d4fb6618ba3bcf2a4841b3d100c4ead | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets | arkts | getRepeatIndexByRule | 根据规则获取索引 | getRepeatIndexByRule(ruleString: string): number {
if (!ruleString || ruleString.trim() === '') {
return 0; // 对应"一次性活动"
}
try {
const rule: RepeatRule = JSON.parse(ruleString);
const index = this.repeatOptions.findIndex(option => option.type === rule.type);
return index >= 0 ? in... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRepeatIndexByRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Lef... | getRepeatIndexByRule(ruleString: string): number {
if (!ruleString || ruleString.trim() === '') {
return 0; // 对应"一次性活动"
}
try {
const rule: RepeatRule = JSON.parse(ruleString);
const index = this.repeatOptions.findIndex(option => option.type === rule.type);
return index >= 0 ? in... | https://gitcode.com/openharmony/codelabs | 2048156b25d14ccfcc40476792cd1acb916867cf | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/view/OrderCommentPage.ets | arkts | build | 构建订单评论页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.order_comment"),
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: {
backgroundColor: $r("app.color.bg_white")
},
paddingValue: {
top: this.windowSafeAreaState.topInset,
l... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.order_comment"),
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: {
backgroundColor: $r("app.color.bg_white")
},
paddingValue: {
top: this.windowSafeAreaState.topInset,
l... | https://github.com/Joker-x-dev/CoolMallArkTS | aa62e2bae57242e56d7ba862c3eb0f863ca77bcc | github |
erosTeam/NextE | shared/src/main/ets/utils/BasicDataSource.ets | arkts | prependData | Prepend a page as real LazyForEach inserts, so List can preserve visible content position. | prependData(items: T[]): void {
for (let i: number = items.length - 1; i >= 0; i--) {
this.items.splice(0, 0, items[i])
this.listeners.forEach((l: DataChangeListener) => {
l.onDataAdd(0)
})
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left prependData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left items AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#[#Left [ AST#[#Right AST#]#Left ... | prependData(items: T[]): void {
for (let i: number = items.length - 1; i >= 0; i--) {
this.items.splice(0, 0, items[i])
this.listeners.forEach((l: DataChangeListener) => {
l.onDataAdd(0)
})
}
} | https://github.com/erosTeam/NextE | e0680b5ba67b2a7f5b7a609da31aad91448216dc | github |
offlinecat-dev/OCNetORM | src/main/ets/schema/SchemaBuilder.ets | arkts | generateCreateTableSql | 根据实体元数据生成 CREATE TABLE SQL 语句
@param metadata 实体元数据
@returns CREATE TABLE SQL 语句 | generateCreateTableSql(metadata: EntityMetadata): string {
const tableName = metadata.tableName
const columnDefinitions: Array<string> = []
// 遍历所有列,生成列定义
for (let i = 0; i < metadata.columns.length; i++) {
const column = metadata.columns[i]
const columnDef = this.generateColumnDefinition... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateCreateTableSql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metadata AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EntityMetadata AST#identifier... | generateCreateTableSql(metadata: EntityMetadata): string {
const tableName = metadata.tableName
const columnDefinitions: Array<string> = []
// 遍历所有列,生成列定义
for (let i = 0; i < metadata.columns.length; i++) {
const column = metadata.columns[i]
const columnDef = this.generateColumnDefinition... | https://github.com/offlinecat-dev/OCNetORM | 6ae04831e2aadb85e7a8d941aba15198c0e807ea | github |
XHXYT/Pixark | entry/src/main/ets/common/utils/CardUtil.ets | arkts | getPostPageImageId | 对于一张卡片镜像附着在另一张图片上的场景,弹出页面上的图片需要标记一个id。在这里统一设置id。 | public static getPostPageImageId(prePageClickedCardId: string | number | undefined): string | undefined {
if (!prePageClickedCardId) {
return undefined;
}
return 'Post_Page_Image' + prePageClickedCardId;
} | 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 getPostPageImageId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Le... | public static getPostPageImageId(prePageClickedCardId: string | number | undefined): string | undefined {
if (!prePageClickedCardId) {
return undefined;
}
return 'Post_Page_Image' + prePageClickedCardId;
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/CardUtil.ets#L18-L23 | 7d21871a88c67c4c34729859e7f08d87c2f1261c | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | openAlarm | Enabling/Disabling alarms.
@param id number
@return isOpen boolean | public openAlarm(id: number, isOpen: boolean) {
for (let i = 0; i < this.alarms.length; i++) {
if (this.alarms[i].id === id) {
this.alarms[i].isOpen = isOpen;
if (isOpen) {
this.reminderService.addReminder(this.alarms[i]);
} else {
this.reminderService.deleteRemin... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left openAlarm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | public openAlarm(id: number, isOpen: boolean) {
for (let i = 0; i < this.alarms.length; i++) {
if (this.alarms[i].id === id) {
this.alarms[i].isOpen = isOpen;
if (isOpen) {
this.reminderService.addReminder(this.alarms[i]);
} else {
this.reminderService.deleteRemin... | https://gitee.com/harmonyos/codelabs.git | 2474763c02451e31001f25941332c57103fae9f7 | gitee |
codelably/HCompass | core/di/src/main/ets/ServiceContainer.ets | arkts | getKeys | 获取所有已注册的服务键
@returns 服务键数组 | getKeys(): ServiceKey[] {
return Array.from(this.services.keys());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getKeys 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 ServiceKey AST#identifier#Right AST#[#Left [ AST#[#Rig... | getKeys(): ServiceKey[] {
return Array.from(this.services.keys());
} | https://github.com/codelably/HCompass | b881ee64141b18c4741234cc6a4558e0efc6af26 | github |
Octo-o-o-o/harmonyos-ai-workspace | tools/hooks/test-fixtures/BadDecorators.ets | arkts | build | V1 Link | build() {
Button('+1')
.onClick(() => { this.value++ });
} | 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() {
Button('+1')
.onClick(() => { this.value++ });
} | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | 24b736289a0c756cd536e37d8bedfb1f9a1117aa | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateShort | ═══════════════════════════════════════════════════════════════
快捷时长方
═══════════════════════════════════════════════════════════════
短振动 ~100ms,常用于按钮点击反馈 | static vibrateShort(): void {
VibratorManager.logExecution('vibrateShort');
VibratorManager.vibrateTime(100, VibrationUsage.TOUCH);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateShort 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#expressio... | static vibrateShort(): void {
VibratorManager.logExecution('vibrateShort');
VibratorManager.vibrateTime(100, VibrationUsage.TOUCH);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | deb4813021279e69258e846c464c87f20f40d924 | github |
imperson123/- | Harmonyos-Application/entry/src/main/ets/pages/TMAC.ets | arkts | run | 执行矩阵乘法 | public run(input: Float32Array): Float32Array {
if (input.length !== this.M * this.K) {
throw new Error(`Input shape mismatch: expected ${this.M*this.K} elements`);
}
const output = new Float32Array(this.M * this.N);
const ret = tmac_qgemm_lut(this.weight, input, output,... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left run AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public run(input: Float32Array): Float32Array {
if (input.length !== this.M * this.K) {
throw new Error(`Input shape mismatch: expected ${this.M*this.K} elements`);
}
const output = new Float32Array(this.M * this.N);
const ret = tmac_qgemm_lut(this.weight, input, output,... | https://github.com/imperson123/- | 8200fb0c15ba34c7a1d1e6573daebe360d490bca | github |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets | arkts | deleteData | 根据索引删除数据项 | deleteData(index: number): void {
this.originDataArray.splice(index, 1);
this.notifyDataDelete(index);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST... | deleteData(index: number): void {
this.originDataArray.splice(index, 1);
this.notifyDataDelete(index);
} | https://gitee.com/openharmony/arkui_ace_engine.git | 434e33450857c725c26579306452eaca02579b1d | gitee |
openeuler-mirror/arkui-linux | samples/woodfish/openHarnmony_woodfish/entry/src/main/ets/pages/Index.ets | arkts | animationStep | 单步动画执行函数 | animationStep(value: AnimateParam, event: () => void) {
return () => {
return new Promise((resolve) => {
let onFinish = value.onFinish
value.onFinish = () => {
if(onFinish) onFinish()
resolve(true)
}
animateTo(value, event)
})
}
} | AST#program#Left AST#ERROR#Left AST#identifier#Left animationStep AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AnimateParam AST#identifier#Right AST#,#Left , AST#,#Right AST#binary_expression#Left... | animationStep(value: AnimateParam, event: () => void) {
return () => {
return new Promise((resolve) => {
let onFinish = value.onFinish
value.onFinish = () => {
if(onFinish) onFinish()
resolve(true)
}
animateTo(value, event)
})
}
} | https://github.com/openeuler-mirror/arkui-linux | 6fa6022321c28d1ed6905d76e39c68315d205c9b | github |
openharmony-sig/flutter_packages | packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets | arkts | setFlashMode | 设置闪光灯模式。
进行设置之前,需要先检查:
设备是否支持闪光灯,可使用方法hasFlash。
设备是否支持指定的闪光灯模式,可使用方法isFlashModeSupported。 | setFlashMode(result: MethodResult, newMode: camera.FlashMode) {
if (!CameraUtils.hasFlash(this.getCurSession())) {
result.error("setFlashModeFailed", "The camera device does not have flash.", null);
return;
}
if (!CameraUtils.isFlashModeSupported(this.getCurSession(), newMode)) {
result... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setFlashMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodResult AST#identifie... | setFlashMode(result: MethodResult, newMode: camera.FlashMode) {
if (!CameraUtils.hasFlash(this.getCurSession())) {
result.error("setFlashModeFailed", "The camera device does not have flash.", null);
return;
}
if (!CameraUtils.isFlashModeSupported(this.getCurSession(), newMode)) {
result... | https://gitee.com/openharmony-sig/flutter_packages.git | 05c5b0cfefe6904fcaebff67d17d15b87fe02e44 | gitee |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _readProcessingInstruction | 读取处理指令
@see https://www.w3.org/TR/xml/ 2.6节 [15] Pi
@return 是否读取到了处理指令 | private _readProcessingInstruction(): boolean{
let _svgStringReader = this._svgStringReader!;
let mark = _svgStringReader.charIndex;
if (!_svgStringReader.readStringFast(XMLConstants.XML_START_PROCESSING_INSTRUCTION)) {
return false;
}
let name = this._readName();
if (name) {
if ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readProcessingInstruction 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#... | private _readProcessingInstruction(): boolean{
let _svgStringReader = this._svgStringReader!;
let mark = _svgStringReader.charIndex;
if (!_svgStringReader.readStringFast(XMLConstants.XML_START_PROCESSING_INSTRUCTION)) {
return false;
}
let name = this._readName();
if (name) {
if ... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | bf02fa82fd6fa1a0cb0cbab5d3307d5b346a168b | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | constructor | The constructors below are implemented via initobj instruction
Constructs an empty String | public constructor() {} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a74873989029a83ff517cc44e198050dca04d5b5 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets | arkts | $_invoke | Creates a new instance of a Boolean based on the specified value
@param { T } value The value that can be represented in Boolean.
@returns { boolean } A new Boolean instance representing the specified value.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke<T>(value: T): boolean {
return new Boolean(value).valueOf();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Righ... | static $_invoke<T>(value: T): boolean {
return new Boolean(value).valueOf();
} | https://gitcode.com/iop123123/arkts-static-skills | be2ba2d7602a95758c24f027d4c9f716fd89cdf4 | gitcode |
openharmony/codelabs | ETSUI/ChatAppDemo/entry/src/main/ets/utils/UserHandler.ets | arkts | queryUsersByPhones | 根据手机号列表批量查询用户信息
@param phoneNumbers 手机号数组,例如 ['138...','139...'] | async queryUsersByPhones(phoneNumbers: string[]): Promise<UserModel[]> {
const users: UserModel[] = [];
if (!this.store || phoneNumbers.length === 0) {
return users;
}
let predicates = new relationalStore.RdbPredicates('User');
// 使用 in 语句:WHERE phoneNumber IN ('138...', '139...')
predi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryUsersByPhones AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left phoneNumbers AST#identifier#Right AST#type_annotation#Left A... | async queryUsersByPhones(phoneNumbers: string[]): Promise<UserModel[]> {
const users: UserModel[] = [];
if (!this.store || phoneNumbers.length === 0) {
return users;
}
let predicates = new relationalStore.RdbPredicates('User');
// 使用 in 语句:WHERE phoneNumber IN ('138...', '139...')
predi... | https://gitcode.com/openharmony/codelabs | 915eeecbcd09df9f0e8a680973ebd90bbef57c3f | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.