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
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
getNode
Gets the node at the specified index. @param index The index of the node to get. @returns The node at the specified index, or undefined if the index is out of range.
private getNode(index: int): ListNode<T> | undefined { if (index >= 0 && index < this.elementNum) { let currentNode: ListNode<T>; if (index < this.elementNum / 2) { currentNode = this.head!; for (let i = 0; i < index; i++) { current...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R...
private getNode(index: int): ListNode<T> | undefined { if (index >= 0 && index < this.elementNum) { let currentNode: ListNode<T>; if (index < this.elementNum / 2) { currentNode = this.head!; for (let i = 0; i < index; i++) { current...
https://gitcode.com/iop123123/arkts-static-skills
77e439f7b10c2660a1b9ba8eb7d1a816a6a7fa9f
gitcode
fbinba3955/Flymby
common/src/main/ets/video/VideoPlayerView.ets
arkts
changeScreenMode
切换屏幕模式
changeScreenMode(): void { try { if (this.screenMode === window.Orientation.USER_ROTATION_LANDSCAPE) { this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); } else if (this.screenMode === window.Orientation.USER_ROTATION_PORTRAIT) { this.setOrientation(window.Orientation.USER...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left changeScreenMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
changeScreenMode(): void { try { if (this.screenMode === window.Orientation.USER_ROTATION_LANDSCAPE) { this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); } else if (this.screenMode === window.Orientation.USER_ROTATION_PORTRAIT) { this.setOrientation(window.Orientation.USER...
https://github.com/fbinba3955/Flymby
dc0cfe8c4246f919a9bea631da7e66ecbd833eb7
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/PronunciationService.ets
arkts
dispose
Shut the engine down. Idempotent — subsequent speak() is a no-op.
dispose(): void { this.disposed = true; const engine: textToSpeech.TextToSpeechEngine | undefined = this.engine; this.engine = undefined; this.initialized = false; if (engine !== undefined) { try { engine.stop(); engine.shutdown(); } catch (err) { console.error(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dispose 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...
dispose(): void { this.disposed = true; const engine: textToSpeech.TextToSpeechEngine | undefined = this.engine; this.engine = undefined; this.initialized = false; if (engine !== undefined) { try { engine.stop(); engine.shutdown(); } catch (err) { console.error(...
https://github.com/terryma2024/happyword
98b5baba3716426d52674542365baa2c6b7505af
github
openharmony/arkui_ace_engine
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
makeNumeric
Returns a segment representing the given string of decimal digits encoded in numeric mode.
public static makeNumeric(digits: string): QrSegment { if (!QrSegment.isNumeric(digits)) { throw new RangeError("String contains non-numeric characters"); } let bb: Array<bit> = [] for (let i = 0; i < digits.length;) { // Consume up to 3 digits per iteration const n...
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 makeNumeric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left digits AST#identifier#Right AST#:#Left : AS...
public static makeNumeric(digits: string): QrSegment { if (!QrSegment.isNumeric(digits)) { throw new RangeError("String contains non-numeric characters"); } let bb: Array<bit> = [] for (let i = 0; i < digits.length;) { // Consume up to 3 digits per iteration const n...
https://gitee.com/openharmony/arkui_ace_engine.git
130facbbd737dbb3efea64fd5f0497fd548d5424
gitee
HateCodingHateCoding/Bullying-detection-system-v2-public
frontend/AnQ/entry/src/main/ets/pages/PageOne.ets
arkts
aboutToAppear
页面显示时初始化
aboutToAppear() { console.info('PageOne页面显示,当前警情状态:', this.hasAlert, this.alertData); if (this.hasAlert && this.alertData) { // 有真实警情,初始化处理状态 this.accepted = false; this.completed = false; this.currentStep = 1; this.sliderValue = 0; // 从AppStorage加载记录 this.records =...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { console.info('PageOne页面显示,当前警情状态:', this.hasAlert, this.alertData); if (this.hasAlert && this.alertData) { // 有真实警情,初始化处理状态 this.accepted = false; this.completed = false; this.currentStep = 1; this.sliderValue = 0; // 从AppStorage加载记录 this.records =...
https://github.com/HateCodingHateCoding/Bullying-detection-system-v2-public
c8364e09dc1710d821fe0422b5f675cd7a7bd4bf
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CoverCacheManager.ets
arkts
getTempManga
获取临时漫画信息
async getTempManga(sourceId: number, externalId: string): Promise<TempMangaInfo | null> { try { const id = `${sourceId}_${externalId}`; const sql = `SELECT * FROM temp_manga_info WHERE id = ?`; const records = await this.dbManager.querySql(sql, [id]); if (records && records.length >...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTempManga AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async getTempManga(sourceId: number, externalId: string): Promise<TempMangaInfo | null> { try { const id = `${sourceId}_${externalId}`; const sql = `SELECT * FROM temp_manga_info WHERE id = ?`; const records = await this.dbManager.querySql(sql, [id]); if (records && records.length >...
https://github.com/DaLongZhuaZi/manxia
d925caeae649003465362ec41b2495899104fddc
github
xiaofenger_705/protobuf-arkts-generator
test/Address.ets
arkts
clear
Clear all fields
clear(): this { this.street = '' this.city = '' this.zipCode = '' this.unknownFields.clear() return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear 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#this#Left this AST#this#Right AST#ERROR#Right AST#statement_block#Left A...
clear(): this { this.street = '' this.city = '' this.zipCode = '' this.unknownFields.clear() return this }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
f37c67576f6b8c0a8631867b922a13e337cdb386
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
fromObjects
Creates a DataFrame from an array of objects @param {Any[]} data - Array of objects to convert @static
public static fromObjects(...data: Any[]): void { const columns = new Set<string>(); const preparedInfo = new Array<Map<string, string>>(data.length, (i) => { let map = DataFrame.getObjectInfoForTable(data[i]); for (let key of map.keys()) { columns...
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 fromObjects AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#iden...
public static fromObjects(...data: Any[]): void { const columns = new Set<string>(); const preparedInfo = new Array<Map<string, string>>(data.length, (i) => { let map = DataFrame.getObjectInfoForTable(data[i]); for (let key of map.keys()) { columns...
https://gitcode.com/iop123123/arkts-static-skills
0ce06378cdc02ace302fe736314bad65ef79ee2b
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/hardware/facades/SensorManagerFacade.ets
arkts
stopAccelerometerListener
@ohos.permission ohos.permission.ACCELEROMETER
stopAccelerometerListener(): void { try { sensor.off(sensor.SensorId.ACCELEROMETER); logger.info(TAG, '已停止加速度传感器监听'); } catch (e) { logger.error(TAG, '停止加速度传感器失败: ' + e); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAccelerometerListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#st...
stopAccelerometerListener(): void { try { sensor.off(sensor.SensorId.ACCELEROMETER); logger.info(TAG, '已停止加速度传感器监听'); } catch (e) { logger.error(TAG, '停止加速度传感器失败: ' + e); } }
https://github.com/DaLongZhuaZi/NGF
cbdcca1f3f904811f92c8db936fd0a30496af817
github
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getSimilarShows
@summary Gets similar items. @param {LibraryApiGetSimilarShowsRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public async getSimilarShows(requestParameters: LibraryApiGetSimilarShowsRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Shows/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
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 getSimilarShows AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right A...
public async getSimilarShows(requestParameters: LibraryApiGetSimilarShowsRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Shows/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
8c009a37bce58bd09d628245c0079b924e037880
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/CustomWishlistFlow.ui.test.ets
arkts
ensureParentPin
Seed the parent PIN precondition directly. ConfigFlow owns coverage for the PIN setup UI; this suite exercises WishlistPage's PIN gate and custom-wish dialog, so using AppStorage keeps each case inside Hypium's 60s timeout without weakening the surface under test.
async function ensureParentPin(driver: Driver, pin: string): Promise<void> { try { const stored: GameConfig | undefined = AppStorage.get<GameConfig>(GAME_CONFIG_STORAGE_KEY); const next: GameConfig = cloneGameConfig(stored !== undefined ? stored : new GameConfig()); next.parentPin = pin; AppStor...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left ensureParentPin AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#t...
async function ensureParentPin(driver: Driver, pin: string): Promise<void> { try { const stored: GameConfig | undefined = AppStorage.get<GameConfig>(GAME_CONFIG_STORAGE_KEY); const next: GameConfig = cloneGameConfig(stored !== undefined ? stored : new GameConfig()); next.parentPin = pin; AppStor...
https://github.com/terryma2024/happyword
9b218589fb436e6ae7a7478059ff1d91ab650925
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
clearHistory
清空播放历史
clearHistory(): void { this.historyList = []; this.saveData(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearHistory 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...
clearHistory(): void { this.historyList = []; this.saveData(); }
https://github.com/cpdd5201314/harmonyOS-music-app
b90d78a3a310ab0d953de8f7680b1c281a078d9d
github
arkui-x/samples
CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
initSubWindow
创建并展示弹窗 @param { SubWindowParams } params - 页面显示的值 @param { Handler } handler - WindowStage对象
initSubWindow(handler: Handler, params: SubWindowParams): void { const windowStage = handler.windowStage; // 注册回调 this.subscribeCallback(); // 初始化参数 this.updateOrCreateParams(params); // 新建子窗口 this.createSubWindow(windowStage); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initSubWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left handler AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Handler AST#identifier#Right AST#,#Left...
initSubWindow(handler: Handler, params: SubWindowParams): void { const windowStage = handler.windowStage; // 注册回调 this.subscribeCallback(); // 初始化参数 this.updateOrCreateParams(params); // 新建子窗口 this.createSubWindow(windowStage); }
https://gitcode.com/arkui-x/samples
3d02b0e300eca4a757d533e4633b04a7bb1a1f9d
gitcode
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/HistoryManager.ets
arkts
saveSimpleHistory
保存基础评估器历史记录
static async saveSimpleHistory(context: Context, item: SimpleHistoryItem): Promise<void> { try { const prefs = await HistoryManager.getPreferences(context); // 读取现有历史记录 const historyStr = await prefs.get(HistoryManager.SIMPLE_HISTORY_KEY, '[]') as string; let history: SimpleHistoryI...
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 saveSimpleHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Lef...
static async saveSimpleHistory(context: Context, item: SimpleHistoryItem): Promise<void> { try { const prefs = await HistoryManager.getPreferences(context); // 读取现有历史记录 const historyStr = await prefs.get(HistoryManager.SIMPLE_HISTORY_KEY, '[]') as string; let history: SimpleHistoryI...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
27f15ce199ea6775bece98e977cda1d2542cdbdf
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/FileUtils.ets
arkts
persistPermission
持久化文件权限 @param path 文件路径 @returns 结果 @throws BusinessError
public static persistPermission(path: string, operationMode: fileShare.OperationMode): Promise<void> { if (!canIUse(FileUtils.FolderAuthorization)) { throw new Error('this api is not supported on this device'); } let policyInfo: fileShare.PolicyInfo = { uri: path, operationMode: operatio...
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 persistPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left ...
public static persistPermission(path: string, operationMode: fileShare.OperationMode): Promise<void> { if (!canIUse(FileUtils.FolderAuthorization)) { throw new Error('this api is not supported on this device'); } let policyInfo: fileShare.PolicyInfo = { uri: path, operationMode: operatio...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FileUtils.ets#L38-L48
5e11c0e904517c2c89d668cf9811aa87bfdb8304
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
parseUpdate
Parses a JSON string and populates the fields of an existing instance. Unlike parse<T>(json, type), this does NOT require a default constructor. Fields whose keys are absent from the JSON retain their current values on the instance (merge semantics). @param { string } json - JSON string to parse @param { T } instance -...
public static parseUpdate<T>(json: string, instance: T): T { return JSON.parseUpdate<T>(json, undefined, instance) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left parseUpdate AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right...
public static parseUpdate<T>(json: string, instance: T): T { return JSON.parseUpdate<T>(json, undefined, instance) }
https://gitcode.com/iop123123/arkts-static-skills
c077cf76322ec8e1f26c08aa9db10129b502559e
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/DeviceSensorService.ets
arkts
correctOrientation
根据设备方向校正传感器坐标轴 参照 Android ControllerHandler.createSensorListener 的方向校正逻辑 @param rawX 原始 X 值 @param rawY 原始 Y 值 @param rawZ 原始 Z 值 @returns 校正后的 [x, y, z]
private correctOrientation(rawX: number, rawY: number, rawZ: number): number[] { const rotation = this.getDeviceRotation(); let x: number, y: number, z: number; // HarmonyOS display.rotation 的旋转方向定义与 Android Surface.ROTATION_* 相反: // HarmonyOS rotation=1 (90°顺时针) 对应 Android ROTATION_270 // Harmon...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left correctOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rawX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private correctOrientation(rawX: number, rawY: number, rawZ: number): number[] { const rotation = this.getDeviceRotation(); let x: number, y: number, z: number; // HarmonyOS display.rotation 的旋转方向定义与 Android Surface.ROTATION_* 相反: // HarmonyOS rotation=1 (90°顺时针) 对应 Android ROTATION_270 // Harmon...
https://github.com/AlkaidLab/moonlight-harmony
54af5db7282c2c31a0d63ae955ff854a8f863b67
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/AnomalyDetectionService.ets
arkts
detectCategoryAnomaly
分类异常检测
private static async detectCategoryAnomaly( bill: Bill, userId: number, baseline: UserSpendingBaseline ): Promise<AnomalyDetectionResult> { try { // 获取该分类的历史平均消费 const categoryBills = await BillDAO.getByCategoryId(userId, bill.categoryId, 100); if (categoryBills.length < 3) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left detectCategoryAnomaly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifie...
private static async detectCategoryAnomaly( bill: Bill, userId: number, baseline: UserSpendingBaseline ): Promise<AnomalyDetectionResult> { try { // 获取该分类的历史平均消费 const categoryBills = await BillDAO.getByCategoryId(userId, bill.categoryId, 100); if (categoryBills.length < 3) { ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
e424f484efc7be1d43f258f16a5f4700cafa74dd
github
HarmonyOS_Samples/BestPracticeSnippets
AppDataSecurity/entry/src/main/ets/pages/Index.ets
arkts
EncryptData
[End generate_aes_key] [Start encrypt_data]
async function EncryptData(): Promise<void> { let encryptProperties = GetAesEncryptProperties(); let options: huks.HuksOptions = { properties: encryptProperties, inData: StringToUint8Array(plainText) }; await huks.initSession(aesKeyAlias, options) .then((data) => { handle = data.handle; }...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left EncryptData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#L...
async function EncryptData(): Promise<void> { let encryptProperties = GetAesEncryptProperties(); let options: huks.HuksOptions = { properties: encryptProperties, inData: StringToUint8Array(plainText) }; await huks.initSession(aesKeyAlias, options) .then((data) => { handle = data.handle; }...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
bdb02d336fc928c9f76d90b294ce88d39874d67e
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/RecentFilesService.ets
arkts
loadMostRecentFile
加载最近打开的文件 返回最近打开的第一个文件的参数,如果没有则返回null
public async loadMostRecentFile(): Promise<RecentFile | null> { try { const recentFiles = await this.getRecentFiles(); if (recentFiles.length === 0) { return null; } // 获取最近打开的第一个文件 const recentFile = recentFiles[0]; // 检查文件是否存在 const fileExists = await this.chec...
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 loadMostRecentFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public async loadMostRecentFile(): Promise<RecentFile | null> { try { const recentFiles = await this.getRecentFiles(); if (recentFiles.length === 0) { return null; } // 获取最近打开的第一个文件 const recentFile = recentFiles[0]; // 检查文件是否存在 const fileExists = await this.chec...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L224-L247
98f606e7c625e9bf8161d7ee80d13f31a6c020cc
github
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
initWithEmptyValue
初始化value
initWithEmptyValue(arr: IBestStringNumber[], children: IBestPickerOption[]){ if(children && children.length){ this.columns.push(children) arr.push(children[0].value) this.initWithEmptyValue(arr, children[0].children!) }else{ this.indexArr = Array(arr.length).fill(0) this.offsetList = Array(arr.lengt...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initWithEmptyValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifie...
initWithEmptyValue(arr: IBestStringNumber[], children: IBestPickerOption[]){ if(children && children.length){ this.columns.push(children) arr.push(children[0].value) this.initWithEmptyValue(arr, children[0].children!) }else{ this.indexArr = Array(arr.length).fill(0) this.offsetList = Array(arr.lengt...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L398-L408
ac5fef3d3a1d6f4ce6ce6c64000db4fa87089df2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
finally
Schedule callback to execute after the promise is completed @param [onFinally] callback that will be called after the promise is completed @returns { Promise } new promise that will be completed the same way as the current promise after the execution of the callback or rejected if the callback finished with an exceptio...
finally<U = T>(onFinally?: () => PromiseLike<U>|U): Promise<Awaited<T>> { let promise = new Promise<Awaited<T>>(); let fn: () => void = (): void => { try { let onFinallyResult: PromiseLike<U>|U; let onFinallyError: Error | undefined = undefined; ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left finally AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Right AST#binary_expression#Left AST#identifier#Left T AST#identifier#Right AST...
finally<U = T>(onFinally?: () => PromiseLike<U>|U): Promise<Awaited<T>> { let promise = new Promise<Awaited<T>>(); let fn: () => void = (): void => { try { let onFinallyResult: PromiseLike<U>|U; let onFinallyError: Error | undefined = undefined; ...
https://gitcode.com/iop123123/arkts-static-skills
c528ccdba97ef8339f8535731d943d72af31d7e6
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/TvShowsApi.ets
arkts
getNextUp
getNextUp @summary Gets a list of next up episodes. @param {TvShowsApiGetNextUpRequest} requestParameters Request parameters. @throws {RequiredError} @memberof TvShowsApi
public async getNextUp(requestParameters: TvShowsApiGetNextUpRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: "/Shows/NextUp", parameters: requestParameters}) }
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 getNextUp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#L...
public async getNextUp(requestParameters: TvShowsApiGetNextUpRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: "/Shows/NextUp", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
a81af885adc1396f2391804e630e6fddb3369012
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/pages/DiyCacheCountPage.ets
arkts
getState
获取当前播放状态函数
getState(): string { return this.avPlayer?.state ? this.avPlayer?.state : ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo...
getState(): string { return this.avPlayer?.state ? this.avPlayer?.state : ''; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
9f286843579fc01be490db24137543eafec654e5
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
add
Adds an element to the end of the list. @param element The element to add. @returns True if the element was added successfully.
public add(element: T): boolean { this.insert(this.elementNum, element); return true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
public add(element: T): boolean { this.insert(this.elementNum, element); return true; }
https://gitcode.com/iop123123/arkts-static-skills
44af6201c85c6d66532e5c9f69635d687bdad0cf
gitcode
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
setFloat32
Sets a float. @param byteOffset The byte offset. @param value The value. @param littleEndian If the value is little endian.
setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void { this.dataView?.setFloat32(byteOffset, value, littleEndian) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFloat32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#...
setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void { this.dataView?.setFloat32(byteOffset, value, littleEndian) }
https://gitee.com/openharmony-sig/flutter_engine.git
6a26a269b0357863450eb49efba4d7bdd1c820b9
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/Rect.ets
arkts
offsetTo
Offset the rectangle to a specific (left, top) position, keeping its width and height the same. @param newLeft The new "left" coordinate for the rectangle @param newTop The new "top" coordinate for the rectangle
public offsetTo(newLeft: number, newTop: number) { this.right += newLeft - this.left; this.bottom += newTop - this.top; this.left = newLeft; this.top = newTop; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left offsetTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newLeft AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right ...
public offsetTo(newLeft: number, newTop: number) { this.right += newLeft - this.left; this.bottom += newTop - this.top; this.left = newLeft; this.top = newTop; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f30e6a1969646dcf978bb3932c57f6a08bbd2be6
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/addition/addition_long.ets
arkts
main
--- desc: check addition of two long integers ---
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a + b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a + b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a934a770b981b247745a5819b0f77cd93f651e11
gitee
apap6628114/nga_oh
entry/src/main/ets/parser/nga/html-thread/DomMarkerExtractor.ets
arkts
extractPostDate
提取指定楼层的发帖时间字符串(已 trim)。 @param html 源 HTML @param lou 楼层号 @returns 发帖时间;未找到时返回空串
function extractPostDate(html: string, lou: number): string { const marker: string = `<span id='postdate${lou}'`; const startIdx: number = html.indexOf(marker); if (startIdx < 0) { return ''; } const tagEnd: number = html.indexOf('>', startIdx); if (tagEnd < 0) { return ''; } const contentStart:...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractPostDate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function extractPostDate(html: string, lou: number): string { const marker: string = `<span id='postdate${lou}'`; const startIdx: number = html.indexOf(marker); if (startIdx < 0) { return ''; } const tagEnd: number = html.indexOf('>', startIdx); if (tagEnd < 0) { return ''; } const contentStart:...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/nga/html-thread/DomMarkerExtractor.ets#L65-L81
1b5d6b7e492e9db839c54fb5a4ca5d4fd947e057
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EpubParser.ets
arkts
parse
解析EPUB文件
async parse(filePath: string): Promise<EBook> { try { logger.info(TAG, `开始解析EPUB文件: ${filePath}`); const metadata = await this.extractMetadata(filePath); const fileSize = this.getFileSize(filePath); const bookId = this.generateId(); // 创建占位符章节 const placeholderChapter: EBookC...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async parse(filePath: string): Promise<EBook> { try { logger.info(TAG, `开始解析EPUB文件: ${filePath}`); const metadata = await this.extractMetadata(filePath); const fileSize = this.getFileSize(filePath); const bookId = this.generateId(); // 创建占位符章节 const placeholderChapter: EBookC...
https://github.com/DaLongZhuaZi/manxia
fade3176a305566a67d5c089f8750e20e61079fb
github
openharmony/codelabs
Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
getDisZ
计算手指(即小圆)移动距离大圆圆心的距离
getDisZ() { // 小圆和大圆圆心 var centerX = this.startPosX + this.smallR + 60 var centerY = this.startPosY + this.smallR + 60 return Math.sqrt(Math.abs(this.curX - centerX) * Math.abs(this.curX - centerX) + Math.abs(this.curY - centerY) * Math.abs(this.curY - centerY)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisZ AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // 小圆和大圆圆心 AST#c...
getDisZ() { // 小圆和大圆圆心 var centerX = this.startPosX + this.smallR + 60 var centerY = this.startPosY + this.smallR + 60 return Math.sqrt(Math.abs(this.curX - centerX) * Math.abs(this.curX - centerX) + Math.abs(this.curY - centerY) * Math.abs(this.curY - centerY)); }
https://gitee.com/openharmony/codelabs.git
94aa4d184fa9e38d586c13e8715e718c2b59cb35
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoSourceParser.ets
arkts
parseExploreKinds
解析发现分类URL
parseExploreKinds(exploreUrl: string | undefined): LegadoExploreKind[] { if (!exploreUrl) { return []; } const kinds: LegadoExploreKind[] = []; const ruleStr = exploreUrl.trim(); // 检查是否为JSON格式 if (ruleStr.startsWith('[')) { try { const parsed: Object = SafeUtils.parseOb...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parseExploreKinds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left exploreUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
parseExploreKinds(exploreUrl: string | undefined): LegadoExploreKind[] { if (!exploreUrl) { return []; } const kinds: LegadoExploreKind[] = []; const ruleStr = exploreUrl.trim(); // 检查是否为JSON格式 if (ruleStr.startsWith('[')) { try { const parsed: Object = SafeUtils.parseOb...
https://github.com/DaLongZhuaZi/manxia
21d591269c8c04eda98b39e04396fd8c00cade78
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets
arkts
updateFoldPosture
外部注入折叠状态(如从 onConfigurationUpdate 回调中调用)
updateFoldPosture(posture: FoldPosture): void { if (this.cachedFoldPosture !== posture) { this.cachedFoldPosture = posture hilog.info(DOMAIN, TAG, `FoldPosture updated: ${posture}`) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateFoldPosture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left posture AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FoldPosture AST#identifier#Right AS...
updateFoldPosture(posture: FoldPosture): void { if (this.cachedFoldPosture !== posture) { this.cachedFoldPosture = posture hilog.info(DOMAIN, TAG, `FoldPosture updated: ${posture}`) } }
https://github.com/Xiwei753/xiezuoruanjian
8d54e9673f53f0b9623b9060c98677e52959ef6d
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LineScatterCandleRadarRenderer.ets
arkts
drawHighlightLines
Draws vertical & horizontal highlight-lines if enabled. @param c @param x x-position of the highlight line intersection @param y y-position of the highlight line intersection @param set the currently drawn dataset
protected drawHighlightLines(x: number, y: number, dataSet: ILineScatterCandleRadarDataSet<any>): Paint[] { let pathPaints: Paint[] = []; // set color and stroke-width this.mHighlightPaint.setColor(dataSet.getHighLightColor()); this.mHighlightPaint.setStrokeWidth(dataSet.getHighlightLineWidth()); ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawHighlightLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
protected drawHighlightLines(x: number, y: number, dataSet: ILineScatterCandleRadarDataSet<any>): Paint[] { let pathPaints: Paint[] = []; // set color and stroke-width this.mHighlightPaint.setColor(dataSet.getHighLightColor()); this.mHighlightPaint.setStrokeWidth(dataSet.getHighlightLineWidth()); ...
https://gitee.com/openharmony/developtools_profiler.git
68392bcb53c0dde884ea99a4d26cfda03ac15480
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
toFixed
toFixed(double) returns std.core.String representing the underlying double using fixed-point notation @param { double } [ d ] @returns { String } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toFixed(d?: double): String { if (d == undefined) { return this.toFixedImpl(0) } return this.toFixedImpl(d) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toFixed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
public toFixed(d?: double): String { if (d == undefined) { return this.toFixedImpl(0) } return this.toFixedImpl(d) }
https://gitcode.com/iop123123/arkts-static-skills
5bb173a9a756c0b50b6dcb7752f87458e9e5f974
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
getCachedRomFile
获取缓存的 ROM 文件路径 @param romUri ROM 的 URI(用于生成哈希) @param forUse 是否用于使用(会更新最后修改时间) @returns 缓存文件路径,如果不存在则返回 null
getCachedRomFile(romUri: string, forUse: boolean = false): string | null { const romHash = this.hashCode(romUri).toString(); const cacheDir = this.getCacheDir(); if (!cacheDir) { return null; } try { const stat = fileIo.statSync(cacheDir); if (!stat.isDirectory()) { ret...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCachedRomFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left romUri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
getCachedRomFile(romUri: string, forUse: boolean = false): string | null { const romHash = this.hashCode(romUri).toString(); const cacheDir = this.getCacheDir(); if (!cacheDir) { return null; } try { const stat = fileIo.statSync(cacheDir); if (!stat.isDirectory()) { ret...
https://github.com/richshaw2015/nds
771e328bcf2de57da966fce33f3e42e4cbbf823a
github
kumaleap/ArkSwipeDeck
library/src/main/ets/utils/GestureUtils.ets
arkts
createTapGesture
创建点击手势处理器 @param onClick - 点击回调 @returns 点击手势处理器
static createTapGesture(onClick: () => void): TapGestureInterface { hilog.debug(0x0000, TAG, 'GestureUtils.createTapGesture: 创建点击手势'); return TapGesture({ count: 1 }) .onAction((): void => { hilog.debug(0x0000, TAG, 'TapGesture.onAction: 点击触发'); onClick(); }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left createTapGesture AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left onClick AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#argu...
static createTapGesture(onClick: () => void): TapGestureInterface { hilog.debug(0x0000, TAG, 'GestureUtils.createTapGesture: 创建点击手势'); return TapGesture({ count: 1 }) .onAction((): void => { hilog.debug(0x0000, TAG, 'TapGesture.onAction: 点击触发'); onClick(); }); }
https://github.com/kumaleap/ArkSwipeDeck
4302603150f03ded07988c0ac7794be30ec2b9f8
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
onRequestSuccess
请求成功回调 @param {ConfirmOrder} data - 确认订单数据 @returns {void} 无返回值
protected onRequestSuccess(data: ConfirmOrder): void { const normalizedData: ConfirmOrder = new ConfirmOrder(data); super.onRequestSuccess(normalizedData); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left onRequestSuccess 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#identi...
protected onRequestSuccess(data: ConfirmOrder): void { const normalizedData: ConfirmOrder = new ConfirmOrder(data); super.onRequestSuccess(normalizedData); }
https://github.com/Joker-x-dev/CoolMallArkTS
a8eec47a039856848f6fa997f89d959494cdeab7
github
ZHCOOL520/HarmonyOS-AUTOcall
entry/src/main/ets/utils/AutoCallUtils.ets
arkts
hasVoiceCapability
检查设备是否支持语音功能
static hasVoiceCapability(): boolean { try { return call.hasVoiceCapability(); } catch (err) { console.error(`检查语音功能失败: ${JSON.stringify(err)}`); return false; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasVoiceCapability 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 boolea...
static hasVoiceCapability(): boolean { try { return call.hasVoiceCapability(); } catch (err) { console.error(`检查语音功能失败: ${JSON.stringify(err)}`); return false; } }
https://github.com/ZHCOOL520/HarmonyOS-AUTOcall
bb531c2743134930a9c9f4a1c2bed97781b3ae4b
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/Constituency-12-smarthome/entry/src/main/ets/pages/Login.ets
arkts
inputStyle
输入框的通用样式;用@Extend拓展原生组件, 用法如@Extend(UIComponentName) function functionName { ... } UIComponentName表示原生组件,如Text、Button... functionName为样式函数名
@Extend(TextInput) function inputStyle() {.height(45).fontSize(20).backgroundColor('#00000000').width('50%')}
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left TextInput AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express...
@Extend(TextInput) function inputStyle() {.height(45).fontSize(20).backgroundColor('#00000000').width('50%')}
https://gitee.com/openharmony/vendor_unionman.git
f748771fa260ac96f3c92ea545d24f6650f2b545
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
on
Registering Event Messages. @param { string } event - Registering Events. @param { Function } callback - Event callback. @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
on(event: string, callback: Function): void { if (!this.isInitialized) { this.isInitialized = true; this.doInitialize((...data: Object[]): void => {}); } if (!this.callbacks.has(event)) { const callbackList = new Array<Function...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left on AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right...
on(event: string, callback: Function): void { if (!this.isInitialized) { this.isInitialized = true; this.doInitialize((...data: Object[]): void => {}); } if (!this.callbacks.has(event)) { const callbackList = new Array<Function...
https://gitcode.com/iop123123/arkts-static-skills
7744ad16ea361851a90e130c4c9f6e315e3edd6a
gitcode
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/bridge/NativeWriterCoreBridge.ets
arkts
loadSyncConfig
── Sync ──
async loadSyncConfig(): Promise<ResultEnvelope<SyncConfig>> { try { const jsonStr: string = this.getNativeModule().nativeLoadSyncConfig() return this.parseEnvelope<SyncConfig>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_error', message...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadSyncConfig AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async loadSyncConfig(): Promise<ResultEnvelope<SyncConfig>> { try { const jsonStr: string = this.getNativeModule().nativeLoadSyncConfig() return this.parseEnvelope<SyncConfig>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_error', message...
https://github.com/Xiwei753/xiezuoruanjian
da1bf0ca8cf5d81c53d908928b7201ca8adb56a5
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/InputInterceptorService.ets
arkts
stop
停止鼠标拦截器
stop(): void { if (!this.active || !this.native) return; this.native.removeMouseInterceptor(); this.active = false; console.info('MouseInterceptor: 鼠标拦截器已停止'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop 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#{#Left { AST#{#Right AST#property_ident...
stop(): void { if (!this.active || !this.native) return; this.native.removeMouseInterceptor(); this.active = false; console.info('MouseInterceptor: 鼠标拦截器已停止'); }
https://github.com/AlkaidLab/moonlight-harmony
0fa79b38ad5e7b5d154ce649d5de3290d76bc374
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/SourceContentCache.ets
arkts
saveCacheToStorage
保存缓存到存储
private async saveCacheToStorage(): Promise<void> { try { const dataPreferences = await preferences.getPreferences(this.getAbilityContext(), 'source_content_cache'); // 转换Map为普通对象 const cacheData: Record<string, CachedContent> = {}; this.cacheMap.forEach((value, key) => { ca...
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 saveCacheToStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async saveCacheToStorage(): Promise<void> { try { const dataPreferences = await preferences.getPreferences(this.getAbilityContext(), 'source_content_cache'); // 转换Map为普通对象 const cacheData: Record<string, CachedContent> = {}; this.cacheMap.forEach((value, key) => { ca...
https://github.com/DaLongZhuaZi/manxia
d70f9778d1c18a7c47c7f6ac6e48bc0efd5f92ff
github
who7708/harmonyos-codelabs
HmosWorld/features/discover/src/main/ets/model/DiscoverModel.ets
arkts
setCollectionCount
Set collection count of feed or article through public event parameters @param eventData
setCollectionCount(eventData: ActionEventData): void { if (eventData.resourceType === ResourcesType.FEED) { this.hotFeedList.forEach((res: LearningResource) => { if (res.id === eventData.resourceId) { res.collectionCount += eventData.actionValue ? 1 : -1; } }); } if (...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCollectionCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ActionEventData AST#identifier#R...
setCollectionCount(eventData: ActionEventData): void { if (eventData.resourceType === ResourcesType.FEED) { this.hotFeedList.forEach((res: LearningResource) => { if (res.id === eventData.resourceId) { res.collectionCount += eventData.actionValue ? 1 : -1; } }); } if (...
https://github.com/who7708/harmonyos-codelabs
416d4f7284ae9904c4fd8d8bc543c8999215a2fb
github
openharmony-sig/shimmer-ohos
library/src/main/ets/components/MainPage/Shimmer.ets
arkts
setTilt
Sets the tilt angle of the shimmer in degrees.
setTilt(tilt: number): Shimmer { this.tilt = tilt return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTilt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tilt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#R...
setTilt(tilt: number): Shimmer { this.tilt = tilt return this }
https://gitee.com/openharmony-sig/shimmer-ohos.git
e6fe638119c61485b387b4c63517328ce6979652
gitee
arkui-x/samples
CodeLab/Cases/feature/danmakuplayer/src/main/ets/view/VideoView.ets
arkts
onPageHide
页面隐藏时播放暂停
onPageHide() { const player: BaseVideoPlayer = GlobalContext.getContext().getObject('currentPlayer') as BaseVideoPlayer; if (!player) { return; } player.pause(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageHide 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...
onPageHide() { const player: BaseVideoPlayer = GlobalContext.getContext().getObject('currentPlayer') as BaseVideoPlayer; if (!player) { return; } player.pause(); }
https://gitcode.com/arkui-x/samples
325ed03525bdb5da2054dbd14d005e5644cb0d05
gitcode
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
getUserInfo
获取用户信息 @returns {User} 用户信息
getUserInfo(): User { return this.userState.getUserInfo(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserInfo 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 User AST#identifier#Right AST#ERROR#Right AST#stat...
getUserInfo(): User { return this.userState.getUserInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS
04a6fdcd2dfb8cdc691e621d663096396d160b5a
github
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/FriendHandler.ets
arkts
getFriends
获取我的好友列表(关联 User 表查询头像和昵称)
async getFriends(myPhone: string): Promise<UserModel[]> { if (!this.store) { return []; } // 从 Friend 表找到我所有的好友手机号 let predicates = new relationalStore.RdbPredicates('Friend'); predicates.equalTo('myPhone', myPhone); let friendPhones: string[] = []; try { let resultSet = awai...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getFriends AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left myPhone AST#identifier#Right AST#t...
async getFriends(myPhone: string): Promise<UserModel[]> { if (!this.store) { return []; } // 从 Friend 表找到我所有的好友手机号 let predicates = new relationalStore.RdbPredicates('Friend'); predicates.equalTo('myPhone', myPhone); let friendPhones: string[] = []; try { let resultSet = awai...
https://gitcode.com/openharmony/codelabs
114ee35ee852e96f59e06200acb4c02e73ff7c9d
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
toLocaleString
Gets a string with a language-sensitive representation of this date with respect to locale. @param locale @returns a language-sensitive representation of this date.
public toLocaleString(locale: String): String { return Date.getLocaleString("%Ex %EX", locale, this.ms, false); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public toLocaleString(locale: String): String { return Date.getLocaleString("%Ex %EX", locale, this.ms, false); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4ac9abfad3ab5c2c7e0fe8a410b3adbf49208998
gitee
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/SearchHistoryManager.ets
arkts
exportSearchHistory
导出搜索历史数据
static async exportSearchHistory(): Promise<string> { try { const records = await SearchHistoryManager.getSearchHistory() const statistics = await SearchHistoryManager.getSearchStatistics() const exportData: ExportData = { exportTime: new Date().toISOString(), version: '1.0', ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left exportSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
static async exportSearchHistory(): Promise<string> { try { const records = await SearchHistoryManager.getSearchHistory() const statistics = await SearchHistoryManager.getSearchStatistics() const exportData: ExportData = { exportTime: new Date().toISOString(), version: '1.0', ...
https://github.com/cpdd5201314/harmonyOS-music-app
288f29af7a7d87f4f98820e40c618fe024a8e609
github
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/toast/ToastUtils.ets
arkts
hide
隐藏 Toast @returns {void} 无返回值
static hide(): void { IBestToast.hide(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left hide AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
static hide(): void { IBestToast.hide(); }
https://github.com/Joker-x-dev/CoolMallArkTS
c38b4d7cf10ccb9027350b250bd62e6eb923539d
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningRecordService.ets
arkts
generateSessionId
生成会话ID @returns 唯一ID
static generateSessionId(): string { return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateSessionId 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 A...
static generateSessionId(): string { return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
https://github.com/the-wwyang/kids-learning-app
d60b1c51d752dbaf2b69883fdd7e0f2ef63a3a2a
github
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxFileManager.ets
arkts
of
创建一个KDBX文件管理器实例 @param locationInfo 文件位置信息 @return KDBX文件管理器实例
public static of(locationInfo: LocationInfo) { return new KdbxFileManager(locationInfo.storageType, locationInfo.storageConfig); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locationInfo A...
public static of(locationInfo: LocationInfo) { return new KdbxFileManager(locationInfo.storageType, locationInfo.storageConfig); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxFileManager.ets#L33-L35
1ea97b4d52f3df43efa2d7a884df6dfb37b47ea2
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/AppTypeUtil.ets
arkts
isPcApp
Check is pc app type. @returns
static isPcApp(): boolean { const type = AppTypeUtil.getAppType(); return type === AppType.PC; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isPcApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boole...
static isPcApp(): boolean { const type = AppTypeUtil.getAppType(); return type === AppType.PC; }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
4e03e96091ad1a04e73e0350b4c11cd3d2507b0b
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
constructor
Creates a new IntBox instance with the specified initial value. @param { int } value - The initial int value to be wrapped @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(value: int) { this.value = value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public constructor(value: int) { this.value = value; }
https://gitcode.com/iop123123/arkts-static-skills
f3805e1c7fca49933aa1ed076797a9176435d049
gitcode
openharmony/applications_mms
entry/src/main/ets/utils/MmsDatabaseHelper.ets
arkts
query
Query Interface @param predicates Search criteria @return
async query(predicates) { if (this.mRdbStore !== null) { return await this.mRdbStore.query(predicates); } else { HiLog.w(TAG, 'mRdbStore is null, query fail.'); return null; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left predicates AST#identifier#Right AST#)#Left ) AST#)#Right AS...
async query(predicates) { if (this.mRdbStore !== null) { return await this.mRdbStore.query(predicates); } else { HiLog.w(TAG, 'mRdbStore is null, query fail.'); return null; } }
https://gitee.com/openharmony/applications_mms.git
716f7708c9ac28c0dd48024755bd647c31e4d848
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
updateUserTemplate
更新用户模板
updateUserTemplate( template: IUserTemplate, sourceEntry: KdbxEntry, kdbx: Kdbx ): IUserTemplate | null { try { const templateGroup = this.getTemplatesGroup(kdbx); if (!templateGroup) { return null; } // 查找现有模板条目 const existingEntry = this.findEntryByUuid(templ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left updateUserTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
updateUserTemplate( template: IUserTemplate, sourceEntry: KdbxEntry, kdbx: Kdbx ): IUserTemplate | null { try { const templateGroup = this.getTemplatesGroup(kdbx); if (!templateGroup) { return null; } // 查找现有模板条目 const existingEntry = this.findEntryByUuid(templ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L243-L281
1ef82cbbed6fada6b68c2b7584ba904463b682f9
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WordRepository.ets
arkts
size
In-memory size. Zero until `loadFromRawfile` or `setEntries` is called.
size(): number { return this.entries.length; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left size AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block#L...
size(): number { return this.entries.length; }
https://github.com/terryma2024/happyword
6caedef08d97c9dd7b92b9b200a3b27c05d34f69
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/AxisRenderer.ets
arkts
computeAxisValues
Sets up the axis values. Computes the desired number of labels between the two given extremes. @return
protected computeAxisValues(min: number, max: number, customYAxisLabels?: number[]) { let yMin = min; let yMax = max; if (this.mAxis) { let labelCount = this.mAxis.getLabelCount(); let range = Math.abs(yMax - yMin); if (labelCount == 0 || range <= 0 || range == Number.POSITIVE_INFINITY...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left computeAxisValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left min AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
protected computeAxisValues(min: number, max: number, customYAxisLabels?: number[]) { let yMin = min; let yMax = max; if (this.mAxis) { let labelCount = this.mAxis.getLabelCount(); let range = Math.abs(yMax - yMin); if (labelCount == 0 || range <= 0 || range == Number.POSITIVE_INFINITY...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a4b1a5134b7429a78593e29eda0aa4b1a43173b4
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupDiagnostics.ets
arkts
startMonitoring
开始监控启动流程
public startMonitoring(): void { if (this.isMonitoring) { logger.warn('StartupDiagnostics', '⚠️ 启动监控已在进行中'); return; } this.isMonitoring = true; this.startupStartTime = Date.now(); this.phases.clear(); logger.startup('StartupDiagnostics', '开始监控应用启动流程'); logger.performance...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startMonitoring AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres...
public startMonitoring(): void { if (this.isMonitoring) { logger.warn('StartupDiagnostics', '⚠️ 启动监控已在进行中'); return; } this.isMonitoring = true; this.startupStartTime = Date.now(); this.phases.clear(); logger.startup('StartupDiagnostics', '开始监控应用启动流程'); logger.performance...
https://github.com/DaLongZhuaZi/manxia
a3cb022b6d9f237aeae67b86bef1c82c6d931bed
github
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets
arkts
getReferenceLineBol
参考线持久化,再次进入,确定开关是否开启
getReferenceLineBol(bol: boolean): void { let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig; cameraConfig.referenceLineBol = bol; GlobalContext.get().setObject('cameraConfig', cameraConfig); this.referenceLineBol = bol; }
AST#program#Left AST#ERROR#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#Right AST#)#Le...
getReferenceLineBol(bol: boolean): void { let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig; cameraConfig.referenceLineBol = bol; GlobalContext.get().setObject('cameraConfig', cameraConfig); this.referenceLineBol = bol; }
https://gitee.com/openharmony/multimedia_camera_framework.git
b5785d6d4b90c7b82617c8e62eb987370d25f42d
gitee
HarmonyCandies/image_cropper
image_cropper/src/main/ets/common/ImageCropperLayerPainter.ets
arkts
paint
/ Paint the entire crop layer, including mask, lines, and corners / The rect may be bigger than size when we rotate crop rect. / Adjust the rect to ensure the mask covers the whole area after rotation
public paint( config: ImageCropperLayerPainterConfig ): void { // Draw the mask layer this.paintMask(config); // Draw the grid lines this.paintLines(config); // Draw the corners of the crop area this.paintCorners(config); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left paint AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#E...
public paint( config: ImageCropperLayerPainterConfig ): void { // Draw the mask layer this.paintMask(config); // Draw the grid lines this.paintLines(config); // Draw the corners of the crop area this.paintCorners(config); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/common/ImageCropperLayerPainter.ets#L7-L19
61c7031499e354e8317e8f6a6182f22e74f95e19
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SharedLedger.ets
arkts
incrementVersion
增加版本号(乐观锁)
incrementVersion(): void { this.version += 1; this.updatedAt = new Date().toISOString(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left incrementVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
incrementVersion(): void { this.version += 1; this.updatedAt = new Date().toISOString(); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
399ac2ff641799f4eeac222ae1f14f20f752722b
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/UserListViewModel.ets
arkts
onUser
项目的点击事件
onUser(user: UserLite) { console.info('UserListViewModel: onUser') //打开对于用户的profile页面 router.push({ url: 'pages/profile/profile', params: { profileType: ProfileType.Other.valueOf(), path: user.path } }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UserLite AST#identifier#Right AST#...
onUser(user: UserLite) { console.info('UserListViewModel: onUser') //打开对于用户的profile页面 router.push({ url: 'pages/profile/profile', params: { profileType: ProfileType.Other.valueOf(), path: user.path } }) }
https://gitee.com/openharmony-sig/online_event.git
30ec7f5f45cb331ef05015d401421502bd12333b
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
constructor
constructor @syscap SystemCapability.Utils.Lang @FaAndStageModel
private constructor() { super(TypeAPI.getTypeDescriptor(null), getBootRuntimeLinker()) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private constructor() { super(TypeAPI.getTypeDescriptor(null), getBootRuntimeLinker()) }
https://gitcode.com/iop123123/arkts-static-skills
80f8761756ceb4f3950266d639a91b9079187739
gitcode
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/Logger.ets
arkts
setFileLoggingEnabled
... (init method remains same) 设置是否启用文件日志
static setFileLoggingEnabled(enable: boolean) { Logger.isFileEnabled = enable; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setFileLoggingEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
static setFileLoggingEnabled(enable: boolean) { Logger.isFileEnabled = enable; }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
91886646e7570a87dc0d79a9b1fc5d5a07628d20
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/model/CardComponentDataModel.ets
arkts
getComponentData
获取组件数据 @param currentPage 当前页 @param pageSize 每页上的资源数据数量 @returns Promise<ResponseModel<ComponentModel>>
public getComponentData(currentPage: number, pageSize: number): Promise<ResponseModel<ComponentModel>> { return this.service.getComponentDataByPreference(currentPage, pageSize) .then((data: ResponseModel<ComponentModel>) => { return data }).catch((error: string) => { Logger.error(TAG, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n...
public getComponentData(currentPage: number, pageSize: number): Promise<ResponseModel<ComponentModel>> { return this.service.getComponentDataByPreference(currentPage, pageSize) .then((data: ResponseModel<ComponentModel>) => { return data }).catch((error: string) => { Logger.error(TAG, ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
d0171434ed007f50f2660a0cf04f53be2218bad8
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
forEach
Applies a function over all elements of Int8Array @param fn function to apply @returns undefined
public forEach(fn: (val: byte) => byte): void { let newF: (val: byte, index: int, array: Int8Array) => byte = (val: byte, index: int, array: Int8Array): byte => { return fn(val) } this.forEach(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
public forEach(fn: (val: byte) => byte): void { let newF: (val: byte, index: int, array: Int8Array) => byte = (val: byte, index: int, array: Int8Array): byte => { return fn(val) } this.forEach(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
63e6f3c825a7578848352aa6b64f49b1ba447880
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
getString
从ResultSet中安全获取String值 @param resultSet 结果集 @param columnName 列名 @param defaultValue 默认值 @returns String值
static getString(resultSet: relationalStore.ResultSet, columnName: string, defaultValue: string = ''): string { try { const index = resultSet.getColumnIndex(columnName); return resultSet.getString(index); } catch (error) { console.warn(`[DAOHelper] 获取String值失败: ${columnName}`, error); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression...
static getString(resultSet: relationalStore.ResultSet, columnName: string, defaultValue: string = ''): string { try { const index = resultSet.getColumnIndex(columnName); return resultSet.getString(index); } catch (error) { console.warn(`[DAOHelper] 获取String值失败: ${columnName}`, error); ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
729809d271f11508ce32b247f45ffc7f10ddd836
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/AuthenticationHandler.ets
arkts
getStoredToken
获取存储的令牌
async getStoredToken(): Promise<string | null> { try { await this.initPreferences(); if (!this.preferencesStore) { return null; } const key = this.getTokenKey(); const token = await this.preferencesStore.get(key, '') as string; return token || null; } catch (error)...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getStoredToken AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async getStoredToken(): Promise<string | null> { try { await this.initPreferences(); if (!this.preferencesStore) { return null; } const key = this.getTokenKey(); const token = await this.preferencesStore.get(key, '') as string; return token || null; } catch (error)...
https://github.com/DaLongZhuaZi/manxia
88358cc4891872cc242b51909c1fe3e3e7fc3ba5
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
getGameProfileName
── 游戏→配置自动关联 ── 获取游戏关联的配置名称。 @returns 配置名称,未关联则返回 null
static async getGameProfileName(appId: number): Promise<string | null> { await CustomKeyStore.ensureInit(); const name = CustomKeyStore.gameProfiles?.[String(appId)]; if (!name) return null; // 验证配置仍然存在 if (!CustomKeyStore.profiles!.find(p => p.name === name)) { CustomKeyStore.gameProfiles![...
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 getGameProfileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appId AST#identifier#Right AST#:#Left...
static async getGameProfileName(appId: number): Promise<string | null> { await CustomKeyStore.ensureInit(); const name = CustomKeyStore.gameProfiles?.[String(appId)]; if (!name) return null; // 验证配置仍然存在 if (!CustomKeyStore.profiles!.find(p => p.name === name)) { CustomKeyStore.gameProfiles![...
https://github.com/AlkaidLab/moonlight-harmony
a2a113292a1e3dd1e3280d14e3aeff438ffc8e60
github
HarmonyOS_Samples/BestPracticeSnippets
PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/LowPower_Animate_Example.ets
arkts
build
初始状态置为false
build() { Column() { Button('change size') .width(this.widthSize) .height(this.heightSize) .margin(30) .onClick(() => { if (this.flag && this.isVisble) { // 建议使用this.getUIContext()?.animateTo() this.getUIContext()?.animateTo({ d...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { Button('change size') .width(this.widthSize) .height(this.heightSize) .margin(30) .onClick(() => { if (this.flag && this.isVisble) { // 建议使用this.getUIContext()?.animateTo() this.getUIContext()?.animateTo({ d...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
28325436ed6d960616376ce37b0a4b8298cb3a1d
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/common/accessibility/AccessibilityConfig.ets
arkts
getTextColor
获取文本颜色(考虑高对比度模式) @param normalColor 正常模式颜色 @param highContrastColor 高对比度模式颜色
public getTextColor(normalColor: string, highContrastColor?: string): string { if (this.settings.highContrastMode) { return highContrastColor ?? '#000000'; } return normalColor; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left normalColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
public getTextColor(normalColor: string, highContrastColor?: string): string { if (this.settings.highContrastMode) { return highContrastColor ?? '#000000'; } return normalColor; }
https://github.com/LJ666-ui/harmony-health-care
b516af12bc9a202c5c35a6cfe106ec5ee9051dc1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
initialize
初始化管理器
async initialize(): Promise<void> { if (this.initialized) { return; } try { // 加载分类列表 const categoriesJson: string = this.settingsManager.getString(CATEGORIES_KEY, '[]'); this.categories = SafeUtils.parseArr(categoriesJson) as BookshelfCategory[]; // 加载内容-分类映射 const m...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async initialize(): Promise<void> { if (this.initialized) { return; } try { // 加载分类列表 const categoriesJson: string = this.settingsManager.getString(CATEGORIES_KEY, '[]'); this.categories = SafeUtils.parseArr(categoriesJson) as BookshelfCategory[]; // 加载内容-分类映射 const m...
https://github.com/DaLongZhuaZi/manxia
ffac59fb4b76f6af3488d9de6dd884b1739732c2
github
HarmonyOS_Samples/BestPracticeSnippets
DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets
arkts
getPreviewProfile
[End Case1_start]
getPreviewProfile(cameraOutputCapability: camera.CameraOutputCapability): camera.Profile | undefined { let previewProfiles: Array<camera.Profile> = cameraOutputCapability.previewProfiles; if (previewProfiles.length < 1) { return undefined; } let index: number = previewProfiles.findIndex((preview...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getPreviewProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraOutputCapability AST#identifier#Right ...
getPreviewProfile(cameraOutputCapability: camera.CameraOutputCapability): camera.Profile | undefined { let previewProfiles: Array<camera.Profile> = cameraOutputCapability.previewProfiles; if (previewProfiles.length < 1) { return undefined; } let index: number = previewProfiles.findIndex((preview...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
4d3cf6d04601fe6b5579ad812d483b67413d4b61
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readFloatLE
Reads a 32-bit float from the buffer at the specified offset using little-endian format @param {int} [offset=0] - Number of bytes to skip before reading @returns {double} The read value
public readFloatLE(offset: int = 0): double { let lengthOffset: int = this.length - 4; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${le...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readFloatLE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_express...
public readFloatLE(offset: int = 0): double { let lengthOffset: int = this.length - 4; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${le...
https://gitcode.com/iop123123/arkts-static-skills
2b9564cec8ff5644435db75560bdccbc9f1ed240
gitcode
wanrenhuifu/JLU
harmonyos-鸿蒙实训/jilinuniversity-homework/entry/src/main/ets/pages/CommonTest.ets
arkts
build
@State num:number=0
build() { //必须要有一个容器组件跟节点 Column() { //按钮 //Button('按钮'+this.num) //类型样式 //.type(ButtonType.Normal) //.fontSize(20) //.width(150) //.height(80) //.borderRadius(20) //.border({width:10}) //.backgroundImage() //事件方法 // .onClick(()=>{ ...
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#comment#Le...
build() { //必须要有一个容器组件跟节点 Column() { //按钮 //Button('按钮'+this.num) //类型样式 //.type(ButtonType.Normal) //.fontSize(20) //.width(150) //.height(80) //.borderRadius(20) //.border({width:10}) //.backgroundImage() //事件方法 // .onClick(()=>{ ...
https://github.com/wanrenhuifu/JLU
4e9be4d168fe56fc34c6504cef9a5d05fd17f1af
github
openharmony/arkui_ace_engine
advanced_ui_component/treeviewv2/source/treeviewv2.ets
arkts
onNodeAdd
Node add event registration and processing. @syscap SystemCapability.ArkUI.ArkUI.Full @since 26
public onNodeAdd(callback: OnChangedCallback): void { this.nodeAddEvents.push(callback); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onNodeAdd 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 On...
public onNodeAdd(callback: OnChangedCallback): void { this.nodeAddEvents.push(callback); }
https://gitcode.com/openharmony/arkui_ace_engine
c6797da30221e09c9ea5993854afdba5e65c0d11
gitcode
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
getCurrentVersionDescription
获取当前版本升级日志 @return 当前版本描述文件
async getCurrentVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> { return this.updateManager.getCurrentVersionDescription(update.DescriptionFormat.STANDARD, DeviceUtils.getSystemLanguage()); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getCurrentVersionDescription AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left...
async getCurrentVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> { return this.updateManager.getCurrentVersionDescription(update.DescriptionFormat.STANDARD, DeviceUtils.getSystemLanguage()); }
https://gitee.com/openharmony/update_update_app.git
0eee8020fed17056b7ddf7879eb9e2c27e58f578
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/StringBuilder.ets
arkts
append
Appends a double as string to the builder's internal buffer @param i value to be appended @returns builder with updated internal buffer
public append(i: double): StringBuilder { this.append(StringBuilder.toString(i)); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left append AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#i...
public append(i: double): StringBuilder { this.append(StringBuilder.toString(i)); return this; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
cde6ebcab6eec7612891e8877649ee9cda4b5cc1
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test21_original_index.ets
arkts
testShapeInheritance
--- Tests ---
function testShapeInheritance(): string { let c: RoundShape = GeomFactory.createRoundShape(5); let r: BoxShape = GeomFactory.createBoxShape(3, 4); let s: SquareShape = GeomFactory.createSq(2); let areaC: number = c.area(); let areaR: number = r.area(); let areaS: number = s.area(); let diam: number = c.di...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testShapeInheritance 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#predef...
function testShapeInheritance(): string { let c: RoundShape = GeomFactory.createRoundShape(5); let r: BoxShape = GeomFactory.createBoxShape(3, 4); let s: SquareShape = GeomFactory.createSq(2); let areaC: number = c.area(); let areaR: number = r.area(); let areaS: number = s.area(); let diam: number = c.di...
https://github.com/miaochiahao/ark-ghidra
c7e39f858e3f3c5a69e9617dd289477b989d1677
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.variable_and_constant_declarations/03.type_compatibility_with_initializer/initializer_compatibility_n.ets
arkts
main
--- desc: Type {{i.type}} compatibility with initializer {{i.value}} tags: [compile-only, negative] ---
function main(): void { let a: {{i.type}} = {{i.value}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let a: {{i.type}} = {{i.value}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a307cd76cbbcee7071ffd2786cc2e9c03a87c3ca
gitee
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/catstypicalframework/utils/url.ets
arkts
validateUrlCore
Shared logic of core url validation. @param url The url. @param domainValidator The domain validation function. @returns A tuple [isLegal, hasScheme]: - isLegal: True if the URL is structurally legal. - hasScheme: True if a valid scheme (like http:, mailto:) was explicitly provided. If false, the URL is legal but may r...
function validateUrlCore(url: string, domainValidator: (host: string) => boolean): [boolean, boolean] { // 1. 基础类型与格式校验 if (typeof url !== 'string' || url.length === 0) return [false, false]; if (url.trim() !== url) return [false, false]; if (!LEGAL_CHARACTERS_REGEX.test(url)) return [false, false]; // 合法字符白名单...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left validateUrlCore 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 : AST#:#R...
function validateUrlCore(url: string, domainValidator: (host: string) => boolean): [boolean, boolean] { // 1. 基础类型与格式校验 if (typeof url !== 'string' || url.length === 0) return [false, false]; if (url.trim() !== url) return [false, false]; if (!LEGAL_CHARACTERS_REGEX.test(url)) return [false, false]; // 合法字符白名单...
https://github.com/awaLiny2333/LinysBrowser_NEXT
3b3c49f9b48e5499108639778dd360ee9dec9c8b
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
isProtectedValue
判断字段是否是保护字段 @param value 字段值 @returns 结果
public static isProtectedValue(value: KdbxEntryField | undefined): boolean { return value instanceof ProtectedValue; }
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 isProtectedValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left ...
public static isProtectedValue(value: KdbxEntryField | undefined): boolean { return value instanceof ProtectedValue; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L94-L96
b32cccdf5a1f16bb54c86ee95037a980d179885e
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryCache.ets
arkts
get
获取缓存数据 @param entityName 实体名称 @param id 实体主键值 @returns 缓存的实体数据(深拷贝),如果未命中返回 null
get(entityName: string, id: ValueType): EntityData | null { if (!this.enabled) { return null } const key = this.generateKey(entityName, id) const entry = this.cache.get(key) if (entry !== undefined) { // 检查是否过期 const now = Date.now() if (now - entry.timestamp < this.ttlMs...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get 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 ...
get(entityName: string, id: ValueType): EntityData | null { if (!this.enabled) { return null } const key = this.generateKey(entityName, id) const entry = this.cache.get(key) if (entry !== undefined) { // 检查是否过期 const now = Date.now() if (now - entry.timestamp < this.ttlMs...
https://github.com/offlinecat-dev/OCNetORM
a09ebcf0dbadafcca1a6a4939ac26831b924b175
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
fromCharCode
The String.fromCharCode() static method returns a string created from the specified sequence of UTF-16 code units.
public static fromCharCode(/*... */ch: number[]): String { throw new Error("not implemented: rest") }
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 fromCharCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#comment#Left /*... */ AST#comment#Right AST#ERROR#Left AST#identifier#Lef...
public static fromCharCode(/*... */ch: number[]): String { throw new Error("not implemented: rest") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
97e7d3bf847404e8365d86529911627447ca40be
gitee
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/PreferenceDao.ets
arkts
clear
清除所有偏好设置
async clear(): Promise<void> { await this.ensureInitialized(); try { await this.preference!.clear(); await this.preference!.flush(); Logger.info(this.LOG_TAG, 'All preferences cleared'); } catch (err) { const error = err instanceof Error ? err : new Error(String(err)); Logge...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#L...
async clear(): Promise<void> { await this.ensureInitialized(); try { await this.preference!.clear(); await this.preference!.flush(); Logger.info(this.LOG_TAG, 'All preferences cleared'); } catch (err) { const error = err instanceof Error ? err : new Error(String(err)); Logge...
https://github.com/Kira-Yagami-Light/Kira-Projects
088fbadd5ced13c11474244b4db3128507c56690
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
isAudioEnabled
检查音频是否可用 当音频初始化失败时,模拟器会继续运行但禁用音频输出 此函数用于检查音频状态并显示相应提示 @returns 音频是否可用 Requirements: 11.3
static isAudioEnabled(): boolean { return MelonDSNative.native.isAudioEnabled(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isAudioEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AS...
static isAudioEnabled(): boolean { return MelonDSNative.native.isAudioEnabled(); }
https://github.com/richshaw2015/nds
6f646bb61af993680bc5c9676ff2c89a6fc3ee16
github
openharmony/applications_launcher
feature/bigfolder/src/main/ets/default/view/FolderOpenComponent.ets
arkts
setStartAppInfo
set start app info
setStartAppInfo() { if (CheckEmptyUtils.isEmpty(this.item)) { Log.showError(TAG, 'setStartAppInfo with item') return; } Log.showInfo(TAG, 'app setStartAppInfo'); if (AppStorage.get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) { AppStorage.setOrCreate('openFolderStatus', BigFold...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setStartAppInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
setStartAppInfo() { if (CheckEmptyUtils.isEmpty(this.item)) { Log.showError(TAG, 'setStartAppInfo with item') return; } Log.showInfo(TAG, 'app setStartAppInfo'); if (AppStorage.get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) { AppStorage.setOrCreate('openFolderStatus', BigFold...
https://gitee.com/openharmony/applications_launcher.git
b9f4090da27014dc92e0866243f71860d9cf1218
gitee
IoTAccessControl/ArkTSAnalysis
TestApps/AccountKit-QuickLogin/entry/src/main/ets/pages/QuickLoginPage.ets
arkts
getProtocolUrl
Obtain the privacy policy address from rawfile.
getProtocolUrl(privacyUrl: string): string { try { // Read files from /AppScope/resources/rawfile. const value: Uint8Array = getContext().resourceManager.getRawFileContentSync(this.srcPath); // Return the link to the HUAWEI ID User Authentication Agreement. return JSON.parse(buffer.from(va...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProtocolUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left privacyUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AS...
getProtocolUrl(privacyUrl: string): string { try { // Read files from /AppScope/resources/rawfile. const value: Uint8Array = getContext().resourceManager.getRawFileContentSync(this.srcPath); // Return the link to the HUAWEI ID User Authentication Agreement. return JSON.parse(buffer.from(va...
https://github.com/IoTAccessControl/ArkTSAnalysis
3244dc99528c1b78b79c66f0dda6b8fdbc0c030a
github
arkui-x/samples
CodeLab/Cases/feature/compressfile/src/main/ets/components/CompressFileComponent.ets
arkts
compressByWorker
向worker线程发送信息,进行压缩 @returns
compressByWorker(): void { /** * TODO:知识点:主线程中使用new worker.ThreadWorker创建Worker对象。 * TODO:知识点:相对路径加载形式,加载路径规则:{relativePath}。 */ let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../worker/Worker.ets'); // TODO:知识点:主线程使用postMessage()向worker线程发送消息。 // 主线程使用postMessage()向...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left compressByWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
compressByWorker(): void { /** * TODO:知识点:主线程中使用new worker.ThreadWorker创建Worker对象。 * TODO:知识点:相对路径加载形式,加载路径规则:{relativePath}。 */ let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../worker/Worker.ets'); // TODO:知识点:主线程使用postMessage()向worker线程发送消息。 // 主线程使用postMessage()向...
https://gitcode.com/arkui-x/samples
fd039eff412f90b2a47c5aa5589bfe10f82bd137
gitcode
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/model/PhotoModel.ets
arkts
setTagArray
设置标签数组 @param tagArray 标签数组
setTagArray(tagArray: string[]) { this.tags = tagArray.map(tag => `#${tag}`).join(' '); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setTagArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tagArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#[#Left [ AST#[#Ri...
setTagArray(tagArray: string[]) { this.tags = tagArray.map(tag => `#${tag}`).join(' '); }
https://gitcode.com/openharmony/codelabs
35f680564b95968b8d3387f7456c6a4c383a5d97
gitcode
Countly/countly-sdk-hos
library/src/main/ets/CountlyConfig.ets
arkts
setDisplayMode
IMMERSIVE (default), overlay covers the full screen including notch and gesture-bar areas. SAFE_AREA, overlay respects cutout + status bar + navigation-bar insets so content doesn't render behind system UI.
public setDisplayMode(option: WebViewDisplayOption): ContentConfig { this.displayMode = option; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDisplayMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public setDisplayMode(option: WebViewDisplayOption): ContentConfig { this.displayMode = option; return this; }
https://github.com/Countly/countly-sdk-hos
c662677ba1b5f77ee1302d3b998596bf31a72439
github
HarmonyOS_Samples/BestPracticeSnippets
AvoidTimeComsume/entry/src/main/ets/views/UseTaskPool.ets
arkts
taskPoolExecute
[Start task_pool_execute] The following methods are defined outside of the component
async function taskPoolExecute(UIContext: UIContext): Promise<Item[]> { let task: taskpool.Task = new taskpool.Task(mockRequestData, UIContext); let result: Item[] = []; try { result = await taskpool.execute(task) as Item[] } catch (error) { hilog.error(0x0000,'',`execute failed. code=${error.code}, mes...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left taskPoolExecute AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left UIContext AST#identifier#Right AS...
async function taskPoolExecute(UIContext: UIContext): Promise<Item[]> { let task: taskpool.Task = new taskpool.Task(mockRequestData, UIContext); let result: Item[] = []; try { result = await taskpool.execute(task) as Item[] } catch (error) { hilog.error(0x0000,'',`execute failed. code=${error.code}, mes...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
30f478a8eb771c80bfff6c2edbcbe4f609319010
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
getMangaEngine
获取或创建MangaSourceEngine实例 【关键重构】优先使用sourceName作为主键,确保图源管理的稳定性 @param sourceId 图源ID(数字类型,可能不稳定) @param sourceName 图源名称(推荐使用,稳定的标识符) @returns MangaSourceEngine实例
async getMangaEngine(sourceId: number, sourceName?: string): Promise<MangaSourceEngine> { try { let cacheKey: string = ''; // 【关键】优先使用sourceName作为缓存key if (sourceName) { cacheKey = sourceName; logger.debug(TAG, `使用sourceName作为缓存key: "${sourceName}"`); } else if (this...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getMangaEngine AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left ...
async getMangaEngine(sourceId: number, sourceName?: string): Promise<MangaSourceEngine> { try { let cacheKey: string = ''; // 【关键】优先使用sourceName作为缓存key if (sourceName) { cacheKey = sourceName; logger.debug(TAG, `使用sourceName作为缓存key: "${sourceName}"`); } else if (this...
https://github.com/DaLongZhuaZi/manxia
a41859f256a8650881da452831e4d1128109f939
github
openharmony/arkui_ace_engine
examples/Accessibility/AccessibilityCapi/entry/src/main/ets/pages/Index.ets
arkts
getTotalTestCaseCount
计算总测试用例数
getTotalTestCaseCount(): number { return this.loadedScenarios.reduce((sum: number, s: ScenarioData): number => sum + (s.testCaseCount || 0), 0); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTotalTestCaseCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#...
getTotalTestCaseCount(): number { return this.loadedScenarios.reduce((sum: number, s: ScenarioData): number => sum + (s.testCaseCount || 0), 0); }
https://gitcode.com/openharmony/arkui_ace_engine
9f76b542be0c321c2cc75d7a805ca34fa26888ca
gitcode
openharmony-sig/fluttertpc_video_compress
ohos/src/main/ets/dev/fluttercommunity/video_compress/Utility.ets
arkts
getMediaInfoJsonByAVPlayer
由于AVMetadataExtractor获取到的信息不全,用AVPlayer获取 @param _path @returns
getMediaInfoJsonByAVPlayer(_path: string): Promise<AVPlayerMediaInfo> { return new Promise(async resolve => { // 创建avPlayer实例对象 let avPlayer: media.AVPlayer = await media.createAVPlayer(); avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => { if (state ==...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getMediaInfoJsonByAVPlayer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left _path AST#identifier#Right AST#:#Left : AST#:#R...
getMediaInfoJsonByAVPlayer(_path: string): Promise<AVPlayerMediaInfo> { return new Promise(async resolve => { // 创建avPlayer实例对象 let avPlayer: media.AVPlayer = await media.createAVPlayer(); avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => { if (state ==...
https://gitee.com/openharmony-sig/fluttertpc_video_compress.git
16e4028cb457ca2bbe41bad5559303926a9b7c44
gitee
apap6628114/nga_oh
entry/src/main/ets/common/managers/TopicPaginationManager.ets
arkts
replaceWith
用新的一页主题整体替换当前内容(跳页/首次加载场景)。 @param list - 该页主题 @param page - 页码 @param totalPages - 总页数
replaceWith(list: object[], page: number, totalPages: number): void { this.threads = list this.applyState(page, totalPages) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left replaceWith AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left object AST#ide...
replaceWith(list: object[], page: number, totalPages: number): void { this.threads = list this.applyState(page, totalPages) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/TopicPaginationManager.ets#L41-L44
275ae15439391b1f9c73a4edde0cf3b9ab7e9295
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
trimStart
The trimStart() method removes whitespace from the beginning of a string and returns a new string, without modifying the original string. trimLeft() is an alias of this method. @returns { String } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public trimStart(): String { return this.trimLeft() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trimStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#i...
public trimStart(): String { return this.trimLeft() }
https://gitcode.com/iop123123/arkts-static-skills
fc999200659a8a1e682d3831f492c8eef8db5bb1
gitcode