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 |
|---|---|---|---|---|---|---|---|---|---|---|
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test54_original_index.ets | arkts | removeDuplicates | --- Two-pointer: remove duplicates in-place --- | function removeDuplicates(arr: number[]): number {
if (arr.length === 0) {
return 0;
}
let writeIdx: number = 1;
for (let readIdx = 1; readIdx < arr.length; readIdx++) {
if (arr[readIdx] !== arr[readIdx - 1]) {
arr[writeIdx] = arr[readIdx];
writeIdx++;
}
}
return writeIdx;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left removeDuplicates AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function removeDuplicates(arr: number[]): number {
if (arr.length === 0) {
return 0;
}
let writeIdx: number = 1;
for (let readIdx = 1; readIdx < arr.length; readIdx++) {
if (arr[readIdx] !== arr[readIdx - 1]) {
arr[writeIdx] = arr[readIdx];
writeIdx++;
}
}
return writeIdx;
} | https://github.com/miaochiahao/ark-ghidra | f6133863eadf6514b14a44195aafa3fe33b2976f | github |
openharmony/applications_app_samples | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets | arkts | watchCameraPermission | 监听相机权限变化 | watchCameraPermission() {
let interval = setInterval(() => {
this.hasCameraPermission = AppStorage.Get(QRCodeScanConst.HAS_CAMERA_PERMISSION)
if (this.hasCameraPermission) {
let qrCodeScanInterval = setInterval(() => {
if (this.qrCodeParseResult.length > 0 || this.isQRCodeScanStopped... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left watchCameraPermission 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... | watchCameraPermission() {
let interval = setInterval(() => {
this.hasCameraPermission = AppStorage.Get(QRCodeScanConst.HAS_CAMERA_PERMISSION)
if (this.hasCameraPermission) {
let qrCodeScanInterval = setInterval(() => {
if (this.qrCodeParseResult.length > 0 || this.isQRCodeScanStopped... | https://github.com/openharmony/applications_app_samples | d26c280ff5f030732d93c3d798cad9c4f0605c54 | github |
openharmony/applications_mms | entry/src/main/ets/service/SettingService.ets | arkts | updateSettingValue | Update related values
@param code Updated code.
@param actionData Updated Value
@param callback
@return | updateSettingValue(code, actionData, callback) {
switch (code) {
case common.route.MESSAGE_CODE_UPDATE_DELIVERY_REPORTS_VALUE:
// Delivery Report
mSettingModel.updateSwitchValue(common.string.KEY_OF_DELIVERY_REPORT_SWITCH,
actionData.intValue, callback... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateSettingValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left code AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left actionData AST#identifier#Right AST#,#Left , AST#,#Ri... | updateSettingValue(code, actionData, callback) {
switch (code) {
case common.route.MESSAGE_CODE_UPDATE_DELIVERY_REPORTS_VALUE:
// Delivery Report
mSettingModel.updateSwitchValue(common.string.KEY_OF_DELIVERY_REPORT_SWITCH,
actionData.intValue, callback... | https://gitee.com/openharmony/applications_mms.git | cc23ef88b562ebf921a21530cd53b58b01198969 | gitee |
openharmony/applications_app_samples | code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets | arkts | getReferenceLineBol | Persist the reference line, enter again to determine if the switch is turned on | getReferenceLineBol(bol: boolean) {
this.settingDataObj.referenceLineBol = bol;
this.referenceLineBol = bol;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getReferenceLineBol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bol AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier... | getReferenceLineBol(bol: boolean) {
this.settingDataObj.referenceLineBol = bol;
this.referenceLineBol = bol;
} | https://github.com/openharmony/applications_app_samples | 37a5099f4c6277305bce4a417e0ad0918a235099 | github |
HarmonyOS_Samples/BestPracticeSnippets | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | remove | Delete the cache corresponding to the key | public remove(key: string): void {
this.lruCache.remove(key);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST... | public remove(key: string): void {
this.lruCache.remove(key);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | a705d3117af5834475bf02ff1efef2f3300821c0 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/common/ErrorHandler.ets | arkts | clearErrorLog | 清空错误日志 | public static clearErrorLog(): void {
this.errorLog = [];
} | 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 clearErrorLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public static clearErrorLog(): void {
this.errorLog = [];
} | https://github.com/the-wwyang/kids-learning-app | 96320f7f118210e4ddb69c6118e06b53ee7f12bd | github |
tdcare/tdwebrtc | src/main/ets/CameraCapture.ets | arkts | initialize | 初始化摄像头
@param previewSurfaceId XComponent 的 surfaceId,用于本地预览显示 | public async initialize(previewSurfaceId?: string): Promise<boolean> {
try {
LogUtil.info(`[CameraCapture] 开始初始化, 预览SurfaceId=${previewSurfaceId ?? 'none'}`);
// ── 1. 获取 CameraManager ──
this.cameraManager = camera.getCameraManager(this.context);
// ── 2. 获取摄像头列表 ──
const cameras:... | 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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left previewSurfaceId AST#identifier#Right AST#ERROR#Left AST#?#L... | public async initialize(previewSurfaceId?: string): Promise<boolean> {
try {
LogUtil.info(`[CameraCapture] 开始初始化, 预览SurfaceId=${previewSurfaceId ?? 'none'}`);
// ── 1. 获取 CameraManager ──
this.cameraManager = camera.getCameraManager(this.context);
// ── 2. 获取摄像头列表 ──
const cameras:... | https://github.com/tdcare/tdwebrtc | 12037739dcc9bbbaa84a658d12a35327d717d6e7 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AccountDAO.ets | arkts | update | 更新账户信息
@param account Account 对象
@throws | static async update(account: Account) {
if (!account.validate()) {
throw new Error('[AccountDAO] 更新失败,数据验证不通过');
}
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
// 更新字段
const valueBucket: relationalStore.ValuesBucket = {
name: account.name,
... | 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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left : AST#:#R... | static async update(account: Account) {
if (!account.validate()) {
throw new Error('[AccountDAO] 更新失败,数据验证不通过');
}
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
// 更新字段
const valueBucket: relationalStore.ValuesBucket = {
name: account.name,
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | bcd2d6ad2f5edf47e422d88f6d55ba883e45a3eb | github |
wuba/omni-ui | omni_component/src/main/ets/components/calendar/OmniCalendar.ets | arkts | _updateDateOnNextClick | 更新日期用于下一页点击 | _updateDateOnNextClick(): Date {
if (this.displayMode == DisplayMode.month) {
return new Date(this.currentDate.getFullYear(), this.currentDate.getMonth() + 1, 1);
} else {
return new Date(this.currentDate.getTime() + 7 * 24 * 60 * 60 * 1000);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left _updateDateOnNextClick 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 Date AST#identifier#Right AST#ERROR#Rig... | _updateDateOnNextClick(): Date {
if (this.displayMode == DisplayMode.month) {
return new Date(this.currentDate.getFullYear(), this.currentDate.getMonth() + 1, 1);
} else {
return new Date(this.currentDate.getTime() + 7 * 24 * 60 * 60 * 1000);
}
} | https://github.com/wuba/omni-ui | 1f5364bc0bbddda99c8a0428e61bb2808bca4817 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/controller/AVPlayerController/AVPlayerController.ets | arkts | create | 待处理的最新帧请求时间 | async create() {
try {
if (!this.avPlayer) {
this.avPlayer = await media.createAVPlayer()
}
} catch (error) {
ToolsUtil.showToast('播放异常')
salmonLogger.addLog('avplayer',
'create avplayer error: ' + error.code + ':' + error.message, true)
}
return this.avPlayer
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left create AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right A... | async create() {
try {
if (!this.avPlayer) {
this.avPlayer = await media.createAVPlayer()
}
} catch (error) {
ToolsUtil.showToast('播放异常')
salmonLogger.addLog('avplayer',
'create avplayer error: ' + error.code + ':' + error.message, true)
}
return this.avPlayer
... | https://github.com/Yebingiscn/SweetVideo | 53a21513464bff490cc0b7a8c3cb6b7d8e869f28 | github |
openharmony/applications_call | entry/src/main/ets/model/CallManager.ets | arkts | update | update callData callBack
@param { Object } callData -Object | async update(callData) {
LogUtils.i(TAG, 'update calldata:')
if (this.callData != undefined && this.callData.callId === callData.callId) {
const { callState } = this.callData;
if (callState === 6 && this.callList.length === 1) {
globalThis.calluiAbilityContext?.terminateSelf().then((data) ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left update AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callData AST#identifier#Right AST#)#Left ) AST#)#Right AST... | async update(callData) {
LogUtils.i(TAG, 'update calldata:')
if (this.callData != undefined && this.callData.callId === callData.callId) {
const { callState } = this.callData;
if (callState === 6 && this.callList.length === 1) {
globalThis.calluiAbilityContext?.terminateSelf().then((data) ... | https://gitee.com/openharmony/applications_call.git | 5e535c594868f395e772abf65601dc3df69d0dfb | gitee |
yangyongzhen/hmmovie | entry/src/main/ets/utils/AVPlayerUtil.ets | arkts | setUrl | 设置资源路径
@param url | async setUrl(url: string) {
console.info('AVPlayer set url')
try {
this.avPlayer.url = url;
console.info(`AVPlayer set rul ${url} , duration ${this.avPlayer.state}`)
} catch (e) {
console.info(`AVPlayer set url error ` + e)
}
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setUrl AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async setUrl(url: string) {
console.info('AVPlayer set url')
try {
this.avPlayer.url = url;
console.info(`AVPlayer set rul ${url} , duration ${this.avPlayer.state}`)
} catch (e) {
console.info(`AVPlayer set url error ` + e)
}
} | https://github.com/yangyongzhen/hmmovie | 834ff0c6a7f3ba31d93dbe438e65674f998fb873 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toBinary | Return a string representing the value of this Decimal in base 2, round to `significantDigits`
significant digits using rounding mode `rounding`.
@param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
@param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
@returns { ... | public toBinary(significantDigits: double, rounding: Rounding): string {
return this.toStringBinary(2, significantDigits, rounding);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toBinary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left significantDigits AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left double AST... | public toBinary(significantDigits: double, rounding: Rounding): string {
return this.toStringBinary(2, significantDigits, rounding);
} | https://gitcode.com/iop123123/arkts-static-skills | 7edcdec1d70fe850ee6f622997d4e0bb77463f9d | gitcode |
openharmony/applications_launcher | feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets | arkts | updateOpenFolderData | 监听桌面元素变化时,更新打开的大文件的数据。
eg:应用角标更新时,大文件内的应用角标同步更新。 | updateOpenFolderData() {
const openFolderData = AppStorage.get('openFolderData') as FolderData;
if (CheckEmptyUtils.isEmptyArr(this.mAppListInfo)) {
Log.showError(TAG, 'mAppListInfo is empty');
return;
}
if (openFolderData?.folderId && this.mAppListInfo?.length) {
let temp = this.mAp... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateOpenFolderData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | updateOpenFolderData() {
const openFolderData = AppStorage.get('openFolderData') as FolderData;
if (CheckEmptyUtils.isEmptyArr(this.mAppListInfo)) {
Log.showError(TAG, 'mAppListInfo is empty');
return;
}
if (openFolderData?.folderId && this.mAppListInfo?.length) {
let temp = this.mAp... | https://gitee.com/openharmony/applications_launcher.git | 5c8f065dab998048538e0d5dc95951e7297d9203 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | saveOnlineMangaToDatabaseFast | 快速保存在线漫画到数据库(不预取页面信息)
用于首次加载时快速响应UI | private async saveOnlineMangaToDatabaseFast(manga: Manga, chapters: MangaChapter[], externalId: string): Promise<void> {
try {
// 获取作者信息
let authorStr = '';
if (manga.metadata && manga.metadata.authors && manga.metadata.authors.length > 0) {
authorStr = manga.metadata.authors[0];
}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveOnlineMangaToDatabaseFast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Ri... | private async saveOnlineMangaToDatabaseFast(manga: Manga, chapters: MangaChapter[], externalId: string): Promise<void> {
try {
// 获取作者信息
let authorStr = '';
if (manga.metadata && manga.metadata.authors && manga.metadata.authors.length > 0) {
authorStr = manga.metadata.authors[0];
}... | https://github.com/DaLongZhuaZi/manxia | 7feef03ea8ff410590ad73e70bc4b8629f72b10f | github |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets | arkts | onChangeIsModeBol | 暂停后点击停止 需要将暂停回复默认 | onChangeIsModeBol(): void {
this.isRecording = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onChangeIsModeBol 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_... | onChangeIsModeBol(): void {
this.isRecording = false;
} | https://gitee.com/openharmony/multimedia_camera_framework.git | c9dd39d8531614f47b9381c2a24edfcf89ed567b | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxFileManager.ets | arkts | switchStorage | 切换存储类型
@param storageType 新的存储类型
@throws 如果指定类型的存储未注册则抛出异常 | public switchStorage(storageType: StorageType): void {
this.storage = FileStorageFactory.getInstance().getStorage(storageType);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left switchStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left storageType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public switchStorage(storageType: StorageType): void {
this.storage = FileStorageFactory.getInstance().getStorage(storageType);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxFileManager.ets#L121-L123 | 45e51d9188efcd2110eb0f369356bb026434dc8c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/pages/PathPlannerTestPage.ets | arkts | selectCategory | ==================== 分类浏览方法 ==================== | selectCategory(category: DestinationCategory) {
this.selectedCategory = category;
this.categoryPOIs = this.planner.getDestinationsByCategory(category);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DestinationCategory AS... | selectCategory(category: DestinationCategory) {
this.selectedCategory = category;
this.categoryPOIs = this.planner.getDestinationsByCategory(category);
} | https://github.com/LJ666-ui/harmony-health-care | d016cc1a43b277fd81221c79550952447f61dd04 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadVibrationService.ets | arkts | stopAll | 停止所有震动(设备马达 + USB 控制器马达) | stopAll(): void {
// 清除 watchdog
if (this.rumbleWatchdogTimer !== -1) {
clearTimeout(this.rumbleWatchdogTimer);
this.rumbleWatchdogTimer = -1;
}
// 清除 stop 确认定时器
if (this.stopConfirmTimer !== -1) {
clearTimeout(this.stopConfirmTimer);
this.stopConfirmTimer = -1;
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | stopAll(): void {
// 清除 watchdog
if (this.rumbleWatchdogTimer !== -1) {
clearTimeout(this.rumbleWatchdogTimer);
this.rumbleWatchdogTimer = -1;
}
// 清除 stop 确认定时器
if (this.stopConfirmTimer !== -1) {
clearTimeout(this.stopConfirmTimer);
this.stopConfirmTimer = -1;
}
... | https://github.com/AlkaidLab/moonlight-harmony | 652145e45013c09431d96c81e22a0a9e53b2711d | github |
the-wwyang/kids-learning-app | src/main/ets/common/ErrorHandler.ets | arkts | getErrorLog | 获取错误日志 | public static getErrorLog(limit?: number): ErrorInfo[] {
if (limit) {
return this.errorLog.slice(-limit);
}
return [...this.errorLog];
} | 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 getErrorLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#?#Left ? AST... | public static getErrorLog(limit?: number): ErrorInfo[] {
if (limit) {
return this.errorLog.slice(-limit);
}
return [...this.errorLog];
} | https://github.com/the-wwyang/kids-learning-app | b2796dbb4772c4984f37ee77c6601e058b8b4261 | github |
HarmonyOS_Samples/BestPracticeSnippets | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | previewOutputCallBack | Listening for preview events | previewOutputCallBack(previewOutput: camera.PreviewOutput): void {
Logger.info(TAG, 'previewOutputCallBack is called');
try {
previewOutput.on('frameStart', (): void => {
Logger.debug(TAG, 'Preview frame started');
});
previewOutput.on('frameEnd', (): void => {
Logger.debug(T... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left previewOutputCallBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left previewOutput AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left camera AST#ide... | previewOutputCallBack(previewOutput: camera.PreviewOutput): void {
Logger.info(TAG, 'previewOutputCallBack is called');
try {
previewOutput.on('frameStart', (): void => {
Logger.debug(TAG, 'Preview frame started');
});
previewOutput.on('frameEnd', (): void => {
Logger.debug(T... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 177fb153a72fe12d165ebc68be82dc002a61aada | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/AdminAuthService.ets | arkts | saveAuthInfo | 保存认证信息到本地
@param token JWT Token
@param adminInfo 管理员信息 | static async saveAuthInfo(token: string, adminInfo: AdminLoginResponse): Promise<void> {
try {
await HttpUtil.saveAdminToken(token);
AppStorage.setOrCreate<string>('adminToken', token);
AppStorage.setOrCreate<AdminLoginResponse>('adminInfo', adminInfo);
AppStorage.setOrCreate<boolean>('isA... | 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 saveAuthInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST... | static async saveAuthInfo(token: string, adminInfo: AdminLoginResponse): Promise<void> {
try {
await HttpUtil.saveAdminToken(token);
AppStorage.setOrCreate<string>('adminToken', token);
AppStorage.setOrCreate<AdminLoginResponse>('adminInfo', adminInfo);
AppStorage.setOrCreate<boolean>('isA... | https://github.com/LJ666-ui/harmony-health-care | 14ef5e422aabc0ef8f8e6af2b89cee30bc892ba6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DataValidator.ets | arkts | applyRules | 应用验证规则
@param value - 要验证的值
@param rules - 验证规则数组
@returns 验证结果 | static applyRules<T>(value: T, rules: ValidationRule<T>[]): ValidationResult {
const results = rules.map(rule => rule.validate(value));
return DataValidator.combineResults(results);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left applyRules 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#(#Ri... | static applyRules<T>(value: T, rules: ValidationRule<T>[]): ValidationResult {
const results = rules.map(rule => rule.validate(value));
return DataValidator.combineResults(results);
} | https://github.com/DaLongZhuaZi/manxia | daf0dfd55a96da08092a177870d98395c4d6aea9 | github |
Tianpei-Shi/MusicDash | src/services/UserService.ets | arkts | updateUserInfo | 更新用户信息 | async updateUserInfo(username: string, like?: string, phone?: number): Promise<boolean> {
if (!this.currentUser) {
return false;
}
this.currentUser.username = username;
if (like) {
this.currentUser.like = like;
}
if (phone) {
this.currentUser.phone = phone;
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateUserInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right ... | async updateUserInfo(username: string, like?: string, phone?: number): Promise<boolean> {
if (!this.currentUser) {
return false;
}
this.currentUser.username = username;
if (like) {
this.currentUser.like = like;
}
if (phone) {
this.currentUser.phone = phone;
}
... | https://github.com/Tianpei-Shi/MusicDash | 0a41ad9cce1433fb46b03070c5ea6b16548cb89e | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | getBooleanQueryValue | Searches the query string for the first value with the given key and interprets it as a boolean value.
@param { string } key - Indicates the key value to be queried.
@param { boolean } defaultValue - The default value returned when the key has no query parameters.
@returns { boolean } Query with key value returns true,... | getBooleanQueryValue(key: string, defaultValue: boolean): boolean {
let flag = this.uriEntry.getQueryValue(key);
if (flag == null) {
return defaultValue;
}
flag = flag.toLocaleLowerCase();
return 'false' != flag && '0' != flag;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBooleanQueryValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Le... | getBooleanQueryValue(key: string, defaultValue: boolean): boolean {
let flag = this.uriEntry.getQueryValue(key);
if (flag == null) {
return defaultValue;
}
flag = flag.toLocaleLowerCase();
return 'false' != flag && '0' != flag;
} | https://gitcode.com/iop123123/arkts-static-skills | 9dd2df3bb1b9a5b0ee230c7dff3f39e4d2a27a02 | gitcode |
queueit/harmony-sdk | queueit_sdk/src/main/ets/view/QueueItViewManager.ets | arkts | handleHttpErrorReceive | Called by <Web onHttpErrorReceive={...}> | public handleHttpErrorReceive(event: OnHttpErrorReceiveEvent): void {
this.isLoading = false;
const req = event?.request;
const responseCode = event?.response?.getResponseCode() ?? 'N/A';
const responseMessage = event?.response?.getReasonMessage() ?? 'N/A';
const requestUrl =... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleHttpErrorReceive 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#identifi... | public handleHttpErrorReceive(event: OnHttpErrorReceiveEvent): void {
this.isLoading = false;
const req = event?.request;
const responseCode = event?.response?.getResponseCode() ?? 'N/A';
const responseMessage = event?.response?.getReasonMessage() ?? 'N/A';
const requestUrl =... | https://github.com/queueit/harmony-sdk | 106f9c7745fd1aaff3be9d2cb48e38e30a3fef16 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets | arkts | printDebugInfo | 打印调试信息 | printDebugInfo(): void {
const dump = this.dumpActiveTasks();
logger.info(TAG, '========== 全局任务状态 ==========');
logger.info(TAG, `活跃页面: ${dump.globalStats.totalPages}`);
logger.info(TAG, `总定时器: ${dump.globalStats.totalTimers}`);
logger.info(TAG, `总 Promise: ${dump.globalStats.totalPromises}`)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left printDebugInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | printDebugInfo(): void {
const dump = this.dumpActiveTasks();
logger.info(TAG, '========== 全局任务状态 ==========');
logger.info(TAG, `活跃页面: ${dump.globalStats.totalPages}`);
logger.info(TAG, `总定时器: ${dump.globalStats.totalTimers}`);
logger.info(TAG, `总 Promise: ${dump.globalStats.totalPromises}`)... | https://github.com/DaLongZhuaZi/manxia | ab07d96c8af971a10731c8ccfba530abcc94df66 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Math.ets | arkts | random | Pseudo-random number in the range [0.0, 1.0)
@returns A floating-point, pseudo-random number that's greater than or equal to 0 and less than 1,
with approximately uniform distribution over that range — which you can then scale to your desired range.
Initial seed to the random number generator algorithm can be given usi... | public static random(): number {
return random();
} | 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 random AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :... | public static random(): number {
return random();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a0ad963be3f3ef23ce42305334e74191d2877b6f | gitee |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | getCurrentAssistantIdInMemory | 从 state 读当前助手 id(已是 Preferences 同步值) | getCurrentAssistantIdInMemory(): string {
return getAppSettingsState().currentAssistantId
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentAssistantIdInMemory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Ri... | getCurrentAssistantIdInMemory(): string {
return getAppSettingsState().currentAssistantId
} | https://github.com/LongLiveY96/chatcube | 25f0859d8898493289c197cc7758e629f1789f8a | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/HistoryManager.ets | arkts | getSimpleHistory | 获取基础评估器历史记录列表 | static async getSimpleHistory(context: Context): Promise<SimpleHistoryItem[]> {
try {
const prefs = await HistoryManager.getPreferences(context);
const historyStr = await prefs.get(HistoryManager.SIMPLE_HISTORY_KEY, '[]') as string;
return JSON.parse(historyStr);
} catch (error) {
cons... | 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 getSimpleHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left... | static async getSimpleHistory(context: Context): Promise<SimpleHistoryItem[]> {
try {
const prefs = await HistoryManager.getPreferences(context);
const historyStr = await prefs.get(HistoryManager.SIMPLE_HISTORY_KEY, '[]') as string;
return JSON.parse(historyStr);
} catch (error) {
cons... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | b7dd0bb2a674a1b1a34198c8af23984d3f6402e8 | github |
electronicminer/Harmony-Markdown-Editor | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | saveAIConfigApiUrl | AI Config Methods | static async saveAIConfigApiUrl(context: common.UIAbilityContext, url: string) {
const prefs = await PreferencesUtil.getPreferences(context);
await prefs.put(PreferencesUtil.KEY_AI_API_URL, url);
await prefs.flush();
} | 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 saveAIConfigApiUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le... | static async saveAIConfigApiUrl(context: common.UIAbilityContext, url: string) {
const prefs = await PreferencesUtil.getPreferences(context);
await prefs.put(PreferencesUtil.KEY_AI_API_URL, url);
await prefs.flush();
} | https://github.com/electronicminer/Harmony-Markdown-Editor | 1b2c96d8fe886b4ca332215e34698fb27db0566a | github |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/AuthUtil.ets | arkts | getUserId | 获取用户ID | static getUserId(): number {
return AppStorage.get<number>(STORAGE_KEYS.USER_ID) || 0;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | static getUserId(): number {
return AppStorage.get<number>(STORAGE_KEYS.USER_ID) || 0;
} | https://github.com/Coke0807/NewsAPP-HarmonyOS | fadb0e8f2d6f02a655b42e97230fa0452f93a9b6 | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BillManager.ets | arkts | getBillsByRange | 查询指定时间区间内的账单明细,供报表等需要原始流水的场景复用。 | static async getBillsByRange(startTime: number, endTime: number, type: string = ''): Promise<BillBean[]> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.greaterThanOrEqualTo('date', startTime);
predicates.lessThan('date', endTime);
if (type.length > 0) {
predicates... | 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 getBillsByRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startTime AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static async getBillsByRange(startTime: number, endTime: number, type: string = ''): Promise<BillBean[]> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.greaterThanOrEqualTo('date', startTime);
predicates.lessThan('date', endTime);
if (type.length > 0) {
predicates... | https://github.com/ZestBox-18/kitebook-frontend | 97d292e94d3eecb5733ee1a0a5efb2d7d388a229 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getContentRect | Returns the rectangle that defines the borders of the chart-value surface
(into which the actual values are drawn).
@return | public getContentRect(): MyRect {
return this.mViewPortHandler.getContentRect();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getContentRect 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 MyRect ... | public getContentRect(): MyRect {
return this.mViewPortHandler.getContentRect();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | af82d7085fd6856e7056691be1396502f510611f | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/left_shift/left_shift_short.ets | arkts | main | ---
desc: check left shift operation for short integer
--- | function main(): void {
const a: short = {{v.left}}
const b: int = {{v.right}}
assert (a << b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: short = {{v.left}}
const b: int = {{v.right}}
assert (a << b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1ea112031093eb6c742f55d54e7f795254c48ed3 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarChartModel.ets | arkts | isHighlightFullBarEnabled | @return true the highlight operation is be full-bar oriented, false if single-value
@Override | public isHighlightFullBarEnabled(): boolean {
return this.mHighlightFullBarEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isHighlightFullBarEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left... | public isHighlightFullBarEnabled(): boolean {
return this.mHighlightFullBarEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 37bf7c9dbfbaf27d708174f4a30ddf180b29fdbd | gitee |
heeh02/superconnect | harmony/entry/src/main/ets/services/WindowController.ets | arkts | enterFullscreen | Enter immersive fullscreen + post the "exit fullscreen" notification. | enterFullscreen(): void {
WindowMode.apply(this.ctx, DisplayMode.Fullscreen, this.onLog);
FullscreenNotification.show(this.ctx, this.onLog);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left enterFullscreen 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_bl... | enterFullscreen(): void {
WindowMode.apply(this.ctx, DisplayMode.Fullscreen, this.onLog);
FullscreenNotification.show(this.ctx, this.onLog);
} | https://github.com/heeh02/superconnect | d61e7ff281f7a01adf0cd38e2d6e6d10977ab781 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | filter | creates a new Int32Array from current Int32Array based on a condition fn
@param fn the condition to apply for each element
@returns a new Int32Array with elements from current Int32Array that satisfy condition fn | public filter(fn: (val: int) => boolean): Int32Array {
let newF: (val: int, index: int, array: Int32Array) => boolean =
(val: int, index: int, array: Int32Array): boolean => { return fn(val) }
return this.filter(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: int) => boolean): Int32Array {
let newF: (val: int, index: int, array: Int32Array) => boolean =
(val: int, index: int, array: Int32Array): boolean => { return fn(val) }
return this.filter(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4ba67c3c173527ee398bf9af2d5e24417c09deec | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Message.ets | arkts | getTarget | Get the message handler
@returns { MessageHandler } The message handler | public getTarget(): concurrency.MessageHandler {
return this.handler;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTarget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#member_expression#Left AST#i... | public getTarget(): concurrency.MessageHandler {
return this.handler;
} | https://gitcode.com/iop123123/arkts-static-skills | 28455bbf42ecde004a0d9f89624e3e14bcda4ba5 | gitcode |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/StringUtil.ets | arkts | isNotEmpty | Determine whether character conversion is a non empty string
@params stringValue character string | public static isNotEmpty(stringValue: string | null | undefined): boolean {
return stringValue !== undefined && stringValue !== null && stringValue.length !== 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 isNotEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left strin... | public static isNotEmpty(stringValue: string | null | undefined): boolean {
return stringValue !== undefined && stringValue !== null && stringValue.length !== 0;
} | https://gitee.com/openharmony/security_privacy_center.git | 331c1ef961b5c19940c8a8e31fed10e57afa71a0 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SeasonalityDetectionService.ets | arkts | detectTroughs | 检测低谷(使用Z-score) | private static detectTroughs(
data: number[],
metrics: StatisticalMetrics,
zThreshold: number
): number[] {
const troughs: number[] = [];
if (metrics.stdDev === 0) {
return troughs;
}
for (let i = 0; i < data.length; i++) {
const zScore = (data[i] - metrics.mean) / metrics.... | 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 detectTroughs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left :... | private static detectTroughs(
data: number[],
metrics: StatisticalMetrics,
zThreshold: number
): number[] {
const troughs: number[] = [];
if (metrics.stdDev === 0) {
return troughs;
}
for (let i = 0; i < data.length; i++) {
const zScore = (data[i] - metrics.mean) / metrics.... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8fef7f683b3f570d245f92767f33818227e08b51 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | convertObject | convertObject
@param {Any} obj Object to convert.
@returns {Any}
@throws {Error} - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override convertObject(obj: Any): Any {
if (obj != null) {
throw new Error("invalid conversion")
}
return null
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left convertObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : A... | public override convertObject(obj: Any): Any {
if (obj != null) {
throw new Error("invalid conversion")
}
return null
} | https://gitcode.com/iop123123/arkts-static-skills | c4e0039f2133c1e5fd97cdf8ee1b5c980663fa99 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | querySelectorAll | 使用 CSS 选择器查询所有匹配元素 | querySelectorAll(selector: string): HTMLElement[] {
const selectorGroups = Matcher.parseSelector(selector);
if (selectorGroups.length === 0) {
HtmlParserLogger.warn(`无效的选择器: "${selector}"`);
return [];
}
const results: HTMLElement[] = [];
const seen = new Set<HTMLElement>();
f... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left querySelectorAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right ... | querySelectorAll(selector: string): HTMLElement[] {
const selectorGroups = Matcher.parseSelector(selector);
if (selectorGroups.length === 0) {
HtmlParserLogger.warn(`无效的选择器: "${selector}"`);
return [];
}
const results: HTMLElement[] = [];
const seen = new Set<HTMLElement>();
f... | https://github.com/DaLongZhuaZi/manxia | 21f0b1cb879ad514630ea02b417a28e322a7ac4d | github |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/BreakpointState.ets | arkts | getFallbackValue | 获取兜底值(优先默认值,其次取配置中第一个可用值)
@param {BreakpointValueOptions<T>} options - 断点值配置
@param {T | undefined} defaultValue - 默认值
@returns {T} 兜底值 | private getFallbackValue<T>(options: BreakpointValueOptions<T>, defaultValue?: T): T {
if (defaultValue !== undefined) {
return defaultValue;
}
const orderedTypes: BreakpointType[] = [
BreakpointType.XS,
BreakpointType.SM,
BreakpointType.MD,
BreakpointType.LG
];
for... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#binary_expression#Left AST#identifier#Left getFallbackValue 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 (... | private getFallbackValue<T>(options: BreakpointValueOptions<T>, defaultValue?: T): T {
if (defaultValue !== undefined) {
return defaultValue;
}
const orderedTypes: BreakpointType[] = [
BreakpointType.XS,
BreakpointType.SM,
BreakpointType.MD,
BreakpointType.LG
];
for... | https://github.com/Joker-x-dev/CoolMallArkTS | 9c7746271034e98f104158c2c6404005b79308d0 | github |
openharmony-sig/knowledge_demo_travel | FA/WiFiScanner/entry/src/main/ets/MainAbility/common/utils/ToolUtil.ets | arkts | intToIp | Int转IP | intToIp(num){
let str
let tt = new Array()
tt[0] = (num >>> 24) >>> 0
tt[1] = ((num << 8) >>> 24) >>> 0
tt[2] = (num << 16) >>> 24
tt[3] = (num << 24) >>> 24
str = String(tt[0]) + '.' + String(tt[1]) + '.' + String(tt[2]) + '.' + String(tt[3])
return str
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left intToIp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left num AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_s... | intToIp(num){
let str
let tt = new Array()
tt[0] = (num >>> 24) >>> 0
tt[1] = ((num << 8) >>> 24) >>> 0
tt[2] = (num << 16) >>> 24
tt[3] = (num << 24) >>> 24
str = String(tt[0]) + '.' + String(tt[1]) + '.' + String(tt[2]) + '.' + String(tt[3])
return str
} | https://gitee.com/openharmony-sig/knowledge_demo_travel.git | b02a9132c15f27f7da6dadd49da938d4f4ccf683 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | useSidebarLayout | 是否使用分栏布局 | public static useSidebarLayout(): boolean {
return ResponsiveLayoutHelper.getLayoutParams().useSidebarLayout;
} | 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 useSidebarLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public static useSidebarLayout(): boolean {
return ResponsiveLayoutHelper.getLayoutParams().useSidebarLayout;
} | https://github.com/DaLongZhuaZi/manxia | 06ab689d8a371dcc10d573a44e7ab593b5507a71 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test9_original_index.ets | arkts | testArrayConcat | --- Array spread (manual, no spread in ArkTS strict) --- | function testArrayConcat(): string {
let a: number[] = [1, 2, 3];
let b: number[] = [4, 5, 6];
let combined: number[] = a.concat(b);
return String(combined.length);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayConcat AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_... | function testArrayConcat(): string {
let a: number[] = [1, 2, 3];
let b: number[] = [4, 5, 6];
let combined: number[] = a.concat(b);
return String(combined.length);
} | https://github.com/miaochiahao/ark-ghidra | 66232893fa4058144b7296fa0ebcbdad2d4c9136 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyStore.ets | arkts | switchProfile | 切换到指定配置 | static async switchProfile(name: string): Promise<CustomKeyProfile | null> {
await CustomKeyStore.ensureInit();
const profile = CustomKeyStore.profiles!.find(p => p.name === name);
if (!profile) return null;
CustomKeyStore.activeProfileName = name;
await PreferencesUtil.put(STORAGE_KEY_ACTIVE, nam... | 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 switchProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST... | static async switchProfile(name: string): Promise<CustomKeyProfile | null> {
await CustomKeyStore.ensureInit();
const profile = CustomKeyStore.profiles!.find(p => p.name === name);
if (!profile) return null;
CustomKeyStore.activeProfileName = name;
await PreferencesUtil.put(STORAGE_KEY_ACTIVE, nam... | https://github.com/AlkaidLab/moonlight-harmony | 8153ab043d5ba4bbdd4707733e02f925565390d2 | github |
openharmony-sig/flutter_packages | packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets | arkts | getMaxExposureBias | 查询最大曝光补偿值 | public static getMaxExposureBias(captureSession: camera.PhotoSession | camera.VideoSession): number {
let maxExposure: number = 10;
try {
let biasRangeArray = captureSession.getExposureBiasRange();
if (biasRangeArray.length > 1) {
maxExposure = biasRangeArray[biasRangeArray.length-1];
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getMaxExposureBias AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Le... | public static getMaxExposureBias(captureSession: camera.PhotoSession | camera.VideoSession): number {
let maxExposure: number = 10;
try {
let biasRangeArray = captureSession.getExposureBiasRange();
if (biasRangeArray.length > 1) {
maxExposure = biasRangeArray[biasRangeArray.length-1];
... | https://gitee.com/openharmony-sig/flutter_packages.git | 82b41d18b34f3ba9f61d04609da6522f50ab099f | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | appendDefaultDateTimeOptions | NOTE (ikorobkov): uncomment when #33175 will be fixed
/**
* Gets a string with a language-sensitive representation of this date with respect to locale.
*
* @param { Intl.LocalesArgument } [ locales ] A string with a BCP 47 language tag, or an
* array of such strings
* @param { Intl.DateTimeFormatOptions } [ options... | private appendDefaultDateTimeOptions(options: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions {
const hasDateOptions = options.weekday !== undefined || options.year !== undefined || options.month !== undefined || options.day !== undefined
const hasTimeOptions = options.hour !== undefined || ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendDefaultDateTimeOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left options AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | private appendDefaultDateTimeOptions(options: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions {
const hasDateOptions = options.weekday !== undefined || options.year !== undefined || options.month !== undefined || options.day !== undefined
const hasTimeOptions = options.hour !== undefined || ... | https://gitcode.com/iop123123/arkts-static-skills | 10c71c5f936758ef40aa8c03242fa9555912c3e6 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/errors/HookError.ets | arkts | constructor | 构造函数
@param entityName 实体名称
@param hookName 钩子名称(beforeSave/afterLoad/beforeDelete/...)
@param originalError 原始错误信息 | constructor(entityName: string, hookName: string, originalError: string) {
const sanitizedError = sanitizeErrorMessage(originalError)
const context = new ErrorContext()
context.entityName = entityName
context.operation = hookName
context.details = sanitizedError
super(`实体 '${entityName}' 的 '${... | 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 entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST... | constructor(entityName: string, hookName: string, originalError: string) {
const sanitizedError = sanitizeErrorMessage(originalError)
const context = new ErrorContext()
context.entityName = entityName
context.operation = hookName
context.details = sanitizedError
super(`实体 '${entityName}' 的 '${... | https://github.com/offlinecat-dev/OCNetORM | 76a0e6ad439fcbcdf75e3a11904bc48612963108 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Tabs/MyTabsComp.ets | arkts | getDebugInfo | 获取调试信息,CPU 占用率,内存 | getDebugInfo() {
// 获取进程的CPU使用率。 如占用率为50%,则返回0.5。
this.cpuUsage = hidebug.getCpuUsage() * 100
// 获取应用进程实际使用的物理内存大小,单位为kB
// 1MB = 1024KB (Windows 系统,普遍混淆)
// 1MB = 1000KB (MAC 系统,手机系统,Linux 系统,U 盘、DVD 光盘、、、)
this.memorySize = Number(hidebug.getPss()) / 1000
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDebugInfo 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 ... | getDebugInfo() {
// 获取进程的CPU使用率。 如占用率为50%,则返回0.5。
this.cpuUsage = hidebug.getCpuUsage() * 100
// 获取应用进程实际使用的物理内存大小,单位为kB
// 1MB = 1024KB (Windows 系统,普遍混淆)
// 1MB = 1000KB (MAC 系统,手机系统,Linux 系统,U 盘、DVD 光盘、、、)
this.memorySize = Number(hidebug.getPss()) / 1000
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | c2bc93656f4cfc9fdc8fe1d5c103141a503c0194 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/TerminalManager.ets | arkts | getAllTerminalConfigs | 获取所有终端配置 | getAllTerminalConfigs(): TerminalConfig[] {
return Array.from(this.terminalConfigs.values());
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllTerminalConfigs 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... | getAllTerminalConfigs(): TerminalConfig[] {
return Array.from(this.terminalConfigs.values());
} | https://github.com/LJ666-ui/harmony-health-care | 870efdb4826cbce7a64402a4ab6038c068bde0ef | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets | arkts | constructor | Constructor that specifies to how many digits the value should be
formatted.
@param digits | constructor(digits: number) {
this.digits = digits;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left digits AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right... | constructor(digits: number) {
this.digits = digits;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f688ceb5848e0ea778644024171a5a539ce7f246 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getSimState | 获取指定卡槽的SIM卡状态。使用Promise异步回调。
@param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 默认移动数据的SIM卡。
@returns | static async getSimState(slotId?: number): Promise<sim.SimState> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //默认移动数据的SIM卡
return sim.getSimState(slotId);
} | 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 getSimState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST... | static async getSimState(slotId?: number): Promise<sim.SimState> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //默认移动数据的SIM卡
return sim.getSimState(slotId);
} | https://github.com/tdcare/tdwebrtc | 8f9b2b1b2a697e1cb8c3eed2cf1854b4f1ea60e7 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | refreshLibrary | @summary Starts a library scan.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public refreshLibrary(): Promise<void> {
return this.apiClient.post({path: `/Library/Refresh`})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left refreshLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#instantiation_expressio... | public refreshLibrary(): Promise<void> {
return this.apiClient.post({path: `/Library/Refresh`})
} | https://github.com/OHPG/FinSdk | 1abdf15cb760178e9c6e46b21d1b097c7ae2579b | github |
webabcd/HarmonyDemo | entry/src/main/ets/MyAbilityStage.ets | arkts | onAcceptWant | 当 UIAbility 以 specified 的方式启动时,就会走到 HAP 的对应的 AbilityStage 中的 onAcceptWant() 回调 | onAcceptWant(want: Want): string {
MyLog.d('AbilityStage onAcceptWant');
// 返回 specified 标识
// 如果相同 specified 标识的 UIAbility 已存在,则热启动它(启动已存在的实例)
// 如果相同 specified 标识的 UIAbility 不存在,则冷启动它(创建新的实例,并启动)
return `${want.parameters?.specifiedKey ?? ""}`
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onAcceptWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#)#Left ) AST#... | onAcceptWant(want: Want): string {
MyLog.d('AbilityStage onAcceptWant');
// 返回 specified 标识
// 如果相同 specified 标识的 UIAbility 已存在,则热启动它(启动已存在的实例)
// 如果相同 specified 标识的 UIAbility 不存在,则冷启动它(创建新的实例,并启动)
return `${want.parameters?.specifiedKey ?? ""}`
} | https://github.com/webabcd/HarmonyDemo | 914a8c72997b07de3c91d0f67ab740570e92a055 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Atomics.ets | arkts | add | Int32Array | public static add(typedArray: Int32Array, index: int, value: int): int {
throw new Error("not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typedArray A... | public static add(typedArray: Int32Array, index: int, value: int): int {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7787fd6b5d233862ffea3e87134efde3d55e101f | gitee |
LZZLHY/hlib | entry/src/main/ets/api/DomainManifest.ets | arkts | loadFromStorage | ─── 持久化加载 ───────────────────────────────────────
EntryAbility 初始化阶段调一次:从 preferences 读出用户配置和上次缓存。 | static async loadFromStorage(): Promise<void> {
DomainManifest.enabled = await PreferencesStore.getBoolean(
'settings',
AppStorageKeys.DOMAIN_MANIFEST_ENABLED,
false,
);
DomainManifest.manifestUrl = await PreferencesStore.getString(
'settings',
AppStorageKeys.DOMAIN_MANIFEST_... | 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 loadFromStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | static async loadFromStorage(): Promise<void> {
DomainManifest.enabled = await PreferencesStore.getBoolean(
'settings',
AppStorageKeys.DOMAIN_MANIFEST_ENABLED,
false,
);
DomainManifest.manifestUrl = await PreferencesStore.getString(
'settings',
AppStorageKeys.DOMAIN_MANIFEST_... | https://github.com/LZZLHY/hlib | 0e1d370d5000d2fa224892d2226fc14f82e166b3 | github |
tianlongbaobao/idut-HarmonyOS-Next | oh_modules/@ohos/@tencent/wechat_open_sdk/src/main/ets/diff_dev_oauth/DiffDevOAuth.ets | arkts | getDiffDevOAuth | 获取IDiffDevOAuth指定版本的实现
@param version | public static getDiffDevOAuth(version: number = DiffDevOAuthFactory.MAX_SUPPORTED_VERSION): IDiffDevOAuth | null {
if (version > DiffDevOAuthFactory.MAX_SUPPORTED_VERSION) {
return null
}
switch (version) {
case DiffDevOAuthFactory.VERSION_1:
return new DiffDevOAuthImplV1()
def... | 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 getDiffDevOAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left version AST#identifier#Right AST#:#Left... | public static getDiffDevOAuth(version: number = DiffDevOAuthFactory.MAX_SUPPORTED_VERSION): IDiffDevOAuth | null {
if (version > DiffDevOAuthFactory.MAX_SUPPORTED_VERSION) {
return null
}
switch (version) {
case DiffDevOAuthFactory.VERSION_1:
return new DiffDevOAuthImplV1()
def... | https://github.com/tianlongbaobao/idut-HarmonyOS-Next | 7ad51c245e85a51c0d109edb337a0c2bfcc26b97 | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/WantAgentUtil.ets | arkts | getToggleFullScreenWantAgent | Get the WantAgent used to start the full screen alarm page.
@param alarmInfo AlarmInfo
@return WantAgent used to start the full screen alarm page. | static async getToggleFullScreenWantAgent(alarmInfo: AlarmInfo): Promise<WantAgent | undefined> {
try {
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: TIMER_ALERT_BUNDLE,
abilityName: FULL_SCREEN_ABILITY,
parameters: {
... | 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 getToggleFullScreenWantAgent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmInfo AST#identifier#Ri... | static async getToggleFullScreenWantAgent(alarmInfo: AlarmInfo): Promise<WantAgent | undefined> {
try {
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: TIMER_ALERT_BUNDLE,
abilityName: FULL_SCREEN_ABILITY,
parameters: {
... | https://gitee.com/openharmony-sig/applications_clock.git | 85dcec07bbeeb1565e7f27e7d33f6b70002c4a04 | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/AchievementService.ets | arkts | getUnlockedAchievementsMap | 获取已解锁成就的映射 | private async getUnlockedAchievementsMap(): Promise<Map<string, UnlockedAchievementInfo>> {
const map = new Map<string, UnlockedAchievementInfo>();
if (!this.preferences) {
return map;
}
try {
const unlockedJson = await this.preferences.get(this.KEY_UNLOCKED_ACHIEVEMENTS, '{}');
co... | 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 getUnlockedAchievementsMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express... | private async getUnlockedAchievementsMap(): Promise<Map<string, UnlockedAchievementInfo>> {
const map = new Map<string, UnlockedAchievementInfo>();
if (!this.preferences) {
return map;
}
try {
const unlockedJson = await this.preferences.get(this.KEY_UNLOCKED_ACHIEVEMENTS, '{}');
co... | https://gitcode.com/openharmony/codelabs | 5885f1ae9f13a7cb983159f814dbec8f4b5cd481 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | error | ❌ 错误级别的日志
@param tag - 日志分类标签
@param message - 要输出的日志信息
@param args - 其他可选参数 | public error(tag: string, message: string, ...args: (string | number | boolean)[]): void {
if (this.currentLevel <= LogLevel.ERROR) {
const formattedMessage = this.formatMessageWithArgs(LogLevel.ERROR, tag, message, args);
// 仅当hilog输出级别允许时才输出到hilog
if (this.shouldOutputToHilog(LogLevel.ERROR)) ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public error(tag: string, message: string, ...args: (string | number | boolean)[]): void {
if (this.currentLevel <= LogLevel.ERROR) {
const formattedMessage = this.formatMessageWithArgs(LogLevel.ERROR, tag, message, args);
// 仅当hilog输出级别允许时才输出到hilog
if (this.shouldOutputToHilog(LogLevel.ERROR)) ... | https://github.com/DaLongZhuaZi/manxia | d72db9ab63ed91a5860ee3c70e6daf3e15e22eeb | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets | arkts | refreshToken | 使用刷新令牌获取新的访问令牌
@param refreshRequest 刷新令牌请求
@return Promise<OAuth2Token> 新的访问令牌
@throws 如果刷新令牌失败则抛出异常 | public async refreshToken(refreshRequest: OAuth2RefreshRequest): Promise<OAuth2Token> {
if (!refreshRequest.refreshToken || refreshRequest.refreshToken.trim().length === 0) {
throw new OAuth2Error(OAuth2ErrorCodes.INVALID_PARAMETERS, 'Refresh token is required');
}
const requestBody: Record<string,... | 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 refreshToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left refreshRequest AST#identifier#Right AST#:#L... | public async refreshToken(refreshRequest: OAuth2RefreshRequest): Promise<OAuth2Token> {
if (!refreshRequest.refreshToken || refreshRequest.refreshToken.trim().length === 0) {
throw new OAuth2Error(OAuth2ErrorCodes.INVALID_PARAMETERS, 'Refresh token is required');
}
const requestBody: Record<string,... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L104-L129 | c28600a9da184bc33a72b14d33dc3a6d0c4a5a61 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new TypeError 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("TypeError", 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("TypeError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 1de5dda4e131bbde607222008ef0a4a1138d7d50 | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/SearchFilter.ets | arkts | toQueryString | 转换为 Discourse 搜索查询字符串
例如:in:bookmarks #分类 tags:harmonyos status:open after:2024-01-01 | toQueryString(): string {
const parts: string[] = [];
// 搜索范围
if (this.inType !== null) {
parts.push(`in:${(this.inType as SearchInType).value}`);
}
// 分类
if (this.categorySlug !== null && (this.categorySlug as string).length > 0) {
if (this.parentCategorySlug !== null && (this.p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toQueryString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statemen... | toQueryString(): string {
const parts: string[] = [];
// 搜索范围
if (this.inType !== null) {
parts.push(`in:${(this.inType as SearchInType).value}`);
}
// 分类
if (this.categorySlug !== null && (this.categorySlug as string).length > 0) {
if (this.parentCategorySlug !== null && (this.p... | https://github.com/Amaz1ny/HarmonyDO-public | a8fdac4e19a2548295990a6650da8e132f78b066 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | constructor | Constructs view
@param { ArrayBuffer } buffer underlying buffer
@param { int } [ byteOffset ] offset to start from
@param { int } [ byteLength ] lenth of bytes to take
@throws { RangeError } RangeError if provided indicies are invalid
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(buffer: ArrayBuffer, byteOffset?: int, byteLength?: int) {
this.buffer_ = buffer
this.actualBuffer = buffer
if (byteOffset === undefined) {
byteOffset = 0
}
if (byteLength === undefined) {
byteLength = this.buffer_.getByteLength() - ... | 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 buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ar... | public constructor(buffer: ArrayBuffer, byteOffset?: int, byteLength?: int) {
this.buffer_ = buffer
this.actualBuffer = buffer
if (byteOffset === undefined) {
byteOffset = 0
}
if (byteLength === undefined) {
byteLength = this.buffer_.getByteLength() - ... | https://gitcode.com/iop123123/arkts-static-skills | fe6dafcab21e06222f143769717746e07667d80b | gitcode |
erosTeam/NextE | feature/gallery/src/main/ets/viewmodel/GalleryDetailViewModel.ets | arkts | applyNonRefreshSeedRating | eros_fe keeps list/gdata seed rating presentation on first open: detail HTML may have a weaker or
differently-derived rating block, while the list row already carries the user's personal rating
colour. A pull-to-refresh is the explicit "trust fresh detail" path, so this only applies to the
initial non-refresh load. | private applyNonRefreshSeedRating(
seedRatingFallBack: number,
seedRatingCount: string,
seedColorRating: string,
): void {
if (seedRatingFallBack > 0 && this.gallery.ratingFallBack <= 0) {
this.gallery.ratingFallBack = seedRatingFallBack
}
if (seedRatingCount.length > 0 && this.gallery... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyNonRefreshSeedRating AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seedRatingFallBack AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#numbe... | private applyNonRefreshSeedRating(
seedRatingFallBack: number,
seedRatingCount: string,
seedColorRating: string,
): void {
if (seedRatingFallBack > 0 && this.gallery.ratingFallBack <= 0) {
this.gallery.ratingFallBack = seedRatingFallBack
}
if (seedRatingCount.length > 0 && this.gallery... | https://github.com/erosTeam/NextE | 6e383ed61947c2ecfb9880c5373286a0dc028331 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets | arkts | injectNsfwFlag | 为ComicInfo结果注入当前源的isNSFW标记 | private injectNsfwFlag(results: ComicInfo[], sourceId?: string): ComicInfo[] {
const sid = sourceId || this.currentSourceId;
const isNsfw = sid ? (this.sourceNsfwMap.get(sid) === true) : false;
if (isNsfw) {
for (const item of results) {
(item as ESObject).isNSFW = true;
}
}
re... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left injectNsfwFlag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_e... | private injectNsfwFlag(results: ComicInfo[], sourceId?: string): ComicInfo[] {
const sid = sourceId || this.currentSourceId;
const isNsfw = sid ? (this.sourceNsfwMap.get(sid) === true) : false;
if (isNsfw) {
for (const item of results) {
(item as ESObject).isNSFW = true;
}
}
re... | https://github.com/DaLongZhuaZi/manxia | 9616d7e6007f74b917f7ce5dd56ebeda7801796a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an array-like or iterable object.
@param { ArrayLike<T> } arrayLike - An array-like or iterable object to convert to an array.
@param { function } mapfn - A mapping function to call on every element of the array.
@returns { BigInt64Array } - A new BigInt64Array
@static
@syscap SystemCapability.Uti... | public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => BigInt): BigInt64Array {
let res = new BigInt64Array(arrayLike.length)
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identif... | public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => BigInt): BigInt64Array {
let res = new BigInt64Array(arrayLike.length)
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by ... | https://gitcode.com/iop123123/arkts-static-skills | 5e0758ea66eea319d50ff8dfb43ffee67a635766 | gitcode |
codelably/HCompass | packages/demo/src/main/ets/services/DemoNavSvcImpl.ets | arkts | toNetworkListDemo | 跳转到 Network List Demo 示例页
@returns {void} 无返回值 | toNetworkListDemo(): void {
const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService);
navigation?.navigateTo(DemoRoutes.NetworkListDemo);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toNetworkListDemo 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_... | toNetworkListDemo(): void {
const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService);
navigation?.navigateTo(DemoRoutes.NetworkListDemo);
} | https://github.com/codelably/HCompass | 4117d5d06c44da2c51c99c6c5f1077ffbb455a63 | github |
openharmony-sig/ohos_checksum | library/src/main/ets/md5.ets | arkts | str2rstr_utf8 | Encode a string as utf-8.
For efficiency, this assumes the input is valid utf-16. | str2rstr_utf8(input: string) :string {
let output = "";
let i = -1;
let x: number, y: number;
while (++i < input.length) {
/* Decode utf-16 surrogate pairs */
x = input.charCodeAt(i);
y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left str2rstr_utf8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ... | str2rstr_utf8(input: string) :string {
let output = "";
let i = -1;
let x: number, y: number;
while (++i < input.length) {
/* Decode utf-16 surrogate pairs */
x = input.charCodeAt(i);
y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
... | https://gitee.com/openharmony-sig/ohos_checksum.git | 8fbf3f6897fbf8608bd2804f24ba0a35eeae5d19 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test3_original_index.ets | arkts | testTypeAssertion | === 'as' Type Assertion === | function testTypeAssertion(): string {
let value: StringOrNumber = 'hello';
let str: string = value as string;
return str.toUpperCase();
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTypeAssertion AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testTypeAssertion(): string {
let value: StringOrNumber = 'hello';
let str: string = value as string;
return str.toUpperCase();
} | https://github.com/miaochiahao/ark-ghidra | e2944a37c8ec6cf18ddccfd8c151f1ad38ddabf6 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/rag/Reranker.ets | arkts | calculateSemanticSimilarity | 计算语义相似度(简化版) | private calculateSemanticSimilarity(query: string, document: string): number {
// 简化实现:基于词重叠
const querySet = new Set(query.toLowerCase().split(/\s+/));
const docSet = new Set(document.toLowerCase().split(/\s+/));
const intersection = new Set([...querySet].filter(x => docSet.has(x)));
const u... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateSemanticSimilarity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private calculateSemanticSimilarity(query: string, document: string): number {
// 简化实现:基于词重叠
const querySet = new Set(query.toLowerCase().split(/\s+/));
const docSet = new Set(document.toLowerCase().split(/\s+/));
const intersection = new Set([...querySet].filter(x => docSet.has(x)));
const u... | https://github.com/LJ666-ui/harmony-health-care | b1736b7cd8dcdb67ae7921c608515a6e5b8951ef | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/pages/permission-access-record.ets | arkts | getAppRecords | Get application record info
@param {Object} application info
@param {String} groupName
@param {Boolean} true: count, false: lastTime | getAppRecords(appInfo: AppRecordInfo, groupName: ResourceStr, option: boolean): number {
let record = appInfo.permissions.filter(permission => {
return permission.groupName == groupName;
})
if (record.length > 0) {
return option ? record[0].count : record[0].lastTime;
} else {
return... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAppRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AppRecordInfo AST#identifier#Right AST#... | getAppRecords(appInfo: AppRecordInfo, groupName: ResourceStr, option: boolean): number {
let record = appInfo.permissions.filter(permission => {
return permission.groupName == groupName;
})
if (record.length > 0) {
return option ? record[0].count : record[0].lastTime;
} else {
return... | https://gitee.com/openharmony/applications_permission_manager.git | 30a71961e26252eef4d607be21167346c56f9ad2 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | updateReadingProgress | 更新阅读进度
这是最常用的方法,在阅读器中调用 | public async updateReadingProgress(
contentId: string,
trackerId: TrackerId,
chapterNumber: number,
totalChapters?: number
): Promise<boolean> {
const record = await this.getTrackRecord(contentId, trackerId);
if (!record) {
logger.warn(TAG, `跟踪记录不存在: contentId=${contentId}, trackerId=$... | 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 updateReadingProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST... | public async updateReadingProgress(
contentId: string,
trackerId: TrackerId,
chapterNumber: number,
totalChapters?: number
): Promise<boolean> {
const record = await this.getTrackRecord(contentId, trackerId);
if (!record) {
logger.warn(TAG, `跟踪记录不存在: contentId=${contentId}, trackerId=$... | https://github.com/DaLongZhuaZi/manxia | e5011c05a8043103d632de0e0c3320312fc6572d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/DataManagementPage.ets | arkts | getDuplicateReasonsLabel | 重复原因文本映射 | function getDuplicateReasonsLabel(reasons?: DuplicateReason[]): string {
if (!reasons || reasons.length === 0) { return '无'; }
const labels: string[] = [];
for (let i = 0; i < reasons.length; i++) {
const r: DuplicateReason = reasons[i];
switch (r) {
case DuplicateReason.TITLE_EXACT: labels.push('标题... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getDuplicateReasonsLabel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left reasons AST#identifier#Right AST#?#Left ? AST#?#Right AST#typ... | function getDuplicateReasonsLabel(reasons?: DuplicateReason[]): string {
if (!reasons || reasons.length === 0) { return '无'; }
const labels: string[] = [];
for (let i = 0; i < reasons.length; i++) {
const r: DuplicateReason = reasons[i];
switch (r) {
case DuplicateReason.TITLE_EXACT: labels.push('标题... | https://github.com/DaLongZhuaZi/manxia | 2e2e906709be3cb9cdcd7c60cc4f2dc4da4ba8dc | github |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | dataContact | Save the contact name to the database.
@param {Object} addParams Contact Information
@param {string} DAHelper Database path
@param {string} result Contact ID
@param {string} uri Database address | dataContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
let displayName = '';
let updateFlag = 0;
if (addParams.display_name != undefined && addParams.display_name.length > 0) {
displayName = addParams.display_name;
} else {
updateFlag = 1;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left dataContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#identifi... | dataContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
let displayName = '';
let updateFlag = 0;
if (addParams.display_name != undefined && addParams.display_name.length > 0) {
displayName = addParams.display_name;
} else {
updateFlag = 1;
... | https://gitee.com/openharmony/applications_contacts.git | f2301be651ad5a14237cc89d254024ef0ce19e6c | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | searchLast | Search last. | searchLast() {
try {
this.controller?.searchNext(false);
} catch (e) {
meow(`Failed to search last for [${this.searchedSearchKey}]: ${e}`, 'meowTabInfo][currentTabSearchLast', meowLevel.ERROR);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | searchLast() {
try {
this.controller?.searchNext(false);
} catch (e) {
meow(`Failed to search last for [${this.searchedSearchKey}]: ${e}`, 'meowTabInfo][currentTabSearchLast', meowLevel.ERROR);
}
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 9f44a14f58e7e954c23f9a578607c813fc537b84 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/network/WebSocketDemo.ets | arkts | launchWebSocketServer | 启动 websocket 服务端 | launchWebSocketServer() {
// 设置监听的 IP 地址和端口号
let ipAddress: socket.NetAddress = {
address: "0.0.0.0",
port: 8888
}
// 开始监听 socket
this.tcpServer.listen(ipAddress).then(() => {
this.message += `监听端口成功,监听的端口号:${ipAddress.port}\n`
}).catch((err: BusinessError) => {
this.m... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left launchWebSocketServer 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... | launchWebSocketServer() {
// 设置监听的 IP 地址和端口号
let ipAddress: socket.NetAddress = {
address: "0.0.0.0",
port: 8888
}
// 开始监听 socket
this.tcpServer.listen(ipAddress).then(() => {
this.message += `监听端口成功,监听的端口号:${ipAddress.port}\n`
}).catch((err: BusinessError) => {
this.m... | https://github.com/webabcd/HarmonyDemo | 20d55d458e80bc85a27a427e21a22448c39e755d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Runtime.ets | arkts | lambdaUnsafeCallStub | Internal stub to handle a generic case of unsafeCall for std.core.Lambda... helper classes
Internal stub to handle the generic case of unsafeCall for std.core.Lambda... helper classes.
@param { Function } fn The function to call
@param { FixedArray<Any> } r The FixedArray containing call arguments
@returns { Any } The ... | static lambdaUnsafeCallStub(fn: Function, r: FixedArray<Any>): Any {
return __lambdaUnsafeCallStub(fn, r)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left lambdaUnsafeCallStub AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static lambdaUnsafeCallStub(fn: Function, r: FixedArray<Any>): Any {
return __lambdaUnsafeCallStub(fn, r)
} | https://gitcode.com/iop123123/arkts-static-skills | b807ba8d344992cc5c5078314380f56fc9a149be | gitcode |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/context/ContextUtil.ets | arkts | getUIAbilityCtx | 获取 UIAbility 组件的上下文
@returns {common.UIAbilityContext} | static getUIAbilityCtx(): common.UIAbilityContext {
return ContextUtil.context
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getUIAbilityCtx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#member_expression#Left... | static getUIAbilityCtx(): common.UIAbilityContext {
return ContextUtil.context
} | https://github.com/Joker-x-dev/CoolMallArkTS | 1f3486d59d013d7d6dd56cd111d75072c17eeb63 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/ImageProcessing/JinmantiantangDescrambler.ets | arkts | stringToUint8Array | 字符串转Uint8Array | private stringToUint8Array(str: string): Uint8Array {
const encoder = new util.TextEncoder();
return encoder.encodeInto(str);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stringToUint8Array 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#... | private stringToUint8Array(str: string): Uint8Array {
const encoder = new util.TextEncoder();
return encoder.encodeInto(str);
} | https://github.com/DaLongZhuaZi/manxia | b8795478382b4753b7ca8d3978651c4327dba422 | github |
PollenWang6/HiXD | entry/src/main/ets/services/AttendanceModels.ets | arkts | getAttendanceStatus | 获取考勤状态 | getAttendanceStatus(): AttendanceStatus {
const total: number = this.totalTimes > 0 ? this.totalTimes : (parseInt(this.requiredCheckIn) || 0) * 2;
const timeToError: number = Math.floor(total / 4);
const absenceNum: number = parseInt(this.absenceCount) || 0;
const absenceHours: number = absenceNum * 2... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAttendanceStatus 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 AttendanceStatus AST#identifier#Right AST#... | getAttendanceStatus(): AttendanceStatus {
const total: number = this.totalTimes > 0 ? this.totalTimes : (parseInt(this.requiredCheckIn) || 0) * 2;
const timeToError: number = Math.floor(total / 4);
const absenceNum: number = parseInt(this.absenceCount) || 0;
const absenceHours: number = absenceNum * 2... | https://github.com/PollenWang6/HiXD | cc3deace66a43740711854332137ddc3de9c6dd1 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | toChar | Returns the primitive as char value
@param { char } value value to cast
@returns { char }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static toChar(value: char): char {
return value;
}; | 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 toChar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | public static toChar(value: char): char {
return value;
}; | https://gitcode.com/iop123123/arkts-static-skills | 1799edd43ff5fbc21842822ddad69aefd5143ec5 | gitcode |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/RdbManager.ets | arkts | getSongsByPlaylistId | 根据歌单 ID 获取该歌单下的所有歌曲
@param playlistId 歌单 ID | async getSongsByPlaylistId(playlistId: number): Promise<SongItemType[]> {
if (!this.rdbStore) return [];
const songs: SongItemType[] = [];
const sql = `
SELECT s.* FROM ${this.tableNameSong} s
INNER JOIN ${this.tableNameMap} m
ON s.id = m.song_id
WHERE m.playlist_id = ?
`;
try {... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getSongsByPlaylistId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left playlistId AST#identifier#Right AST#typ... | async getSongsByPlaylistId(playlistId: number): Promise<SongItemType[]> {
if (!this.rdbStore) return [];
const songs: SongItemType[] = [];
const sql = `
SELECT s.* FROM ${this.tableNameSong} s
INNER JOIN ${this.tableNameMap} m
ON s.id = m.song_id
WHERE m.playlist_id = ?
`;
try {... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L372-L405 | 42a2e2a7899a16aba202bccfaaf4f679dbcc1945 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/NativeHidController.ets | arkts | processInputReport | 使用原生层处理 HID 报告 | private processInputReport(data: Uint8Array): void {
// 调用原生解析器,传入强制协议类型
const state = this.nativeParser.parseHidReport(
this.vendorId,
this.productId,
data,
this.forceProtocolType
);
if (!state) {
// 原生解析失败,使用 TypeScript 后备解析器
const hexStr = Array.from(data.slice(... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processInputReport 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... | private processInputReport(data: Uint8Array): void {
// 调用原生解析器,传入强制协议类型
const state = this.nativeParser.parseHidReport(
this.vendorId,
this.productId,
data,
this.forceProtocolType
);
if (!state) {
// 原生解析失败,使用 TypeScript 后备解析器
const hexStr = Array.from(data.slice(... | https://github.com/AlkaidLab/moonlight-harmony | 6600470df2fcbb95ffd95323ff9edf605a322702 | github |
DaLongZhuaZi/manxia | tmp/ohpm_research/wolfx_minizip/package/src/main/ets/Zip.ets | arkts | setProgressCallback | 添加fileProgress属性
设置进度回调函数
@param callback 进度回调函数 | setProgressCallback(callback: CompressProgressCallback): void {
this.progressCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setProgressCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CompressProgressCallback AST#ide... | setProgressCallback(callback: CompressProgressCallback): void {
this.progressCallback = callback;
} | https://github.com/DaLongZhuaZi/manxia | 68b34c54e22def104cf1a3b192bb8009c4289bf4 | github |
Eklps/harmony-mall-perf | entry/src/main/ets/viewmodel/InitialData.ets | arkts | constructor | 图片宽高比 | constructor(goodsImg: Resource, goodsName: Resource, title: string, price: Resource, priceVal: number, reviewCount: number, positiveRate: number, category: GoodsCategory, aspectRatio?: number) {
this.id = util.generateRandomUUID(true);
this.goodsImg = goodsImg;
this.goodsName = goodsName;
this.title =... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left goodsImg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#R... | constructor(goodsImg: Resource, goodsName: Resource, title: string, price: Resource, priceVal: number, reviewCount: number, positiveRate: number, category: GoodsCategory, aspectRatio?: number) {
this.id = util.generateRandomUUID(true);
this.goodsImg = goodsImg;
this.goodsName = goodsName;
this.title =... | https://github.com/Eklps/harmony-mall-perf | 205779baf263f517ad7fea4f099b80be6b49bfcd | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/DataCrypto.ets | arkts | setMasterPassword | 设置主密码 (首次使用)
生成随机盐, PBKDF2 派生 DEK, 计算验证器, 存储到 cloudPrefs | async setMasterPassword(password: string): Promise<void> {
if (!password || password.length < 8) {
throw new Error('[DataCrypto] 密码长度不足 (最少 8 位)');
}
try {
// 1. 生成随机盐
const salt = this.generateRandomSync(this.SALT_LENGTH);
// 2. PBKDF2 派生 DEK
const dek = await this.deriveK... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setMasterPassword AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left password AST#identifier#Rig... | async setMasterPassword(password: string): Promise<void> {
if (!password || password.length < 8) {
throw new Error('[DataCrypto] 密码长度不足 (最少 8 位)');
}
try {
// 1. 生成随机盐
const salt = this.generateRandomSync(this.SALT_LENGTH);
// 2. PBKDF2 派生 DEK
const dek = await this.deriveK... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 34e2d08837b7fc027d152050776ec90f1e15640c | github |
jiahaozheng406/huawei-travel-app-HarmonyOS | entry/src/main/ets/pages/SplashPage.ets | arkts | onPageShow | 展示页面1秒后跳转 | onPageShow() {
setTimeout(() => {
// 用replace而不是push, 防止用户按返回键返回
router.replaceUrl({
url: 'pages/LoginPage'
})
}, 1000)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
setTimeout(() => {
// 用replace而不是push, 防止用户按返回键返回
router.replaceUrl({
url: 'pages/LoginPage'
})
}, 1000)
} | https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS | 64d77a217ced609dfdd44d601656f71fd258dc19 | github |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/database/EncryptedDB.ets | arkts | insertEvent | Insert event log into database (encrypted) | static insertEvent(
dbInsert: (row: EncryptedEventLogRow) => void,
log: PlainEventLog
): void {
const encryptedRow: EncryptedEventLogRow =
SecurityService.encryptLogFields(log)
dbInsert(encryptedRow)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left insertEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left dbInsert AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static insertEvent(
dbInsert: (row: EncryptedEventLogRow) => void,
log: PlainEventLog
): void {
const encryptedRow: EncryptedEventLogRow =
SecurityService.encryptLogFields(log)
dbInsert(encryptedRow)
} | https://gitcode.com/openharmony/codelabs | 606ba51e69aa46fe105ccca52df25b03f3ff4911 | gitcode |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/request/PageRequest.ets | arkts | constructor | @param {Partial<PageRequest>} init - 初始化数据 | constructor(init?: Partial<PageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.sort = init.sort ?? this.sort;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres... | constructor(init?: Partial<PageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.sort = init.sort ?? this.sort;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 921c0b9b50fa460ca08e4389ba07c0f8c486f71d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | detectKeyboardOrMouse | 检测是否有键盘或鼠标连接 | private async detectKeyboardOrMouse(): Promise<boolean> {
try {
const deviceIds = await inputDevice.getDeviceIds();
for (const id of deviceIds) {
const info = await inputDevice.getDeviceInfo(id);
const sources: inputDevice.SourceType[] = info.sources;
if (sources.includes('keyb... | 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 detectKeyboardOrMouse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async detectKeyboardOrMouse(): Promise<boolean> {
try {
const deviceIds = await inputDevice.getDeviceIds();
for (const id of deviceIds) {
const info = await inputDevice.getDeviceInfo(id);
const sources: inputDevice.SourceType[] = info.sources;
if (sources.includes('keyb... | https://github.com/AlkaidLab/moonlight-harmony | 8ecc9e5cd4d62ec9482fe192e2d1fc054042e29b | github |
openharmony-sig/arkcompiler_ets_frontend | arkoala-arkts/shopping/user/src/ets/pages/search/searchPage.ets | arkts | build | async onPortrait(mediaQueryResult: mediaQuery.MediaQueryResult) {
let result = mediaQueryResult.matches
if (result) {
this.width1 = 45
this.swiperWidth = 30
} else {
this.width1 = 100
this.swiperWidth = 60
}
} | build() {
NavDestination() {
Column() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image('/resources/icon/back.png')
.width(25 * this.ratio)
.aspectRatio(1)
.objectFit(ImageFit.Contain)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
NavDestination() {
Column() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image('/resources/icon/back.png')
.width(25 * this.ratio)
.aspectRatio(1)
.objectFit(ImageFit.Contain)
... | https://gitee.com/openharmony-sig/arkcompiler_ets_frontend.git | 0e80c1182d8dcf75c849b097b1c54fd131a7811d | gitee |
smarthane/DrawerLayout | DrawerLayout/src/main/ets/components/DrawerLayout.ets | arkts | toVp | 转换VP
@param width
@param dpi
@returns | public static toVp(width: number, dpi?: number): number {
let displayObject = display.getDefaultDisplaySync();
let screenDensityDPI = displayObject.densityDPI;
return width * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left toVp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#i... | public static toVp(width: number, dpi?: number): number {
let displayObject = display.getDefaultDisplaySync();
let screenDensityDPI = displayObject.densityDPI;
return width * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI);
} | https://github.com/smarthane/DrawerLayout | 9a73de8d832ceb6dcbe92c5a8b3ee0e2e164e996 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateBuilder.ets | arkts | buildAndAdd | 构建并添加到分组
@returns 构建完成并添加到分组的KdbxEntry | buildAndAdd(): KdbxEntry {
const entry = this.build();
// KdbxEntry.create已经将条目添加到分组,所以这里不需要再次添加
return entry;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildAndAdd 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 KdbxEntry AST#identifier#Right AST#ERROR#Right AST... | buildAndAdd(): KdbxEntry {
const entry = this.build();
// KdbxEntry.create已经将条目添加到分组,所以这里不需要再次添加
return entry;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L292-L296 | 8f367431894227d1adc8098b42be99cfa987a1ea | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getGlobalState | 获取全局字体状态 | public static getGlobalState(): FontAwareState {
return FontAwareHelper.globalState;
} | 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 getGlobalState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getGlobalState(): FontAwareState {
return FontAwareHelper.globalState;
} | https://github.com/DaLongZhuaZi/manxia | d62fd4fa683962d9e2e69b5ed0473cb09c453966 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test36_original_index.ets | arkts | seasonMonth | === Round 36: Switch with multiple cases, enum-const pattern,
arithmetic expression chains, string parsing/validation,
flatten nested array (manual), regex-free pattern matching ===
--- Switch with grouped cases --- | function seasonMonth(month: number): string {
if (month === 3 || month === 4 || month === 5) {
return 'spring';
}
if (month === 6 || month === 7 || month === 8) {
return 'summer';
}
if (month === 9 || month === 10 || month === 11) {
return 'autumn';
}
if (month === 12 || month === 1 || month =... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left seasonMonth AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left month AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function seasonMonth(month: number): string {
if (month === 3 || month === 4 || month === 5) {
return 'spring';
}
if (month === 6 || month === 7 || month === 8) {
return 'summer';
}
if (month === 9 || month === 10 || month === 11) {
return 'autumn';
}
if (month === 12 || month === 1 || month =... | https://github.com/miaochiahao/ark-ghidra | 7de0ad4dc3847118028cf536f02acd68e7847dda | github |
openharmony/applications_contacts | feature/phonenumber/src/main/ets/MmsService.ets | arkts | jumpToMms | Switching to the SMS app | private static jumpToMms(params:SendMessageParams[]) {
let actionData: Record<string, string> = {};
actionData.contactObjects = JSON.stringify(params);
actionData.pageFlag = 'conversation';
let str : LooseObject = {
bundleName: MMS_BUNDLE_NAME,
abilityName: MMS_ABILITY_NAME,
paramete... | 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 jumpToMms AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : A... | private static jumpToMms(params:SendMessageParams[]) {
let actionData: Record<string, string> = {};
actionData.contactObjects = JSON.stringify(params);
actionData.pageFlag = 'conversation';
let str : LooseObject = {
bundleName: MMS_BUNDLE_NAME,
abilityName: MMS_ABILITY_NAME,
paramete... | https://gitee.com/openharmony/applications_contacts.git | 40983d799e8a0a374ed10eaf0564a7db54741291 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.