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
LongLiveY96/chatcube
entry/src/main/ets/services/WebSearchService.ets
arkts
isValidUrl
验证 URL 格式
isValidUrl(text: string): boolean { const urlPattern = /^https?:\/\/[\w\-.]+(:\d+)?(\/[\w\-._~:/?#[\]@!$&'()*+,;=]*)?$|^[\w\-.]+(:\d+)?(\/[\w\-._~:/?#[\]@!$&'()*+,;=]*)?$/ return urlPattern.test(text.trim()) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValidUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#...
isValidUrl(text: string): boolean { const urlPattern = /^https?:\/\/[\w\-.]+(:\d+)?(\/[\w\-._~:/?#[\]@!$&'()*+,;=]*)?$|^[\w\-.]+(:\d+)?(\/[\w\-._~:/?#[\]@!$&'()*+,;=]*)?$/ return urlPattern.test(text.trim()) }
https://github.com/LongLiveY96/chatcube
d2134e026372bc2e75afbf0886e788d8a04e9054
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
removeAt
Removes the value at the specified index from the LightWeightSet @param index the index to remove the value from @returns true if the value was removed, false otherwise @throws BusinessError if the index exceeds Int.MAX_VALUE.
removeAt(index: int): boolean { this.checkIndex(index); return this.buckets.removeAt(index); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeAt 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#)#Ri...
removeAt(index: int): boolean { this.checkIndex(index); return this.buckets.removeAt(index); }
https://gitcode.com/iop123123/arkts-static-skills
65a9a00c105ad06c0ee410461327d1ff3327b226
gitcode
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/class_files_manager_old.ets
arkts
reset_song_data
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 内部函数 // ////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 外部函数 // ////////// 重置表 //
reset_song_data() { // 重置目录 try {fs.rmdirSync(files_manager_path)} catch {} // 重置列表 this.all_songs_list = [] this.play_list = new Map<string, string[]>() this.artist_composer_list = new Map<string, string[]>() this.album_list = new Map<string, string[]>() this.album_artist_list = new M...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left reset_song_data AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
reset_song_data() { // 重置目录 try {fs.rmdirSync(files_manager_path)} catch {} // 重置列表 this.all_songs_list = [] this.play_list = new Map<string, string[]>() this.artist_composer_list = new Map<string, string[]>() this.album_list = new Map<string, string[]>() this.album_artist_list = new M...
https://github.com/Nekofox-POT/LinMusic
ac0d250e3d62c376c84293b3b33a35ff2a1c3783
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
loadRecentGames
加载最近游戏列表
private async loadRecentGames(): Promise<void> { if (!this.dataPreferences) return; try { const json = await this.dataPreferences.get(KEY_RECENT_GAMES, '[]') as string; this.recentGames = JSON.parse(json) as GameInfo[]; console.info(`${TAG} Loaded ${this.recentGames.length} recent games`); ...
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 loadRecentGames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async loadRecentGames(): Promise<void> { if (!this.dataPreferences) return; try { const json = await this.dataPreferences.get(KEY_RECENT_GAMES, '[]') as string; this.recentGames = JSON.parse(json) as GameInfo[]; console.info(`${TAG} Loaded ${this.recentGames.length} recent games`); ...
https://github.com/richshaw2015/nds
9b60a119d78332e44ad57a5c3dfc0c955f3281a9
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/FavoritesVM.ets
arkts
refresh
拉服务端 saved 列表 + 合并本地。
static async refresh(): Promise<Book[]> { Logger.i(TAG, `refresh: fetching from server...`); let remote: Book[]; try { remote = await ZLibraryClient.instance.getUserSaved(200); } catch (e) { Logger.w(TAG, `refresh: getUserSaved failed: ${(e as Error).message}`); // 服务端不可达时保留本地缓存 ...
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 refresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :...
static async refresh(): Promise<Book[]> { Logger.i(TAG, `refresh: fetching from server...`); let remote: Book[]; try { remote = await ZLibraryClient.instance.getUserSaved(200); } catch (e) { Logger.w(TAG, `refresh: getUserSaved failed: ${(e as Error).message}`); // 服务端不可达时保留本地缓存 ...
https://github.com/LZZLHY/hlib
d9b450ca30c7c10f2d4a2a28a7599527b34d876f
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/http/HttpClient.ets
arkts
requestStream
流式请求(SSE)— 返回 HttpRequest 实例供调用方监听事件
static requestStream( url: string, body: string, headers: Record<string, string>, onData: (chunk: ArrayBuffer) => void, onComplete: () => void, onError: (err: string) => void ): http.HttpRequest { const httpRequest = http.createHttp() const streamHeaders: Record<string, string> = { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left requestStream AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#...
static requestStream( url: string, body: string, headers: Record<string, string>, onData: (chunk: ArrayBuffer) => void, onComplete: () => void, onError: (err: string) => void ): http.HttpRequest { const httpRequest = http.createHttp() const streamHeaders: Record<string, string> = { ...
https://github.com/encorexin/WordPressCMS
00035f7b9490bf1ec8c1edb8c0c39d34ff5882ae
github
openharmony-sig/ohos_subsampling_scale_image_view
library/src/main/ets/components/MainPage/SubsamplingScaleImageView.ets
arkts
setDoubleTapZoomDuration
Set the duration of the double tap zoom animation. @param durationMs Duration in milliseconds.
public setDoubleTapZoomDuration(durationMs: number): Model { this.doubleTapZoomDuration = Math.max(0, durationMs); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDoubleTapZoomDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durationMs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numbe...
public setDoubleTapZoomDuration(durationMs: number): Model { this.doubleTapZoomDuration = Math.max(0, durationMs); return this; }
https://gitee.com/openharmony-sig/ohos_subsampling_scale_image_view.git
56a5f423a12abcd64658fc3853dfe06992c45d65
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readBigInt64LE
Reads a signed 64-bit integer from the buffer at the specified offset using little-endian format @param {int} [offset=0] - Number of bytes to skip before reading @returns {bigint} The read value
public readBigInt64LE(offset: int = 0): bigint { let lengthOffset: int = this.length - 8; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= $...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readBigInt64LE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expr...
public readBigInt64LE(offset: int = 0): bigint { let lengthOffset: int = this.length - 8; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= $...
https://gitcode.com/iop123123/arkts-static-skills
32a3620c84813c4d79274dc66ace86f0793897f7
gitcode
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Row.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example RowSpaceEvenlyTop() { Text("A"); Text("B"); Text("C"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceEvenly, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVal...
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 { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceEvenly, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVal...
https://github.com/Joker-x-dev/CoolMallArkTS
9f8aaff994f36f04a4a6e6fca495c73c13deabb4
github
openharmony/applications_app_samples
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/SelectUserDialog.ets
arkts
build
最终返回的用户id
build() { Column() { Text(this.title) .fontSize(20) .fontColor($r('app.color.COLOR_E6000000')) .fontFamily($r('app.string.font_family')) .width('90%') .textAlign(TextAlign.Start) .margin({ top: 14, bottom: 14 }) Column() { Row() { Tex...
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() { Text(this.title) .fontSize(20) .fontColor($r('app.color.COLOR_E6000000')) .fontFamily($r('app.string.font_family')) .width('90%') .textAlign(TextAlign.Start) .margin({ top: 14, bottom: 14 }) Column() { Row() { Tex...
https://github.com/openharmony/applications_app_samples
ddfdd125ce5264ef10b6162de6e314af3f50993c
github
OHPG/FinSdk
jellyfin/src/main/ets/api/PlaylistsApi.ets
arkts
getPlaylistUser
@summary Get a playlist user. @param {PlaylistsApiGetPlaylistUserRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof PlaylistsApi
public getPlaylistUser(requestParameters: PlaylistsApiGetPlaylistUserRequest): Promise<PlaylistUserPermissions> { return this.apiClient.get({path: `/Playlists/${requestParameters.playlistId}/Users/${requestParameters.userId}`, parameters: requestParameters, excludeParams: ['playlistId', 'userId']}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPlaylistUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
public getPlaylistUser(requestParameters: PlaylistsApiGetPlaylistUserRequest): Promise<PlaylistUserPermissions> { return this.apiClient.get({path: `/Playlists/${requestParameters.playlistId}/Users/${requestParameters.userId}`, parameters: requestParameters, excludeParams: ['playlistId', 'userId']}) }
https://github.com/OHPG/FinSdk
65ccb86349b7e5dc2b4e820e53884ca2627b541c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
initialize
公开的初始化方法 由SplashPage在适当时机调用,确保主题在UI渲染前完全初始化
public async initialize(): Promise<void> { if (this.isInitialized) { logger.debug(TAG, 'ThemeManager已初始化,跳过重复初始化'); return; } try { logger.info(TAG, '🎨 开始ThemeManager初始化'); // 1. 首先检测系统主题 this.detectSystemTheme(); logger.info(TAG, `📱 系统主题检测完成: ${this.actualThe...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public async initialize(): Promise<void> { if (this.isInitialized) { logger.debug(TAG, 'ThemeManager已初始化,跳过重复初始化'); return; } try { logger.info(TAG, '🎨 开始ThemeManager初始化'); // 1. 首先检测系统主题 this.detectSystemTheme(); logger.info(TAG, `📱 系统主题检测完成: ${this.actualThe...
https://github.com/DaLongZhuaZi/manxia
71b3e3077c76d4b496b346fd32c075112269923a
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
getLocalUdpAddress
获取本地 UDP 地址
public getLocalUdpAddress(): string | null { return this.client?.getLocalUdpAddress() ?? null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLocalUdpAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#L...
public getLocalUdpAddress(): string | null { return this.client?.getLocalUdpAddress() ?? null; }
https://github.com/tdcare/tdwebrtc
fc8ae46b308fb1c38ae8c85e325db96f9d0537b8
github
openharmony/arkui_advanced_ui_component
atomicserviceweb/source/atomicserviceweb.ets
arkts
reportSuccessEvent
上报Api调用成功的打点 @param apiNameAlias 接口别名
public reportSuccessEvent(apiNameAlias?: string): void { const apiName: string = `has.${apiNameAlias}`; if (this.isNeedReport(apiName)) { HiAnalyticsUtil.reportApiEvent(apiName, ActionState.SUCCESS); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reportSuccessEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left apiNameAlias AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right ...
public reportSuccessEvent(apiNameAlias?: string): void { const apiName: string = `has.${apiNameAlias}`; if (this.isNeedReport(apiName)) { HiAnalyticsUtil.reportApiEvent(apiName, ActionState.SUCCESS); } }
https://gitee.com/openharmony/arkui_advanced_ui_component.git
fd121e2d58b75177d9238a5c4b44fd3b8a2b6d43
gitee
harmonyos/codelabs
DownloadNotification/entry/src/main/ets/pages/MainPage.ets
arkts
download
Start the timer and send notification.
download() { this.interval = setInterval(async () => { if (this.downloadProgress === CommonConstants.PROGRESS_TOTAL) { this.notificationTitle = await getStringByRes($r('app.string.notification_title_finish'), this); this.downloadStatus = DOWNLOAD_STATUS.FINISHED; clearInterval(this.i...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left download AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS...
download() { this.interval = setInterval(async () => { if (this.downloadProgress === CommonConstants.PROGRESS_TOTAL) { this.notificationTitle = await getStringByRes($r('app.string.notification_title_finish'), this); this.downloadStatus = DOWNLOAD_STATUS.FINISHED; clearInterval(this.i...
https://gitee.com/harmonyos/codelabs.git
baabc9c975d5d6ea6ea165b0869989362fd611f6
gitee
arkui-x/samples
CodeLab/Cases/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets
arkts
scrollList
MyScroller组件滑动List
scrollList(offset: number) { this.listScroller.scrollBy(0, offset); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left scrollList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ...
scrollList(offset: number) { this.listScroller.scrollBy(0, offset); }
https://gitcode.com/arkui-x/samples
4f780937857c1aeffd7f93cf164416be08f3ef2f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets
arkts
escapeScript
转义脚本字符串
private escapeScript(script: string): string { return script .replace(/\\/g, '\\\\') .replace(/'/g, "\\'") .replace(/"/g, '\\"') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') .replace(/\t/g, '\\t'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeScript AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left script AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private escapeScript(script: string): string { return script .replace(/\\/g, '\\\\') .replace(/'/g, "\\'") .replace(/"/g, '\\"') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') .replace(/\t/g, '\\t'); }
https://github.com/DaLongZhuaZi/manxia
01c6a33930218c3014e39d83cc2c7aadd8a1927d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
readFile
读取文件字节
async readFile(path: string): Promise<Uint8Array | null> { try { const fullPath = this.resolvePath(path); const file = SafeFileUtils.openSync(fullPath, fileIo.OpenMode.READ_ONLY); const stat = SafeFileUtils.statSync(fullPath); const buffer = new ArrayBuffer(stat.size); SafeFileUtils....
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left readFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async readFile(path: string): Promise<Uint8Array | null> { try { const fullPath = this.resolvePath(path); const file = SafeFileUtils.openSync(fullPath, fileIo.OpenMode.READ_ONLY); const stat = SafeFileUtils.statSync(fullPath); const buffer = new ArrayBuffer(stat.size); SafeFileUtils....
https://github.com/DaLongZhuaZi/manxia
643bd8e570af3ade24a36b8e8cfbdc93b46b0fed
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
setComment
Sets a comment in the XML output. @param {string} comment - The comment string to be added to the XML output.
public setComment(text: string): void { let stringBuilder = this.prepareBufferForNewItem(text); stringBuilder.append(`<!--${text}-->`); this.type = XmlType.OTHERS; this.writeToBuffer(stringBuilder, 'SetComment'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
public setComment(text: string): void { let stringBuilder = this.prepareBufferForNewItem(text); stringBuilder.append(`<!--${text}-->`); this.type = XmlType.OTHERS; this.writeToBuffer(stringBuilder, 'SetComment'); }
https://gitcode.com/iop123123/arkts-static-skills
4b5bf481fa5ea076e112632df8dad4deaa1ccfd8
gitcode
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/ResourceUtil.ets
arkts
getRawFileStringByKey
通过键从原始文件资源“web_config.json”中获取内容。 @param context Context @param key ConfigMapKey @returns string
public static getRawFileStringByKey(context: Context, key: ConfigMapKeyEnum): string { const configStr: string | undefined = AppStorage.get(key) if (configStr) { return configStr } try { const result: Uint8Array = context.resourceManager.getRawFileContentSync('web_config.json') const...
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: ConfigMapKeyEnum): string { const configStr: string | undefined = AppStorage.get(key) if (configStr) { return configStr } try { const result: Uint8Array = context.resourceManager.getRawFileContentSync('web_config.json') const...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
7d528f53cb6dbeb3c1cc6b918751946cf938383c
gitcode
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
getDuration
Total duration in ms from AVPlayer, or 0 if not prepared.
private getDuration() { if (this.isPrepared && this.avPlayer) { return this.avPlayer.duration; } return 0; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private getDuration() { if (this.isPrepared && this.avPlayer) { return this.avPlayer.duration; } return 0; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
51454bc3d25a16fe5c575972baa404bbc05d221c
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets
arkts
getContactById
根据ID查询联系人
public async getContactById(id: number): Promise<ContactsItem | null> { try { const rdbStore = await this.ensureDBInitialized(); // 创建查询条件 const predicates = new relationalStore.RdbPredicates('contacts'); predicates.equalTo('id', id); // 查询数据 const resultSet = await rdbStore....
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 getContactById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#...
public async getContactById(id: number): Promise<ContactsItem | null> { try { const rdbStore = await this.ensureDBInitialized(); // 创建查询条件 const predicates = new relationalStore.RdbPredicates('contacts'); predicates.equalTo('id', id); // 查询数据 const resultSet = await rdbStore....
https://gitcode.com/openharmony/codelabs
0fd54d1ca14146e0e604914f532e9bce7e31c83a
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_or_equal/less_or_equal_long.ets
arkts
main
--- desc: check less or equal operation for long integer ---
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
5f49676928934f24e90ec172207c5f633264bcf3
gitee
pangpang20/antennaPodHM
entry/src/main/ets/service/PodcastService.ets
arkts
parseRssFeed
解析RSS Feed
private parseRssFeed(rssContent: string, feedUrl: string): Podcast { // 简化的RSS解析实现 // 实际应该使用XML解析器 const podcast = new Podcast(); podcast.id = this.generateId(); podcast.feedUrl = feedUrl; // 解析标题 const titleMatch = rssContent.match(/<title>(.*?)<\/title>/); if (titleMatch) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseRssFeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rssContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private parseRssFeed(rssContent: string, feedUrl: string): Podcast { // 简化的RSS解析实现 // 实际应该使用XML解析器 const podcast = new Podcast(); podcast.id = this.generateId(); podcast.feedUrl = feedUrl; // 解析标题 const titleMatch = rssContent.match(/<title>(.*?)<\/title>/); if (titleMatch) { ...
https://github.com/pangpang20/antennaPodHM
54cf5a64b6e39c1c3e2d757fc6cec5cf87e7419e
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/VideoInfoUtil.ets
arkts
saveOriginalVideoWidthAndHeight
保存视频初始长宽,变更后视频长宽后使用
static saveOriginalVideoWidthAndHeight(playAreaWidth: number, playAreaHeight: number) { VideoInfoUtil.playAreaWidth = playAreaWidth VideoInfoUtil.playAreaHeight = playAreaHeight }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveOriginalVideoWidthAndHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left playAreaWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#...
static saveOriginalVideoWidthAndHeight(playAreaWidth: number, playAreaHeight: number) { VideoInfoUtil.playAreaWidth = playAreaWidth VideoInfoUtil.playAreaHeight = playAreaHeight }
https://github.com/Yebingiscn/SweetVideo
b72d5b7ed85ccabb2fcbba9b7ee9ccc4c8ffa30b
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
createSession
Creates and activates AVSession, sets launch want agent, and registers controller listeners.
private async createSession(): Promise<void> { if (!this.abilityContext) { return; } try { this.session = await avSession.createAVSession(this.abilityContext, 'SESSION_NAME', 'audio'); Logger.info(TAG, `session create done : sessionId : ${this.session.sessionId}`); this.session.act...
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 createSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
private async createSession(): Promise<void> { if (!this.abilityContext) { return; } try { this.session = await avSession.createAVSession(this.abilityContext, 'SESSION_NAME', 'audio'); Logger.info(TAG, `session create done : sessionId : ${this.session.sessionId}`); this.session.act...
https://gitcode.com/HarmonyOS_Samples/MusicHome
f4ed9ef641de80d77928c15e48f1da6ae48fa2ea
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
loadMoreSources
加载更多书源(分页) @param reset 是否重置列表
loadMoreSources(reset: boolean = false): void { if (this.isLoadingMore && !reset) return; if (!this.hasMoreData && !reset) return; this.isLoadingMore = true; const startIndex = reset ? 0 : this.currentPage * PAGE_SIZE; const endIndex = startIndex + PAGE_SIZE; const newSources = this....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadMoreSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left boolean ...
loadMoreSources(reset: boolean = false): void { if (this.isLoadingMore && !reset) return; if (!this.hasMoreData && !reset) return; this.isLoadingMore = true; const startIndex = reset ? 0 : this.currentPage * PAGE_SIZE; const endIndex = startIndex + PAGE_SIZE; const newSources = this....
https://github.com/DaLongZhuaZi/manxia
672bd4e03bfe2acdc298adc8e12e672abb140caa
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
fill
Fills the Int32Array with specified value @param { number } value - new value @param { int } [start] - start index to begin fill from @param { int } [end] - last index to end fill from, excluded @returns { this } - modified Int32Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: number, start?: int, end?: int): this { this.fill(Int32Array.doubleToInt(value), start, end) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill 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#ERR...
public fill(value: number, start?: int, end?: int): this { this.fill(Int32Array.doubleToInt(value), start, end) return this }
https://gitcode.com/iop123123/arkts-static-skills
cc4c82c1a456c022371560b9a110c679766db64d
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
slice
Creates a new `Array` object and populates it with elements of `this` instance of `Array` class selected from `start` to `Int.MAX_VALUE`, which means 'to the end of an array'. @param start zero-based index at which to start extraction @returns `Array` instance, constructed from extracted elements of `this` instance.
public slice(start: number): Array<T> { return this.slice(start as number) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right...
public slice(start: number): Array<T> { return this.slice(start as number) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
50699bf358deb094a6f037049695fb95a4059f8c
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataValidator.ets
arkts
validateNumberRange
验证数字范围 @param value - 要验证的数字 @param min - 最小值 @param max - 最大值 @param fieldName - 字段名称 @returns 验证结果
static validateNumberRange(value: number | undefined | null, min: number, max: number, fieldName: string = 'field'): ValidationResult { const errors: string[] = []; if (value === null || value === undefined) { errors.push(`${fieldName} 不能为空`); } else if (typeof value !== 'number' || isNaN(value...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateNumberRange 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#binary_expr...
static validateNumberRange(value: number | undefined | null, min: number, max: number, fieldName: string = 'field'): ValidationResult { const errors: string[] = []; if (value === null || value === undefined) { errors.push(`${fieldName} 不能为空`); } else if (typeof value !== 'number' || isNaN(value...
https://github.com/DaLongZhuaZi/manxia
13913604987ec7148cde4f051d763ae336c184c7
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
errDetail
提取错误详情 (ArkTS Error/BusinessError 属性不可枚举, JSON.stringify 返回 {}) @returns "code=N message" 或 "message" 或 "未知错误"
static errDetail(err: Object): string { const e = err as Record<string, Object>; const code = e['code']; const msg = (e['message'] as string) || ''; let detail = msg.length > 0 ? msg : '未知错误'; if (code !== undefined && code !== null) { detail = 'code=' + code.toString() + ' ' + detail; }...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left errDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object ...
static errDetail(err: Object): string { const e = err as Record<string, Object>; const code = e['code']; const msg = (e['message'] as string) || ''; let detail = msg.length > 0 ? msg : '未知错误'; if (code !== undefined && code !== null) { detail = 'code=' + code.toString() + ' ' + detail; }...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
9a1d397ccede6a09fbdc83d2f52ec17751cb1923
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 an iterable or an array of entries. @param { Iterable<[K, V]> | readonly ((readonly [K, V]) | null | undefined)[] | null } [entries] - The iterable or array of entries used for initialization. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(entries?: Iterable<[K, V]> | readonly ((readonly [K, V]) | null | undefined)[] | null) { super(entries) }
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 entries AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression...
constructor(entries?: Iterable<[K, V]> | readonly ((readonly [K, V]) | null | undefined)[] | null) { super(entries) }
https://gitcode.com/iop123123/arkts-static-skills
79388856604145ae931fc9eedf0030e1dd60dbd1
gitcode
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
init
初始化样式系统
static async init(): Promise<void> { if (StyleUtil.isInitialized) { return; } try { // 初始化主题系统 await ThemeUtil.init(); // 添加主题变更监听器 ThemeUtil.addThemeChangeListener((theme: ThemeType) => { StyleUtil.currentTheme = theme; StyleUtil.updatePageStyles(); ...
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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS...
static async init(): Promise<void> { if (StyleUtil.isInitialized) { return; } try { // 初始化主题系统 await ThemeUtil.init(); // 添加主题变更监听器 ThemeUtil.addThemeChangeListener((theme: ThemeType) => { StyleUtil.currentTheme = theme; StyleUtil.updatePageStyles(); ...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
e32e1105c75ad4247e4d58deda9234bac97e5e23
github
dingzhilin1990/zhilinclaw
src/security/CredentialVault.ets
arkts
store
存储凭证 @param name 凭证名称 @param type 凭证类型 @param value 凭证值(明文) @param options 可选配置
public async store( name: string, type: CredentialType, value: string, options?: { expiresAt?: number; tags?: string[]; accessPolicy?: Partial<CredentialAccessPolicy>; } ): Promise<string> { const id = `cred_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left store AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
public async store( name: string, type: CredentialType, value: string, options?: { expiresAt?: number; tags?: string[]; accessPolicy?: Partial<CredentialAccessPolicy>; } ): Promise<string> { const id = `cred_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`; ...
https://github.com/dingzhilin1990/zhilinclaw
46dc2074448ef6a96541c318624ed00495992a75
github
ibestservices/ibest-ui
library/src/main/ets/components/button/index.ets
arkts
getLoadingSize
获取loading的大小
getLoadingSize() { return this.loadingSize != -1 ? getSizeByUnit(this.loadingSize) : this.getBtnSize()?.fontSize as string }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLoadingSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
getLoadingSize() { return this.loadingSize != -1 ? getSizeByUnit(this.loadingSize) : this.getBtnSize()?.fontSize as string }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/button/index.ets#L252-L254
4beac0d7ec5282cd2a3699dd5566eb3469b92548
github
honjow/Next2V
shared/src/main/ets/components/MarkdownContent.ets
arkts
CodeSpanBuilder
customInlineBuilder callback: handles `codespan` tokens in normal paragraphs via StyledString API (the library's default uses plain Text, losing monospace).
function CodeSpanBuilder(tokenItem: Token, params: CustomInlineParams): void { if (tokenItem.type === "codespan") { let text = ` ${tokenItem.text} `; params.inlineTextStyle?.appendStyledString( new MutableStyledString(text, [ { start: 0, length: text.length, styledK...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left CodeSpanBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tokenItem AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function CodeSpanBuilder(tokenItem: Token, params: CustomInlineParams): void { if (tokenItem.type === "codespan") { let text = ` ${tokenItem.text} `; params.inlineTextStyle?.appendStyledString( new MutableStyledString(text, [ { start: 0, length: text.length, styledK...
https://github.com/honjow/Next2V
ebe5b6f2dce3e39d5b6fb170614ef5974966bacb
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
isFinite
Return true if the value of this Decimal is a finite number, otherwise return false. @returns { boolean } the boolean type
public isFinite(): boolean { return !!this.digits; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFinite 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#bool...
public isFinite(): boolean { return !!this.digits; }
https://gitcode.com/iop123123/arkts-static-skills
75d065bd85d8c05bfed1786ce6b62963a227fc6b
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnThemeViewModel.ets
arkts
applyRandomColor
生成并应用随机颜色
applyRandomColor(): void { const randomHex = getRandomHexColor(); this.applyCustomColor(randomHex); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyRandomColor 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...
applyRandomColor(): void { const randomHex = getRandomHexColor(); this.applyCustomColor(randomHex); }
https://github.com/codelably/tuniao-ui
cf7878ec8ec50fcccf08527e8158e214ce4ed998
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
removeFromPlaylist
从播放列表移除
removeFromPlaylist(index: number): void { if (index >= 0 && index < this.playlist.length) { this.playlist.splice(index, 1); if (this.currentIndex >= index && this.currentIndex > 0) { this.currentIndex--; } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeFromPlaylist 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#)#Le...
removeFromPlaylist(index: number): void { if (index >= 0 && index < this.playlist.length) { this.playlist.splice(index, 1); if (this.currentIndex >= index && this.currentIndex > 0) { this.currentIndex--; } } }
https://github.com/cpdd5201314/harmonyOS-music-app
eb0bcf05c1bfe613e8a5ece249ed48843f1635c4
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGManager.ets
arkts
getSVGRoot
获取SVG标签对应的对象 找到标签内容为svg的对象 @param obj svg文件对应的对象 @return 返回svg标签对应的JS对象,如果没找到,返回false
public getSVGRoot(obj: Object = this._svgObj): object{ let objValue: Record<string, object>=obj as Record<string, object> let svgObj: Record<string, string | object> = {}; // 获取节点信息对象 let svgElements: object | Array<object> = objValue[SVGAttrConstants.ATTR_KEY_ELEMENTS]; if (typeof svgElements !=...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSVGRoot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#...
public getSVGRoot(obj: Object = this._svgObj): object{ let objValue: Record<string, object>=obj as Record<string, object> let svgObj: Record<string, string | object> = {}; // 获取节点信息对象 let svgElements: object | Array<object> = objValue[SVGAttrConstants.ATTR_KEY_ELEMENTS]; if (typeof svgElements !=...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
f82b4c36023b4e3dd322d5706f95107351a0b5ac
gitee
openharmony-sig/earth
hpauditor/tests/issues/expected/issue305.ets.audit.ets
arkts
printName
HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 6 : issue305.ets
printName(): void { console.info("sendable: TaskpoolTestClass desc is: " + this.desc); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left printName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le...
printName(): void { console.info("sendable: TaskpoolTestClass desc is: " + this.desc); }
https://gitee.com/openharmony-sig/earth.git
5ac68736141f61627960cb887e74ee088b33330d
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/HttpClient.ets
arkts
getTextByFullUrl
GET 文本(完整 URL,用于跨域请求如 connect.linux.do) 经过 CF challenge 处理;跨域请求时合并 BASE_URL 的 cookie(处理自动重定向场景)
async getTextByFullUrl( url: string, accept: string = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', readTimeoutMs: number = 60000 ): Promise<string> { await this.cookieStore.init(); const full: string = url !== undefined && url !== null ? url.trim() : ''; if (full.length...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTextByFullUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async getTextByFullUrl( url: string, accept: string = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', readTimeoutMs: number = 60000 ): Promise<string> { await this.cookieStore.init(); const full: string = url !== undefined && url !== null ? url.trim() : ''; if (full.length...
https://github.com/Amaz1ny/HarmonyDO-public
dd0ab9d3313a45b375dc5a9029dd30afc2f500d4
github
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/RouterUtils.ets
arkts
pop
返回上一级 @param result @param animated
public static pop(result?: Object, animated?: boolean, stackName: string = StackEnum.Main) { if (result) { RouterUtils.getStack(stackName).pop(result, animated); } else { RouterUtils.getStack(stackName).pop(animated); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left pop AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le...
public static pop(result?: Object, animated?: boolean, stackName: string = StackEnum.Main) { if (result) { RouterUtils.getStack(stackName).pop(result, animated); } else { RouterUtils.getStack(stackName).pop(animated); } }
https://github.com/xblLab/HarmonyProjectTemplate
7a30b61a4b3dc9a9cd3820da22efee6d9e99c8f5
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/keyshortcuts/scripts/helpers.ets
arkts
stringToModifier
Converts a string representation of a modifier key into the HarmonyOS `ModifierKey` constant. This function is case-insensitive. If an unrecognized string is passed, it safely returns `ModifierKey.NONE` to prevent unexpected side effects during subsequent keyboard event bitwise operations. @param raw - The raw modifier...
function stringToModifier(raw: string): ModifierKey | undefined { const key = raw.toUpperCase(); const modifierMap: Record<string, ModifierKey> = { 'CTRL': ModifierKey.CTRL, 'SHIFT': ModifierKey.SHIFT, 'ALT': ModifierKey.ALT, }; // meow(raw, 'toModifier'); // meow(modifierMap[key].toString(), 'to...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left stringToModifier AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left raw AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function stringToModifier(raw: string): ModifierKey | undefined { const key = raw.toUpperCase(); const modifierMap: Record<string, ModifierKey> = { 'CTRL': ModifierKey.CTRL, 'SHIFT': ModifierKey.SHIFT, 'ALT': ModifierKey.ALT, }; // meow(raw, 'toModifier'); // meow(modifierMap[key].toString(), 'to...
https://github.com/awaLiny2333/LinysBrowser_NEXT
8da574e4e15b1f9ec5951795e1ecc274591c5b63
github
HarmonyOS_Samples/guide-snippets
Ability/GuideForAppExit/terminateSelf/src/main/ets/terminateselfability/TerminateSelfAbility.ets
arkts
onForeground
[EndExclude appStop_terminateSelf]
onForeground(): void { // Ability has brought to foreground hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); // 获取UIAbilityContext let context = this.context; setTimeout(() => { context.terminateSelf().then(() => { console.info('Succeeded in terminating self.');...
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'); // 获取UIAbilityContext let context = this.context; setTimeout(() => { context.terminateSelf().then(() => { console.info('Succeeded in terminating self.');...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
eb01f3fb38a77dd9e9fcd78b06473c3019c88481
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/contentSource/facades/SourceLoaderFacade.ets
arkts
initialize
初始化源码加载器 @param filesDir 文件目录路径 @note API 23 适配:通过依赖注入传入路径,替代直接依赖 GlobalContext
initialize(filesDir: string | undefined): void { this.filesDir = filesDir || ''; logger.info(TAG, '源码加载器初始化完成: filesDir=' + filesDir); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left filesDir AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#...
initialize(filesDir: string | undefined): void { this.filesDir = filesDir || ''; logger.info(TAG, '源码加载器初始化完成: filesDir=' + filesDir); }
https://github.com/DaLongZhuaZi/NGF
cd50a87f6664e2b87e0348bf0beec56a6869b929
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
init
初始化,需要传入 Context
async init(context: common.UIAbilityContext): Promise<void> { // 避免重复初始化 if (this.isInitialized) { console.info('ComputerManager: 已初始化,跳过'); return; } this.context = context; this.mdnsDiscovery = new MdnsDiscovery(context); // 初始化 PreferencesUtil PreferencesUtil.init(...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
async init(context: common.UIAbilityContext): Promise<void> { // 避免重复初始化 if (this.isInitialized) { console.info('ComputerManager: 已初始化,跳过'); return; } this.context = context; this.mdnsDiscovery = new MdnsDiscovery(context); // 初始化 PreferencesUtil PreferencesUtil.init(...
https://github.com/AlkaidLab/moonlight-harmony
a6f1d745d28a39dc1f4c6a2e3cfd7e64fe3a5658
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Settings/SettingsPermissionPage.ets
arkts
updatePermission
刷新权限列表
updatePermission() { // 重新赋值整个数组 this.permissionList = this.permissionList.map<PermissionItem>((item => { return { name: item.name, title: item.title, desc: item.desc, permissions: item.permissions, timeStamp: Date.now() } })) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updatePermission 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#L...
updatePermission() { // 重新赋值整个数组 this.permissionList = this.permissionList.map<PermissionItem>((item => { return { name: item.name, title: item.title, desc: item.desc, permissions: item.permissions, timeStamp: Date.now() } })) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
aab14f4f111dd209361ce67f9cacc8d9848c45c7
gitcode
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/UIContextSelf.ets
arkts
offEventHub
Unsubscription
public static offEventHub(event: string): void { try { UIContextSelf.commonContext.eventHub.off(event); Logger.info(TAG, `offEventHub, event: ${event}`); } catch (error) { Logger.error(TAG, `Failed to offEventHub. Code: ${error.code}, message: ${error.message}.`); } };
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 offEventHub AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST...
public static offEventHub(event: string): void { try { UIContextSelf.commonContext.eventHub.off(event); Logger.info(TAG, `offEventHub, event: ${event}`); } catch (error) { Logger.error(TAG, `Failed to offEventHub. Code: ${error.code}, message: ${error.message}.`); } };
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
ae045a4fbf976364083a5dac1cbd09d6c8068636
gitcode
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/model/BuildingModel.ets
arkts
clone
克隆建筑物
clone(): BuildingModel { const building = new BuildingModel(); building.id = this.id; building.width = this.width; building.length = this.length; building.height = this.height; building.floorHeight = this.floorHeight; building.units = this.units; building.rotationDeg = this.rotationDeg...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clone 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 BuildingModel AST#identifier#Right AST#ERROR#Right AST#s...
clone(): BuildingModel { const building = new BuildingModel(); building.id = this.id; building.width = this.width; building.length = this.length; building.height = this.height; building.floorHeight = this.floorHeight; building.units = this.units; building.rotationDeg = this.rotationDeg...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
cfb50337222a053c731919cac904574d2465096f
github
Tianpei-Shi/MusicDash
src/model/UserModel.ets
arkts
toCloudObject
转换为CloudDB对象格式
toCloudObject(): CloudDBZoneObject { const cloudObject: CloudDBZoneObject = { id: this.id, username: this.username, password: this.password, like: this.like || '', history: this.history || '', phone: this.phone || 0, createdTime: this.createdTime || Date.now(), last...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toCloudObject 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 CloudDBZoneObject AST#identifier#Right AST#ERROR...
toCloudObject(): CloudDBZoneObject { const cloudObject: CloudDBZoneObject = { id: this.id, username: this.username, password: this.password, like: this.like || '', history: this.history || '', phone: this.phone || 0, createdTime: this.createdTime || Date.now(), last...
https://github.com/Tianpei-Shi/MusicDash
019916bd9830fc0d41561561b937551bce17dc0b
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/converter/Converter.ets
arkts
create
Create a new instance of the factory.
static create(): StringConverterFactory { return new StringConverterFactory(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left create 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 StringConverter...
static create(): StringConverterFactory { return new StringConverterFactory(); }
https://github.com/killetom/ktretrofit
167295d2daf91c793ad366c8315f249ec8bda0a2
github
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
setAudioMute
设置音频静音状态
public async setAudioMute(muted: boolean): Promise<void> { if (this.audioCapture !== null) { if (muted) { // 停止音频采集,相当于静音 await this.audioCapture.stop(); LogUtil.info('[MediaStream] 音频已静音'); } else { // 重新开始音频采集 await this.audioCapture.start(); LogUtil.i...
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 setAudioMute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left muted AST#identifier#Right AST#:#Left : AST...
public async setAudioMute(muted: boolean): Promise<void> { if (this.audioCapture !== null) { if (muted) { // 停止音频采集,相当于静音 await this.audioCapture.stop(); LogUtil.info('[MediaStream] 音频已静音'); } else { // 重新开始音频采集 await this.audioCapture.start(); LogUtil.i...
https://github.com/tdcare/tdwebrtc
db74f20120ef77c44eed1145449fcf16a18a2132
github
Vincent-Leon/zotero-harmony
entry/src/main/ets/components/PdfView.ets
arkts
toAnnotationLite
---------- helpers ---------- Cherry-pick the annotation fields we render from a full ZoteroItem; null when the required parentItem/annotationType is missing (defensive: child items returned by the API should always have both).
function toAnnotationLite(item: ZoteroItem): ZoteroAnnotationLite | null { const data = item.data; const annoType = data.extraFields.get('annotationType'); const annoPosition = data.extraFields.get('annotationPosition'); if (annoType === undefined || annoPosition === undefined) { return null; } return {...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left toAnnotationLite AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function toAnnotationLite(item: ZoteroItem): ZoteroAnnotationLite | null { const data = item.data; const annoType = data.extraFields.get('annotationType'); const annoPosition = data.extraFields.get('annotationPosition'); if (annoType === undefined || annoPosition === undefined) { return null; } return {...
https://github.com/Vincent-Leon/zotero-harmony
92433bd05b8b4efe96daffe30acc275b20f50a9c
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/features/mydemo/src/main/ets/Video/view/VideoView.ets
arkts
tabBarContainerStyle
标签容器样式
@Extend(Column) function tabBarContainerStyle() { .width(Constants.FULL_SIZE) .height(Constants.FULL_SIZE) .justifyContent(FlexAlign.Center) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Column AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
@Extend(Column) function tabBarContainerStyle() { .width(Constants.FULL_SIZE) .height(Constants.FULL_SIZE) .justifyContent(FlexAlign.Center) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
dade750bb1e6c162df34162d1c75d9f054938a97
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/pages/RehabListPage.ets
arkts
handleRefresh
==================== 下拉刷新 ====================
handleRefresh(): void { this.isRefreshing = true; setTimeout(() => { this.currentPage = 1; this.loadCoursesFromAPI(); this.isRefreshing = false; ToastUtil.refreshSuccess(); }, 1000); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleRefresh 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...
handleRefresh(): void { this.isRefreshing = true; setTimeout(() => { this.currentPage = 1; this.loadCoursesFromAPI(); this.isRefreshing = false; ToastUtil.refreshSuccess(); }, 1000); }
https://github.com/LJ666-ui/harmony-health-care
50452ecb483315bc29915877a371d3ecfe52abb4
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
hasEBookReadingProgress
检查电子书是否有阅读进度 判断条件:有 domPos 或 currentChapterIndex > 0 或 progress > 0
private hasEBookReadingProgress(ebook: EBook): boolean { if (!ebook.readingProgress) { return false; } const progress = ebook.readingProgress; // 有 domPos 表示有精确的阅读位置 if (progress.domPos && progress.domPos.length > 0) { return true; } // 章节索引大于 0 表示已经翻过页 if (progress.current...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasEBookReadingProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private hasEBookReadingProgress(ebook: EBook): boolean { if (!ebook.readingProgress) { return false; } const progress = ebook.readingProgress; // 有 domPos 表示有精确的阅读位置 if (progress.domPos && progress.domPos.length > 0) { return true; } // 章节索引大于 0 表示已经翻过页 if (progress.current...
https://github.com/DaLongZhuaZi/manxia
4b040b278623953cad835656a980510a628bb6af
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ubyte.ets
arkts
main
--- desc: check postfix decrement for unsigned byte operand ---
function main(): void { let value: ubyte = {{v.value}} let result: ubyte = 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: ubyte = {{v.value}} let result: ubyte = value-- assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
eb30ae75388b47bc60c243a9609b6a65831138b1
gitee
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/custom/styles/modifier/Modifiers.ets
arkts
onComponentChanged
组件变化时候调用
onComponentChanged(component: ButtonAttribute): void { Log.info("MyButtonModifierUpdater onComponentChanged"); // TODO 不调用? }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onComponentChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left component AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ButtonAttribute AST#identifier#R...
onComponentChanged(component: ButtonAttribute): void { Log.info("MyButtonModifierUpdater onComponentChanged"); // TODO 不调用? }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/custom/styles/modifier/Modifiers.ets#L35-L37
b5d742b16e02be23e0a6b36bedc96f5d5e67eb5b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/StringUtil.ets
arkts
stringToUint8Array
将字符串转换为 Uint8Array @param str 字符串 @returns UTF-8 编码的 Uint8Array
static stringToUint8Array(str: string): Uint8Array { return StringUtil.getTextEncoder().encodeInto(str); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left stringToUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static stringToUint8Array(str: string): Uint8Array { return StringUtil.getTextEncoder().encodeInto(str); }
https://github.com/AlkaidLab/moonlight-harmony
6ddd6457c5c52f4b051850ccbbd7bd55d92ae752
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
insert
创建共享账本
static async insert(ledger: SharedLedger): Promise<number> { try { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); ledger.createdAt = now; ledger.updatedAt = now; const values: relationalStore.ValuesBucket = { name: ledger.name, des...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ledger AST#identifier#Right AST#:#Left : AST#:#Ri...
static async insert(ledger: SharedLedger): Promise<number> { try { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); ledger.createdAt = now; ledger.updatedAt = now; const values: relationalStore.ValuesBucket = { name: ledger.name, des...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
bf4a2f3de4f60b268049c20439a6de9ce080b384
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/CommentManager.ets
arkts
deleteReply
Delete a reply
static async deleteReply(commentId: string, replyId: string): Promise<boolean> { try { if (!CommentManager.preferencesInstance) { console.error('Preferences not initialized'); return false; } const comments = await CommentManager.getAllComments(); const comment = comments....
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 deleteReply AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
static async deleteReply(commentId: string, replyId: string): Promise<boolean> { try { if (!CommentManager.preferencesInstance) { console.error('Preferences not initialized'); return false; } const comments = await CommentManager.getAllComments(); const comment = comments....
https://github.com/Harrisonls2004/WaterFlow
51b92445ef54f3fbb2515b464429c6970f99d460
github
LZZLHY/hlib
entry/src/main/ets/api/ZLibraryClient.ets
arkts
getProfile
当前账户信息。
async getProfile(): Promise<User> { const json = await this.http.get<UserEnvelope>('/eapi/user/profile'); ZLibraryClient.assertOk(json); return User.fromJson(json.user as object); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getProfile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t...
async getProfile(): Promise<User> { const json = await this.http.get<UserEnvelope>('/eapi/user/profile'); ZLibraryClient.assertOk(json); return User.fromJson(json.user as object); }
https://github.com/LZZLHY/hlib
dce03c29ce76f29c6da78bf4fdd114861257d4e9
github
offlinecat-dev/OCNetORM
src/main/ets/core/HooksProcessor.ets
arkts
getInstance
获取单例实例 @returns HooksProcessor 实例
static getInstance(): HooksProcessor { return HooksProcessor.instance }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance 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 HooksProce...
static getInstance(): HooksProcessor { return HooksProcessor.instance }
https://github.com/offlinecat-dev/OCNetORM
702036056cc7669bcd478be9dcaf98bf68071575
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
from
Creates an array from an array of the same type. @param { BigUint64Array } arr - An array to convert to a new array. @returns { BigUint64Array } - A new BigUint64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: BigUint64Array): BigUint64Array { let result = new BigUint64Array(arr.length) result.set(arr) return result }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: BigUint64Array): BigUint64Array { let result = new BigUint64Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
fdd10ae6758cd7834e53072287335394af4bed61
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
withTimeout
创建带超时的 CancellablePromise
static withTimeout<T>( promise: CancellablePromise<T>, timeoutMs: number, timeoutMessage: string = '操作超时' ): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { const timerId = setTimeout(() => { promise.cancel(timeoutMessage); reject(new Err...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left withTimeout AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#R...
static withTimeout<T>( promise: CancellablePromise<T>, timeoutMs: number, timeoutMessage: string = '操作超时' ): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { const timerId = setTimeout(() => { promise.cancel(timeoutMessage); reject(new Err...
https://github.com/DaLongZhuaZi/manxia
74caec6ce43b775b0d09c0cdbcf676636ab7c0a6
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/view/HeroBannerSection.ets
arkts
build
Horizontal scroll of hero cards driven by the view model hero list.
build() { Scroll() { Row({ space: new BreakpointType(8, 12, 16, 16).getValue(this.breakpointEnv.widthBreakpoint) }) { ForEach(this.recommendViewModel.heroCards, (item: RecommendHeroCardUi, index?: number) => { Column() { this.HeroBannerCard(item); } }, (_item:...
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() { Scroll() { Row({ space: new BreakpointType(8, 12, 16, 16).getValue(this.breakpointEnv.widthBreakpoint) }) { ForEach(this.recommendViewModel.heroCards, (item: RecommendHeroCardUi, index?: number) => { Column() { this.HeroBannerCard(item); } }, (_item:...
https://gitcode.com/HarmonyOS_Samples/MusicHome
ce881dbe725846b1f1af6cc0ccc3ae4d5c0a923e
gitcode
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/basepage/ColumnPage.ets
arkts
onPageHide
生命周期回调:页面隐藏 只限入口组件 这里不生效
onPageHide(): void { Log.info(TAG2 + "onPageHide") }
AST#program#Left AST#ERROR#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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
onPageHide(): void { Log.info(TAG2 + "onPageHide") }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/basepage/ColumnPage.ets#L98-L100
025ca8fa4af069430a889ab70c73811599da0e07
github
Gramony/Gramony
features/home/src/main/ets/utils/push.ets
arkts
getLastRegisterTime
获取最后注册时间
async getLastRegisterTime(): Promise<number> { try { const dataPreferences = await preferences.getPreferences(this.context, 'push_settings'); return await dataPreferences.get(PUSH_LAST_REGISTER_TIME_KEY, 0) as number; } catch (e) { Logger.error('PushService getLastRegisterTime error: ' + JSO...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLastRegisterTime AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
async getLastRegisterTime(): Promise<number> { try { const dataPreferences = await preferences.getPreferences(this.context, 'push_settings'); return await dataPreferences.get(PUSH_LAST_REGISTER_TIME_KEY, 0) as number; } catch (e) { Logger.error('PushService getLastRegisterTime error: ' + JSO...
https://github.com/Gramony/Gramony
8ef867073306f07b3e625f02fad75ac295fcc331
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
addInterface
Adds implemented interface (in ets it follows `extends` keyword) @param iface interface to implement @returns this
public addInterface(base: InterfaceType): InterfaceTypeCreator throws { this.checkNotCreated() this.bases.push(TypeOrCreator.from(base)) return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addInterface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Int...
public addInterface(base: InterfaceType): InterfaceTypeCreator throws { this.checkNotCreated() this.bases.push(TypeOrCreator.from(base)) return this; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
024d5572e32f26d13572d36f21773f0dddbad218
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedSint32
访问 repeated sint32 字段
visitRepeatedSint32(value: number[], fieldNumber: number): void { for (const item of value) { this.visitSint32(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedSint32 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...
visitRepeatedSint32(value: number[], fieldNumber: number): void { for (const item of value) { this.visitSint32(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
c7d19e5adc5cbda1fa0c6f14d18003af00d28b2f
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
delete
批量删除(不加载实体) @returns 受影响行数
async delete(): Promise<number> { const executor = new QueryExecutor(this) return await executor.delete() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#...
async delete(): Promise<number> { const executor = new QueryExecutor(this) return await executor.delete() }
https://github.com/offlinecat-dev/OCNetORM
cb1a9ad68450c58e91ae5603a4d02d94bf9b239f
github
LJ666-ui/harmony-health-care
entry/src/main/ets/components/charts/base/BaseChart.ets
arkts
pan
处理平移 @param deltaX X方向偏移 @param deltaY Y方向偏移
public pan(deltaX: number, deltaY: number): void { this.interaction.panX += deltaX; this.interaction.panY += deltaY; this.interaction.isInteracting = true; this.refresh(); this.emitEvent({ type: 'pan', position: [deltaX, deltaY], timestamp: Date.now() }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pan AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deltaX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public pan(deltaX: number, deltaY: number): void { this.interaction.panX += deltaX; this.interaction.panY += deltaY; this.interaction.isInteracting = true; this.refresh(); this.emitEvent({ type: 'pan', position: [deltaX, deltaY], timestamp: Date.now() }); }
https://github.com/LJ666-ui/harmony-health-care
8d7477108c549fdc23d8d9c176848c11035abbb1
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/15.unary_expressions/06.unary_minus_operator/unary_minus_inbound.ets
arkts
main
--- desc: Unary minus operator (inbound) params: {{inb.type}} {{inb.origin}} => {{inb.dest}} ---
function main(): void { let a: {{inb.type}} = {{inb.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: {{inb.type}} = {{inb.origin}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1d3889dc6fe2ff9f17bfd4bfda9a2e4a2c137621
gitee
codelably/HCompass
packages/auth/src/main/ets/AuthModule.ets
arkts
canActivate
检查是否可以激活路由 @param context 路由上下文 @returns 是否允许导航
canActivate(context: RouteContext): boolean | Promise<boolean> { const targetRoute = context.targetRoute; // 检查是否是受保护的路由 const isProtected = this.requiresLogin(targetRoute); if (!isProtected) { return true; } // 检查是否已登录 const userState = getUserState(); if (userState.isLoggedI...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left canActivate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
canActivate(context: RouteContext): boolean | Promise<boolean> { const targetRoute = context.targetRoute; // 检查是否是受保护的路由 const isProtected = this.requiresLogin(targetRoute); if (!isProtected) { return true; } // 检查是否已登录 const userState = getUserState(); if (userState.isLoggedI...
https://github.com/codelably/HCompass
5ab7a14c09b0cebfe8d93b158ee3d123b2019cc2
github
DaLongZhuaZi/manxia
entry/src/main/ets/EntryAbility.ets
arkts
notifyDeepLinkToUI
通知UI层有新的Deep Link需要处理(仅用于onNewWant场景)
private notifyDeepLinkToUI(): void { const current = AppStorage.get<number>('deepLinkTrigger') || 0; AppStorage.setOrCreate('deepLinkTrigger', current + 1); logger.info('EntryAbility', `📣 通知UI处理Deep Link (trigger: ${current + 1})`); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyDeepLinkToUI 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 A...
private notifyDeepLinkToUI(): void { const current = AppStorage.get<number>('deepLinkTrigger') || 0; AppStorage.setOrCreate('deepLinkTrigger', current + 1); logger.info('EntryAbility', `📣 通知UI处理Deep Link (trigger: ${current + 1})`); }
https://github.com/DaLongZhuaZi/manxia
f0bb6748548e9ecc910604e530115f31be7bb3ad
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets
arkts
revokePermissionWithResult
撤销权限并返回操作结果 @param permission 操作权限 @param flag 授权flag @param tokenId 应用token @param atManager atManager对象 return
private async revokePermissionWithResult( permission: Permission, flag: number, tokenId: number, atManager: abilityAccessCtrl.AtManager ): Promise<optionAndState> { try { await atManager.revokeUserGrantedPermission(tokenId, permission, flag); Log.info(`revoke permission success, permission: ${pe...
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 revokePermissionWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#...
private async revokePermissionWithResult( permission: Permission, flag: number, tokenId: number, atManager: abilityAccessCtrl.AtManager ): Promise<optionAndState> { try { await atManager.revokeUserGrantedPermission(tokenId, permission, flag); Log.info(`revoke permission success, permission: ${pe...
https://gitee.com/openharmony/applications_permission_manager.git
e83247d7530d873506fae13fdd2f40c5a1a68ca9
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets
arkts
setSpringParams
设置弹簧参数(SPRING插值器) @param stiffness 弹簧刚度 @param damping 阻尼比 @param mass 质量
setSpringParams(stiffness: number, damping: number, mass: number = 1): AnimationConfig { this.springConfig = { stiffness, damping, mass }; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSpringParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stiffness AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AS...
setSpringParams(stiffness: number, damping: number, mass: number = 1): AnimationConfig { this.springConfig = { stiffness, damping, mass }; return this; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
cb138598b3fd115095af7eedf1fb6bfe83fd790c
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/MyAbilityStage.ets
arkts
onCreate
创建完成时的回调(注:加载 HAP 的入口 UIAbility 实例之前会先创建 AbilityStage 实例)
onCreate() { MyLog.d('AbilityStage onCreate'); // AbilityStageContext - AbilityStage 的上下文(在 AbilityStage 内,可以通过 this.context 获取 AbilityStageContext 对象) // currentHapModuleInfo - 当前的 hap 模块信息(一个 HapModuleInfo 对象) // name - 当前的 hap 模块的名称 // codePath - 当前的 hap 模块的 .hap 文件的地址 let abilit...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS...
onCreate() { MyLog.d('AbilityStage onCreate'); // AbilityStageContext - AbilityStage 的上下文(在 AbilityStage 内,可以通过 this.context 获取 AbilityStageContext 对象) // currentHapModuleInfo - 当前的 hap 模块信息(一个 HapModuleInfo 对象) // name - 当前的 hap 模块的名称 // codePath - 当前的 hap 模块的 .hap 文件的地址 let abilit...
https://github.com/webabcd/HarmonyDemo
d19e5dea184a4faa704b509639bdb63b17fc79fa
github
offlinecat-dev/OCNetORM
src/main/ets/errors/RelationError.ets
arkts
constructor
构造函数 @param joinTable 中间表名称
constructor(joinTable: string) { const context = new ErrorContext() context.tableName = joinTable context.operation = '加载多对多关联' context.details = `中间表 '${joinTable}' 不存在` super(`多对多关联中间表 '${joinTable}' 未找到`, ERROR_JOIN_TABLE_NOT_FOUND, context) this.name = 'JoinTableNotFoundError' }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left joinTable AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#...
constructor(joinTable: string) { const context = new ErrorContext() context.tableName = joinTable context.operation = '加载多对多关联' context.details = `中间表 '${joinTable}' 不存在` super(`多对多关联中间表 '${joinTable}' 未找到`, ERROR_JOIN_TABLE_NOT_FOUND, context) this.name = 'JoinTableNotFoundError' }
https://github.com/offlinecat-dev/OCNetORM
6c97468f98530f63f27895f35eefc1e3dad4310d
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/display/TextTimerDemo.ets
arkts
buildTextTimer
自定义 TextTimer
@Builder function buildTextTimer(config: TextTimerConfiguration) { /* * TextClockConfiguration - 自定义 TextClock 的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * isCountDown - 是否是倒计时 * count - 当倒计时时,计时器的初始的毫秒数 * started - 计时器是否已经开始了 * elapsedTime - 计时器经过的时间,单位为 format...
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 buildTextTimer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#re...
@Builder function buildTextTimer(config: TextTimerConfiguration) { /* * TextClockConfiguration - 自定义 TextClock 的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * isCountDown - 是否是倒计时 * count - 当倒计时时,计时器的初始的毫秒数 * started - 计时器是否已经开始了 * elapsedTime - 计时器经过的时间,单位为 format...
https://github.com/webabcd/HarmonyDemo
08dba1fe9e0e90b36c82ecdf9490d9a0b28e7c46
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
subscribeCollectEvent
订阅收藏event @param callback
subscribeCollectEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_COLLECT, key, callback) }
AST#program#Left AST#ERROR#Left AST#identifier#Left subscribeCollectEvent AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left A...
subscribeCollectEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_COLLECT, key, callback) }
https://github.com/RedRackham-R/WanAndroidHarmoney
beb41ccb790ab482826bbc95eacc21729d62872f
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/MeasurementManager.ets
arkts
registeredTypes
Get the list of registered component types
get registeredTypes(): ReadonlySet<string> { return this._registeredTypes; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left registeredTypes 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_stat...
get registeredTypes(): ReadonlySet<string> { return this._registeredTypes; }
https://github.com/AGenUI/AGenUI
bcb71ea72b3b986dced17e5ae4ac8f9e6ab7fb3c
github
arkui-x/samples
CodeLab/Cases/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets
arkts
getAnimation
定时器ID 获取动画效果。 @returns {TransitionEffect} 返回一个 TransitionEffect 实例,根据动画类型不同返回不同的动画效果。
getAnimation(): TransitionEffect { if (this.animationType === IconAnimationType.ScaleUpAndFadeOut) { // TODO:知识点:使用TransitionEffect.asymmetric()方法设置不同的出入场动画,实现两种不同的动画效果,并利用combine函数实现透明度、旋转角度、位移和缩放组合的转场效果。 return TransitionEffect.asymmetric( // 入场动画配置:放大抖动淡入 // 出场动画配置:放大淡出 Tran...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAnimation 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 TransitionEffect AST#identifier#Right AST#ERROR#R...
getAnimation(): TransitionEffect { if (this.animationType === IconAnimationType.ScaleUpAndFadeOut) { // TODO:知识点:使用TransitionEffect.asymmetric()方法设置不同的出入场动画,实现两种不同的动画效果,并利用combine函数实现透明度、旋转角度、位移和缩放组合的转场效果。 return TransitionEffect.asymmetric( // 入场动画配置:放大抖动淡入 // 出场动画配置:放大淡出 Tran...
https://gitcode.com/arkui-x/samples
313b079ebeb253c1a1e25d0f615ef0015186ff52
gitcode
HarmonyOS_Samples/BestPracticeSnippets
VideoProcessBaseWeb/entry/src/main/ets/utils/WebDownloadManager.ets
arkts
cancel
[End resume]
public cancel(): void { try { this.currentTask.cancel(); this.taskStatus = this.currentTask.getState(); this.deleteFile(); } catch (e) { hilog.error(0x000, Constants.TAG, `failed to cancel:${JSON.stringify(e)}`); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cancel 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_stat...
public cancel(): void { try { this.currentTask.cancel(); this.taskStatus = this.currentTask.getState(); this.deleteFile(); } catch (e) { hilog.error(0x000, Constants.TAG, `failed to cancel:${JSON.stringify(e)}`); } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
3e4e0a827509b91603e67b549ad89a0184ffaa45
gitcode
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/dialogs/classes/meowDialogManager.ets
arkts
closeAll
Closes all dialogs.
closeAll() { for (const controller of this.openedDialogs) { controller.close(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closeAll 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#for_in_statement#Left AST#fo...
closeAll() { for (const controller of this.openedDialogs) { controller.close(); } }
https://github.com/awaLiny2333/LinysBrowser_NEXT
de3c48493856ffd03341aa19102d096531b441dc
github
codelably/HCompass
core/navigation/src/main/ets/GuardManager.ets
arkts
getGuardNames
获取所有守卫名称 @returns 守卫名称列表
getGuardNames(): string[] { return this.guards.map(g => g.name ?? 'unnamed'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getGuardNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
getGuardNames(): string[] { return this.guards.map(g => g.name ?? 'unnamed'); }
https://github.com/codelably/HCompass
4d08df543d1c11f6924a51ce57e4a6ced2eca9a1
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Creates a Uint8ClampedArray with the same ArrayBuffer @param begin start index, inclusive @returns new Uint8ClampedArray with the same ArrayBuffer public
/* public */ internal subarray(begin: int): Uint8ClampedArray { return this.subarray(begin, this.length) }
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Lef...
/* public */ internal subarray(begin: int): Uint8ClampedArray { return this.subarray(begin, this.length) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bebae65deae791cb94ba98176e056a6d210e592e
gitee
XHXYT/Pixark
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initAccounts
纯本地账号初始化(不包含网络请求)
private async initAccounts() { let savedAccounts: AccountContext[] = []; let lastActiveUserId = ''; let retryCount = 3; while (retryCount > 0) { try { const accountsJson = await kvDbUtil.getData<string>('pixiv_accounts', '[]'); savedAccounts = JSON.parse(accountsJson) as Account...
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 initAccounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async initAccounts() { let savedAccounts: AccountContext[] = []; let lastActiveUserId = ''; let retryCount = 3; while (retryCount > 0) { try { const accountsJson = await kvDbUtil.getData<string>('pixiv_accounts', '[]'); savedAccounts = JSON.parse(accountsJson) as Account...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/entryability/EntryAbility.ets#L179-L230
52535817b67f3a661647b4a31371265f8166c0ac
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelReplaceRuleManager.ets
arkts
refreshRules
刷新规则(从数据库重新加载)
async refreshRules(): Promise<void> { try { await this.loadRulesFromStorage(); logger.info(TAG, `刷新替换规则完成,共 ${this.rules.size} 条规则`); } catch (error) { logger.error(TAG, `刷新规则失败: ${String(error)}`); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left refreshRules AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic...
async refreshRules(): Promise<void> { try { await this.loadRulesFromStorage(); logger.info(TAG, `刷新替换规则完成,共 ${this.rules.size} 条规则`); } catch (error) { logger.error(TAG, `刷新规则失败: ${String(error)}`); } }
https://github.com/DaLongZhuaZi/manxia
6805b9857f271a8cec7a121fc7505d6ddbf43dbf
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
from
Creates an Float64Array from array-like argument @param o array-like object to initialize Float64Array @returns new Float64Array
public from(o: Object): Float64Array { throw new Error("Float64Array.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): Float64Array { throw new Error("Float64Array.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9fb0264dc72c00d42fe52adf6a5dc53a6f460953
gitee
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/PermissionService.ets
arkts
ensureDownloadDir
便捷:确保「下载」公共目录写权限。
static ensureDownloadDir(context: common.UIAbilityContext): Promise<boolean> { return PermissionService.ensure(context, PERM_DOWNLOAD_DIR); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left ensureDownloadDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expr...
static ensureDownloadDir(context: common.UIAbilityContext): Promise<boolean> { return PermissionService.ensure(context, PERM_DOWNLOAD_DIR); }
https://github.com/picklerick422/zju-learning-assistant-OH
55547ed6eddd4133a0478bde28bc8669b8403e31
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
encodedAuthority
Gets the encoded authority part of this URI. @returns { string | null }
get encodedAuthority(): string | null { let s: string = this.uriEntry.getAuthority(); return s == '' ? null : s; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left encodedAuthority 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_sta...
get encodedAuthority(): string | null { let s: string = this.uriEntry.getAuthority(); return s == '' ? null : s; }
https://gitcode.com/iop123123/arkts-static-skills
52f5579b219d6168dae82db3f6332ec104a3c679
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncLock.ets
arkts
query
Query information about the specified lock. @param { string } name - name of the lock. @returns { AsyncLockState } Returns an instance of AsyncLockState.
public static query(name: string): AsyncLockState { try { return asyncLockManager.query(name); } catch (e) { throw e; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left query AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#i...
public static query(name: string): AsyncLockState { try { return asyncLockManager.query(name); } catch (e) { throw e; } }
https://gitcode.com/iop123123/arkts-static-skills
e1fcb99221ed3327b368043b5c0ffd411474bebc
gitcode
openharmony-sig/ohos_base64
library/src/main/ets/components/MainPage/Base64.ets
arkts
saveBytes
Saves the contents of a <code>byte[]</code> to the specified {@link File}.
private static saveBytes(filePath: string, bytes: ArrayBuffer | string) { let writeFd = fileio.openSync(filePath, fileio.OpenMode.READ_WRITE|fileio.OpenMode.CREATE) let stream = fileio.fdopenStreamSync(writeFd.fd, "r+") let length = 0; if (bytes instanceof ArrayBuffer) { length = bytes.byteLengt...
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 saveBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left :...
private static saveBytes(filePath: string, bytes: ArrayBuffer | string) { let writeFd = fileio.openSync(filePath, fileio.OpenMode.READ_WRITE|fileio.OpenMode.CREATE) let stream = fileio.fdopenStreamSync(writeFd.fd, "r+") let length = 0; if (bytes instanceof ArrayBuffer) { length = bytes.byteLengt...
https://gitee.com/openharmony-sig/ohos_base64.git
e2307ac72e9461fa7378e8f8d043eafaa2cd7865
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Core/ErrorHandler.ets
arkts
setEnabled
启用/禁用错误处理
public setEnabled(enabled: boolean): void { this.isEnabled = enabled; logger.info(ERROR_HANDLER_TAG, `🔄 错误处理已${enabled ? '启用' : '禁用'}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bo...
public setEnabled(enabled: boolean): void { this.isEnabled = enabled; logger.info(ERROR_HANDLER_TAG, `🔄 错误处理已${enabled ? '启用' : '禁用'}`); }
https://github.com/DaLongZhuaZi/manxia
82208cff4d3f849f3ebe29aaccd81c7a94bbdb32
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCountToViewModel.ets
arkts
startControl
开始手动控制的动画
startControl(): void { this.controlController.start(); this.controlStatusText = "动画中"; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startControl 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...
startControl(): void { this.controlController.start(); this.controlStatusText = "动画中"; }
https://github.com/codelably/tuniao-ui
77c479685e88a7d36d1cf6d88ff3ef3bb01ec088
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.Dialog.ets
arkts
getLengthMetricsByResource
get LengthMetrics size @param resource resource @param defaultValue default value @param isAllowZero allow value zero @returns LengthMetrics size
function getLengthMetricsByResource(resource: Resource, defaultValue: number, isAllowZero?: boolean): number { if (!resource) { hilog.error(0x3900, 'Ace', 'CustomContentDialog getLengthMetricsByResource error'); return defaultValue; } try { let sourceValue: number = LengthMetrics.resource(resource).va...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getLengthMetricsByResource AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resource AST#identifier#Right AST#type_annotation#Left AST#...
function getLengthMetricsByResource(resource: Resource, defaultValue: number, isAllowZero?: boolean): number { if (!resource) { hilog.error(0x3900, 'Ace', 'CustomContentDialog getLengthMetricsByResource error'); return defaultValue; } try { let sourceValue: number = LengthMetrics.resource(resource).va...
https://gitcode.com/openharmony/arkui_ace_engine
ddc4a0887d70901e9fa00ad54b5e2b975c602518
gitcode
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/calculator/Evaluator.ets
arkts
getMemoryDisplay
get memoryDisplay @return isMemoryDisplay true/false
async getMemoryDisplay(): Promise<boolean> { await this.getPreference(); if (this.sharePreference === null) { LogUtil.error(TAG, 'sharePreference is null'); return false; } let res: dataPreferences.ValueType = await this.sharePreference.get(SHARE_MEMORY, ''); if(res !== ''){ this...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMemoryDisplay AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen...
async getMemoryDisplay(): Promise<boolean> { await this.getPreference(); if (this.sharePreference === null) { LogUtil.error(TAG, 'sharePreference is null'); return false; } let res: dataPreferences.ValueType = await this.sharePreference.get(SHARE_MEMORY, ''); if(res !== ''){ this...
https://gitee.com/openharmony-sig/applications_calculator.git
8c6d658030e1e23fb20d0e720f65bdb52bd4331f
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/WeakRef.ets
arkts
constructor
Constructs a weak reference instance pointing to the given target object. @param { T } target - The target object for the weak reference. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(target: T) { this.referent = target; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#R...
public constructor(target: T) { this.referent = target; }
https://gitcode.com/iop123123/arkts-static-skills
a973a0609f2aad6f4ee9c42d49ec9816cc7b2c7c
gitcode