nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGEllipse.ets
arkts
setCX
设置椭圆中心点x坐标 @param newCX x坐标值
public setCX(newCX: number): void{ this._cx = newCX; this._ellipseResultObj['cx'] = newCX; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left setCX AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newCX AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public setCX(newCX: number): void{ this._cx = newCX; this._ellipseResultObj['cx'] = newCX; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
226ea0e2f490aa365ad275ac9eaab8c8e3bf13c6
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnButtonViewModel.ets
arkts
toggleLoading
切换加载状态
toggleLoading(): void { this.isLoading = !this.isLoading; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
toggleLoading(): void { this.isLoading = !this.isLoading; }
https://github.com/codelably/tuniao-ui
fb07c1c48b6460c04f081808dd3bf80e2f659378
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/HtmlFormatter.ets
arkts
resolveUrl
解析相对URL为绝对URL
private static resolveUrl(url: string, baseUrl: string): string { if (!url) return ''; const trimmedUrl = url.trim(); // 已经是绝对URL if (trimmedUrl.startsWith('http://') || trimmedUrl.startsWith('https://') || trimmedUrl.startsWith('//')) { if (trimmedUrl.startsWith('//')) { return 'ht...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left resolveUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST...
private static resolveUrl(url: string, baseUrl: string): string { if (!url) return ''; const trimmedUrl = url.trim(); // 已经是绝对URL if (trimmedUrl.startsWith('http://') || trimmedUrl.startsWith('https://') || trimmedUrl.startsWith('//')) { if (trimmedUrl.startsWith('//')) { return 'ht...
https://github.com/DaLongZhuaZi/manxia
ffe4ea9aa5533ce4387d16480d48b38e894ed365
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
getUserInfo
获取用户信息 @returns
getUserInfo(): IUserInfo | null { return this.userInfo; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#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#ERROR#Left AST#:#Left : AST#:#Right AST#identifie...
getUserInfo(): IUserInfo | null { return this.userInfo; }
https://github.com/RedRackham-R/WanAndroidHarmoney
806c7a0bdd65739de05987dcebdd9122abbe62ac
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryExecutor.ets
arkts
constructor
构造函数 @param queryBuilder 查询构建器
constructor(queryBuilder: QueryBuilder) { this.queryBuilder = queryBuilder.clone() this.dataMapper = new DataMapper(queryBuilder.getEntityName()) this.relationLoader = new RelationLoader(this.queryBuilder.getEntityName(), () => this.getStore()) this.orderSupport = new QueryExecutorOrderSupport(this.qu...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left queryBuilder AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left QueryBuilder AST#iden...
constructor(queryBuilder: QueryBuilder) { this.queryBuilder = queryBuilder.clone() this.dataMapper = new DataMapper(queryBuilder.getEntityName()) this.relationLoader = new RelationLoader(this.queryBuilder.getEntityName(), () => this.getStore()) this.orderSupport = new QueryExecutorOrderSupport(this.qu...
https://github.com/offlinecat-dev/OCNetORM
bc587cec98f14ccf8b48e6459b6a7542ff721cb8
github
apap6628114/nga_oh
entry/src/main/ets/store/settings/domain/NoteSettings.ets
arkts
reset
重置便签列表与 manager
reset(): void { this.manager = new FilterListManager<UserNoteEntry>() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset 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 A...
reset(): void { this.manager = new FilterListManager<UserNoteEntry>() }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/NoteSettings.ets#L64-L66
b27b332e5aa657ecb62f9bdce79f3133bb0a5228
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
clearEngineCache
[优化] 清除引擎内部缓存(在源配置更新时调用)
clearEngineCache(): void { this.sourceSettingsCache.clear(); this.parsedConfigCache = null; logger.debug(TAG, '引擎内部缓存已清除'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearEngineCache 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...
clearEngineCache(): void { this.sourceSettingsCache.clear(); this.parsedConfigCache = null; logger.debug(TAG, '引擎内部缓存已清除'); }
https://github.com/DaLongZhuaZi/manxia
0b856306f5b67a54332f927dcb72a71fa4ea2a4c
github
OHPG/FinSdk
network/src/main/ets/api/ApiClient.ets
arkts
updateServer
Update server address @param serverInfo
public updateServer(serverInfo: ServerInfo) { this.serverInfo = serverInfo let basePath = serverInfo.address.endsWith('/') ? serverInfo.address.slice(0, -1) : serverInfo.address; this.updateBaseUrl(basePath) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateServer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left serverInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public updateServer(serverInfo: ServerInfo) { this.serverInfo = serverInfo let basePath = serverInfo.address.endsWith('/') ? serverInfo.address.slice(0, -1) : serverInfo.address; this.updateBaseUrl(basePath) }
https://github.com/OHPG/FinSdk
98da3832121fc9acf09cf8177f92f6eb151cb79f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
searchComics
==================== 漫画搜索与发现 ==================== 搜索漫画
public async searchComics(keyword: string, options?: SearchOptions): Promise<SearchResult> { try { const sourceId = options?.sourceId; const page = options?.page || 1; const pageSize = options?.pageSize || 20; // 从本地数据库搜索 const localComics = await this.dataManager.searchComics...
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 searchComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async searchComics(keyword: string, options?: SearchOptions): Promise<SearchResult> { try { const sourceId = options?.sourceId; const page = options?.page || 1; const pageSize = options?.pageSize || 20; // 从本地数据库搜索 const localComics = await this.dataManager.searchComics...
https://github.com/DaLongZhuaZi/manxia
5846a7a335f07b905971f46cd6275b4f2cc5f00f
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/events/EventsProcessor.ets
arkts
queryCalendarIdAndCreatorByEvent
查询待插入的 event 数据中 calendar_id 与 calendar 表相同的结果 @param rdbStore rdb数据库 @param values 插入操作的数据 @return DataShareResultSet
async function queryCalendarIdAndCreatorByEvent(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket): Promise<data_rdb.ResultSet> { const calendarId = values[EventColumns.CALENDAR_ID] as ValueType; const columns = [CalendarsColumns.ID, CalendarsColumns.CREATOR]...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left queryCalendarIdAndCreatorByEvent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#ide...
async function queryCalendarIdAndCreatorByEvent(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket): Promise<data_rdb.ResultSet> { const calendarId = values[EventColumns.CALENDAR_ID] as ValueType; const columns = [CalendarsColumns.ID, CalendarsColumns.CREATOR]...
https://gitee.com/openharmony/applications_calendar_data.git
473e395eaa41706605af9a242e9f700eee4b58e9
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/ftp/FTPHandler.ets
arkts
downloadFrom
下载文件到本地
public async downloadFrom(remotePath: string, localPath: string): Promise<void> { if (!this.client) { throw new Error('FTP client is not connected'); } hilog.info(DOMAIN, TAG, `Downloading ${remotePath} to ${localPath}`); await this.client.downloadTo(localPath, remotePath); hilog.info(DOMAIN...
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 downloadFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remotePath AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public async downloadFrom(remotePath: string, localPath: string): Promise<void> { if (!this.client) { throw new Error('FTP client is not connected'); } hilog.info(DOMAIN, TAG, `Downloading ${remotePath} to ${localPath}`); await this.client.downloadTo(localPath, remotePath); hilog.info(DOMAIN...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPHandler.ets#L79-L86
8ea3b1425dd8afdd6bbbd23a0cbcaaa50d25f8e6
github
dingzhilin1990/zhilinclaw
src/core/ZhiLinClawCore.ets
arkts
getMemoryManager
获取记忆管理器
public getMemoryManager(): MemoryManager { return this.memoryManager; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMemoryManager 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 Memor...
public getMemoryManager(): MemoryManager { return this.memoryManager; }
https://github.com/dingzhilin1990/zhilinclaw
ebfa620218fe89af5050ae3acb2f7ab7bd594520
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets
arkts
selectTaskByPriorityNonBlocking
@brief Non-blocking priority-based task selection using LinkedConcurrentQueue.poll() Uses poll() instead of pop() to avoid blocking
function selectTaskByPriorityNonBlocking(): QueuedExecution | undefined { let queuedExecution: QueuedExecution | undefined = undefined; // HIGH priority tasks (with continuous execution limit) if (getGlobalTaskQueueSize(Priority.HIGH) > 0) { if (globalHighTaskExecuteCoun...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left selectTaskByPriorityNonBlocking 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...
function selectTaskByPriorityNonBlocking(): QueuedExecution | undefined { let queuedExecution: QueuedExecution | undefined = undefined; // HIGH priority tasks (with continuous execution limit) if (getGlobalTaskQueueSize(Priority.HIGH) > 0) { if (globalHighTaskExecuteCoun...
https://gitcode.com/iop123123/arkts-static-skills
3dbc96ebbaf6b11997513b0690d285871ab2b246
gitcode
openharmony-sig/ohos_highlightguide
library/src/main/ets/highlightguide/model/GuidePage.ets
arkts
getHighLightIndicator
获取当前引导页的引导层 @returns 引导层布局
public getHighLightIndicator(): Function | null { return this.highLightIndicator; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighLightIndicator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expressio...
public getHighLightIndicator(): Function | null { return this.highLightIndicator; }
https://gitee.com/openharmony-sig/ohos_highlightguide.git
0d62f77fd561b86b1795b1db84b6e04fa20fddcd
gitee
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
popToRoot
返回根视图,即Navigation页面 @param result
public popToRoot(result: ObjectOrNull = null, opts: IPopOptions = { animated: true }) { if (ObjectUtil.isNotEmpty(result)) { this.popToRootWithResult(result, opts.animated ?? true) } else { this.clear() } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left popToRoot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressio...
public popToRoot(result: ObjectOrNull = null, opts: IPopOptions = { animated: true }) { if (ObjectUtil.isNotEmpty(result)) { this.popToRootWithResult(result, opts.animated ?? true) } else { this.clear() } }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L358-L364
6621431841ae95c0e855065df66cd4659c4fd33c
github
openharmony-sig/earth
hpauditor/tests/issues/expected/issue304.ets.audit.ets
arkts
concurrentFunc
HPAudit: Use lowerCamelCase for variable and function names : hp-specs-lcamelcase-vars-funcs-params : 1 : 8 : issue304.ets
async function concurrentFunc(): Promise<void> { try { /* HPAudit: Declare unchanged variables as const : hp-performance-unchanged-const-vars : 1 : 10 : issue304.ets */ const task: taskpool.Task = new taskpool.Task(add, 1, 2); console.info("taskpool res is: " + await taskpool.execute(task)); } catch (...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left concurrentFunc 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 function concurrentFunc(): Promise<void> { try { /* HPAudit: Declare unchanged variables as const : hp-performance-unchanged-const-vars : 1 : 10 : issue304.ets */ const task: taskpool.Task = new taskpool.Task(add, 1, 2); console.info("taskpool res is: " + await taskpool.execute(task)); } catch (...
https://gitee.com/openharmony-sig/earth.git
8d8b141e06f612eb78d8eaced7423e83866d7314
gitee
zmuxuny/ai-guardian-star
entry/src/main/ets/pages/MqttManager.ets
arkts
clearFallRecords
── 缓存管理(清内存 + 同步清库)──────────────────────────────
public clearFallRecords(): void { this.fallRecords = []; this.lastRecordedFallTimestamp = 0; DatabaseHelper.getInstance() .clearAllHealthEvents() .then(() => console.log("[mqtt]:ArkDB 摔倒/久坐历史已清除")) .catch((e: Error) => console.error(`[mqtt]:ArkDB 清除失败 ${e.message}`)); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearFallRecords 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#expre...
public clearFallRecords(): void { this.fallRecords = []; this.lastRecordedFallTimestamp = 0; DatabaseHelper.getInstance() .clearAllHealthEvents() .then(() => console.log("[mqtt]:ArkDB 摔倒/久坐历史已清除")) .catch((e: Error) => console.error(`[mqtt]:ArkDB 清除失败 ${e.message}`)); }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/pages/MqttManager.ets#L460-L467
59e31770244673500140b27e9dcf55b191792a4b
github
openharmony/applications_app_samples
code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets
arkts
setColorSpaceBeforeCommitConfig
设置色彩空间。
function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: number): void { let colorSpace: colorSpaceManager.ColorSpace = isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT; let colorSpaces: colorSpaceManager.ColorSpace[] = getSupportedColorSpaces...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left setColorSpaceBeforeCommitConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left session AST#identifier#Right AST#type_annotation#Left ...
function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: number): void { let colorSpace: colorSpaceManager.ColorSpace = isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT; let colorSpaces: colorSpaceManager.ColorSpace[] = getSupportedColorSpaces...
https://github.com/openharmony/applications_app_samples
0a57801863e37f453801fb2389ced94518a9d45a
github
robotzzh/AgricultureApp
entry/src/main/ets/common/History_Info.ets
arkts
to_arraylist
--------------------数据库操作部分(finished)------------------// --------------------数组装配部分 -------------------------//
static to_arraylist(message):ArrayList<number>{ let array = new ArrayList<number>(); if(!Object.keys(message)) return array; for(let index of Object.keys(message)){ array.add(message[index]); } //console.info("begin= "+array[0].toString()+"length = "+array.length) return array; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left to_arraylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static to_arraylist(message):ArrayList<number>{ let array = new ArrayList<number>(); if(!Object.keys(message)) return array; for(let index of Object.keys(message)){ array.add(message[index]); } //console.info("begin= "+array[0].toString()+"length = "+array.length) return array; }
https://github.com/robotzzh/AgricultureApp
dfb7319c525e8870e2e008f0b0e2aa4e656d268c
github
Octo-o-o-o/harmonyos-ai-workspace
samples/templates/web-bridge-h5-shell/BridgeJavaScriptProxy.ets
arkts
detach
组件卸载时调,避免 controller 持有时 Web 组件无法 GC
detach(): void { this.webController = null }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left detach 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 ...
detach(): void { this.webController = null }
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
439376c2e17522c083dae1b22aa26c9131c77b10
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/DataRenderer.ets
arkts
getPaintValues
Returns the Paint object this renderer uses for drawing the values (value-text). @return
public getPaintValues(): Paint { return this.mValuePaint; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPaintValues 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 Paint A...
public getPaintValues(): Paint { return this.mValuePaint; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a1ab0fef06dde520d2da6215242bae7e7bf9e9f7
gitee
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
aspectRatio
Aspect ratio calculation
get aspectRatio(): number { if (this.height !== 0) { return this.width / this.height; } return this.width > 0 ? Infinity : (this.width < 0 ? -Infinity : 0); }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left aspectRatio 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...
get aspectRatio(): number { if (this.height !== 0) { return this.width / this.height; } return this.width > 0 ? Infinity : (this.width < 0 ? -Infinity : 0); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L207-L212
05a294299fea43832b4cb16d8f1d56d819bfc32e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets
arkts
constructor
Creates a new FinalMap instance from another FinalMap. @param { FinalMap<K, V> } map - Another FinalMap instance used for initialization. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(map: FinalMap<K, V>) { super(map) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#L...
constructor(map: FinalMap<K, V>) { super(map) }
https://gitcode.com/iop123123/arkts-static-skills
56ae60d8de7de4aa1d811b99e6f11684501c4d97
gitcode
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets
arkts
getPosition
returns the position of the x-labels
public getPosition(): XAxisPosition { return this.mPosition; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPosition 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 XAxisPosit...
public getPosition(): XAxisPosition { return this.mPosition; }
https://gitee.com/openharmony/developtools_profiler.git
467d61426f10c1b4839ad157f8726fcd958f6fbb
gitee
erosTeam/NextE
shared/src/main/ets/constants/EhConstants.ets
arkts
tagNamespaceColor
Tag namespace → chip background color (eros_fe ThemeColors.tagColorTagType, pastel light / muted dark). Unmapped namespaces (e.g. 'mixed') fall back to misc grey. Short prefixes are expanded first so 'a:'/'artist:' share one color.
static tagNamespaceColor(ns: string): ResourceColor { if (EhConstants.tagNsColorMap === null) { const m: Map<string, ResourceColor> = new Map<string, ResourceColor>() m.set('artist', $r('app.color.tagns_artist')) m.set('female', $r('app.color.tagns_female')) m.set('male', $r('app.color.tag...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left tagNamespaceColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ns AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
static tagNamespaceColor(ns: string): ResourceColor { if (EhConstants.tagNsColorMap === null) { const m: Map<string, ResourceColor> = new Map<string, ResourceColor>() m.set('artist', $r('app.color.tagns_artist')) m.set('female', $r('app.color.tagns_female')) m.set('male', $r('app.color.tag...
https://github.com/erosTeam/NextE
4253ad2f67eb62ce6e36b718b6ced3891060d41e
github
HarmonyOS_Samples/BestPracticeSnippets
JSCrash/entry/src/main/ets/pages/CannotReadPropertyXXXOfUndefinedFix.ets
arkts
build
[End updateGestureValue2]
build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center...
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() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
c15f6fee947e4bb23179a6a02555e58d442de9d7
gitcode
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/bookmarks/classes/meowBookmarkItem.ets
arkts
addBookmark
Adds a new bookmark to the children array. @param label The label of the new bookmark. @param url The URL of the new bookmark.
addBookmark(label: string, url?: string) { try { this.children.push(new meowBookmarkItem(false, label, url || '', nowHtmlTimestamp(), nowHtmlTimestamp())); } catch (e) { meow(`Failed to add folder: ${label}`, 'meowBookmarkItem', meowLevel.ERROR); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addBookmark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
addBookmark(label: string, url?: string) { try { this.children.push(new meowBookmarkItem(false, label, url || '', nowHtmlTimestamp(), nowHtmlTimestamp())); } catch (e) { meow(`Failed to add folder: ${label}`, 'meowBookmarkItem', meowLevel.ERROR); } }
https://github.com/awaLiny2333/LinysBrowser_NEXT
93c884143473c90016afcd190af76636afdda204
github
OHPG/FinVideo
entry/src/main/ets/data/Repository.ets
arkts
getShowNextUp
获取剧集接下来播放的媒体列表 @param seriesId 剧集id @returns
public getShowNextUp(id: string): Promise<Array<FinItem>> { return this.requireApi().getNextUp(id) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getShowNextUp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public getShowNextUp(id: string): Promise<Array<FinItem>> { return this.requireApi().getNextUp(id) }
https://github.com/OHPG/FinVideo
0873ef517a8329e1912cf95bd9ca50148bfc1747
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
getColumnId
获取主键列名 @returns 主键列名 'id'
getColumnId(): string { return 'id' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColumnId 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_...
getColumnId(): string { return 'id' }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L28-L30
7f5bc45ab1512a69dc49c7b720c7437a7f53b9ca
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets
arkts
evictOldest
清除最旧的缓存项(LRU)
private evictOldest(): void { let oldestKey: string | null = null; let oldestTime = Infinity; this.cache.forEach((item, key) => { if (item.lastAccess < oldestTime) { oldestTime = item.lastAccess; oldestKey = key; } }); if (oldestKey) { this.remove(oldestKey); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left evictOldest 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#express...
private evictOldest(): void { let oldestKey: string | null = null; let oldestTime = Infinity; this.cache.forEach((item, key) => { if (item.lastAccess < oldestTime) { oldestTime = item.lastAccess; oldestKey = key; } }); if (oldestKey) { this.remove(oldestKey); ...
https://github.com/DaLongZhuaZi/manxia
bd421d5e8bf17e1ac576c8b7f4e77cab6aa3a1f1
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Either.ets
arkts
$_invoke
Creates a new instance of a Right<L,R> with R data @param { R } data for Right @returns { Right<L,R> } A new Right instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static $_invoke<L, R>(data: R): Right<L, R> { return new Right<L,R>(data) }
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 $_invoke AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left L AST#identifier#Right AST#binary_expression#Right AST#,#Left , AST#,#Right AS...
public static $_invoke<L, R>(data: R): Right<L, R> { return new Right<L,R>(data) }
https://gitcode.com/iop123123/arkts-static-skills
ebc517f4d42b50029cdb4c0c73a07ea283a87580
gitcode
HarmonyOS_Samples/BestPracticeSnippets
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
getCameraManagerFn
Get Camera Manager Instance
getCameraManagerFn(): camera.CameraManager | undefined { if (this.cameraManager) { return this.cameraManager; } let cameraManager: camera.CameraManager; try { cameraManager = camera.getCameraManager(GlobalContext.get().getCameraSettingContext()); Logger.info(TAG, `getCameraManager su...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getCameraManagerFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#...
getCameraManagerFn(): camera.CameraManager | undefined { if (this.cameraManager) { return this.cameraManager; } let cameraManager: camera.CameraManager; try { cameraManager = camera.getCameraManager(GlobalContext.get().getCameraSettingContext()); Logger.info(TAG, `getCameraManager su...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
df431cab3d8b7f6147a3da27c1f162417c49d647
gitcode
openharmony-tpc/VCard
library/src/main/ets/components/VCardParserImpl_V21.ets
arkts
unescapeCharacter
package
public static unescapeCharacter(ch: number): string | null { // Original vCard 2.1 specification does not allow transformation // "\:" -> ":", "\," -> ",", and "\\" -> "\", but previous // implementation of // this class allowed them, so keep it as is. if (String.fromCharCode...
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 unescapeCharacter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ch AST#identifier#Right AST#:#Left : ...
public static unescapeCharacter(ch: number): string | null { // Original vCard 2.1 specification does not allow transformation // "\:" -> ":", "\," -> ",", and "\\" -> "\", but previous // implementation of // this class allowed them, so keep it as is. if (String.fromCharCode...
https://gitee.com/openharmony-tpc/VCard.git
d60311fed3daa675168f6ad3830bda3b3ef98fc4
gitee
JackJiang2011/harmonychat
entry/src/main/ets/IMClientManager.ets
arkts
getEmitter
返回本类持有的事件订阅对象引用。 @returns 事件订阅对象引用
getEmitter(): common.EventHub { return ClientCoreSDK.getInstance().getEventHub(); }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getEmitter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier...
getEmitter(): common.EventHub { return ClientCoreSDK.getInstance().getEventHub(); }
https://github.com/JackJiang2011/harmonychat
efe84f740f0916c572343c25c3d7a2d127e4bff6
github
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets
arkts
getWeekViewData
获取指定周数据
getWeekViewData(weekNum: number) { this.weekDays = [...TimeUtils.getWeekDays(weekNum)]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWeekViewData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left weekNum AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AS...
getWeekViewData(weekNum: number) { this.weekDays = [...TimeUtils.getWeekDays(weekNum)]; }
https://gitcode.com/arkui-x/samples
0f9efceea71378db3ba4743a75fdbb2239a995f2
gitcode
hhtczengjing/ohos_quickjs
quickjs/src/main/ets/JSValue.ets
arkts
isEqualTo
==================== Comparison ====================
isEqualTo(value: JSValue): boolean { return qjs.strictEquals(this.handle, value.handle); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEqualTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left JSValue AST#identifier#Right AST#)#Left ) AST...
isEqualTo(value: JSValue): boolean { return qjs.strictEquals(this.handle, value.handle); }
https://github.com/hhtczengjing/ohos_quickjs
039742d5ebe8c65d97e8620d37ee42b29c5174a1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
updateSourceRespondTime
更新书源响应时间
async updateSourceRespondTime(sourceId: string, respondTime: number): Promise<boolean> { const source = this.sources.get(sourceId); if (!source) { return false; } source.respondTime = respondTime; // 更新数据库 try { const dataManager = getNovelDataManager(); await dataM...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateSourceRespondTime 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 ...
async updateSourceRespondTime(sourceId: string, respondTime: number): Promise<boolean> { const source = this.sources.get(sourceId); if (!source) { return false; } source.respondTime = respondTime; // 更新数据库 try { const dataManager = getNovelDataManager(); await dataM...
https://github.com/DaLongZhuaZi/manxia
d3373eea502f17ca7b14b9517b495c83565c4ab0
github
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/components/SideBar.ets
arkts
addComment
添加评论方法
addComment(content: string) { const msg = new commentDataModel({ id: util.generateRandomUUID(), avatar: 'https://picx.zhimg.com/027729d02bdf060e24973c3726fea9da_l.jpg?source=06d4cd63', author: 'smallMiSu7', content, time: `${common.toStr(new Date().getMonth() + 1)}-${common.toStr(new...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#L...
addComment(content: string) { const msg = new commentDataModel({ id: util.generateRandomUUID(), avatar: 'https://picx.zhimg.com/027729d02bdf060e24973c3726fea9da_l.jpg?source=06d4cd63', author: 'smallMiSu7', content, time: `${common.toStr(new Date().getMonth() + 1)}-${common.toStr(new...
https://github.com/SMAT-Lab/PhantomRendering
5735655b8c996093f61fbdb5b42fc38aeafdac45
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/history/scripts/indexing.ets
arkts
buildIndexToDiskSync
Build Builds the index for a given chunk synchronously. You shouldn't call this sync function directly! Use the concurrent wrap! @param indexBasePath The base path for the index files. This method would read ${indexBasePath}/history_yyyy_mm.txt.index and .data. @param chunkYear The year of the chunk. @param chunkMonth ...
@Concurrent async function buildIndexToDiskSync(indexBasePath: string, chunk: meowHistoryChunk, cleanRebuild: boolean) { const startTime = Date.now(); const indexChunkPath = `${indexBasePath}/history_${chunk.year}_${chunk.month.toString().padStart(2, '0')}.txt`; // i. Prerequisites // Read entries from the di...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left buildIndexToDiskSync AST#identifier#Right AST#formal_p...
@Concurrent async function buildIndexToDiskSync(indexBasePath: string, chunk: meowHistoryChunk, cleanRebuild: boolean) { const startTime = Date.now(); const indexChunkPath = `${indexBasePath}/history_${chunk.year}_${chunk.month.toString().padStart(2, '0')}.txt`; // i. Prerequisites // Read entries from the di...
https://github.com/awaLiny2333/LinysBrowser_NEXT
64888706805d2fae8ff287fc2378fca34b155e5c
github
openharmony/applications_app_samples
code/BasicFeature/Ability/AbilityRuntime/entry/src/main/ets/abilitylifecyclecallback/AbilityLifecycleCallback.ets
arkts
onWindowStageWillDestroy
注册监听应用上下文的生命周期后,在UIAbility的[onWindowStageDestroy]触发前回调。
onWindowStageWillDestroy(ability, windowStage) { hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onWindowStageWillDestroy'); },
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageWillDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ability AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left windowStage AST#identifier#Right AST#)#Left ...
onWindowStageWillDestroy(ability, windowStage) { hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onWindowStageWillDestroy'); },
https://github.com/openharmony/applications_app_samples
5f6c7f6a078150dd5ba4d7583c626d8943300da0
github
mqxu/HarmonyOS_In_Action
examples/01_foundation/F002_state_management/entry/src/main/ets/utils/StateManager.ets
arkts
clamp
限制数字在指定范围内 @param value 要限制的值 @param min 最小值 @param max 最大值 @returns 限制后的值
static clamp(value: number, min: number, max: number): number { return Math.min(Math.max(value, min), max); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left clamp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
static clamp(value: number, min: number, max: number): number { return Math.min(Math.max(value, min), max); }
https://github.com/mqxu/HarmonyOS_In_Action
2707d3817b7dc219707c6d61dd640d82cc49f9ee
github
LongLiveY96/chatcube
entry/src/main/ets/services/WebDAVSyncService.ets
arkts
downloadRemoteToLocal
仅下载远端备份到本地缓存,返回本地路径
async downloadRemoteToLocal( onProgress?: SyncProgressCallback, controller?: HttpRequestController ): Promise<DownloadResult> { const startTime = Date.now() const config = await this.loadConfig() const validation = this.validateConfig(config) if (validation !== null) { return { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left downloadRemoteToLocal AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left onProgress AST#identifier#Right AST#?#Left ? AST#?#Right ...
async downloadRemoteToLocal( onProgress?: SyncProgressCallback, controller?: HttpRequestController ): Promise<DownloadResult> { const startTime = Date.now() const config = await this.loadConfig() const validation = this.validateConfig(config) if (validation !== null) { return { ...
https://github.com/LongLiveY96/chatcube
c4ca2b0eb8e584167cd4211e7346ee60e992e736
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/15.unary_expressions/06.unary_minus_operator/unary_minus_corner.ets
arkts
main
--- desc: Unary minus operator (corner cases) params: {{un.origin}} => {{un.dest}} ---
function main(): void { let a = {{un.origin}};
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 = {{un.origin}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
153ee1ad24c24983a3e687b8477420d65877bbd2
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
getInt8
Read bytes as they represent given type @param byteOffset zero index to read @returns read value (big endian)
public getInt8(byteOffset: int): byte { return this.getInt8Big(byteOffset) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier...
public getInt8(byteOffset: int): byte { return this.getInt8Big(byteOffset) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
984a5bb13e9da123fab28cec7077887520876a1b
gitee
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
setInt32
Sets a signed integer. @param byteOffset The byte offset. @param value The value. @param littleEndian If the value is little endian.
setInt32(byteOffset: number, value: number, littleEndian?: boolean): void { this.dataView?.setInt32(byteOffset, value, littleEndian) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInt32 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#,#Ri...
setInt32(byteOffset: number, value: number, littleEndian?: boolean): void { this.dataView?.setInt32(byteOffset, value, littleEndian) }
https://gitee.com/openharmony-sig/flutter_engine.git
3ea8fb069af6c754433fee05cee9e530eae6900b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
getDatabaseVersion
获取数据库版本
private async getDatabaseVersion(): Promise<number> { try { const store = this.getStore(); const resultSet = await store.querySql('PRAGMA user_version'); if (resultSet.goToFirstRow()) { const version = resultSet.getLong(0); resultSet.close(); return version; ...
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 getDatabaseVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async getDatabaseVersion(): Promise<number> { try { const store = this.getStore(); const resultSet = await store.querySql('PRAGMA user_version'); if (resultSet.goToFirstRow()) { const version = resultSet.getLong(0); resultSet.close(); return version; ...
https://github.com/DaLongZhuaZi/manxia
0cbc52309a3da90b1ecb772e5021dfe180f2c53e
github
openharmony/applications_print_spooler
entry/src/main/ets/pages/component/PreviewComponent.ets
arkts
onPrintRangeChange
打印范围修改
onPrintRangeChange() { Log.info(TAG, 'onPrintRangeChange enter',JSON.stringify(this.printRange)); if (this.printRange.length === 0 || this.imageSources === undefined) { return; } if (this.currentIndex>this.printRange.length) { Log.info(TAG, 'parseImageSize this.printRange.length: ', JSON.s...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPrintRangeChange 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...
onPrintRangeChange() { Log.info(TAG, 'onPrintRangeChange enter',JSON.stringify(this.printRange)); if (this.printRange.length === 0 || this.imageSources === undefined) { return; } if (this.currentIndex>this.printRange.length) { Log.info(TAG, 'parseImageSize this.printRange.length: ', JSON.s...
https://gitee.com/openharmony/applications_print_spooler.git
e11b56043643ff0556761793e5669f5c2396b10c
gitee
arkui-x/samples
CodeLab/Cases/feature/databaseupgrade/src/main/ets/service/DataService.ets
arkts
transform
V2新老版本字段转换逻辑 @param resultSet 查询结果集 @param targetVersion 目标版本 @returns 目标版本格式数据
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { if (targetVersion === Constants.V3) { // 将teacherName字段改为teacherFirstName字段 return this.transformV2ToV3(resultSet); } else { throw new Error('The database version to which you need to upgrade is incorrect'...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left transform 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#Left AST#identifier#Left relationalStor...
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { if (targetVersion === Constants.V3) { // 将teacherName字段改为teacherFirstName字段 return this.transformV2ToV3(resultSet); } else { throw new Error('The database version to which you need to upgrade is incorrect'...
https://gitcode.com/arkui-x/samples
b93281841007927aa130fc5687cf83842990a096
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets
arkts
clearManga
清空指定漫画的所有缓存
clearManga(sourceId: number, mangaId: string): void { this.deleteMangaDetail(sourceId, mangaId); this.deleteChapterList(sourceId, mangaId); logger.info(TAG, `清空漫画缓存: sourceId=${sourceId}, mangaId=${mangaId}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Ri...
clearManga(sourceId: number, mangaId: string): void { this.deleteMangaDetail(sourceId, mangaId); this.deleteChapterList(sourceId, mangaId); logger.info(TAG, `清空漫画缓存: sourceId=${sourceId}, mangaId=${mangaId}`); }
https://github.com/DaLongZhuaZi/manxia
c4ac3409ca703160753cd45dac3f8e380754f0df
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
$_get
Returns the item at that index. @param { int } index - The zero-based index of the desired code unit. Throws error if index < 0 or index >= buffer.length. @returns { int } The element in the buffer matching the given index. @throws { BusinessError } 10200001 - The value of index is out of range.
$_get(index: int): long { if (index < 0 || index >= this.length) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "length" is out of range. \ It must be >= 0 and <= ${this.length}. Received value is: ${index}`) } return this.getDataView().getU...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left $_get 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#Right AST#ERROR#Right AST#)#Left ) AST#)#Right...
$_get(index: int): long { if (index < 0 || index >= this.length) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "length" is out of range. \ It must be >= 0 and <= ${this.length}. Received value is: ${index}`) } return this.getDataView().getU...
https://gitcode.com/iop123123/arkts-static-skills
f5041bf5a975704f4e9d67a41073ca341f20e656
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
$_invoke
Constructs a new ReferenceError instance with provided message and error specific information @param { String } [message] - Error text @param { ErrorOptions } [options] - Error options @returns { ReferenceError } - Newly created ReferenceError instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
static $_invoke(message?: String, options?: ErrorOptions): ReferenceError { return new ReferenceError(message, options) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#...
static $_invoke(message?: String, options?: ErrorOptions): ReferenceError { return new ReferenceError(message, options) }
https://gitcode.com/iop123123/arkts-static-skills
d0be49177ea34ce58395bdda33eaa414b5cb55e8
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewMangaLoader.ets
arkts
getChapterPageUrls
获取章节页面URL列表
private getChapterPageUrls(chapter: ChapterInfoDatabaseRecord, sourceConfig: WebViewSourceConfig): string[] { // 这里应该根据源配置解析章节页面 // 暂时返回空数组,实际实现需要根据具体的源配置来解析 logger.debug(TAG, `获取章节页面URL: ${chapter.id}`); return []; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getChapterPageUrls AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private getChapterPageUrls(chapter: ChapterInfoDatabaseRecord, sourceConfig: WebViewSourceConfig): string[] { // 这里应该根据源配置解析章节页面 // 暂时返回空数组,实际实现需要根据具体的源配置来解析 logger.debug(TAG, `获取章节页面URL: ${chapter.id}`); return []; }
https://github.com/DaLongZhuaZi/manxia
86156dd5cb1c02de46ea6bec2e1220bbb37a6ae0
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/discover/src/main/ets/views/SearchView.ets
arkts
hotCard
Hot card
@Builder function hotCard(list: HotListItem[], currentBreakpoint: BreakpointTypeEnum, jump: (item: HotListItem) => void) { Text($r('app.string.hmos_world_hot_list')) .fontSize($r('app.float.xl_font_size')) .fontWeight(FontWeight.Medium) .lineHeight($r('app.float.xl_line_height')) .fontColor($r('sys.c...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left hotCard AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_...
@Builder function hotCard(list: HotListItem[], currentBreakpoint: BreakpointTypeEnum, jump: (item: HotListItem) => void) { Text($r('app.string.hmos_world_hot_list')) .fontSize($r('app.float.xl_font_size')) .fontWeight(FontWeight.Medium) .lineHeight($r('app.float.xl_line_height')) .fontColor($r('sys.c...
https://gitcode.com/HarmonyOS_Samples/hmosworld
c46286ba0724eb24558e037c94e80a13aad3d8e5
gitcode
fbinba3955/Flymby
common/src/main/ets/utils/VolumeUtil.ets
arkts
initVolumeManager
初始化音量管理器
public static async initVolumeManager(): Promise<void> { try { // 获取音频管理器 VolumeUtil.audioManager = audio.getAudioManager(); // 获取音量管理器 VolumeUtil.audioVolumeManager = VolumeUtil.audioManager.getVolumeManager(); // 获取音量组管理器 VolumeUtil.audioVolumeGroupManager = VolumeUtil.audioV...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left initVolumeManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argume...
public static async initVolumeManager(): Promise<void> { try { // 获取音频管理器 VolumeUtil.audioManager = audio.getAudioManager(); // 获取音量管理器 VolumeUtil.audioVolumeManager = VolumeUtil.audioManager.getVolumeManager(); // 获取音量组管理器 VolumeUtil.audioVolumeGroupManager = VolumeUtil.audioV...
https://github.com/fbinba3955/Flymby
92e3c9cc171076f6b614063507dc917e480a8e30
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/pages/OCRScanPage.ets
arkts
retry
重新选择图片
retry() { this.hasResult = false; this.selectedImagePath = ''; this.errorMessage = ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left retry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#a...
retry() { this.hasResult = false; this.selectedImagePath = ''; this.errorMessage = ''; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1c50e1a216b211980519619d0bdd22c6f00d5a81
github
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
pauseSound
暂停音效 @param type 音效类型
pauseSound(type: SoundType): void { const audioPlayer = this.loadedSounds.get(type); if (audioPlayer) { // TODO: 暂停播放 // audioPlayer.pause(); console.log(`Pausing sound: ${type}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pauseSound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SoundType AST#identifier#Right AST#)#Left ) A...
pauseSound(type: SoundType): void { const audioPlayer = this.loadedSounds.get(type); if (audioPlayer) { // TODO: 暂停播放 // audioPlayer.pause(); console.log(`Pausing sound: ${type}`); } }
https://github.com/the-wwyang/kids-learning-app
ee4f23a5e5b7789529a4f0d87bbcd70d26bd5788
github
silence17/harmonydemo
entry/src/main/ets/pages/RankPage.ets
arkts
onPageHide
@Entry装饰的组件才可以调用页面的生命周期,页面的生命周期 页面每次隐藏时触发一次
onPageHide(){ }
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(){ }
https://github.com/silence17/harmonydemo
52dde39e0b8c68fb1fef928804be2c1ec5f425b7
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedUint32
访问 repeated uint32 字段
visitRepeatedUint32(value: number[], fieldNumber: number): void { for (const item of value) { this.visitUint32(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedUint32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left numbe...
visitRepeatedUint32(value: number[], fieldNumber: number): void { for (const item of value) { this.visitUint32(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
c8eb04a9fc282b84b2302ea34b53288e417220c3
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CoverCacheManager.ets
arkts
getBatchLocalCoverPaths
批量获取本地封面路径
async getBatchLocalCoverPaths( sourceId: number, externalIds: string[] ): Promise<Map<string, string | null>> { const result = new Map<string, string | null>(); if (externalIds.length === 0) { return result; } try { // 批量查询数据库 const placeholders = externalIds.map(...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBatchLocalCoverPaths 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 ...
async getBatchLocalCoverPaths( sourceId: number, externalIds: string[] ): Promise<Map<string, string | null>> { const result = new Map<string, string | null>(); if (externalIds.length === 0) { return result; } try { // 批量查询数据库 const placeholders = externalIds.map(...
https://github.com/DaLongZhuaZi/manxia
b646716466fc6613842f2e061b77021e991af6ed
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets
arkts
getBookCloseDuration
获取书籍关闭动画时长
public getBookCloseDuration(): number { return this.currentSettings.bookCloseDuration; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBookCloseDuration 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 numbe...
public getBookCloseDuration(): number { return this.currentSettings.bookCloseDuration; }
https://github.com/DaLongZhuaZi/manxia
356a4f2e97e6b8d075c406034e77822410f60049
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets
arkts
stopAllAnimations
停止所有动画
public stopAllAnimations(): void { this.activeAnimations.clear(); this.animationCallbacks.clear(); logger.debug(TAG, '停止所有动画'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopAllAnimations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
public stopAllAnimations(): void { this.activeAnimations.clear(); this.animationCallbacks.clear(); logger.debug(TAG, '停止所有动画'); }
https://github.com/DaLongZhuaZi/manxia
766b823f3f8eacaac4f6328e067cbf7bfd780e17
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
getInstance
获取路由操作的实例,如跳转、返回等操作 @param stackName 栈名,如果有多个Navigation,需要设置,如果一个应用只有一个,可不设置 @returns
public static getInstance(stackName: string = DEFAULT_STACK_NAME): NavDestBuilder<ObjectOrNull> { if (ZRouter.routerMgr === undefined) { ZRouter.routerMgr = ZRouter.getRouterMgr() } return NavDestBuilder.create<ObjectOrNull>(ZRouter.routerMgr, stackName) }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stackName AST#identifier#Right AST#:#Left :...
public static getInstance(stackName: string = DEFAULT_STACK_NAME): NavDestBuilder<ObjectOrNull> { if (ZRouter.routerMgr === undefined) { ZRouter.routerMgr = ZRouter.getRouterMgr() } return NavDestBuilder.create<ObjectOrNull>(ZRouter.routerMgr, stackName) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L166-L171
be452a54515677e73ce2ef519fd48b4d73f4028f
github
PollenWang6/HiXD
entry/src/main/ets/utils/ThemeColors.ets
arkts
textOnColor
根据背景色亮度返回合适的前景色(白 or 黑)
static textOnColor(hex: string): string { if (hex.length < 7) return '#FFFFFF'; const r: number = parseInt(hex.substring(1, 3), 16); const g: number = parseInt(hex.substring(3, 5), 16); const b: number = parseInt(hex.substring(5, 7), 16); const lum: number = (0.299 * r + 0.587 * g + 0.114 * b) / 2...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left textOnColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
static textOnColor(hex: string): string { if (hex.length < 7) return '#FFFFFF'; const r: number = parseInt(hex.substring(1, 3), 16); const g: number = parseInt(hex.substring(3, 5), 16); const b: number = parseInt(hex.substring(5, 7), 16); const lum: number = (0.299 * r + 0.587 * g + 0.114 * b) / 2...
https://github.com/PollenWang6/HiXD
1072177f5e9ac4bcba30fa1076c4e39eae32a237
github
jiahaozheng406/huawei-travel-app-HarmonyOS
entry/src/main/ets/pages/SplashPage.ets
arkts
build
page A pageTransition() { // 定义页面进入时的效果,从左侧滑入,时长为1200ms,无论页面栈发生push还是pop操作均可生效 PageTransitionEnter({ type: RouteType.None, duration: 500 }) .slide(SlideEffect.Left) // 定义页面退出时的效果,向左侧滑出,时长为1000ms,无论页面栈发生push还是pop操作均可生效 PageTransitionExit({ type: RouteType.None, duration: 500 }) .slide(SlideEffect.Left) } 禁用转场 pageTransi...
build() { Column() { // logo Image($r('app.media.yh')) .width($r('app.float.logo_image_size')) .height($r('app.float.logo_image_size')) .margin({ top: $r('app.float.logo_margin_top'), // bottom: $r('app.float.logo_margin_bottom') bottom: 16 ...
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() { // logo Image($r('app.media.yh')) .width($r('app.float.logo_image_size')) .height($r('app.float.logo_image_size')) .margin({ top: $r('app.float.logo_margin_top'), // bottom: $r('app.float.logo_margin_bottom') bottom: 16 ...
https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS
284dcf08b017cd8dcd5220d0d246f8833f93d38b
github
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/utils/FormUtils.ets
arkts
queryForms
Update form operation
public queryForms(): void { FormInfoApi.queryFormData((resultSet: Array<FormInfo>) => { resultSet.forEach((item: FormInfo) => { this.updateRectangleCards(item); }); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryForms AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_...
public queryForms(): void { FormInfoApi.queryFormData((resultSet: Array<FormInfo>) => { resultSet.forEach((item: FormInfo) => { this.updateRectangleCards(item); }); }); }
https://gitee.com/harmonyos/codelabs.git
9114c683ddd58953b1db4e930ff69c0682a95d09
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
strike
The strike() method creates a string that embeds a string in a <strike> element (<strike>str</strike>), which causes a string to be displayed in a big font. @returns { String } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public strike(): String{ return this.CreateHTMLString('strike', '') }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left strike 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#iden...
public strike(): String{ return this.CreateHTMLString('strike', '') }
https://gitcode.com/iop123123/arkts-static-skills
430c8ae69770c8b0c6ecb056c89c99df4f43e31d
gitcode
openharmony/applications_filepicker
audiopicker/src/main/ets/audiopreference/AudioPickerPreference.ets
arkts
getSafetyTipStatus
获取权限状态 @returns boolean
public getSafetyTipStatus(): Promise<boolean> { return new Promise((resolve) => { this.preferenceManager.get(keyPermissionTipLog, false, this.preferenceManager.preferKeys.audioPicker).then((res) => { resolve(res as boolean) }).catch((err: BusinessError) => { logger.error(`getPr...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSafetyTipStatus 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#exp...
public getSafetyTipStatus(): Promise<boolean> { return new Promise((resolve) => { this.preferenceManager.get(keyPermissionTipLog, false, this.preferenceManager.preferKeys.audioPicker).then((res) => { resolve(res as boolean) }).catch((err: BusinessError) => { logger.error(`getPr...
https://gitee.com/openharmony/applications_filepicker.git
ab7a16f7c87ec69f73d5e3108d1a0b4fa7bc18d7
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/UserSessionService.ets
arkts
login
用户登录 @param email 邮箱 @param password 密码 @returns 登录结果
static async login(email: string, password: string): Promise<LoginResult> { try { // 1. 查询用户 const users: User[] = await UserDAO.getAll(); const user: User | undefined = users.find(u => u.email === email); if (!user) { return new LoginResult(false, '用户不存在'); } // 2. 验...
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 login AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left email AST#identifier#Right AST#:#Left : AST#:#Righ...
static async login(email: string, password: string): Promise<LoginResult> { try { // 1. 查询用户 const users: User[] = await UserDAO.getAll(); const user: User | undefined = users.find(u => u.email === email); if (!user) { return new LoginResult(false, '用户不存在'); } // 2. 验...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
e9c2b226e24c06bf3ec9b37e6509eef4ae84db6a
github
midori52000/ArkPilot
Agent/entry/src/main/ets/backend/ProviderConfigStore.ets
arkts
parseCredentialsJson
── credentials JSON ──
function parseCredentialsJson(content: string): Map<string, string> { const result: Map<string, string> = new Map(); if (content.length === 0) return result; try { const parsed: Record<string, string> = JSON.parse(content) as Record<string, string>; const keys: string[] = Object.keys(parsed); for (let...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseCredentialsJson AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function parseCredentialsJson(content: string): Map<string, string> { const result: Map<string, string> = new Map(); if (content.length === 0) return result; try { const parsed: Record<string, string> = JSON.parse(content) as Record<string, string>; const keys: string[] = Object.keys(parsed); for (let...
https://github.com/midori52000/ArkPilot
03bf139264e85b5185a64681002a31a9a92f03d3
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets
arkts
togglePackActiveInPlace
Toggle a pack's active state from inside an already-open PackManagerPage, scrolling its row into view first. Caller is responsible for the surrounding navigation (open / leave). Used by the global / family activation tests where each scenario flips two packs in sequence (one OFF to free a slot, one ON to fill it) and d...
async function togglePackActiveInPlace(driver: Driver, packId: string): Promise<void> { try { await scrollPackRowIntoView(driver, packId); const toggleId: string = `PackToggle_${packId}`; const toggle: Component | null = await driver.findComponent(ON.id(toggleId)); if (toggle === null) { throw n...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left togglePackActiveInPlace AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Rig...
async function togglePackActiveInPlace(driver: Driver, packId: string): Promise<void> { try { await scrollPackRowIntoView(driver, packId); const toggleId: string = `PackToggle_${packId}`; const toggle: Component | null = await driver.findComponent(ON.id(toggleId)); if (toggle === null) { throw n...
https://github.com/terryma2024/happyword
5955b6bd23b57fe13c3f29e2bcf004a68001705e
github
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/pages/Index.ets
arkts
createRecord
✅ 打卡逻辑 (支持多次打卡) 修改:点击不再直接打卡,而是打开弹窗
createRecord(habit: Habit) { if (habit.isChecked) { // 如果已经达标,通常不再打卡,或者你可以允许继续打 return; } // 🆕 设置当前习惯并打开弹窗 this.currentOperatingHabit = habit; this.checkInDialogController.open(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left habit AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Habit AST#identifier#Right ...
createRecord(habit: Habit) { if (habit.isChecked) { // 如果已经达标,通常不再打卡,或者你可以允许继续打 return; } // 🆕 设置当前习惯并打开弹窗 this.currentOperatingHabit = habit; this.checkInDialogController.open(); }
https://gitcode.com/openharmony/codelabs
981895a53c0f388d97c6a4e7bf32e60e98f91895
gitcode
Tianpei-Shi/MusicDash
src/model/UserModel.ets
arkts
toJson
转换为JSON对象
toJson(): UserJsonData { const data: UserJsonData = { id: this.id, username: this.username, password: this.password, like: this.like, history: this.history, phone: this.phone, createdTime: this.createdTime, lastLoginTime: this.lastLoginTime, avatar: this.avata...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toJson 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 UserJsonData AST#identifier#Right AST#ERROR#Right AST#s...
toJson(): UserJsonData { const data: UserJsonData = { id: this.id, username: this.username, password: this.password, like: this.like, history: this.history, phone: this.phone, createdTime: this.createdTime, lastLoginTime: this.lastLoginTime, avatar: this.avata...
https://github.com/Tianpei-Shi/MusicDash
9ec8d78ede7e84f25db1592b44f8c6a18404246d
github
LongLiveY96/chatcube
entry/src/main/ets/services/AttachmentStorageService.ets
arkts
deleteAttachment
删除附件文件
async deleteAttachment(filePath: string): Promise<void> { try { if (filePath !== '' && fileIo.accessSync(filePath)) { fileIo.unlinkSync(filePath) } } catch (error) { console.error('AttachmentStorageService', `Failed to delete attachment: ${JSON.stringify(error)}`) } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteAttachment 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#:#L...
async deleteAttachment(filePath: string): Promise<void> { try { if (filePath !== '' && fileIo.accessSync(filePath)) { fileIo.unlinkSync(filePath) } } catch (error) { console.error('AttachmentStorageService', `Failed to delete attachment: ${JSON.stringify(error)}`) } }
https://github.com/LongLiveY96/chatcube
e2a558fd9368c98f833b2c5088589c5bd2aebc58
github
zcg741/chengyu-game
entry/src/main/ets/service/ThemeService.ets
arkts
getThemeById
AppStorage 键 根据 themeId 获取主题(避免索引访问)
function getThemeById(themeId: string): Theme { if (themeId === 'classic') return THEMES.classic; if (themeId === 'green') return THEMES.green; if (themeId === 'blue') return THEMES.blue; if (themeId === 'dark') return THEMES.dark; return THEMES.classic; // 默认 }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getThemeById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left themeId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function getThemeById(themeId: string): Theme { if (themeId === 'classic') return THEMES.classic; if (themeId === 'green') return THEMES.green; if (themeId === 'blue') return THEMES.blue; if (themeId === 'dark') return THEMES.dark; return THEMES.classic; // 默认 }
https://github.com/zcg741/chengyu-game
923f79d549c9706bc81a827efaea4cd4a4f34614
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
setOnSessionStateChangedCallback
Set callback for session state changes
static setOnSessionStateChangedCallback(callback: (state: SessionState) => void): void { onSessionStateChangedCallback = callback; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left setOnSessionStateChangedCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left...
static setOnSessionStateChangedCallback(callback: (state: SessionState) => void): void { onSessionStateChangedCallback = callback; }
https://github.com/tangwengang-del/freerdp-harmonyos
74f6c26d8a4d7395c51fc2ba45e0187ca3e852cd
github
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/ScanAccessibility.ets
arkts
isOpenAccessibilitySync
Get the status of whether accessibility is enabled. @returns {boolean} Returns the status of whether accessibility is enabled.
static isOpenAccessibilitySync(): boolean { let isOpen: boolean = false; try { isOpen = accessibility.isOpenAccessibilitySync(); } catch (error) { Logger.error(TAG, `Failed to isOpenAccessibilitySync. Code: ${error.code}`); } return isOpen; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isOpenAccessibilitySync 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 b...
static isOpenAccessibilitySync(): boolean { let isOpen: boolean = false; try { isOpen = accessibility.isOpenAccessibilitySync(); } catch (error) { Logger.error(TAG, `Failed to isOpenAccessibilitySync. Code: ${error.code}`); } return isOpen; }
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
cb52e7ef2d15b4ba6409236f961088b322af381d
gitcode
openharmony/applications_filepicker
audiopicker/src/main/ets/basemvvm/AbsBaseViewData.ets
arkts
append
针对分页的数据,不要使用normal,直接使用append @param appendData 需要追加的数据
public append(appendData: VD[]): void { this.liveData.push(...appendData); this.notifyDataReload() this.state.setViewState(BaseState.NORMAL); }
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#identifier#Left appendData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left VD AST#identifier#R...
public append(appendData: VD[]): void { this.liveData.push(...appendData); this.notifyDataReload() this.state.setViewState(BaseState.NORMAL); }
https://gitee.com/openharmony/applications_filepicker.git
0bb2d88bcf062ed1c12b58f190029f991e4b3894
gitee
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/UserManager.ets
arkts
register
Register a new user.
static async register(user: IUser): Promise<boolean> { const result = await UserManager.registerWithResult(user); return result.success; }
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 register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Ri...
static async register(user: IUser): Promise<boolean> { const result = await UserManager.registerWithResult(user); return result.success; }
https://github.com/Harrisonls2004/WaterFlow
dfebc8e5ff3e64209bd0b1583ff083fc9fe68431
github
zcg741/chengyu-game
entry/src/main/ets/service/ChengyuService.ets
arkts
filterChengyu
过滤成语数据 @param list 成语列表 @param difficulty 难度 @param category 分类 @returns 过滤后的成语列表
function filterChengyu(list: Chengyu[], difficulty: number, category: string): Chengyu[] { let result = list; if (difficulty > 0) { result = result.filter(c => c.difficulty === difficulty); } if (category && category !== '全部') { result = result.filter(c => c.category === category); } return result; ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left filterChengyu AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left list AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function filterChengyu(list: Chengyu[], difficulty: number, category: string): Chengyu[] { let result = list; if (difficulty > 0) { result = result.filter(c => c.difficulty === difficulty); } if (category && category !== '全部') { result = result.filter(c => c.category === category); } return result; ...
https://github.com/zcg741/chengyu-game
5caf9e8acfc65825bc30374d56166cbbf04be739
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/AlbumService.ets
arkts
formatPlayTime
格式化播放时长 @param seconds 秒数 @returns 格式化后的时长,如 '03:45'
private static formatPlayTime(seconds: number): string { const minutes = Math.floor(seconds / 60); const secs = Math.floor(seconds % 60); return `${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left formatPlayTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Le...
private static formatPlayTime(seconds: number): string { const minutes = Math.floor(seconds / 60); const secs = Math.floor(seconds % 60); return `${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; }
https://github.com/cpdd5201314/harmonyOS-music-app
4191513444e3c92298278d50221a51a1f9a5cf3c
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets
arkts
getPendingChannelResponseCount
Returns the number of pending channel callback replies. <p>When sending messages to the Flutter application using {@link BinaryMessenger#send(String, ByteBuffer, io.flutter.plugin.common.BinaryMessenger.BinaryReply)}, developers can optionally specify a reply callback if they expect a reply from the Flutter application...
getPendingChannelResponseCount(): number { return this.dartMessenger.getPendingChannelResponseCount(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPendingChannelResponseCount 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#R...
getPendingChannelResponseCount(): number { return this.dartMessenger.getPendingChannelResponseCount(); }
https://gitee.com/openharmony-sig/flutter_engine.git
accbc6b39f2c576a88cb55eaf7e1f60504e0e070
gitee
the-wwyang/kids-learning-app
src/main/ets/storage/AchievementStorageService.ets
arkts
updateAchievement
更新单个成就 @param achievement 成就对象
static async updateAchievement(achievement: Achievement): Promise<void> { try { // 加载所有成就 const achievements = await AchievementStorageService.loadAchievements(); // 查找并更新 const index = achievements.findIndex(a => a.id === achievement.id); if (index >= 0) { achievements[inde...
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 updateAchievement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left achievement AST#identifier#Right AST#:...
static async updateAchievement(achievement: Achievement): Promise<void> { try { // 加载所有成就 const achievements = await AchievementStorageService.loadAchievements(); // 查找并更新 const index = achievements.findIndex(a => a.id === achievement.id); if (index >= 0) { achievements[inde...
https://github.com/the-wwyang/kids-learning-app
70c19028a113eb52d0ce86f5fc8520cf8fff5c41
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_or/bitwise_or_long.ets
arkts
main
--- desc: check bitwise OR 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
e328d47fe1b2449f975f0efcbbd54560be3ddd7a
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreCoverImages
恢复封面图片 [重构] 使用Download同步模式,将漫画文件恢复到Download/漫匹/manga目录
private async restoreCoverImages(sourceDir: string): Promise<void> { const filesDir = this.sandboxManager.getDirectory('files'); const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); try { // 恢复漫画封面和章节图片 const mangaSource = `${sourceDir}/manga`; if (SafeFileUtils.ac...
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 restoreCoverImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceDir AST#identifier#Right AST#ERROR#Left AST...
private async restoreCoverImages(sourceDir: string): Promise<void> { const filesDir = this.sandboxManager.getDirectory('files'); const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); try { // 恢复漫画封面和章节图片 const mangaSource = `${sourceDir}/manga`; if (SafeFileUtils.ac...
https://github.com/DaLongZhuaZi/manxia
e49fcff2ad04cfb9debeb39b1d114fac26b018e6
github
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onForeground
onForeground 生命周期 应用切换到前台时调用
onForeground(): void { // Ability has brought to foreground hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); if (this.started) { return; } this.started = true; // 启动监控服务(Promise 链,避免修改方法签名) MonitorCoreService.init(this.context) .then(() => MonitorCoreServi...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground 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...
onForeground(): void { // Ability has brought to foreground hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); if (this.started) { return; } this.started = true; // 启动监控服务(Promise 链,避免修改方法签名) MonitorCoreService.init(this.context) .then(() => MonitorCoreServi...
https://gitcode.com/openharmony/codelabs
c84b5c7d967582cfd17ab94c6e715467a13d42f3
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
decodeBase64
Decodes the given Base64 string into a byte array. @param base64 The Base64 string to decode. @param urlSafe If true, uses the URL-safe Base64 alphabet. @returns A Uint8Array containing the decoded bytes.
private static decodeBase64(base64: string, urlSafe: boolean): Uint8Array { let table = urlSafe ? Base64Helper.BASE64_URL_SAFE_CHARS : Base64Helper.BASE64_CHARS; let allowedPattern = urlSafe ? "[^A-Za-z0-9\\-_=]" : "[^A-Za-z0-9+/=]"; let cleaned: string = base64.replace(new R...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left decodeBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base64 AST#identifier#Right AST#:#Left ...
private static decodeBase64(base64: string, urlSafe: boolean): Uint8Array { let table = urlSafe ? Base64Helper.BASE64_URL_SAFE_CHARS : Base64Helper.BASE64_CHARS; let allowedPattern = urlSafe ? "[^A-Za-z0-9\\-_=]" : "[^A-Za-z0-9+/=]"; let cleaned: string = base64.replace(new R...
https://gitcode.com/iop123123/arkts-static-skills
91684cd1f329df2f64472b4b671ea1d9df36d196
gitcode
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/ResourceUtil.ets
arkts
getRawFileStringByKey
Get content from the raw file resource "env.json" by key. @param context The base context of an ability or an application. @param key The Json key value. @returns Return the value of the key.
public static getRawFileStringByKey(context: Context, key: ConfigMapKey): string | object { const configStr: string | object | undefined = AppStorage.get(key); if (configStr) { return configStr; } try { if (!context) { Logger.error(TAG, 'getRawFileStringByKey context is null'); ...
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 getRawFileStringByKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#...
public static getRawFileStringByKey(context: Context, key: ConfigMapKey): string | object { const configStr: string | object | undefined = AppStorage.get(key); if (configStr) { return configStr; } try { if (!context) { Logger.error(TAG, 'getRawFileStringByKey context is null'); ...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
2eee2ad6f532c585fa41eea0ec60e26b4640a7dd
gitcode
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
isLunarFirstDayOfMonth
判断是否农历初一 @param year 年 @param month 月 @param day 日 @returns 返回是否农历初一
static isLunarFirstDayOfMonth(year: number, month: number, day: number): boolean { let i18nCalendar: i18n.Calendar = i18n.getCalendar("zh-Hans", "chinese"); i18nCalendar.setTime(new Date(year, month - 1, day)); return i18nCalendar.get("date") === 1 ? true : false; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isLunarFirstDayOfMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
static isLunarFirstDayOfMonth(year: number, month: number, day: number): boolean { let i18nCalendar: i18n.Calendar = i18n.getCalendar("zh-Hans", "chinese"); i18nCalendar.setTime(new Date(year, month - 1, day)); return i18nCalendar.get("date") === 1 ? true : false; }
https://gitcode.com/arkui-x/samples
cb990a6c3c1a48248b5d95d25508ef6517b2c366
gitcode
pangpang20/antennaPodHM
entry/src/main/ets/service/SettingsService.ets
arkts
setContinuePlayback
设置自动续播
async setContinuePlayback(enabled: boolean): Promise<void> { this.settings.continuePlayback = enabled; await this.saveSettings(); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setContinuePlayback AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_...
async setContinuePlayback(enabled: boolean): Promise<void> { this.settings.continuePlayback = enabled; await this.saveSettings(); }
https://github.com/pangpang20/antennaPodHM
6da2329799001cf328f969c0d9e0cc647b4a06ac
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
heuristic
启发式函数 @param node 当前节点 @param goal 目标节点
private heuristic(node: GraphNode, goal: GraphNode): number { // 同楼层:曼哈顿距离 if (node.floor === goal.floor) { return ( Math.abs(node.position.x - goal.position.x) + Math.abs(node.position.z - goal.position.z) ); } // 跨楼层:欧几里得距离 return this.getDistance(node.position, goal...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left heuristic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Gra...
private heuristic(node: GraphNode, goal: GraphNode): number { // 同楼层:曼哈顿距离 if (node.floor === goal.floor) { return ( Math.abs(node.position.x - goal.position.x) + Math.abs(node.position.z - goal.position.z) ); } // 跨楼层:欧几里得距离 return this.getDistance(node.position, goal...
https://github.com/LJ666-ui/harmony-health-care
58c9a09bfbcff4860bf275b7fa66aed7dac0a21d
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test5_original_index.ets
arkts
testArrayCreation
=== Array.from like pattern ===
function testArrayCreation(): string { let source: number[] = [10, 20, 30]; let arr: number[] = []; for (const n of source) { arr.push(n * 2); } let result: string = ''; for (const item of arr) { if (result.length > 0) { result = result + ','; } result = result + String(item); } re...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayCreation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine...
function testArrayCreation(): string { let source: number[] = [10, 20, 30]; let arr: number[] = []; for (const n of source) { arr.push(n * 2); } let result: string = ''; for (const item of arr) { if (result.length > 0) { result = result + ','; } result = result + String(item); } re...
https://github.com/miaochiahao/ark-ghidra
a21ec691bbc203adf03766c96ac11b4d672ff105
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/view/RecommendPage.ets
arkts
build
Builds the scrollable home column, optional {@link HomeFloatingMiniBar}, and outer padding.
build() { Column() { Scroll() { Column() { HomeTopBar() HeroBannerSection({ recommendViewModel: this.recommendViewModel }) CategoryChipsSection({ recommendViewModel: this.recommendViewModel }) ForYouSection({ recommendViewModel: this.recommendViewModel }) ...
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() { Scroll() { Column() { HomeTopBar() HeroBannerSection({ recommendViewModel: this.recommendViewModel }) CategoryChipsSection({ recommendViewModel: this.recommendViewModel }) ForYouSection({ recommendViewModel: this.recommendViewModel }) ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
44907f357830ef305dee112cf3a7cb0096302415
gitcode
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Column.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example ColumnEnd() { Text("Hi"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.End, alignItems: HorizontalAlign.End, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue,...
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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.End, alignItems: HorizontalAlign.End, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue,...
https://github.com/Joker-x-dev/CoolMallArkTS
e0cf4d44f8f5cf5f062f98922de9d5d58f94fa41
github
codelably/tuniao-ui
packages/main/src/main/ets/view/TnThemePage.ets
arkts
aboutToDisappear
页面销毁时恢复默认主题
aboutToDisappear(): void { this.vm.restoreDefaultTheme(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
aboutToDisappear(): void { this.vm.restoreDefaultTheme(); }
https://github.com/codelably/tuniao-ui
b6057037f6ab5e61d3bb4570782376173a56dbd5
github
openharmony-sig/amountinputtext
libamountinput/src/main/ets/widget/AmountInputText.ets
arkts
isValidAmount
是否有效的金额,需满足设定条件,小数点前后数字个数满足要求 @param value
isValidAmount(value: string, instance: any): boolean { let left = ""; let right = ""; let index = value.indexOf('.'); if (index > 0) { left = value.substring(0, value.indexOf('.')); if (index < value.length - 1) { right = value.substring(value.indexOf('.') + 1); } } else ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValidAmount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , ...
isValidAmount(value: string, instance: any): boolean { let left = ""; let right = ""; let index = value.indexOf('.'); if (index > 0) { left = value.substring(0, value.indexOf('.')); if (index < value.length - 1) { right = value.substring(value.indexOf('.') + 1); } } else ...
https://gitee.com/openharmony-sig/amountinputtext.git
c798f3a9abf659f26521d00a8c0cfe5236274b92
gitee
HarmonyOS_Samples/BestPracticeSnippets
AvoidTimeComsume/entry/src/main/ets/views/UseAsync.ets
arkts
build
[Start use_async]
build() { Column({ space: 2 }) { Row({ space: 5 }) { Column() { Image($r('app.media.chevron_left')) .width(16) .height(16) } .width(40) .height(40) .justifyContent(FlexAlign.Center) .backgroundColor('#E8E8E8') .borderR...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { Column({ space: 2 }) { Row({ space: 5 }) { Column() { Image($r('app.media.chevron_left')) .width(16) .height(16) } .width(40) .height(40) .justifyContent(FlexAlign.Center) .backgroundColor('#E8E8E8') .borderR...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
6926e01f20a1dfe446c9851f93528c2a959be4f4
gitcode
arkui-x/samples
CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets
arkts
getDisplay
获取手机物理逻辑密度 @returns {Promise<number>}
async getDisplay(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType> if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].densityPixels; } globalDisplays = await display.getAllDisplays(); WindowModel.getInstance()...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getDisplay 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#...
async getDisplay(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType> if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].densityPixels; } globalDisplays = await display.getAllDisplays(); WindowModel.getInstance()...
https://gitcode.com/arkui-x/samples
50d2c639881e366655456b788ed4a9a34e8d6089
gitcode
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
isBluetoothEnabled
蓝牙功能是否可用
isBluetoothEnabled(): boolean { Log.showInfo(TAG, `isBluetoothEnabled`); const state: access.BluetoothState = access.getState(); Log.showInfo(TAG, `isBluetoothEnabled: state = ${state}`); if (state === access.BluetoothState.STATE_ON || state === access.BluetoothState.STATE_TURNING_ON) { return t...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isBluetoothEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#...
isBluetoothEnabled(): boolean { Log.showInfo(TAG, `isBluetoothEnabled`); const state: access.BluetoothState = access.getState(); Log.showInfo(TAG, `isBluetoothEnabled: state = ${state}`); if (state === access.BluetoothState.STATE_ON || state === access.BluetoothState.STATE_TURNING_ON) { return t...
https://gitcode.com/arkui-x/samples
fe72f031eec33c95be5a076b7271e7505a9a5cf7
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
getCoveringGridPosition
When an item is deleted, the filling position of other items is calculated.
getCoveringGridPosition(index: number): PositionXY { let xNew: number = 0; let yNew: number = 0; if (index > this.selectedIndex && this.arraySelectIsChange !== 2) { xNew = index % this.colNum === 0 ? this.blockWidth * (this.colNum - 1) : -this.blockWidth; yNew = index % this.colNum === 0 ? -th...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCoveringGridPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST...
getCoveringGridPosition(index: number): PositionXY { let xNew: number = 0; let yNew: number = 0; if (index > this.selectedIndex && this.arraySelectIsChange !== 2) { xNew = index % this.colNum === 0 ? this.blockWidth * (this.colNum - 1) : -this.blockWidth; yNew = index % this.colNum === 0 ? -th...
https://gitcode.com/openharmony/arkui_ace_engine
5f9df80e85c2fe98a10aa3d37f8a74cdef692135
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_uint.ets
arkts
main
--- desc: check prefix decrement for unsigned integer operand ---
function main(): void { let value: uint = {{v.value}} let result: uint = --value assert value == {{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 { let value: uint = {{v.value}} let result: uint = --value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f8fcce8ee2244b92dbe580c3d99fbe672b588d7f
gitee