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
aimilin6688/KeePassHO
entry/src/main/ets/storage/local/LocalFileStorage.ets
arkts
doGetInfo
获取文件信息 @param path 文件路径 @returns 结果
public async doGetInfo(path: string): Promise<FileInfo> { try { // 打开文件 const file = await fs.open(path, fs.OpenMode.READ_ONLY); const stat = await fs.stat(file.fd); await fs.close(file.fd); return { name: FilenameUtils.getFileName(path), size: stat.size, modi...
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 doGetInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#R...
public async doGetInfo(path: string): Promise<FileInfo> { try { // 打开文件 const file = await fs.open(path, fs.OpenMode.READ_ONLY); const stat = await fs.stat(file.fd); await fs.close(file.fd); return { name: FilenameUtils.getFileName(path), size: stat.size, modi...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L162-L180
37c2686f4a1f6d87573bb4be389aeed7c244f5a8
github
arkui-x/samples
CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
destroySubWindow
销毁当前窗口
private destroySubWindow() { if (this.subWindow) { this.subWindow.destroyWindow((err) => { if (err.code) { console.error('Fail to destroy the window. Cause:' + JSON.stringify(err)); return; } this.subWindow = null; }); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left destroySubWindow 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#{#...
private destroySubWindow() { if (this.subWindow) { this.subWindow.destroyWindow((err) => { if (err.code) { console.error('Fail to destroy the window. Cause:' + JSON.stringify(err)); return; } this.subWindow = null; }); } }
https://gitcode.com/arkui-x/samples
f006c2ec47efff6f679c55bea4036e302734a697
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
onSaveEdit
save data
onSaveEdit(): void { if (this.isStartDrag) { return; } this.getUIContext()?.animateTo({ duration: ENTER_EXIT_ICON_DURATION, curve: LONG_TOUCH_SCALE as ICurve }, () => { this.longScaleOnePointTwo = 1; }) this.editGridDataLength = this.selected.length; this.getUIConte...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSaveEdit 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...
onSaveEdit(): void { if (this.isStartDrag) { return; } this.getUIContext()?.animateTo({ duration: ENTER_EXIT_ICON_DURATION, curve: LONG_TOUCH_SCALE as ICurve }, () => { this.longScaleOnePointTwo = 1; }) this.editGridDataLength = this.selected.length; this.getUIConte...
https://gitcode.com/openharmony/arkui_ace_engine
f0ddafc18a55357ccd128861bde8ccfe2e6badc2
gitcode
tdcare/tdwebrtc
src/main/ets/CameraCapture.ets
arkts
selectCamera
选择摄像头(优先匹配指定位置)
private selectCamera(cameras: camera.CameraDevice[]): camera.CameraDevice { const targetPosition: camera.CameraPosition = this.config.cameraPosition === 'front' ? camera.CameraPosition.CAMERA_POSITION_FRONT : camera.CameraPosition.CAMERA_POSITION_BACK; for (let i = 0; i < cameras.length; i++) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left selectCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cameras AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_exp...
private selectCamera(cameras: camera.CameraDevice[]): camera.CameraDevice { const targetPosition: camera.CameraPosition = this.config.cameraPosition === 'front' ? camera.CameraPosition.CAMERA_POSITION_FRONT : camera.CameraPosition.CAMERA_POSITION_BACK; for (let i = 0; i < cameras.length; i++) { ...
https://github.com/tdcare/tdwebrtc
c5e63f30cb745081ef0400c62bea5de7234d2311
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Copies all elements of arr to the current Uint32Array starting from insertPos. @param arr array to copy data from @param insertPos start index where data from arr will be inserted {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} public
/* public */ internal set(arr: number[], insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint32Array.length") } for (let i = 0; i < arr.length; ++i) { ...
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#id...
/* public */ internal set(arr: number[], insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint32Array.length") } for (let i = 0; i < arr.length; ++i) { ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
778e554882ac4300227804b8d88f565eea6fd9e8
gitee
openharmony/graphic_graphic_2d
frameworks/text/interface/export/ani/@ohos.graphics.text.ets
arkts
constructor
Constructor ParagraphBuilder. @param { ParagraphStyle } paragraphStyle - Paragraph style {@link ParagraphStyle} @param { FontCollection } fontCollection - Font collection {@link FontCollection} @syscap SystemCapability.Graphics.Drawing @since 12
constructor(paragraphStyle: ParagraphStyle, fontCollection: FontCollection) { this.constructorNative(paragraphStyle, fontCollection); this.registerCleaner(this.nativeObj); };
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 paragraphStyle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ParagraphStyle AST#...
constructor(paragraphStyle: ParagraphStyle, fontCollection: FontCollection) { this.constructorNative(paragraphStyle, fontCollection); this.registerCleaner(this.nativeObj); };
https://gitee.com/openharmony/graphic_graphic_2d.git
3fb36010c9f5e0186d7b8192cbfb051be9015cde
gitee
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/FootprintRepository.ets
arkts
getRecentFootprints
获取指定数量的最新足迹记录 @param {number} limit 限制数量 @returns {Promise<Footprint[]>} 足迹列表
getRecentFootprints(limit: number): Promise<Footprint[]> { return this.dataSource.getRecentFootprints(limit); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getRecentFootprints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
getRecentFootprints(limit: number): Promise<Footprint[]> { return this.dataSource.getRecentFootprints(limit); }
https://github.com/Joker-x-dev/CoolMallArkTS
a2bad1079d569d6a2a667e437072efd847bf1768
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicPlayerService.ets
arkts
getDuration
获取总时长(毫秒)
getDuration(): number { if (this.avPlayer) { return this.avPlayer.duration; } return 0; }
AST#program#Left AST#ERROR#Left 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#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_...
getDuration(): number { if (this.avPlayer) { return this.avPlayer.duration; } return 0; }
https://github.com/cpdd5201314/harmonyOS-music-app
6b36934f318f5347e906c930c165de9e4a818d6f
github
iichen-bycode/ArkTsWanandroid
entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
getHomeArticle
分页获取文章 @param callback
async getHomeArticle(isRefresh:boolean = false,callback: ResultCallback) { if(isRefresh) { this.page = 0 this.articleModel.over = false } if(this.articleModel.over && false) { callback([]) } else { let hotTopArticle = [] if(this.page == 0) { hotTopArticle = await ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getHomeArticle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isRefresh AST#identifier#Right...
async getHomeArticle(isRefresh:boolean = false,callback: ResultCallback) { if(isRefresh) { this.page = 0 this.articleModel.over = false } if(this.articleModel.over && false) { callback([]) } else { let hotTopArticle = [] if(this.page == 0) { hotTopArticle = await ...
https://github.com/iichen-bycode/ArkTsWanandroid
d539a42b874b5b361eaf69cfde3b894b48384790
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARRenderer.ets
arkts
drawDebugInfo
绘制调试信息
private drawDebugInfo(): void { if (!this.canvasContext) return; const ctx = this.canvasContext; // 绘制帧率 ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; ctx.font = '20px monospace'; ctx.textAlign = 'left'; ctx.fillText(`FPS: ${this.currentFps}`, 20, 30); ctx.fillText( `方向: ${Math.r...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawDebugInfo 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#vo...
private drawDebugInfo(): void { if (!this.canvasContext) return; const ctx = this.canvasContext; // 绘制帧率 ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; ctx.font = '20px monospace'; ctx.textAlign = 'left'; ctx.fillText(`FPS: ${this.currentFps}`, 20, 30); ctx.fillText( `方向: ${Math.r...
https://github.com/LJ666-ui/harmony-health-care
cb1d2dfafaa2f0a99d7b174ca3360eae83c0784c
github
openharmony/applications_app_samples
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets
arkts
packToDataImageSource
ImageSource转为数据 @param context 调用rawFile创建ImageSource方法
async packToDataImageSource(context: Context): Promise<string> { const resourceMgr = context.createModuleContext('entry').resourceManager let rawFileDescriptor: resourceManager.RawFileDescriptor rawFileDescriptor = await resourceMgr.getRawFd('HdrVivid.jpg'); let fileName = this.getTimeStr() + `_source...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left packToDataImageSource 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...
async packToDataImageSource(context: Context): Promise<string> { const resourceMgr = context.createModuleContext('entry').resourceManager let rawFileDescriptor: resourceManager.RawFileDescriptor rawFileDescriptor = await resourceMgr.getRawFd('HdrVivid.jpg'); let fileName = this.getTimeStr() + `_source...
https://github.com/openharmony/applications_app_samples
e53bd4f1bdc0afa9a19453cbffc1373ff2fb3499
github
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
resetProgress
Reset progress bar data.
resetProgress() { this.seekTime = PlayConstants.PROGRESS_SEEK_TIME; this.playerModel.currentTime = PlayConstants.PROGRESS_CURRENT_TIME; this.playerModel.progressVal = PlayConstants.PROGRESS_PROGRESS_VAL; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resetProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
resetProgress() { this.seekTime = PlayConstants.PROGRESS_SEEK_TIME; this.playerModel.currentTime = PlayConstants.PROGRESS_CURRENT_TIME; this.playerModel.progressVal = PlayConstants.PROGRESS_PROGRESS_VAL; }
https://gitee.com/openharmony/codelabs.git
2eb2248d2dca1f5858aac8c84fbe3b25cb303486
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
set
Copies elements from an ArrayLike object to the Uint8ClampedArray. @param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy. @param { int } [offset] - Optional. The offset into the target array at which to begin writing values from the source array. The default value is 0. @throws { Rang...
public set(array: ArrayLike<number>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafeCl...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public set(array: ArrayLike<number>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafeCl...
https://gitcode.com/iop123123/arkts-static-skills
59c8813d1cf4607ecb3fc2e2b74abb71cfa32ccb
gitcode
HarmonyOS_Samples/sample_in_harmonyos
features/abilitycommon/src/main/ets/widget/viewmodel/UpdateFormData.ets
arkts
init
Init the viewModel, if this cardList length not equal 0, don't need InitEvent. @param formId @returns formBindingData.FormBindingData
public static init(formId: string): formBindingData.FormBindingData { if (UpdateFormData.viewModel.getState().cardList.length === 0) { UpdateFormData.viewModel.sendEvent(new InitEvent()); } UpdateFormData.viewModel.sendEvent(new AddFormData(formId, UpdateFormData.viewModel.getState().cardList)); ...
AST#program#Left AST#expression_statement#Left AST#member_expression#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 init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#...
public static init(formId: string): formBindingData.FormBindingData { if (UpdateFormData.viewModel.getState().cardList.length === 0) { UpdateFormData.viewModel.sendEvent(new InitEvent()); } UpdateFormData.viewModel.sendEvent(new AddFormData(formId, UpdateFormData.viewModel.getState().cardList)); ...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
1495cc65e76f6b04d90bbee39868b9b587909ed2
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/Index.ets
arkts
getCurrentTitle
获取当前标题
getCurrentTitle(): string { switch (this.currentViewType) { case CalendarViewType.DAY: return formatDateChinese(this.selectedDate) case CalendarViewType.WEEK: return `${this.currentYear}年${this.currentMonth + 1}月` case CalendarViewType.MONTH: return `${this.currentYear}年$...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem...
getCurrentTitle(): string { switch (this.currentViewType) { case CalendarViewType.DAY: return formatDateChinese(this.selectedDate) case CalendarViewType.WEEK: return `${this.currentYear}年${this.currentMonth + 1}月` case CalendarViewType.MONTH: return `${this.currentYear}年$...
https://gitcode.com/openharmony/codelabs
d32c1766c87200befdc29cf46128f3ac68a09b65
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/LearningRecorder.ets
arkts
init
Boot the recorder: open preferences, hydrate the in-memory snapshot, capture which wordIds were already "learned" before this session. Safe to call more than once; subsequent calls are no-ops.
async init(ctx: common.UIAbilityContext): Promise<void> { if (this.ready) { return; } try { await this.store.open(ctx); const loaded: LearningSnapshot = await this.store.load(); this.snapshot = loaded; } catch (err) { console.error(`LearningRecorder.init failed: ${JSON.st...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annota...
async init(ctx: common.UIAbilityContext): Promise<void> { if (this.ready) { return; } try { await this.store.open(ctx); const loaded: LearningSnapshot = await this.store.load(); this.snapshot = loaded; } catch (err) { console.error(`LearningRecorder.init failed: ${JSON.st...
https://github.com/terryma2024/happyword
339bfde24067772fcdae1645c7606b7563d33cca
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/BillDAO.ets
arkts
transaction
事务封装 - 使用 DAOHelper 统一方法
static async transaction(fn: () => Promise<void>) { await DAOHelper.transaction(fn, '[BillDAO]'); }
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 transaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#...
static async transaction(fn: () => Promise<void>) { await DAOHelper.transaction(fn, '[BillDAO]'); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b93c65437ccadfdc0cb48458e37e55c0a741b608
github
offlinecat-dev/OCNetORM
src/main/ets/errors/RelationError.ets
arkts
constructor
构造函数 @param relationType 无效的关系类型
constructor(relationType: string) { const context = new ErrorContext() context.details = `无效的关系类型: ${relationType}` super(`无效的关系类型: '${relationType}',仅支持 ONE_TO_ONE、ONE_TO_MANY、MANY_TO_ONE、MANY_TO_MANY 和 MORPH_TO`, ERROR_INVALID_RELATION_TYPE, context) this.name = 'InvalidRelationTypeError' }
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 relationType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A...
constructor(relationType: string) { const context = new ErrorContext() context.details = `无效的关系类型: ${relationType}` super(`无效的关系类型: '${relationType}',仅支持 ONE_TO_ONE、ONE_TO_MANY、MANY_TO_ONE、MANY_TO_MANY 和 MORPH_TO`, ERROR_INVALID_RELATION_TYPE, context) this.name = 'InvalidRelationTypeError' }
https://github.com/offlinecat-dev/OCNetORM
c23b0ad16f2510557b9119146d27f5662250601b
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/db/MusicMemoryStore.ets
arkts
seedTables
Fills songs, playlists, and recommend feed from built-in demo data.
private seedTables(): void { this.songs = this.buildSongs(); this.playlists = this.buildPlaylists(); this.recommendFeed = this.buildRecommendFeed(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left seedTables 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#expressi...
private seedTables(): void { this.songs = this.buildSongs(); this.playlists = this.buildPlaylists(); this.recommendFeed = this.buildRecommendFeed(); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
7b63185ac6964df475417d304ff5b27396d0249a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Node.ets
arkts
rawText
获取原始文本内容(子类需要重写)
get rawText(): string { return ''; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left rawText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST...
get rawText(): string { return ''; }
https://github.com/DaLongZhuaZi/manxia
0d8adbf2d20194785abfbc215568c88a7ee20d51
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
setCurrentFieldContent
Sets the current field content of the address bar. @param newContent The new field content.
setCurrentFieldContent(newContent: string, timeout: number = 1) { if (this.addressBarContentCurrentField != newContent) { this.addressBarContentCurrentField = newContent; // Refresh suggestions clearTimeout(this.suggestionsRefreshTimeoutId); this.suggestionsRefreshTimeoutId = setTimeout(()...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCurrentFieldContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERRO...
setCurrentFieldContent(newContent: string, timeout: number = 1) { if (this.addressBarContentCurrentField != newContent) { this.addressBarContentCurrentField = newContent; // Refresh suggestions clearTimeout(this.suggestionsRefreshTimeoutId); this.suggestionsRefreshTimeoutId = setTimeout(()...
https://github.com/awaLiny2333/LinysBrowser_NEXT
e6786a201ba0fa9116d8805771bf41e80c49ba71
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets
arkts
setWidth
设置菜单项宽度 @param width 宽度值
public setWidth(width: number): void { this.width = width; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public setWidth(width: number): void { this.width = width; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
fcc6409f53a70823532811d24b23823b61c5f5f4
gitcode
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
release
============================================================ 资源释放 ============================================================ 释放所有资源
public async release(): Promise<void> { // 停止占位画面定时器 this.stopPlaceholderTimer(); // v30: 停止定时 PLI 请求 this.stopPeriodicPliRequests(); // 清除待解码的视频帧队列 this.pendingVideoFrames = []; this.pendingVideoTimestamps = []; this.pendingVideoKeyFrames = []; this.decodeScheduled = false; ...
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 release AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :...
public async release(): Promise<void> { // 停止占位画面定时器 this.stopPlaceholderTimer(); // v30: 停止定时 PLI 请求 this.stopPeriodicPliRequests(); // 清除待解码的视频帧队列 this.pendingVideoFrames = []; this.pendingVideoTimestamps = []; this.pendingVideoKeyFrames = []; this.decodeScheduled = false; ...
https://github.com/tdcare/tdwebrtc
ceeb4b892e5bf4a6d22ba80780347d644b37123c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets
arkts
getUint16
=== Uint16 === Read bytes as they represent given type @param { int } byteOffset zero index to read @returns { int } return byteOffset's Uint16 value @throws { RangeError } - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getUint16(byteOffset: int): int { return this.getUint16Big(byteOffset) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUint16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifi...
public getUint16(byteOffset: int): int { return this.getUint16Big(byteOffset) }
https://gitcode.com/iop123123/arkts-static-skills
fabab5f3616ca5a1bf4a7516acae90658dd9b4b1
gitcode
751496032/DSBridge-HarmonyOS
library/src/main/ets/core/WebViewControllerProxy.ets
arkts
supportDS2
启用DS2.0脚本 @param enable
supportDS2(enable: boolean): void { this.bridge.supportDS2(enable) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left supportDS2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) A...
supportDS2(enable: boolean): void { this.bridge.supportDS2(enable) }
https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L34-L36
a740e2e3fe179947cb8eef602f9160da716b4730
github
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/PhoneNumberUtils.ets
arkts
encryptPhone
加密显示手机号中间四位 @param phone @param maskChar @returns
public static encryptPhone(phone: string, maskChar: string = '*'): string { return phone.replace(/(\d{3})(\d{4})(\d{4})/, `$1${maskChar.repeat(4)}$3`); }
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 encryptPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AS...
public static encryptPhone(phone: string, maskChar: string = '*'): string { return phone.replace(/(\d{3})(\d{4})(\d{4})/, `$1${maskChar.repeat(4)}$3`); }
https://github.com/xblLab/HarmonyProjectTemplate
e831c81911c679fe3b2611626cc8db9864c1052c
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
updateGroup
更新群信息 @param conversationId 会话ID @param data 更新数据
async updateGroup(conversationId: string, data: { name?: string avatar?: string description?: string }): Promise<ApiResponse<Conversation>> { return this.client.put<Conversation>(`/api/v1/im/conversations/${conversationId}`, data) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateGroup AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AST#:#...
async updateGroup(conversationId: string, data: { name?: string avatar?: string description?: string }): Promise<ApiResponse<Conversation>> { return this.client.put<Conversation>(`/api/v1/im/conversations/${conversationId}`, data) }
https://github.com/David8Idira/AI-OA
09d31fef4bfbdd2e6877c00ddadbdd4677b06c4f
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/DownloadsViewModel.ets
arkts
getSelectedCount
获取选中数量
getSelectedCount(): number { return this.selectedIds.size; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelectedCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#state...
getSelectedCount(): number { return this.selectedIds.size; }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L88-L90
4560343d824683ae0372724f2f394aed0854f432
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/AlertManager.ets
arkts
getAlerts
获取告警列表
public getAlerts(): WardAlert[] { // 按等级排序(EMERGENCY > URGENT > WARNING > INFO) return this.alerts.sort((a, b) => { const levelOrder: Record<AlertLevel, number> = { [AlertLevel.EMERGENCY]: 0, [AlertLevel.URGENT]: 1, [AlertLevel.WARNING]: 2, [AlertLevel.INFO]: 3, [...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAlerts 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 WardAlert AS...
public getAlerts(): WardAlert[] { // 按等级排序(EMERGENCY > URGENT > WARNING > INFO) return this.alerts.sort((a, b) => { const levelOrder: Record<AlertLevel, number> = { [AlertLevel.EMERGENCY]: 0, [AlertLevel.URGENT]: 1, [AlertLevel.WARNING]: 2, [AlertLevel.INFO]: 3, [...
https://github.com/LJ666-ui/harmony-health-care
1bccbd2c03839609f7b435c7ae5b8c616ccac462
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
uint64Number
Read unsigned varint64 as number (may lose precision)
uint64Number(): number { const v = this.uint64(); const max = BigInt(Number.MAX_SAFE_INTEGER); return v <= max ? Number(v) : Number(v) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left uint64Number AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement...
uint64Number(): number { const v = this.uint64(); const max = BigInt(Number.MAX_SAFE_INTEGER); return v <= max ? Number(v) : Number(v) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
5545b2f762b1646a6788b17781b66438ed4cb101
gitcode
arkui-x/samples
CodeLab/Cases/feature/danmakuplayer/src/main/ets/model/DanmakuVideoPlayer.ets
arkts
onViewClick
点击视窗逻辑
onViewClick(view: IDanmakuView): boolean { this.that.isVisible = true; return false; };
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onViewClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left view AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IDanmakuView AST#identifier#Right AST#)#Left...
onViewClick(view: IDanmakuView): boolean { this.that.isVisible = true; return false; };
https://gitcode.com/arkui-x/samples
c0ce4bbf8941873fab9b0ea0978b92cfa0a1c271
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
setInverted
If this is set to true, the y-axis is inverted which means that low values are on top of the chart, high values on bottom. @param enabled
public setInverted(enabled: boolean): void { this.mInverted = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setInverted 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 b...
public setInverted(enabled: boolean): void { this.mInverted = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
37d4b3eec271f47ee9e86bde2d11500efc566b85
gitee
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
set_dsd
设置dsd支持(重加载) //
async set_dsd(mode: boolean) { // 设置 // this.global_config!.dsd_support = mode this.global_config?.save_data() // 重加载 // this.reset_data() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left set_dsd AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left mode AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
async set_dsd(mode: boolean) { // 设置 // this.global_config!.dsd_support = mode this.global_config?.save_data() // 重加载 // this.reset_data() }
https://github.com/Nekofox-POT/LinMusic
ffd96ef10b2ae9fd04ee562987ca7a9d7cddb5b0
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
offBLEDeviceFind
取消订阅查找蓝牙设备
private offBLEDeviceFind() { try { ble.off('BLEDeviceFind'); } catch (err) { Log.showError(TAG, `offBLEDeviceFind: err = ${err}`); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left offBLEDeviceFind 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#{#...
private offBLEDeviceFind() { try { ble.off('BLEDeviceFind'); } catch (err) { Log.showError(TAG, `offBLEDeviceFind: err = ${err}`); } }
https://gitcode.com/arkui-x/samples
4acf0f93c851020b2483f07b8f1cda6983b90686
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/MessageHandler.ets
arkts
getWorker
Get the target worker associated with this handler @returns { EAWorker } The worker that handles messages for this handler
public getWorker(): EAWorker { return this.worker; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWorker 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 EAWorker AST...
public getWorker(): EAWorker { return this.worker; }
https://gitcode.com/iop123123/arkts-static-skills
c85a514b0667dd56dec8984036573cd25cc7c264
gitcode
apap6628114/nga_oh
entry/src/main/ets/store/settings/domain/ReadingSettings.ets
arkts
load
从持久化对象加载阅读字段
load(saved: SettingsState): void { if (saved.threadNavMode !== undefined) this.ctx.state.threadNavMode = saved.threadNavMode if (saved.prefetchPageCount !== undefined) { this.ctx.state.prefetchPageCount = saved.prefetchPageCount } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left load AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left saved AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SettingsState AST#identifier#Right AST#)#Left ) AS...
load(saved: SettingsState): void { if (saved.threadNavMode !== undefined) this.ctx.state.threadNavMode = saved.threadNavMode if (saved.prefetchPageCount !== undefined) { this.ctx.state.prefetchPageCount = saved.prefetchPageCount } }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/ReadingSettings.ets#L28-L33
a804c5f12a032304d82ba55dcf82916927548a6f
github
azhu0001/localsend-harmony
entry/src/main/ets/transaction/ComponentAttrUtils.ets
arkts
getRectInfoById
Gets the location information of a component based on its id.
public static getRectInfoById(context: UIContext, id: string): RectInfoInPx { if (!context || !id) { throw Error('object is empty'); } let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id); hilog.info(0x0000, 'ComponentAttrUtils', 'the value is ' + J...
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 getRectInfoById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left...
public static getRectInfoById(context: UIContext, id: string): RectInfoInPx { if (!context || !id) { throw Error('object is empty'); } let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id); hilog.info(0x0000, 'ComponentAttrUtils', 'the value is ' + J...
https://gitcode.com/azhu0001/localsend-harmony
5be221004eca85a52bd90dfbfb7d60dcd0e91b4f
gitcode
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
sendPcmAudio
发送 PCM 音频数据(一体化:G.711 编码 + RTP 打包 + 发送,单次 NAPI 调用) 一体化:G.711 编码 + RTP 打包 + 发送,单次 NAPI 调用 @param trackId 音频轨道 ID @param pcmData PCM 16-bit LE 数据 @param timestamp RTP 时间戳
public sendPcmAudio(trackId: string, pcmData: Uint8Array, timestamp: number): boolean { if (!this.client) return false; return this.client.sendPcmAudio(trackId, pcmData, timestamp); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendPcmAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left trackId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
public sendPcmAudio(trackId: string, pcmData: Uint8Array, timestamp: number): boolean { if (!this.client) return false; return this.client.sendPcmAudio(trackId, pcmData, timestamp); }
https://github.com/tdcare/tdwebrtc
ba10c26307ac171a43284bdd563be2bc29236b9e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/JArrayList.ets
arkts
remove
在列表中移除一个元素 @param {*} element 要删除的元素
remove(element: T) { // 查找当前元素的索引 const index = this.dataSource.indexOf(element); if (index >= 0) { this.dataSource.splice(index, 1); this.listSize--; return true; } return false; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Le...
remove(element: T) { // 查找当前元素的索引 const index = this.dataSource.indexOf(element); if (index >= 0) { this.dataSource.splice(index, 1); this.listSize--; return true; } return false; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
73c4f49b277ee639252cbe47c387a520576f466a
gitee
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/interconnect/facades/AppLinkingFacade.ets
arkts
shareText
打开系统共享面板,分享内容给其他应用或超级终端
shareText(text: string): void { const context: common.UIAbilityContext | null = uiContextManager.getFullAbilityContext(); if (!context) { logger.error(TAG, '缺少 UIAbilityContext,无法拉起分享面板'); return; } try { const want: Want = { action: 'ohos.want.action.sendData', type...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shareText 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#)...
shareText(text: string): void { const context: common.UIAbilityContext | null = uiContextManager.getFullAbilityContext(); if (!context) { logger.error(TAG, '缺少 UIAbilityContext,无法拉起分享面板'); return; } try { const want: Want = { action: 'ohos.want.action.sendData', type...
https://github.com/DaLongZhuaZi/NGF
2b622d644a47a77bf8f0c53009257d69d90bcaa9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets
arkts
onPageFinish
页面加载完成回调(由WebView组件调用)
onPageFinish(url: string): void { logger.debug(TAG, `页面加载完成: ${url}`); if (this.pageLoadCallback) { this.pageLoadCallback(url); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageFinish AST#identifier#Right AST#arguments#Left 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...
onPageFinish(url: string): void { logger.debug(TAG, `页面加载完成: ${url}`); if (this.pageLoadCallback) { this.pageLoadCallback(url); } }
https://github.com/DaLongZhuaZi/manxia
d7595f1b9b0774be0985fc7c229a95e6ff24822e
github
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
closeNoRepeatAlarms
Queries and disables all alarms that are unique and whose start time is the same as that of alarmInfo in the alarm list. Query and reset the alarm time of all duplicate alarms in the alarm list. The alarm time is the same as that of alarmInfo. @param alarmTime alarm clock that is being started
async closeNoRepeatAlarms(alarmInfo: AlarmInfo): Promise<void> { const rdbStore = await this.getRdbStore(); rdbStore.beginTransaction(); const predicates = new rdb.RdbPredicates(DATA_TABLE); predicates.equalTo('ALARM_TIME', alarmInfo.alarmTime as number); predicates.equalTo('ENABLED', ENABLED_TRUE...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left closeNoRepeatAlarms AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#type_annotation#Left AST...
async closeNoRepeatAlarms(alarmInfo: AlarmInfo): Promise<void> { const rdbStore = await this.getRdbStore(); rdbStore.beginTransaction(); const predicates = new rdb.RdbPredicates(DATA_TABLE); predicates.equalTo('ALARM_TIME', alarmInfo.alarmTime as number); predicates.equalTo('ENABLED', ENABLED_TRUE...
https://gitee.com/openharmony-sig/applications_clock.git
31d3a1121cec8770aba34384846230d635c10ac6
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
releaseSlot
通用槽位释放方法
private releaseSlot(deviceKey: string, keyToSlotMap: Map<string, number>, logPrefix: string): void { const slot = keyToSlotMap.get(deviceKey); if (slot !== undefined) { this.slotOccupied[slot] = false; keyToSlotMap.delete(deviceKey); console.info(`[${logPrefix}] 释放设备槽位: Key=${deviceKey}, Slo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left releaseSlot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
private releaseSlot(deviceKey: string, keyToSlotMap: Map<string, number>, logPrefix: string): void { const slot = keyToSlotMap.get(deviceKey); if (slot !== undefined) { this.slotOccupied[slot] = false; keyToSlotMap.delete(deviceKey); console.info(`[${logPrefix}] 释放设备槽位: Key=${deviceKey}, Slo...
https://github.com/AlkaidLab/moonlight-harmony
5bcd6c40b6954c49b4dc8f41770cab0967c0eace
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
buildBookDetailActions
构建电子书详情操作序列
buildBookDetailActions(config: MangaSourceConfig): Action[] { const workflow = this.getWorkflow(config, 'getBookDetail'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少电子书详情工作流配置' ); } return this.processActions(workflow, {}); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildBookDetailActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfi...
buildBookDetailActions(config: MangaSourceConfig): Action[] { const workflow = this.getWorkflow(config, 'getBookDetail'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少电子书详情工作流配置' ); } return this.processActions(workflow, {}); }
https://github.com/DaLongZhuaZi/manxia
4476cb9d6eadb19bba5025d54be8c6e13e4f5290
github
arkui-x/samples
CodeLab/Cases/common/routermodule/src/main/ets/router/DynamicsRouter.ets
arkts
getRouterReferrer
获取路由来源页面栈
public static getRouterReferrer(): string[] { return DynamicsRouter.referrer; }
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 getRouterReferrer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public static getRouterReferrer(): string[] { return DynamicsRouter.referrer; }
https://gitcode.com/arkui-x/samples
35c0352eb36351dba22a730104f5c37a20144265
gitcode
PollenWang6/HiXD
entry/src/main/ets/utils/AccentColors.ets
arkts
selectCustom
自定义颜色
static selectCustom(hex: string): boolean { if (!hex.startsWith('#') || hex.length !== 7) return false; if (!/^#[0-9A-Fa-f]{6}$/.test(hex)) return false; PreferenceUtil.putString(CUSTOM_KEY, hex); AppStorage.setOrCreate('accent_color', hex); AppStorage.setOrCreate('accent_index', -1); return t...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left selectCustom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
static selectCustom(hex: string): boolean { if (!hex.startsWith('#') || hex.length !== 7) return false; if (!/^#[0-9A-Fa-f]{6}$/.test(hex)) return false; PreferenceUtil.putString(CUSTOM_KEY, hex); AppStorage.setOrCreate('accent_color', hex); AppStorage.setOrCreate('accent_index', -1); return t...
https://github.com/PollenWang6/HiXD
53cbf7fccb2100fe29374538252c8c5e0658f827
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/common/utils/ResourceUtils.ets
arkts
getRawFileString
获取 RawFile 内容并转为字符串
public static async getRawFileString(fileName: string): Promise<string> { try { // Fix: this.getRawFileContent -> ResourceUtils.getRawFileContent const data = await ResourceUtils.getRawFileContent(fileName); if (data.length === 0) { return ''; } // 暂未实现 TextDecoder,返回空 ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getRawFileString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#ide...
public static async getRawFileString(fileName: string): Promise<string> { try { // Fix: this.getRawFileContent -> ResourceUtils.getRawFileContent const data = await ResourceUtils.getRawFileContent(fileName); if (data.length === 0) { return ''; } // 暂未实现 TextDecoder,返回空 ...
https://gitcode.com/openharmony/codelabs
c949ea6cb996271d26d8b50433b11ff3ab360329
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/AudioVibrationService.ets
arkts
triggerUsbRumble
==================== USB 手柄振动(场景感知) ==================== USB 手柄振动 — 根据实际音频频段和立体声位置分配 low/high motor lowFreqRatio 由 C++ 层实时计算,反映低频在总能量中的真实占比 stereoBalance 反映声源的左右位置: - 低频马达 (heavy) 模拟左侧,高频马达 (light) 模拟右侧 - 声源偏左时增强低频马达,偏右时增强高频马达 - 与 lowFreqRatio 叠加: 先按频段分配基础强度,再按空间位置微调
private triggerUsbRumble(intensity: number, lowFreqRatio: number = 50): void { const base = Math.floor(intensity * RUMBLE_MAX / 100); // 将 C++ 的低频占比 (0-100) 映射为 motor 分配比例 // ratio=100 → 全部低频, ratio=0 → 全部高频 // 加权平滑: 避免极端分配,至少保留 15% 给另一个 motor const lowWeight = Math.max(0.15, Math.min(0.85, lowFre...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left triggerUsbRumble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left intensity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#...
private triggerUsbRumble(intensity: number, lowFreqRatio: number = 50): void { const base = Math.floor(intensity * RUMBLE_MAX / 100); // 将 C++ 的低频占比 (0-100) 映射为 motor 分配比例 // ratio=100 → 全部低频, ratio=0 → 全部高频 // 加权平滑: 避免极端分配,至少保留 15% 给另一个 motor const lowWeight = Math.max(0.15, Math.min(0.85, lowFre...
https://github.com/AlkaidLab/moonlight-harmony
959f484e61ee5c28e566276a0d2b648eb7a0ff3a
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrShareService.ets
arkts
scanQrCode
启动系统相机扫码 @returns 扫码内容字符串,失败返回 null
static async scanQrCode(): Promise<string | null> { if (!QrShareService.isScanQrCodeSupported()) { console.warn('[QrShareService] 当前设备不支持 ScanBarcode 系统能力'); return null; } try { const options: scanBarcode.ScanOptions = { scanTypes: [scanCore.ScanType.QR_CODE], enableMul...
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 scanQrCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
static async scanQrCode(): Promise<string | null> { if (!QrShareService.isScanQrCodeSupported()) { console.warn('[QrShareService] 当前设备不支持 ScanBarcode 系统能力'); return null; } try { const options: scanBarcode.ScanOptions = { scanTypes: [scanCore.ScanType.QR_CODE], enableMul...
https://github.com/AlkaidLab/moonlight-harmony
260fa5a600c392ac466c1ea7c834b67736679e13
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/arkts/concurrent/TaskPoolDemo.ets
arkts
fun1
@Concurrent 表示函数可以被创建为一个被任务池执行的任务
@Concurrent function fun1(a: number, b: number): number { return a + b }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left fun1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_...
@Concurrent function fun1(a: number, b: number): number { return a + b }
https://github.com/webabcd/HarmonyDemo
b107ed3ef2f2559bb9519578fe196e3d3d2e27f0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
exportCacheInfo
导出缓存信息
private async exportCacheInfo(): Promise<CacheInfoBackup[]> { try { const sql = ` SELECT id, cacheKey, cacheType, filePath, fileSize, expireTime, accessCount, lastAccessTime, createTime FROM cache_info `; const results = await this.dbManager.querySql(sql); ...
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 exportCacheInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async exportCacheInfo(): Promise<CacheInfoBackup[]> { try { const sql = ` SELECT id, cacheKey, cacheType, filePath, fileSize, expireTime, accessCount, lastAccessTime, createTime FROM cache_info `; const results = await this.dbManager.querySql(sql); ...
https://github.com/DaLongZhuaZi/manxia
dec28e1e9800b0773412344518573c20c25baf22
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPPerformanceManager.ets
arkts
processFrame
处理接收到的帧数据
async processFrame(frameData: ArrayBuffer, frameId: string): Promise<ArrayBuffer> { const startTime = Date.now() try { // 更新帧率统计 this.updateFrameStats() // 检查帧缓存 if (this.config.enableFrameCache && this.frameCacheManager.hasFrame(frameId)) { const cachedFrame = this...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left processFrame AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left frameData AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async processFrame(frameData: ArrayBuffer, frameId: string): Promise<ArrayBuffer> { const startTime = Date.now() try { // 更新帧率统计 this.updateFrameStats() // 检查帧缓存 if (this.config.enableFrameCache && this.frameCacheManager.hasFrame(frameId)) { const cachedFrame = this...
https://github.com/AetheriumSimulator/qemu-hmos
ba0859f003983d2a09f6c05d9f92440f74ee052e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
jsonKey
Gets the key associated with this JSON element. @returns {string} The key of this element
get jsonKey(): string { return this.key }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left jsonKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST...
get jsonKey(): string { return this.key }
https://gitcode.com/iop123123/arkts-static-skills
5e208f777f6352bc3d127f4dc1277bb3b1e45fa4
gitcode
tdcare/tdwebrtc
src/main/ets/SignalingClient.ets
arkts
sendSosHangup
发送 SOS 挂断
public sendSosHangup(toMac: string, roomId: string): void { const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_SOS_HANGUP, room_id: roomId, from_mac: this.mac, to_mac: toMac, msg: '', }; env.data = data; this.sendRawMe...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendSosHangup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
public sendSosHangup(toMac: string, roomId: string): void { const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_SOS_HANGUP, room_id: roomId, from_mac: this.mac, to_mac: toMac, msg: '', }; env.data = data; this.sendRawMe...
https://github.com/tdcare/tdwebrtc
5dfee5e68a44174eb7f21fd784c50d614978c160
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test20_original_index.ets
arkts
testShiftAssignment
--- Bitwise shift assignment ---
function testShiftAssignment(): string { let v: number = 100; v = v << 2; let a: number = v; v = v >> 1; let b: number = v; v = v >>> 1; let c: number = v; return String(a) + ',' + String(b) + ',' + String(c); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testShiftAssignment 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#predefi...
function testShiftAssignment(): string { let v: number = 100; v = v << 2; let a: number = v; v = v >> 1; let b: number = v; v = v >>> 1; let c: number = v; return String(a) + ',' + String(b) + ',' + String(c); }
https://github.com/miaochiahao/ark-ghidra
961d0cceeb5d645ee0b0cb3472fe5329b29d479c
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/data/RegionData.ets
arkts
getRegionOptions
获取地区级联选项 @returns {IBestCascaderOption[]} 地区选项
static getRegionOptions(): IBestCascaderOption[] { return REGION_OPTIONS; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRegionOptions 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 IBest...
static getRegionOptions(): IBestCascaderOption[] { return REGION_OPTIONS; }
https://github.com/Joker-x-dev/CoolMallArkTS
dde14e38a9e902b41f095c24b9352fc306530e37
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/CustomWishlistFlow.ui.test.ets
arkts
typeInto
Type into one of the dialog's TextInput fields. inputText() pops the soft IME, which on a narrow landscape viewport overlays the stacked sibling inputs and makes them fail the default `visible:true` lookup. We pressBack() right after each call so the next typeInto / submit can locate its target. pressBack() while the I...
async function typeInto(driver: Driver, id: string, text: string): Promise<void> { try { await driver.assertComponentExist(ON.id(id)); const input = await driver.findComponent(ON.id(id)); await input.inputText(text); await driver.delayMs(300); await driver.pressBack(); await driver.delayMs(400...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left typeInto AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#type_ann...
async function typeInto(driver: Driver, id: string, text: string): Promise<void> { try { await driver.assertComponentExist(ON.id(id)); const input = await driver.findComponent(ON.id(id)); await input.inputText(text); await driver.delayMs(300); await driver.pressBack(); await driver.delayMs(400...
https://github.com/terryma2024/happyword
3231cd0c63936002861e5600697990112486f9aa
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
deleteDirectoryRecursive
递归删除目录及其所有内容
private deleteDirectoryRecursive(dirPath: string): void { try { if (!SafeFileUtils.accessSync(dirPath)) { return; } const entries = SafeFileUtils.listFileSync(dirPath); for (const entry of entries) { const fullPath = `${dirPath}/${entry}`; const stat = SafeFi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left deleteDirectoryRecursive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin...
private deleteDirectoryRecursive(dirPath: string): void { try { if (!SafeFileUtils.accessSync(dirPath)) { return; } const entries = SafeFileUtils.listFileSync(dirPath); for (const entry of entries) { const fullPath = `${dirPath}/${entry}`; const stat = SafeFi...
https://github.com/DaLongZhuaZi/manxia
5c0f2be51362618088e5035bc4b85fe03585f14d
github
openharmony/testfwk_arkxtest
jsunit/src_static/module/assert/deepEquals/DeepTypeUtils.ets
arkts
keys
获取对象的自有属性 @param obj 对象 @param isArray 是否是数组,[object Array]
static keys(obj: object, isArray: boolean): Array<string> { const extraKeys = new Array<string>(); const allKeys = DeepTypeUtils.getAllKeys(obj); const keyList = new Array<string>(); for (const key of allKeys) { keyList.push(key); } if (!isArray) { return keyList; } if (a...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifie...
static keys(obj: object, isArray: boolean): Array<string> { const extraKeys = new Array<string>(); const allKeys = DeepTypeUtils.getAllKeys(obj); const keyList = new Array<string>(); for (const key of allKeys) { keyList.push(key); } if (!isArray) { return keyList; } if (a...
https://gitee.com/openharmony/testfwk_arkxtest.git
76e62280fc3d1c11b168cc0a124c3661bfbfbbef
gitee
Dige945/EmoCollector
entry/src/main/ets/service/AIService.ets
arkts
getLocalMockResponse
生成本地模拟的 AI 分析建议
private getLocalMockResponse(records: MoodData[]): string { // 统计今日主要心情 const moodCounts = new Map<number, number>(); records.forEach((record: MoodData) => { const count = moodCounts.get(record.moodScore) || 0; moodCounts.set(record.moodScore, count + 1); }); let dominantMood = 2; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLocalMockResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subsc...
private getLocalMockResponse(records: MoodData[]): string { // 统计今日主要心情 const moodCounts = new Map<number, number>(); records.forEach((record: MoodData) => { const count = moodCounts.get(record.moodScore) || 0; moodCounts.set(record.moodScore, count + 1); }); let dominantMood = 2; ...
https://github.com/Dige945/EmoCollector
293fabdbda9b16528070f552255e93a9fc36bb28
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SessionManager.ets
arkts
getActiveSessions
获取所有活跃会话
getActiveSessions(): SessionState[] { const sessions: SessionState[] = []; this.sessionStates.forEach(state => { if (state.isActive) { sessions.push(state); } }); return sessions; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getActiveSessions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left SessionState A...
getActiveSessions(): SessionState[] { const sessions: SessionState[] = []; this.sessionStates.forEach(state => { if (state.isActive) { sessions.push(state); } }); return sessions; }
https://github.com/DaLongZhuaZi/manxia
55fbbc6d6f046c6f08e06fe9d1490dfab70f6733
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/ESError.ets
arkts
message
Sets the message of the error in the ESValue.
override set message(val: string) { this.err_.setProperty("message", ESValue.wrapString(val)); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier...
override set message(val: string) { this.err_.setProperty("message", ESValue.wrapString(val)); }
https://gitcode.com/iop123123/arkts-static-skills
9ebf9892d396c2b166b2f0e8ca26789295379119
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/utils/ClipboardManager.ets
arkts
onLocalClipboardChanged
Handle local clipboard change
private async onLocalClipboardChanged(): Promise<void> { if (!this.isEnabled || this.instance === 0) return; try { const systemPasteboard = pasteboard.getSystemPasteboard(); const pasteData = await systemPasteboard.getData(); if (!pasteData) return; // Get text conte...
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 onLocalClipboardChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private async onLocalClipboardChanged(): Promise<void> { if (!this.isEnabled || this.instance === 0) return; try { const systemPasteboard = pasteboard.getSystemPasteboard(); const pasteData = await systemPasteboard.getData(); if (!pasteData) return; // Get text conte...
https://github.com/tangwengang-del/freerdp-harmonyos
1637ed722a836fdb229befae9b5b80e0be488c98
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
findLast
Finds the last element in the Int16Array that satisfies the condition @param { function } fn - condition @returns { short } - the last element that satisfies fn @throws { Error } - If the element cannot be found, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLast(fn: (val: number, index: int, array: Int16Array) => boolean): short { for (let i = this.lengthInt - 1; i >= 0; --i) { let val = this.getUnsafe(i) if (fn((val).toDouble(), i, this)) { return val } } throw new Error("Int16Arra...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public findLast(fn: (val: number, index: int, array: Int16Array) => boolean): short { for (let i = this.lengthInt - 1; i >= 0; --i) { let val = this.getUnsafe(i) if (fn((val).toDouble(), i, this)) { return val } } throw new Error("Int16Arra...
https://gitcode.com/iop123123/arkts-static-skills
9e4f20be6448cbecbb08b76f3e1f552c22547f23
gitcode
Kira-Yagami-Light/Kira-Projects
XuanyinMusic/entry/src/main/ets/utils/AVPlayerManager.ets
arkts
changePlay
切换歌曲(重置播放器并加载本地 rawfile)
static async changePlay() { if (AVPlayerManager.player!.state !== 'idle') { await AVPlayerManager.player!.reset(); } AVPlayerManager.currentSong.duration = 0; AVPlayerManager.currentSong.time = 0; const currentItem = AVPlayerManager.currentSong.playList[AVPlayerManager.currentSong.playIndex...
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 changePlay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR...
static async changePlay() { if (AVPlayerManager.player!.state !== 'idle') { await AVPlayerManager.player!.reset(); } AVPlayerManager.currentSong.duration = 0; AVPlayerManager.currentSong.time = 0; const currentItem = AVPlayerManager.currentSong.playList[AVPlayerManager.currentSong.playIndex...
https://github.com/Kira-Yagami-Light/Kira-Projects
c88426738d3abf672f96ab0ee10d869d38fc0476
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
tryAutoShift
Tries to auto shift the address bar, if there are query keys available.
tryAutoShift() { if (this.addressBarStatus == AddressBarStatuses.NO_SHIFT) { return; } if (preferedKeysSet.has(this.searchKeywordEntries[0][0])) { // Shift to search keyword entries. if (this.addressBarStatus == AddressBarStatuses.CAN_SHIFT) { animateToImmediately(defaultAnimatio...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tryAutoShift AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
tryAutoShift() { if (this.addressBarStatus == AddressBarStatuses.NO_SHIFT) { return; } if (preferedKeysSet.has(this.searchKeywordEntries[0][0])) { // Shift to search keyword entries. if (this.addressBarStatus == AddressBarStatuses.CAN_SHIFT) { animateToImmediately(defaultAnimatio...
https://github.com/awaLiny2333/LinysBrowser_NEXT
074200cd1ff14c14e80edaa3abc8fbe51c96d95c
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/animate/AnimateToPage.ets
arkts
build
组件二透明度 第二步:将状态变量设置到相关可动画属性接口
build() { Row() { // 组件一 Column() { } .rotate({ angle: this.rotateValue }) // 添加旋转动画 .backgroundColor('#317AF7') .justifyContent(FlexAlign.Center) .width(100) .height(100) .borderRadius(30) .onClick(() => { // TODO 先获取context 再调用animateTo ...
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() { Row() { // 组件一 Column() { } .rotate({ angle: this.rotateValue }) // 添加旋转动画 .backgroundColor('#317AF7') .justifyContent(FlexAlign.Center) .width(100) .height(100) .borderRadius(30) .onClick(() => { // TODO 先获取context 再调用animateTo ...
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/animate/AnimateToPage.ets#L13-L57
757ee3e8439d2d72782d08e28161085c512fb7cf
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setFullYear
Sets the full year for a specified date according to local time. @param { int } value new year @param { int } month new month @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setFullYear(value: int, month: int): long { this.setFullYear(value); this.setMonth(month); return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFullYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public setFullYear(value: int, month: int): long { this.setFullYear(value); this.setMonth(month); return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
2b7f4e70c378bcbdba4bc1fec62ccf443b8d86fd
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/FavoriteViewModel.ets
arkts
illustIds
动态获取当前展示的插画 ID 列表
get illustIds(): number[] { return this.currentIllustList.map(i => i.id); }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left illustIds 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#...
get illustIds(): number[] { return this.currentIllustList.map(i => i.id); }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/FavoriteViewModel.ets#L108-L110
f00844f6e5ec5b392d9d4d7dbed502bdecc4a309
github
dingzhilin1990/zhilinclaw
src/core/ZhiLinClawCore.ets
arkts
getSkillRegistry
获取技能注册表
public getSkillRegistry(): SkillRegistry { return this.skillRegistry; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSkillRegistry 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 Skill...
public getSkillRegistry(): SkillRegistry { return this.skillRegistry; }
https://github.com/dingzhilin1990/zhilinclaw
8b665a79ebd3510e8706991b72a72f4f7822d928
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets
arkts
removeCookie
删除Cookie
async removeCookie(url: string, name?: string): Promise<void> { const domain = this.extractDomain(url); if (!domain) return; if (name) { const domainCookies = this.cookies.get(domain); if (domainCookies) { domainCookies.delete(name); } } else { this.cookies.delete(...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeCookie 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 : AST...
async removeCookie(url: string, name?: string): Promise<void> { const domain = this.extractDomain(url); if (!domain) return; if (name) { const domainCookies = this.cookies.get(domain); if (domainCookies) { domainCookies.delete(name); } } else { this.cookies.delete(...
https://github.com/DaLongZhuaZi/manxia
8069151970be3243d7b83c4c95c0dd1c001a7c12
github
OHPG/FinSdk
jellyfin/src/main/ets/api/SessionApi.ets
arkts
reportSessionEnded
reportSessionEnded @summary Reports that a session has ended. @throws {RequiredError} @memberof SessionApi
public async reportSessionEnded(): Promise<void> { return this.apiClient.post({path: "/Sessions/Logout"}) }
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 reportSessionEnded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public async reportSessionEnded(): Promise<void> { return this.apiClient.post({path: "/Sessions/Logout"}) }
https://github.com/OHPG/FinSdk
a72c090bfe482e3ee46063cf2845a13a16abc865
github
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerView.ets
arkts
initImageList
初始化剪辑区域图片列表
initImageList() { // 将视频长度分割为一秒一张图片 let videoThumbs: ThumbContent[] = []; for (let i = 0; i < this.mDuration; i = i + CommonConstants.MS_ONE_SECOND) { let temp = new ThumbContent(); if (this.videoTrimmerOption.framePlaceholder) { temp.framePlaceholder = this.videoTrimmerOption.framePl...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initImageList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
initImageList() { // 将视频长度分割为一秒一张图片 let videoThumbs: ThumbContent[] = []; for (let i = 0; i < this.mDuration; i = i + CommonConstants.MS_ONE_SECOND) { let temp = new ThumbContent(); if (this.videoTrimmerOption.framePlaceholder) { temp.framePlaceholder = this.videoTrimmerOption.framePl...
https://github.com/openharmony/applications_app_samples
2e605eefa8b2bea3a18481fce7c8e008dbdce219
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
scope
==================== 查询作用域 ==================== 应用查询作用域 @param scopeName 作用域名称 @returns 当前实例(支持链式调用) @throws ScopeNotFoundError 如果作用域未注册
scope(scopeName: string): QueryBuilder { const scopeRegistry = ScopeRegistry.getInstance() if (!scopeRegistry.hasScope(this.entityName, scopeName)) { throw new ScopeNotFoundError(this.entityName, scopeName) } return scopeRegistry.applyScope(this.entityName, scopeName, this) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left scope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scopeName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Right ...
scope(scopeName: string): QueryBuilder { const scopeRegistry = ScopeRegistry.getInstance() if (!scopeRegistry.hasScope(this.entityName, scopeName)) { throw new ScopeNotFoundError(this.entityName, scopeName) } return scopeRegistry.applyScope(this.entityName, scopeName, this) }
https://github.com/offlinecat-dev/OCNetORM
e42c6c45c9fd490330ade05ed7ca2b36eda95d66
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/model/DigitPanelModel.ets
arkts
getStandLists
getStandLists @return Array<Array<PhysicsButtonInfo>>
getStandLists(): Array<Array<PhysicsButtonInfo>> { return this.standList; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getStandLists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identif...
getStandLists(): Array<Array<PhysicsButtonInfo>> { return this.standList; }
https://gitee.com/openharmony-sig/applications_calculator.git
42eeb50935a025ff7674255987de89613e2e6bdf
gitee
openharmony/applications_print_spooler
entry/src/main/ets/pages/PrintPage.ets
arkts
checkPrinterConnection
打印机状态发生变化时进行处理 @param printerState 打印机状态
checkPrinterConnection(printerState: print.PrinterState) { Log.error(TAG, 'checkPrinterConnection printerState: ' + JSON.stringify(printerState)); if (CheckEmptyUtils.isEmpty(this.printer)) { Log.error(TAG, 'checkPrinterConnection, invalid printer.'); return; } switch (printerState) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkPrinterConnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left printerState AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left...
checkPrinterConnection(printerState: print.PrinterState) { Log.error(TAG, 'checkPrinterConnection printerState: ' + JSON.stringify(printerState)); if (CheckEmptyUtils.isEmpty(this.printer)) { Log.error(TAG, 'checkPrinterConnection, invalid printer.'); return; } switch (printerState) { ...
https://gitee.com/openharmony/applications_print_spooler.git
e718d9b04a8f29aeb6f3171a2d466fc660ee7b5a
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
getHighlightByTouchPoint
Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the Line-, Scatter-, or CandleStick-Chart. @param x @param y @return
public getHighlightByTouchPoint(x: number, y: number): Highlight | null { if (this.mData == null) { LogUtil.error(ChartModel.LOG_TAG + ":Can't select by touch. No data set.") return null; } else { let hghLighter = this.getHighlighter(); if (hghLighter) { return hghLighter.getH...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighlightByTouchPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public getHighlightByTouchPoint(x: number, y: number): Highlight | null { if (this.mData == null) { LogUtil.error(ChartModel.LOG_TAG + ":Can't select by touch. No data set.") return null; } else { let hghLighter = this.getHighlighter(); if (hghLighter) { return hghLighter.getH...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
492b4b56306c033b0051ec59e06718ae8e0f07c6
gitee
openharmony/applications_filepicker
entry/src/main/ets/pages/component/myphone/BreadCrumb.ets
arkts
onDireListUpdated
监听面包屑变化,滚动到指定位置
onDireListUpdated(): void { setTimeout(() => { this.scroller.scrollEdge(Edge.End); }, 10); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDireListUpdated 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_expressi...
onDireListUpdated(): void { setTimeout(() => { this.scroller.scrollEdge(Edge.End); }, 10); }
https://gitee.com/openharmony/applications_filepicker.git
17100f4f14c155d9fd6c94f1129b61f43acaba46
gitee
codelably/HCompass
packages/user/src/main/ets/services/datasource/UserInfoNetworkDataSourceImpl.ets
arkts
getPersonInfo
获取个人信息 @returns {Promise<NetworkResult<User>>} 个人信息
async getPersonInfo(): Promise<NetworkResult<User>> { const httpClient = getContainer().resolve<AxiosHttpClient>(CoreServiceKeys.HttpClient); const rawResponse: Unknown = await httpClient.get<Unknown>("user/info/person"); return new NetworkResult<User>(rawResponse); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPersonInfo 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#generi...
async getPersonInfo(): Promise<NetworkResult<User>> { const httpClient = getContainer().resolve<AxiosHttpClient>(CoreServiceKeys.HttpClient); const rawResponse: Unknown = await httpClient.get<Unknown>("user/info/person"); return new NetworkResult<User>(rawResponse); }
https://github.com/codelably/HCompass
8aa5f37704229922cf5583dca2220081b0b16fcc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
filter
Creates a new Uint8Array from current Uint8Array based on a condition fn. @param fn the condition to apply for each element @returns a new Uint8Array with elements from current Uint8Array that satisfy condition fn
public filter(fn: (val: number, index: int, array: Uint8Array) => boolean): Uint8Array { let markers = new boolean[this.length] let resLen = 0 for (let i = 0; i < this.length; ++i) { markers[i] = fn(this.at(i), i, this) if (markers[i]) { ++resLen ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public filter(fn: (val: number, index: int, array: Uint8Array) => boolean): Uint8Array { let markers = new boolean[this.length] let resLen = 0 for (let i = 0; i < this.length; ++i) { markers[i] = fn(this.at(i), i, this) if (markers[i]) { ++resLen ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
6636247641addebc129d3ad0fdfc3ba498ecaa73
gitee
ibestservices/ibest-ui
library/src/main/ets/components/dateTimePicker/index.ets
arkts
getResult
获取组件结果
getResult() { let result: IBestDateTimePickerResult = { year: this.value[0], month: this.value[1], day: this.value[2], hour: this.value[3], minute: this.value[4], second: this.value[5] } return result }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
getResult() { let result: IBestDateTimePickerResult = { year: this.value[0], month: this.value[1], day: this.value[2], hour: this.value[3], minute: this.value[4], second: this.value[5] } return result }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dateTimePicker/index.ets#L307-L317
e2c395657819ad5e1a1b266444a680a5dff43cb0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets
arkts
validateSources
批量校验书源 @param sourceIds 要校验的书源ID列表 @param config 校验配置(可选) @param onProgress 进度回调 @param autoUpdateGroups 是否自动更新书源分组(默认true) @param showNotification 是否显示通知(默认true)
async validateSources( sourceIds: string[], config?: Partial<ValidationConfig>, onProgress?: ValidationProgressCallback, autoUpdateGroups: boolean = true, showNotification: boolean = true ): Promise<BatchValidationResult> { if (this.isValidating) { throw new Error('正在进行校验,请等待完成'); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left validateSources AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceIds AST#identifier#Righ...
async validateSources( sourceIds: string[], config?: Partial<ValidationConfig>, onProgress?: ValidationProgressCallback, autoUpdateGroups: boolean = true, showNotification: boolean = true ): Promise<BatchValidationResult> { if (this.isValidating) { throw new Error('正在进行校验,请等待完成'); ...
https://github.com/DaLongZhuaZi/manxia
e99c83b748867282661cf56778056bf8f1fa10d0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/SourceContentCache.ets
arkts
append
追加缓存(用于分页加载)
append(sourceId: number, workflowKey: string, newComics: ComicInfo[], newPage: number, hasMore: boolean): void { const cacheKey = this.generateCacheKey(sourceId, workflowKey); const existing = this.cacheMap.get(cacheKey); if (!existing) { logger.warn(TAG, `追加缓存失败,未找到基础缓存: ${cacheKey}`); retur...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left append AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Right ...
append(sourceId: number, workflowKey: string, newComics: ComicInfo[], newPage: number, hasMore: boolean): void { const cacheKey = this.generateCacheKey(sourceId, workflowKey); const existing = this.cacheMap.get(cacheKey); if (!existing) { logger.warn(TAG, `追加缓存失败,未找到基础缓存: ${cacheKey}`); retur...
https://github.com/DaLongZhuaZi/manxia
23a46a60ac9cdb5f7ae469dd42fa8cd329bccbc5
github
erosTeam/NextE
shared/src/main/ets/network/EhErrorClassifier.ets
arkts
scrapeNotice
EH's removed/not-found pages carry a one-sentence `<p>` explanation; surface it verbatim on a 404.
private static scrapeNotice(body: string): string { const m: RegExpMatchArray | null = body.match(/<p>([^<]{4,200})<\/p>/) if (m !== null && m[1] !== undefined) { return m[1].trim() } return '' }
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 scrapeNotice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left body AST#identifier#Right AST#:#Left : ...
private static scrapeNotice(body: string): string { const m: RegExpMatchArray | null = body.match(/<p>([^<]{4,200})<\/p>/) if (m !== null && m[1] !== undefined) { return m[1].trim() } return '' }
https://github.com/erosTeam/NextE
29432482b7da121bd6cd67e47722c6194db97e20
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
convertToCommand
转换为Command
static convertToCommand(resultSet: relationalStore.ResultSet): Command { const command = new Command(); command.commandId = DAOHelper.getStringValue(resultSet, 'command_id'); command.commandType = DAOHelper.getStringValue(resultSet, 'command_type'); command.aggregateType = DAOHelper.getStringValue(res...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_exp...
static convertToCommand(resultSet: relationalStore.ResultSet): Command { const command = new Command(); command.commandId = DAOHelper.getStringValue(resultSet, 'command_id'); command.commandType = DAOHelper.getStringValue(resultSet, 'command_type'); command.aggregateType = DAOHelper.getStringValue(res...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
435d9d5d82150237a6833fccca659146b97ffb65
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
buildGroupInfos
构建分组信息列表
buildGroupInfos(): GroupInfo[] { const existingGroups = this.sourceManager.getAllGroups(); const groupInfos: GroupInfo[] = []; for (const groupName of existingGroups) { const sourcesInGroup = this.allSources.filter(s => { if (!s.group) return false; const groups = s.group.split(...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildGroupInfos AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left GroupInfo AST#id...
buildGroupInfos(): GroupInfo[] { const existingGroups = this.sourceManager.getAllGroups(); const groupInfos: GroupInfo[] = []; for (const groupName of existingGroups) { const sourcesInGroup = this.allSources.filter(s => { if (!s.group) return false; const groups = s.group.split(...
https://github.com/DaLongZhuaZi/manxia
144065051275697209b35621c1e6850cf69c0d68
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/ScraperManager.ets
arkts
quickSearch
==================== 便捷方法 ==================== 快速搜索 - 返回最佳匹配结果
public async quickSearch( keyword: string, contentType?: ScraperContentType ): Promise<ScrapedMetadata | null> { const result = await this.searchMultipleSources(keyword, contentType); if (result.success && result.mergedResults.length > 0) { return result.mergedResults[0]; } r...
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 quickSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
public async quickSearch( keyword: string, contentType?: ScraperContentType ): Promise<ScrapedMetadata | null> { const result = await this.searchMultipleSources(keyword, contentType); if (result.success && result.mergedResults.length > 0) { return result.mergedResults[0]; } r...
https://github.com/DaLongZhuaZi/manxia
976f98f91c6c63e472303a32994d8e1c37c4fd64
github
CLMC2025/Vignette
entry/src/main/ets/context/TemplateManager.ets
arkts
getAvailableStyles
获取所有可用风格
getAvailableStyles(): ContextStyle[] { const styles: ContextStyle[] = [ ContextStyle.RANDOM, ContextStyle.CONVERSATIONAL, ContextStyle.FORMAL, ContextStyle.HUMOROUS, ContextStyle.NARRATIVE, ContextStyle.TECHNICAL ]; return styles; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAvailableStyles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left ContextStyle ...
getAvailableStyles(): ContextStyle[] { const styles: ContextStyle[] = [ ContextStyle.RANDOM, ContextStyle.CONVERSATIONAL, ContextStyle.FORMAL, ContextStyle.HUMOROUS, ContextStyle.NARRATIVE, ContextStyle.TECHNICAL ]; return styles; }
https://github.com/CLMC2025/Vignette
667eb1791c6fc8a0ab06edfc806499427bfc748e
github
openharmony/applications_mms
entry/src/main/ets/utils/MmsPreferences.ets
arkts
getValueFromMap
Get value from map by key @param key @param defaultValue
public getValueFromMap(key: string, defaultValue: string | number | boolean): string | number | boolean { let value = MmsPreferences.sMap.get(key); if (value == null) { value = defaultValue; } return value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueFromMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
public getValueFromMap(key: string, defaultValue: string | number | boolean): string | number | boolean { let value = MmsPreferences.sMap.get(key); if (value == null) { value = defaultValue; } return value; }
https://gitee.com/openharmony/applications_mms.git
ffb76b64ea7aee9f29076f3dc6fb4eaaed2e7d7c
gitee
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/select/picker/components/BasicStylePicker.ets
arkts
format12HourTime
Formats a Date object into 12-hour time string with AM/PM indicator. Follows the principle of minimal scope - all variables are declared with the narrowest scope necessary. @param {Date} date - The Date object to format @returns {string} Formatted time string in "AM/PM HH:MM" format (e.g., "PM 03:45")
function format12HourTime(ctx: Context | undefined, date: Date): string { let hours = date.getHours(); // Get hours in 24-hour format (0-23) let minutes = date.getMinutes(); // Get minutes (0-59) // Determine AM/PM period based on hour value const ampm = hours >= 12 ? $r('app.string.pm_label') : $r('app.string...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left format12HourTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function format12HourTime(ctx: Context | undefined, date: Date): string { let hours = date.getHours(); // Get hours in 24-hour format (0-23) let minutes = date.getMinutes(); // Get minutes (0-59) // Determine AM/PM period based on hour value const ampm = hours >= 12 ? $r('app.string.pm_label') : $r('app.string...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
a4f499bc9cb804ee8847a74633450599021da48f
gitcode
yongoe1024/RdbPlus
rdbplus/src/main/ets/BaseMapper.ets
arkts
getOne
查询第一个数据 @param wrapper 查询条件 @returns 实体类的数组
async getOne(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<T | undefined> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.getOne(myWrapp...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getOne AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left wrapper AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async getOne(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<T | undefined> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.getOne(myWrapp...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L185-L209
a7f50e90a2e42825b8119e2cb8084d2868ec0096
github
chendi126/harmonyOS-TCP
entry/src/main/ets/common/GlassStyles.ets
arkts
getShadowColor
获取阴影色
static getShadowColor(): string { return GlassColors.SHADOW; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getShadowColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#...
static getShadowColor(): string { return GlassColors.SHADOW; }
https://github.com/chendi126/harmonyOS-TCP
2697892e585a10c11095e47b6efbb801d82e1f22
github
openharmony/applications_mms
entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets
arkts
clickDiv
Click the corresponding option in the dialog box for automatically downloading MMs.
clickDiv(idx) { this.autoRetrieveMmsSwitch = idx + common.string.EMPTY_STR; this.returnAutoRetrieveMmsResultInText(idx); // this.$element('auto-retrieve-mms-dialog').close(); this.autoHandleAutoRetrieveMmsValueChange(this.autoRetrieveMmsSwitch); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickDiv AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left idx AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_...
clickDiv(idx) { this.autoRetrieveMmsSwitch = idx + common.string.EMPTY_STR; this.returnAutoRetrieveMmsResultInText(idx); // this.$element('auto-retrieve-mms-dialog').close(); this.autoHandleAutoRetrieveMmsValueChange(this.autoRetrieveMmsSwitch); }
https://gitee.com/openharmony/applications_mms.git
11510c99005fa02d86c9efa898eb9ca2fafdaa5c
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
dateString
Returns a string representation
private dateString(): String { if (!this.isDateValid()) { throw new Error("Invalid Date"); } let sb = new StringBuilder(); sb.append(dayNames[this.getDay()]); sb.append(" "); sb.append(monthNames[this.getMonth()]); sb.append(" "); let d = ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dateString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String A...
private dateString(): String { if (!this.isDateValid()) { throw new Error("Invalid Date"); } let sb = new StringBuilder(); sb.append(dayNames[this.getDay()]); sb.append(" "); sb.append(monthNames[this.getMonth()]); sb.append(" "); let d = ...
https://gitcode.com/iop123123/arkts-static-skills
6a50a1b3844e900f8e16ad1781b237a7a8c2d14c
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
getDirection
获取方向向量 @param from 起点 @param to 终点
private getDirection(from: Position3D, to: Position3D): Position3D { const distance = this.getDistance(from, to); if (distance === 0) return { x: 0, y: 0, z: 0 }; return { x: (to.x - from.x) / distance, y: (to.y - from.y) / distance, z: (to.z - from.z) / distance }; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
private getDirection(from: Position3D, to: Position3D): Position3D { const distance = this.getDistance(from, to); if (distance === 0) return { x: 0, y: 0, z: 0 }; return { x: (to.x - from.x) / distance, y: (to.y - from.y) / distance, z: (to.z - from.z) / distance }; }
https://github.com/LJ666-ui/harmony-health-care
4589528d4635b6e5d804cf667bbb99360257cbfb
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/Windows11Config.ets
arkts
setupUEFIVars
创建 UEFI 变量文件 调用 Native 层实现
static async setupUEFIVars(vmName: string): Promise<UEFISetupResult> { console.log(`[Windows11Config] 为虚拟机 ${vmName} 设置 UEFI 变量`); try { // 调用 Native 层创建 UEFI 变量文件 const result: UEFISetupResult = qemu.setupUefi(vmName); if (result.success) { console.log(`[Windows11Config]...
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 setupUEFIVars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : A...
static async setupUEFIVars(vmName: string): Promise<UEFISetupResult> { console.log(`[Windows11Config] 为虚拟机 ${vmName} 设置 UEFI 变量`); try { // 调用 Native 层创建 UEFI 变量文件 const result: UEFISetupResult = qemu.setupUefi(vmName); if (result.success) { console.log(`[Windows11Config]...
https://github.com/AetheriumSimulator/qemu-hmos
6e5528339da652d0000b4d7ac8ff21da07bf2ee3
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/BackgroundStreamService.ets
arkts
stop
停止后台保活 在串流断开后调用
async stop(): Promise<void> { if (!this.isRunning) { return; } console.info(`${TAG} 正在停止后台保活...`); await this.cleanup(); this.isRunning = false; console.info(`${TAG} 后台保活已停止`); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left stop 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...
async stop(): Promise<void> { if (!this.isRunning) { return; } console.info(`${TAG} 正在停止后台保活...`); await this.cleanup(); this.isRunning = false; console.info(`${TAG} 后台保活已停止`); }
https://github.com/AlkaidLab/moonlight-harmony
063e6aca85b1d5733faccbe1d38d9acea8e013bf
github
rg2304luyue/ToDoList
entry/src/main/ets/pages/ToDoListPage.ets
arkts
sortTasks
核心排序算法:完成的排序在前 (isComplete 为 true 优先)
sortTasks() { this.totalTasks.sort((a, b) => { if (a.isComplete && !b.isComplete) return -1; if (!a.isComplete && b.isComplete) return 1; return 0; }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sortTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
sortTasks() { this.totalTasks.sort((a, b) => { if (a.isComplete && !b.isComplete) return -1; if (!a.isComplete && b.isComplete) return 1; return 0; }); }
https://github.com/rg2304luyue/ToDoList
58523f02e12d924c7620507e4a198a7063b564b4
github
erosTeam/NextE
shared/src/main/ets/settings/SearchHistorySettings.ets
arkts
add
Record a query: dedup (move-to-front), cap to MAX_HISTORY, persist. No-op for blank input.
static async add(context: common.UIAbilityContext, query: string): Promise<void> { const q: string = query.trim() if (q.length === 0) { return } const state = connectSearchHistory() const next: string[] = [q] state.items.forEach((item: string) => { if (item !== q && next.length < M...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Righ...
static async add(context: common.UIAbilityContext, query: string): Promise<void> { const q: string = query.trim() if (q.length === 0) { return } const state = connectSearchHistory() const next: string[] = [q] state.items.forEach((item: string) => { if (item !== q && next.length < M...
https://github.com/erosTeam/NextE
b917fa69331e29eacec19bd11d61737b9af8cbe6
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/calendar/TnCalendar.ets
arkts
getWeekLabelColor
获取星期标题颜色 @param index 星期索引(0=周日, 6=周六) @returns 文字颜色
private getWeekLabelColor(index: number): ResourceColor { if (this.showWeekendColor && (index === 0 || index === 6)) { return $r("app.color.tn_color_danger"); } return $r("app.color.tn_text_color_secondary"); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getWeekLabelColor 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...
private getWeekLabelColor(index: number): ResourceColor { if (this.showWeekendColor && (index === 0 || index === 6)) { return $r("app.color.tn_color_danger"); } return $r("app.color.tn_text_color_secondary"); }
https://github.com/codelably/tuniao-ui
d993a18e53a4a0171d8c180e12727b17c9ce0a5b
github