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
LZZLHY/hlib
entry/src/main/ets/viewmodel/SpeedTestVM.ets
arkts
isCacheFresh
缓存是否在 TTL 有效期内。
static isCacheFresh(): boolean { const ts: number = SpeedTestVM.getLastTs(); return ts > 0 && (Date.now() - ts) < RESULTS_TTL_MS; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isCacheFresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#...
static isCacheFresh(): boolean { const ts: number = SpeedTestVM.getLastTs(); return ts > 0 && (Date.now() - ts) < RESULTS_TTL_MS; }
https://github.com/LZZLHY/hlib
634135d949498856db4b367de226c430ec3bfbd1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
getLibraryMangas
获取库中的漫画列表(不推荐用于大型库) @deprecated 使用 getLibraryMangasPaginated 代替
public async getLibraryMangas(): Promise<ComicInfo[]> { const result = await this.getLibraryMangasPaginated(-1, 0, 100); return result.items; }
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 getLibraryMangas AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async getLibraryMangas(): Promise<ComicInfo[]> { const result = await this.getLibraryMangasPaginated(-1, 0, 100); return result.items; }
https://github.com/DaLongZhuaZi/manxia
5f6b7cb0e8cc9fe81829513d1d48af97b3df09a5
github
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/common/utils/DataTransformUtil.ets
arkts
stringToUint8Array
Convert a character string to a uint8Array byte stream. @param content to be converted. @returns Uint8Array data.
stringToUint8Array(content: string): Uint8Array { let arr: number[] = []; for (let i = 0, j = content.length; i < j; ++i) { arr.push(content.charCodeAt(i)); } return new Uint8Array(arr); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stringToUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A...
stringToUint8Array(content: string): Uint8Array { let arr: number[] = []; for (let i = 0, j = content.length; i < j; ++i) { arr.push(content.charCodeAt(i)); } return new Uint8Array(arr); }
https://gitee.com/openharmony/codelabs.git
5a017bf30451c06c4574a9d074e6b5abc55d69c4
gitee
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createBackKey
============ 便捷方法 ============ 发送Back键 (使用 BACK_OR_SCREEN_ON)
static createBackKey(): ArrayBuffer { return ControlPacket.createBackOrScreenOn(KeyAction.ACTION_DOWN); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createBackKey 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 ArrayBuf...
static createBackKey(): ArrayBuffer { return ControlPacket.createBackOrScreenOn(KeyAction.ACTION_DOWN); }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
3c4f5db343147ae52d4d7ecc8175392c6696d3cd
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineBridge.ets
arkts
createSurfaceManager
MARK: - C++ ISurfaceManager Factory Creates a C++ ISurfaceManager instance and returns its instanceId.
createSurfaceManager(): number { return nativeCreateSurfaceManager(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createSurfaceManager 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#s...
createSurfaceManager(): number { return nativeCreateSurfaceManager(); }
https://github.com/AGenUI/AGenUI
353a8b1dcc8f604744e36aeab325e615e8ff038b
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnFormViewModel.ets
arkts
setBasicName
==================== 基础表单操作 ==================== 设置基础表单姓名 @param value 姓名值
setBasicName(value: string): void { this.basicForm.name = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBasicName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A...
setBasicName(value: string): void { this.basicForm.name = value; }
https://github.com/codelably/tuniao-ui
11876a88bfedf2bd48510f0ee765a3d63daf2a83
github
apap6628114/nga_oh
entry/src/main/ets/store/SettingsStore.ets
arkts
addKeyword
--- Filter Keywords ---
addKeyword(keyword: string): void { this.filterKeywordSettings.addKeyword(keyword) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addKeyword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig...
addKeyword(keyword: string): void { this.filterKeywordSettings.addKeyword(keyword) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L164-L164
f7e0e1ab635e9a866cb55c1fc3467a0d2d5792df
github
PollenWang6/HiXD
entry/src/main/ets/services/DormWaterService.ets
arkts
isLoggedIn
===== 是否已登录 =====
isLoggedIn(): boolean { return PreferenceUtil.getString('dorm_water_token').length > 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLoggedIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statemen...
isLoggedIn(): boolean { return PreferenceUtil.getString('dorm_water_token').length > 0; }
https://github.com/PollenWang6/HiXD
6dfee9cea12fb431e25f707f74aebb67722bcf9a
github
midori52000/ArkPilot
Agent/entry/src/main/ets/backend/ProviderConfigStore.ets
arkts
parseModelsCacheJson
── models cache JSON ──
function parseModelsCacheJson(content: string): ModelsCache | null { if (content.length === 0) return null; try { const raw: ModelsCacheJsonRaw = JSON.parse(content) as ModelsCacheJsonRaw; const models: ModelsCacheEntry[] = []; if (raw.models !== undefined && raw.models !== null) { for (let i = 0;...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseModelsCacheJson AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function parseModelsCacheJson(content: string): ModelsCache | null { if (content.length === 0) return null; try { const raw: ModelsCacheJsonRaw = JSON.parse(content) as ModelsCacheJsonRaw; const models: ModelsCacheEntry[] = []; if (raw.models !== undefined && raw.models !== null) { for (let i = 0;...
https://github.com/midori52000/ArkPilot
d6ba04f932deff6867f7421e1b4ac77cb8ff9f05
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets
arkts
animateFrame
动画帧更新
private animateFrame(onComplete?: () => void): void { if (!this.isAnimating) { return; } const elapsed = Date.now() - this.animationStartTime; const progress = Math.min(elapsed / this.config.duration, 1.0); // 使用缓动曲线计算进度 const easedProgress = this.applyCurve(progress); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left animateFrame AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left onComplete AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#argu...
private animateFrame(onComplete?: () => void): void { if (!this.isAnimating) { return; } const elapsed = Date.now() - this.animationStartTime; const progress = Math.min(elapsed / this.config.duration, 1.0); // 使用缓动曲线计算进度 const easedProgress = this.applyCurve(progress); ...
https://github.com/DaLongZhuaZi/manxia
c7bef43161852b3fef7ab312fc4095d1868ee6b6
github
erosTeam/NextE
shared/src/main/ets/settings/AccountListSettings.ets
arkts
remove
Remove a saved account; returns the remaining member ids (saved order).
static async remove(context: common.UIAbilityContext, memberId: string): Promise<string[]> { const remaining: string[] = [] try { const store: preferences.Preferences = await preferences.getPreferences( context, StorageKeys.STORE_SETTINGS, ) const records: AccountRecord[] = A...
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 remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#R...
static async remove(context: common.UIAbilityContext, memberId: string): Promise<string[]> { const remaining: string[] = [] try { const store: preferences.Preferences = await preferences.getPreferences( context, StorageKeys.STORE_SETTINGS, ) const records: AccountRecord[] = A...
https://github.com/erosTeam/NextE
e338b6484eda7b5b559acfde5718c1e09a85c50b
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 Float32Array that satisfies the condition @param { function } fn - condition @returns { float } - 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: Float32Array) => boolean): float { 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("Float32...
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: Float32Array) => boolean): float { 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("Float32...
https://gitcode.com/iop123123/arkts-static-skills
eda35128460bb3969a7bdf3ecd837b244043d4dd
gitcode
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/MusicDbApi.ets
arkts
rowToTabApiDto
Maps a category-tab feed row to {@link TabApiDto} with defaults for missing fields.
private rowToTabApiDto(feedRow: RecommendFeedRow): TabApiDto { const dto = new TabApiDto(); dto.title = feedRow.tabTitle ?? $r('app.string.page_show'); dto.iconSelected = feedRow.tabIconSelected ?? $r('app.media.ic_home_chip_featured_sel'); dto.iconUnselected = feedRow.tabIconUnselected ?? $r('app.med...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rowToTabApiDto AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left feedRow AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private rowToTabApiDto(feedRow: RecommendFeedRow): TabApiDto { const dto = new TabApiDto(); dto.title = feedRow.tabTitle ?? $r('app.string.page_show'); dto.iconSelected = feedRow.tabIconSelected ?? $r('app.media.ic_home_chip_featured_sel'); dto.iconUnselected = feedRow.tabIconUnselected ?? $r('app.med...
https://gitcode.com/HarmonyOS_Samples/MusicHome
3adf70493ddabc6a5259e99d4ddad9768d26a369
gitcode
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicPlayerService.ets
arkts
getCurrentInfo
获取当前播放信息
getCurrentInfo(): CurrentPlayInfo { const info: CurrentPlayInfo = { musicInfo: this.currentMusicInfo, source: this.currentSource, quality: this.currentQuality, }; return info; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentInfo 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 CurrentPlayInfo AST#identifier#Right AST#ERROR#...
getCurrentInfo(): CurrentPlayInfo { const info: CurrentPlayInfo = { musicInfo: this.currentMusicInfo, source: this.currentSource, quality: this.currentQuality, }; return info; }
https://github.com/cpdd5201314/harmonyOS-music-app
714d6f99e7bdea01769902d4c114ff5c2f4f0435
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/UserThemeConfig.ets
arkts
setEffects
设置特效配置
public async setEffects(effects: Partial<EffectsConfig>): Promise<void> { this.currentProfile.effects = mergeEffects(this.currentProfile.effects, effects); await this.saveCurrentProfile(); this.notifyChange(); }
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 setEffects AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left effects AST#identifier#Right AST#:#Left : AST...
public async setEffects(effects: Partial<EffectsConfig>): Promise<void> { this.currentProfile.effects = mergeEffects(this.currentProfile.effects, effects); await this.saveCurrentProfile(); this.notifyChange(); }
https://github.com/DaLongZhuaZi/manxia
ddc06400fe1b6b15d2c07be884e7dec9b75de011
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/02.assignment_contexts/array_primitive.ets
arkts
main
--- desc: Assignment contexts does not allow the assignment for arrays if one has elements of a primitive types params: Assignment from '{{case.src_type}}' to '{{case.dst_type}}' tags: - negative - compile-only ---
function main(): void { let src_{{loop.index}}: {{case.src_type}}[] = new {{case.src_type}}[1]; let dst_{{loop.index}}: {{case.dst_type}}[] = new {{case.dst_type}}[1]; dst_{{loop.index}} = src_{{loop.index}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let src_{{loop.index}}: {{case.src_type}}[] = new {{case.src_type}}[1]; let dst_{{loop.index}}: {{case.dst_type}}[] = new {{case.dst_type}}[1]; dst_{{loop.index}} = src_{{loop.index}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
600dc4000f4e31ad64610aae2bf74c161f986826
gitee
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsSubscriber.ets
arkts
getInstance
获取 AlertsSubscriber 的单例
public static getInstance() { if (!AlertsSubscriber.sInstance) { Log.log(TAG, 'call getInstance init'); AlertsSubscriber.sInstance = new AlertsSubscriber(); } return AlertsSubscriber.sInstance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR...
public static getInstance() { if (!AlertsSubscriber.sInstance) { Log.log(TAG, 'call getInstance init'); AlertsSubscriber.sInstance = new AlertsSubscriber(); } return AlertsSubscriber.sInstance; }
https://gitee.com/openharmony/applications_calendar_data.git
bc14e318cfcd420d0a035ea9f1bdf19522269b45
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseDataSet.ets
arkts
setColorsByArr
Sets the colors that should be used fore this DataSet. Colors are reused as soon as the number of Entries the DataSet represents is higher than the size of the colors array. You can use "new int[] { R.color.red, R.color.green, ... }" to provide colors for this method. Internally, the colors are resolved using getResour...
public setColorsByArr(colors: number[]): void { if (this.mColors == null) { this.mColors = new JArrayList <Number>(); } this.mColors.clear(); for (let color of colors) { this.mColors.add(color); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setColorsByArr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
public setColorsByArr(colors: number[]): void { if (this.mColors == null) { this.mColors = new JArrayList <Number>(); } this.mColors.clear(); for (let color of colors) { this.mColors.add(color); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
18fd5dddca18c398a0410a4d47c43dfac881c25f
gitee
openharmony/distributedhardware_distributed_camera
test/hapAppDcameraSample/entry/src/main/ets/recorder/AudioRecorder.ets
arkts
getRecordTime
show recording time
getRecordTime(): void { this.timer = setInterval(() => { this.seconds += 1; this.audioRecorderTimeText = dateTime(this.seconds); }, 1000) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRecordTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
getRecordTime(): void { this.timer = setInterval(() => { this.seconds += 1; this.audioRecorderTimeText = dateTime(this.seconds); }, 1000) }
https://gitee.com/openharmony/distributedhardware_distributed_camera.git
826c8689661c4344d1f12ec1ff18bdc917d8573e
gitee
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
playAchievementUnlock
播放成就解锁音效
static playAchievementUnlock(): void { AudioManager.getInstance().playSound(SoundType.ACHIEVEMENT_UNLOCK); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left playAchievementUnlock 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#...
static playAchievementUnlock(): void { AudioManager.getInstance().playSound(SoundType.ACHIEVEMENT_UNLOCK); }
https://github.com/the-wwyang/kids-learning-app
151054304044acdbe772ba2f0e689f3fab765d76
github
erosTeam/NextE
shared/src/main/ets/components/GalleryCard.ets
arkts
<arrow>
Key carries tagSig.version: the keyGen runs during build, so reading it subscribes the card; when My Tags load and bump it, the keys change → chips rebuild → re-color.
(t: SimpleTag, index: number) => `tag_${this.tagSig.version}_${index}_${this.safeForEachKeyPart(t.namespace)}_${this.safeForEachKeyPart(t.text)}`,
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left t AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left SimpleTag AST#type_identifier#Right AST#type_annotation#Right AST#...
(t: SimpleTag, index: number) => `tag_${this.tagSig.version}_${index}_${this.safeForEachKeyPart(t.namespace)}_${this.safeForEachKeyPart(t.text)}`,
https://github.com/erosTeam/NextE
84430801683a46f679489b89e3ce1df6fb34803f
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/util/ComponentRectFUtil.ets
arkts
componentGlobalRect
获取组件的相对于屏幕左上角的px坐标 @param id 组件id @returns 组件的矩形区域
public static componentGlobalRect(id: string): RectF | null { if (!id) { return null; } let strJson = getInspectorByKey(id); if (strJson) { let obj: Record<string, Object> = JSON.parse(strJson); let componentRectInfo: Record<string, Object> = JSON.parse('[' + obj.$rect + ']'); ...
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 componentGlobalRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left ...
public static componentGlobalRect(id: string): RectF | null { if (!id) { return null; } let strJson = getInspectorByKey(id); if (strJson) { let obj: Record<string, Object> = JSON.parse(strJson); let componentRectInfo: Record<string, Object> = JSON.parse('[' + obj.$rect + ']'); ...
https://github.com/wuba/omni-ui
0470d66744bdb7c8050caba8fe6497ea5770a14d
github
genjishare/snake-game
entry/src/main/ets/common/service/GameStateManager.ets
arkts
createGameData
创建GameData对象 将当前游戏状态转换为GameData对象供接续使用
public createGameData(): GameData | null { if (!this.currentGameState) { return null; } return new GameData(this.currentGameState); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createGameData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left ...
public createGameData(): GameData | null { if (!this.currentGameState) { return null; } return new GameData(this.currentGameState); }
https://github.com/genjishare/snake-game
601b42ff5b31514d5655d277222b81b8e46cd925
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
setAppFont
设置APP界面字体
async setAppFont(fontType: FontType, fontId: string, uiContext?: UIContext | null): Promise<void> { if (fontType === FontType.CUSTOM) { await this.ensureCustomFontRegistered(fontId, FontScene.APP_UI, uiContext); } this.settings.appFontType = fontType; if (fontType === FontType.SYSTEM) { th...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setAppFont AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fontType AST#identifier#Right AST#...
async setAppFont(fontType: FontType, fontId: string, uiContext?: UIContext | null): Promise<void> { if (fontType === FontType.CUSTOM) { await this.ensureCustomFontRegistered(fontId, FontScene.APP_UI, uiContext); } this.settings.appFontType = fontType; if (fontType === FontType.SYSTEM) { th...
https://github.com/DaLongZhuaZi/manxia
5470824a58d8636beca9f6849c5c765688286009
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/InteractionManager.ets
arkts
getAllIntensities
获取所有强度列表
public static getAllIntensities(): VibrationIntensity[] { return [ VibrationIntensity.LEVEL_1, VibrationIntensity.LEVEL_2, VibrationIntensity.LEVEL_3, VibrationIntensity.LEVEL_4, VibrationIntensity.LEVEL_5, ]; }
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 getAllIntensities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public static getAllIntensities(): VibrationIntensity[] { return [ VibrationIntensity.LEVEL_1, VibrationIntensity.LEVEL_2, VibrationIntensity.LEVEL_3, VibrationIntensity.LEVEL_4, VibrationIntensity.LEVEL_5, ]; }
https://github.com/DaLongZhuaZi/manxia
3ef49a54db5e7c78b7345a91081fbec063b98b38
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets
arkts
remove
从缓存移除指定项
public remove(pageId: string): void { const item = this.cache.get(pageId); if (item) { try { item.pixelMap.release(); } catch (e) { logger.warn(TAG, `释放PixelMap失败: ${pageId}`); } this.currentCacheSize -= item.size; this.cache.delete(pageId); logger.debug(TAG...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
public remove(pageId: string): void { const item = this.cache.get(pageId); if (item) { try { item.pixelMap.release(); } catch (e) { logger.warn(TAG, `释放PixelMap失败: ${pageId}`); } this.currentCacheSize -= item.size; this.cache.delete(pageId); logger.debug(TAG...
https://github.com/DaLongZhuaZi/manxia
3ffea1feb8044df710f5ab6c20efa337c66dc423
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypedEntityData.ets
arkts
setValue
设置属性值(通用方法,自动触发 UI 刷新) @param key 属性名 @param value 属性值
setValue(key: string, value: ValueType): void { this.data.set(key, value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R...
setValue(key: string, value: ValueType): void { this.data.set(key, value) }
https://github.com/offlinecat-dev/OCNetORM
1b1641f293c5b0b8cde32b5d60d848b3935148f1
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SmartCategoryDAO.ets
arkts
softDelete
软删除训练记录
static async softDelete(recordId: number): Promise<void> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_deleted: 1, updated_at: new Date().toISOString() }; const predicates = new relationalStore.RdbPredicates(SmartCat...
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 softDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
static async softDelete(recordId: number): Promise<void> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_deleted: 1, updated_at: new Date().toISOString() }; const predicates = new relationalStore.RdbPredicates(SmartCat...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b987c93bd84ff5445441298d4d7743280c67f91e
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/ContactEditPage.ets
arkts
getPageTitle
获取页面标题
getPageTitle(): string { return this.isAddMode() ? '添加联系人' : '编辑联系人'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPageTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement...
getPageTitle(): string { return this.isAddMode() ? '添加联系人' : '编辑联系人'; }
https://gitcode.com/openharmony/codelabs
1eb11bf67c12ce1950fbcebf2d7a3186679cd8d0
gitcode
Tianpei-Shi/MusicDash
src/services/CloudDBService.ets
arkts
getUserById
根据ID获取用户信息
async getUserById(userId: number): Promise<CloudDBZoneObject | null> { try { // 模拟从云数据库获取用户数据 console.log(`获取用户数据,ID: ${userId}`); const userData: CloudDBZoneObject = { id: userId, username: `用户${userId}`, password: "password", like: "周杰伦,林俊杰", history: "稻...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async getUserById(userId: number): Promise<CloudDBZoneObject | null> { try { // 模拟从云数据库获取用户数据 console.log(`获取用户数据,ID: ${userId}`); const userData: CloudDBZoneObject = { id: userId, username: `用户${userId}`, password: "password", like: "周杰伦,林俊杰", history: "稻...
https://github.com/Tianpei-Shi/MusicDash
1bac740047bafdcb8a0b04d94254b9ba434ce6f0
github
LongLiveY96/chatcube
entry/src/main/ets/services/ToolRegistry.ets
arkts
getAllToolConfigs
获取所有已注册工具的配置(用于 UI 显示)
getAllToolConfigs(): ToolConfig[] { const configs: ToolConfig[] = [] this.tools.forEach((tool) => { configs.push(tool.config) }) return configs }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllToolConfigs 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 ToolConfig AST#identifier#Rig...
getAllToolConfigs(): ToolConfig[] { const configs: ToolConfig[] = [] this.tools.forEach((tool) => { configs.push(tool.config) }) return configs }
https://github.com/LongLiveY96/chatcube
c6b9d1d346fdfad224f097b8f66979cd027f031e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
constructor
`Date` constructor. @param year @param month @param day @param hours @param minutes @see ECMA-262, 21.4.2.1
constructor(year: double, month: double, day: double, hours: double, minutes: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, 0.0, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
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 year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right A...
constructor(year: double, month: double, day: double, hours: double, minutes: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, 0.0, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2fd32cad821f9f825d6c0a1cc88fe5e540da24e8
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/ImageProcessing/JinmantiantangDescrambler.ets
arkts
extractImageInfo
从URL提取章节ID和图片索引
static extractImageInfo(url: string): ImageInfo | null { try { // URL格式: https://cdn.xxx.com/media/photos/123456/00001.jpg const match = url.match(/\/photos\/(\d+)\/(\d+)\./); if (match !== null && match.length >= 3) { const result: ImageInfo = { aid: parseInt(match[1]), ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractImageInfo 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 ...
static extractImageInfo(url: string): ImageInfo | null { try { // URL格式: https://cdn.xxx.com/media/photos/123456/00001.jpg const match = url.match(/\/photos\/(\d+)\/(\d+)\./); if (match !== null && match.length >= 3) { const result: ImageInfo = { aid: parseInt(match[1]), ...
https://github.com/DaLongZhuaZi/manxia
3197c2df86922278b9a8b2edd721c63f90585bde
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/view/AddressListPage.ets
arkts
build
构建地址列表页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.address_list_title"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { ColumnStart({...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.address_list_title"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { ColumnStart({...
https://github.com/Joker-x-dev/CoolMallArkTS
ea82538624ddef6f65a47eb6e1979ab3d90d936b
github
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/batchselectcontacts/BatchSelectContactsPresenter.ets
arkts
checkIfNeedCount
Determines whether the current contact element has an option. @param {Object} contact @return {boolean} true,false
checkIfNeedCount(contact:ContactVo):boolean{ if (contact.phoneNumbers.length > 0) { for (let index = 0; index < contact.phoneNumbers.length; index++) { const element = contact.phoneNumbers[index]; if (element.checked) { return true; } } } else { return false...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkIfNeedCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contact AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactVo AST#identifier#Right AST#)...
checkIfNeedCount(contact:ContactVo):boolean{ if (contact.phoneNumbers.length > 0) { for (let index = 0; index < contact.phoneNumbers.length; index++) { const element = contact.phoneNumbers[index]; if (element.checked) { return true; } } } else { return false...
https://gitee.com/openharmony/applications_contacts.git
80f9c17f8026dd108653699db00022f97f9cd7fb
gitee
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets
arkts
aesDecrypt
AES decryption.
aesDecrypt() { AesUtil.decrypt(this.userList[0]?.password, this.userList[0]?.authTag).then((data) => { this.decryptPassword = data; this.login(); }).catch((err: Error) => { Logger.error(`AesDecrypt err cause ${JSON.stringify(err)}`); PromptUtil.promptMessage($r('app.string.message_sys_...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aesDecrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
aesDecrypt() { AesUtil.decrypt(this.userList[0]?.password, this.userList[0]?.authTag).then((data) => { this.decryptPassword = data; this.login(); }).catch((err: Error) => { Logger.error(`AesDecrypt err cause ${JSON.stringify(err)}`); PromptUtil.promptMessage($r('app.string.message_sys_...
https://gitee.com/openharmony/codelabs.git
41b296cd63ec7be97f726dfecef793fbcabd9a41
gitee
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/PreferReadonlyParametertypes/ets/defaultError.ets
arkts
array4
tuple is not readonly
function array4(arg: readonly [string[], number]) {} // tuple element is not readonly
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left array4 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function array4(arg: readonly [string[], number]) {} // tuple element is not readonly
https://github.com/SMAT-Lab/Homecheck-Sec2026
75480464f04ca99dbcf5a8cd112da74931d18fdb
github
mybricks/comlib-harmony-normal
packages/rt-arkts/comlib/src/main/ets/_AudioPlayer.ets
arkts
stopAndReset
目前不需要销毁,不调用
private async stopAndReset() { if (['prepared', 'playing', 'paused', 'completed'].includes(this.avPlayer!.state)) { await this.avPlayer!.stop(); } if (['initialized', 'playing', 'paused', 'completed', 'stopped', 'error'].includes(this.avPlayer!.state)) { await this.avPlayer!.reset(); } }
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 stopAndReset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async stopAndReset() { if (['prepared', 'playing', 'paused', 'completed'].includes(this.avPlayer!.state)) { await this.avPlayer!.stop(); } if (['initialized', 'playing', 'paused', 'completed', 'stopped', 'error'].includes(this.avPlayer!.state)) { await this.avPlayer!.reset(); } }
https://github.com/mybricks/comlib-harmony-normal
26f48adedddc818496187ed3de47210ab65ec23f
github
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/StateManagement/entry/src/main/ets/segment/segment8.ets
arkts
getUserData
[Start Case5] Getting user information in a business class
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { //1.Separate storage of user collection information data in AppStorage AppStorage.setOrCreate('collectedIds', data.collectedIds); AppStorage.setOrCreate('userData', data); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#...
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { //1.Separate storage of user collection information data in AppStorage AppStorage.setOrCreate('collectedIds', data.collectedIds); AppStorage.setOrCreate('userData', data); }) }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
d9a06531723161d1d954cfe765bdabdf3a511df2
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getDarkModeGlassRadius
获取深色玻璃圆角半径(与浅色保持一致)
public getDarkModeGlassRadius(): number { return this.getGlassRadiusForLevel(GlassLevel.CARD); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDarkModeGlassRadius 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 num...
public getDarkModeGlassRadius(): number { return this.getGlassRadiusForLevel(GlassLevel.CARD); }
https://github.com/DaLongZhuaZi/manxia
d9247964774e2cf762802cc4de59eaf58d692905
github
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets
arkts
nativeOnPause
Pause engine loop.
public static nativeOnPause(): void { tuanjie.nativeOnPause(); }
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 nativeOnPause AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public static nativeOnPause(): void { tuanjie.nativeOnPause(); }
https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
3da99d98739b652d8f2439aa0ede04a5112788dd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CacheConfigManager.ets
arkts
updatePreloadConfig
更新预加载配置
public async updatePreloadConfig(config: PreloadConfig): Promise<void> { const newConfig = this.cloneConfig(this.config); newConfig.preload = this.mergePreload(this.config.preload, config); await this.updateConfig(newConfig); }
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 updatePreloadConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Le...
public async updatePreloadConfig(config: PreloadConfig): Promise<void> { const newConfig = this.cloneConfig(this.config); newConfig.preload = this.mergePreload(this.config.preload, config); await this.updateConfig(newConfig); }
https://github.com/DaLongZhuaZi/manxia
f461fb395d781935a74fc7109e9acd1cec9c3a10
github
LZZLHY/hlib
entry/src/main/ets/api/ZLibraryClient.ets
arkts
similar
相似书籍。
async similar(bookId: number | string, hashId: string): Promise<Book[]> { const json = await this.http.get<BooksEnvelope>(`/eapi/book/${bookId}/${hashId}/similar`); ZLibraryClient.assertOk(json); return Book.fromJsonList(json.books as object[]); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left similar AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async similar(bookId: number | string, hashId: string): Promise<Book[]> { const json = await this.http.get<BooksEnvelope>(`/eapi/book/${bookId}/${hashId}/similar`); ZLibraryClient.assertOk(json); return Book.fromJsonList(json.books as object[]); }
https://github.com/LZZLHY/hlib
bb7d7e07976bc43e9d329fca4bec7ee33a898a6f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
then
Schedule the default continuation after the promise is completed. When no fulfillment handler is provided (e.g. `then()` or `then(undefined)`), the returned promise is settled with the same value/reason as the current promise. @param [_onFulfilled] placeholder to accept `undefined` @returns { Promise } a new promise th...
then(_onFulfilled?: undefined): Promise<Awaited<T>> { let promise = new Promise<Awaited<T>>(); let fn: () => void = (): void => { try { if (this.state == Promise.STATE_RESOLVED) { promise.doResolve<T>(this.value as T); } else { ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left then AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _onFulfilled AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#undefine...
then(_onFulfilled?: undefined): Promise<Awaited<T>> { let promise = new Promise<Awaited<T>>(); let fn: () => void = (): void => { try { if (this.state == Promise.STATE_RESOLVED) { promise.doResolve<T>(this.value as T); } else { ...
https://gitcode.com/iop123123/arkts-static-skills
3c256df5b6480ae74ef778d1d1994658700d6d71
gitcode
m-harmongos/harmongos-projects
AlarmClock/entry/src/main/ets/model/ReminderService.ets
arkts
openNotificationPermission
打开通知权限
public openNotificationPermission() { notificationManager.requestEnableNotification().then(() => { Logger.info("Enable notification success"); }).catch((err: Error) => { Logger.error('Enable notification failed because ' + JSON.stringify(err)); }) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left openNotificationPermission 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...
public openNotificationPermission() { notificationManager.requestEnableNotification().then(() => { Logger.info("Enable notification success"); }).catch((err: Error) => { Logger.error('Enable notification failed because ' + JSON.stringify(err)); }) }
https://github.com/m-harmongos/harmongos-projects
ad50b06a2dd38429eda9ca088b61d4247b984c33
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/SettingsService.ets
arkts
getInputSettings
获取输入设置
async getInputSettings(): Promise<InputSettings> { return { // 手柄 enableVibration: await this.getBoolean(SettingsKeys.ENABLE_VIBRATION, true), vibrationMode: await this.getString(SettingsKeys.VIBRATION_MODE, '自动'), gameVibrationStrength: normalizeGameVibrationStrength( await this.g...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getInputSettings AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen...
async getInputSettings(): Promise<InputSettings> { return { // 手柄 enableVibration: await this.getBoolean(SettingsKeys.ENABLE_VIBRATION, true), vibrationMode: await this.getString(SettingsKeys.VIBRATION_MODE, '自动'), gameVibrationStrength: normalizeGameVibrationStrength( await this.g...
https://github.com/AlkaidLab/moonlight-harmony
a379bc60f35b29edf40f5f83af1816ca1e2e7b28
github
openharmony-tpc/openharmony_tpc_samples
LibphoneNumber/entry/src/main/ets/util/Log.ets
arkts
showDebug
print debug level log @param {string} log - Log needs to be printed
static showDebug(log: string, ...ms: string[]) { console.debug(log, ms); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showDebug AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
static showDebug(log: string, ...ms: string[]) { console.debug(log, ms); }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
123aa72bed4eea9934b70f87b3e0bd699906745d
gitee
LZZLHY/hlib
entry/src/main/ets/api/HttpClient.ets
arkts
setSiteLanguage
设置站点内容语言偏好。 影响 `siteLanguageV2` cookie 和 Accept-Language header,从而决定首页热门 / 近期上传等推荐内容的语言。 接受 LANGUAGE_FILTERS 的 key,如 'chinese'/'english';'all' 或空串表示不主动声明。
setSiteLanguage(langKey: string): void { const cleaned: string = langKey.trim(); if (cleaned !== this.siteLanguage) { Logger.i(TAG, `siteLanguage: ${this.siteLanguage} -> ${cleaned}`); this.siteLanguage = cleaned; // 清除 cookieJar 里被服务端写过的旧 siteLanguageV2,避免锁死老偏好。 // 下次请求 buildCookieHea...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSiteLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left langKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#...
setSiteLanguage(langKey: string): void { const cleaned: string = langKey.trim(); if (cleaned !== this.siteLanguage) { Logger.i(TAG, `siteLanguage: ${this.siteLanguage} -> ${cleaned}`); this.siteLanguage = cleaned; // 清除 cookieJar 里被服务端写过的旧 siteLanguageV2,避免锁死老偏好。 // 下次请求 buildCookieHea...
https://github.com/LZZLHY/hlib
d1735f6d471dbd5f0a37626a741571bb3ccbe9d8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets
arkts
of
Creates a new SparseArray instance from a variable number of arguments, regardless of number or type of the arguments. @param { T[] } values Elements of which to create the array. @returns { SparseArray<T> } A new SparseArray instance. @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of<T>(...values: T[]): SparseArray<T> { return new SparseArray<T>(...values) }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left...
public static of<T>(...values: T[]): SparseArray<T> { return new SparseArray<T>(...values) }
https://gitcode.com/iop123123/arkts-static-skills
6c40f66dbf7852bc209cad96a7e48dec54843947
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitRepeatedMessage
访问 repeated message 字段 JSON: array of object ⭐ 每个消息都会递归调用 visitMessage
visitRepeatedMessage(value: Message[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) const jsonArray: Record<string, Object>[] = [] for (const item of value) { const nestedVisitor = new JsonEncodingVisitor() nestedVisitor.recursionDepth = this.recursionDepth + ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Mess...
visitRepeatedMessage(value: Message[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) const jsonArray: Record<string, Object>[] = [] for (const item of value) { const nestedVisitor = new JsonEncodingVisitor() nestedVisitor.recursionDepth = this.recursionDepth + ...
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
1b46d0ed99304b5fdf0167eff3058a96fce7ec0d
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/Windows11Config.ets
arkts
testWindows11Boot
测试虚拟机是否能成功启动 Windows 11 调用 Native 层进行全面检查
static async testWindows11Boot(vmName: string): Promise<{ success: boolean; issues: string[] }> { console.log(`[Windows11Tester] 测试虚拟机 ${vmName} 的 Windows 11 兼容性`); const issues: string[] = []; try { // 调用 Native 层进行全面兼容性检查 const compat: Win11CompatibilityResult = qemu.checkWin11Comp...
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 testWindows11Boot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left...
static async testWindows11Boot(vmName: string): Promise<{ success: boolean; issues: string[] }> { console.log(`[Windows11Tester] 测试虚拟机 ${vmName} 的 Windows 11 兼容性`); const issues: string[] = []; try { // 调用 Native 层进行全面兼容性检查 const compat: Win11CompatibilityResult = qemu.checkWin11Comp...
https://github.com/AetheriumSimulator/qemu-hmos
ffdea7bebdfab81b30cbbd99d2983a09997aabd2
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
createPixelMap
Create or recreate pixel map with current dimensions
async createPixelMap(): Promise<void> { if (this.desktopWidth <= 0 || this.desktopHeight <= 0) { console.warn('SessionState: Cannot create pixel map - invalid dimensions'); return; } // Release old pixel map if (this.pixelMap) { this.pixelMap.release(); this.pixelMap = null; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createPixelMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ...
async createPixelMap(): Promise<void> { if (this.desktopWidth <= 0 || this.desktopHeight <= 0) { console.warn('SessionState: Cannot create pixel map - invalid dimensions'); return; } // Release old pixel map if (this.pixelMap) { this.pixelMap.release(); this.pixelMap = null; ...
https://github.com/tangwengang-del/freerdp-harmonyos
b39548ae84b9316f2f5b71570a3e60e7abe05bfe
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningService.ets
arkts
getRecentModules
获取最近学习的模块
public async getRecentModules(limit: number = 3): Promise<LearningProgress[]> { const allProgress = await this.getAllProgress(); // 按最后学习时间排序 allProgress.sort((a, b) => b.lastStudyTime - a.lastStudyTime); return allProgress.slice(0, limit); }
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 getRecentModules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left :...
public async getRecentModules(limit: number = 3): Promise<LearningProgress[]> { const allProgress = await this.getAllProgress(); // 按最后学习时间排序 allProgress.sort((a, b) => b.lastStudyTime - a.lastStudyTime); return allProgress.slice(0, limit); }
https://github.com/the-wwyang/kids-learning-app
9aaf6ebdd7396d1f6aa06ec2db5fe4c393321295
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningService.ets
arkts
isModuleCompleted
检查模块是否已完成
public async isModuleCompleted(moduleName: string, totalLessons: number): Promise<boolean> { const progress = await this.getModuleProgress(moduleName); if (!progress) return false; return progress.completedLessons >= totalLessons; }
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 isModuleCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#:#...
public async isModuleCompleted(moduleName: string, totalLessons: number): Promise<boolean> { const progress = await this.getModuleProgress(moduleName); if (!progress) return false; return progress.completedLessons >= totalLessons; }
https://github.com/the-wwyang/kids-learning-app
1b705a24a68c95b7c00d948cd05dcc062a5d4c0d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/ShortcutManager.ets
arkts
getDeletedBuiltinShortcuts
获取已删除的内置快捷键列表
getDeletedBuiltinShortcuts(): Shortcut[] { return this.getDefaultShortcuts().filter(s => this.deletedBuiltinIds.includes(s.id)); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getDeletedBuiltinShortcuts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arg...
getDeletedBuiltinShortcuts(): Shortcut[] { return this.getDefaultShortcuts().filter(s => this.deletedBuiltinIds.includes(s.id)); }
https://github.com/AlkaidLab/moonlight-harmony
02ba5a1dba030054d41286eba63df9bd6bd46105
github
HarmonyOS_Samples/sample_in_harmonyos
features/devpractices/src/main/ets/model/ImageModel.ets
arkts
calcFitScaleRatio
Calculate the maximum zoom value of the picture.
calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { let ratio: number = 1.0; if (windowSize.width > imageSize.width) { ratio = windowSize.width / imageSize.width; } else { ratio = windowSize.height / imageSize.height; } return ratio + 1; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calcFitScaleRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left imageSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left image AST#identifier#R...
calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { let ratio: number = 1.0; if (windowSize.width > imageSize.width) { ratio = windowSize.width / imageSize.width; } else { ratio = windowSize.height / imageSize.height; } return ratio + 1; }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
c9ee7db0b0f41cc592841e3da7f5705feec0a718
gitcode
openharmony/applications_app_samples
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
sendData
判断是否为UDP发送 @param message
sendData(message: string): void { if (this.socketType[this.selectAgreementIndex] !== SocketType.UDP) { this.socketController?.sendData(message); } else { oppositePort = this.userId === 1 ? 8082 : 8081; this.socketController?.udpSendData(message, oppositeAddress, oppositePort); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Right...
sendData(message: string): void { if (this.socketType[this.selectAgreementIndex] !== SocketType.UDP) { this.socketController?.sendData(message); } else { oppositePort = this.userId === 1 ? 8082 : 8081; this.socketController?.udpSendData(message, oppositeAddress, oppositePort); } }
https://github.com/openharmony/applications_app_samples
a7ae07d95c7ecbb34c0e7d025f1505554f1cefb8
github
Countly/countly-sdk-hos
library/src/main/ets/internal/ServerConfig.ets
arkts
applySegmentationFilter
Return a copy of `segmentation` with disallowed keys stripped. No-op (returns the input reference) if the filter is empty. Returning a new map mirrors `Utils.sanitizeSegmentation`, ArkTS strict mode rejects the `delete` operator, so in-place mutation isn't available.
public static applySegmentationFilter(segmentation: SegmentationMap, sc: ServerConfig, logger: Logger): SegmentationMap { const fl: FilterList<string[]> = sc.segmentationFilter; if (fl.filterList.length === 0) return segmentation; return ListingFilters.filteredCopy(segmentation, fl.filterList, fl.isWhitel...
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 applySegmentationFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left segmentation AST#identifier#Rig...
public static applySegmentationFilter(segmentation: SegmentationMap, sc: ServerConfig, logger: Logger): SegmentationMap { const fl: FilterList<string[]> = sc.segmentationFilter; if (fl.filterList.length === 0) return segmentation; return ListingFilters.filteredCopy(segmentation, fl.filterList, fl.isWhitel...
https://github.com/Countly/countly-sdk-hos
4cc63e4eebc14f97fff8660700bb78aa13069cd0
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Stack.ets
arkts
forEach
Executes a provided function once for each array element. @param callbackfn - The function to execute on each element, taking the value, index, and Stack as arguments.
public forEach(callbackfn: StackForEachCb<T>): void { this.buffer.forEach(((val: T, idx) => callbackfn(val, idx.toInt(), this))); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr...
public forEach(callbackfn: StackForEachCb<T>): void { this.buffer.forEach(((val: T, idx) => callbackfn(val, idx.toInt(), this))); }
https://gitcode.com/iop123123/arkts-static-skills
605a3e1ab2881da7354241d9ffbf856281ae8843
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets
arkts
getPriority
Get the current priority of the worker @returns { WorkerPriority } The current priority value of the worker
public getPriority(): WorkerPriority { return this.priority; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPriority 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 WorkerPrio...
public getPriority(): WorkerPriority { return this.priority; }
https://gitcode.com/iop123123/arkts-static-skills
c604a5dd1525140af9103dfda3dff6bd18c23aa4
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets
arkts
isInBasicMultilingualPlane
isInBasicMultilingualPlane(char) checks if the char is in Basic Multilingual Plane. See UTF-16 for more details. @param { char } value the char to be checked. @returns { boolean } @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static isInBasicMultilingualPlane(value: char): boolean { if (value.toInt() < Char.BMP_BORDER) { return (value.compareTo(Char.HIGH_SURROGATE_MIN) < 0) || (value.compareTo(Char.LOW_SURROGATE_MAX) > 0); } return false }
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 isInBasicMultilingualPlane AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left A...
public static isInBasicMultilingualPlane(value: char): boolean { if (value.toInt() < Char.BMP_BORDER) { return (value.compareTo(Char.HIGH_SURROGATE_MIN) < 0) || (value.compareTo(Char.LOW_SURROGATE_MAX) > 0); } return false }
https://gitcode.com/iop123123/arkts-static-skills
7dfb4bbe7d1050d5e60a6bc22084937a42eca3a2
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets
arkts
getLibrary
获取库中的漫画列表(不推荐用于大型库) @deprecated 使用 getLibraryPaginated 代替
public async getLibrary(): Promise<ComicInfo[]> { try { return await this.suwayomiSource.getLibraryMangas(); } catch (error) { logger.error(TAG, `获取库列表失败: ${error}`); return []; } }
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 getLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public async getLibrary(): Promise<ComicInfo[]> { try { return await this.suwayomiSource.getLibraryMangas(); } catch (error) { logger.error(TAG, `获取库列表失败: ${error}`); return []; } }
https://github.com/DaLongZhuaZi/manxia
561ec50eddb52932e2532c6f5dd6892d05e5d564
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/DBManager.ets
arkts
getRdbStore
获取 RDBStore 实例 外部类通过此方法获取数据库实例进行操作
public getRdbStore(): relationalStore.RdbStore { if (!this.rdbStore) { throw new Error('数据库未初始化,请先调用 initDB()'); } return this.rdbStore; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#member_expression#Left AST...
public getRdbStore(): relationalStore.RdbStore { if (!this.rdbStore) { throw new Error('数据库未初始化,请先调用 initDB()'); } return this.rdbStore; }
https://github.com/fuhhhhhhhh/openharmony
4aacd3ca5a0a39cb8a5daa977242dc3da4c68325
github
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets
arkts
startAudioWorker
start Audio Worker
public async startAudioWorker(): Promise<void> { try { if (!this.workerInstance) { LogUtil.info(TAG, 'start to create AudioWorker'); await this.createAudioWorker(); } else { LogUtil.info(TAG, 'AudioWorker has been create, state:' + this.workerInstance.state); this.audio...
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 startAudioWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async startAudioWorker(): Promise<void> { try { if (!this.workerInstance) { LogUtil.info(TAG, 'start to create AudioWorker'); await this.createAudioWorker(); } else { LogUtil.info(TAG, 'AudioWorker has been create, state:' + this.workerInstance.state); this.audio...
https://gitee.com/openharmony-sig/applications_clock.git
c65757477a5bd8d2cea7668bfd8931d875898ec3
gitee
openharmony-sig/smartperf
device/device_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets
arkts
resetCircleColors
resets the circle-colors array and creates a new one
public resetCircleColors(): void { if (this.mCircleColors == null) { this.mCircleColors = new JArrayList<Number>(); } this.mCircleColors.clear(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetCircleColors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
public resetCircleColors(): void { if (this.mCircleColors == null) { this.mCircleColors = new JArrayList<Number>(); } this.mCircleColors.clear(); }
https://gitee.com/openharmony-sig/smartperf.git
1b48a02494f6df73c57f595bdf3bc69a87aeac72
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
writableCorked
Number of times Writable.uncork() needs to be called in order to fully uncork the stream.
get writableCorked(): int { return this.writableCorkedInner; };
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left writableCorked 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 int AST#identifi...
get writableCorked(): int { return this.writableCorkedInner; };
https://gitcode.com/iop123123/arkts-static-skills
eaee546ccee5c9a999de11f0246dc37d840f04a0
gitcode
tdcare/tdwebrtc
src/main/ets/SignalingClient.ets
arkts
sendVideoSosCall
发送视频 SOS 呼叫
public sendVideoSosCall(toMac: string, roomId: string, msg: string, callType: CallType): void { this.currentCallType = callType; const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_VIDEO_SOS_CALL, room_id: roomId, from_mac: this.mac, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendVideoSosCall 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#Lef...
public sendVideoSosCall(toMac: string, roomId: string, msg: string, callType: CallType): void { this.currentCallType = callType; const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_VIDEO_SOS_CALL, room_id: roomId, from_mac: this.mac, ...
https://github.com/tdcare/tdwebrtc
47191c28d368e783295f6c936a1b56a2b586d1f3
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/ClientSessionManager.ets
arkts
stopAll
Force stop the current client
public stopAll(): void { if (this.currentClient) { const client = this.currentClient; this.currentClient = undefined; try { client.stop(); } catch (e) { LoggerClientSession.error('[ClientSessionManager] Error stopping client:', e); } } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
public stopAll(): void { if (this.currentClient) { const client = this.currentClient; this.currentClient = undefined; try { client.stop(); } catch (e) { LoggerClientSession.error('[ClientSessionManager] Error stopping client:', e); } } }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
93034dc2ca154c93ed030a74addf4d0083cad15b
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/model/PlanModel.ets
arkts
isStarted
检查计划是否已开始
isStarted(): boolean { const today = new Date(); today.setHours(0, 0, 0, 0); const start = new Date(this.startDate); start.setHours(0, 0, 0, 0); return today >= start; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isStarted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement...
isStarted(): boolean { const today = new Date(); today.setHours(0, 0, 0, 0); const start = new Date(this.startDate); start.setHours(0, 0, 0, 0); return today >= start; }
https://gitcode.com/openharmony/codelabs
7cc522cb8712e6fc04687c8a7e6d6b1c20d65eee
gitcode
arkui-x/samples
CodeLab/Cases/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets
arkts
rgb2hsv
RGB格式转换为HSV格式,公式参考resources/base/media/rgb_to_hsv.png @param color RGB像素值 @returns HSV像素值
public static rgb2hsv(color: ColorRgb): ColorHsv { // RGB颜色取值范围是0~255,需要转换为0~1的浮点数 const red: number = color.red / MAX_RGB_VALUE; const green: number = color.green / MAX_RGB_VALUE; const blue: number = color.blue / MAX_RGB_VALUE; const max: number = Math.max(red, green, blue); const min: numb...
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 rgb2hsv AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#R...
public static rgb2hsv(color: ColorRgb): ColorHsv { // RGB颜色取值范围是0~255,需要转换为0~1的浮点数 const red: number = color.red / MAX_RGB_VALUE; const green: number = color.green / MAX_RGB_VALUE; const blue: number = color.blue / MAX_RGB_VALUE; const max: number = Math.max(red, green, blue); const min: numb...
https://gitcode.com/arkui-x/samples
a3269d4d4a9f0b66c2399e510ed6972f456c4d6a
gitcode
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
setDownloadProgress
设置进度 @param value 进度
setDownloadProgress(value): void { if (this._downloadProgress !== value && value !== undefined && value !== null) { this._downloadProgress = value; AppStorage.Set('downloadProgress', this._downloadProgress); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDownloadProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right...
setDownloadProgress(value): void { if (this._downloadProgress !== value && value !== undefined && value !== null) { this._downloadProgress = value; AppStorage.Set('downloadProgress', this._downloadProgress); } }
https://gitee.com/openharmony/update_update_app.git
88d0b6d738938cdeb151473a0d08360193a6f517
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebImageDownloader.ets
arkts
downloadImage
从URL下载图片并转换为base64 @param url 图片URL @param size 图片尺寸 @returns base64编码的图片数据
public static async downloadImage(url: string, size: number = 64): Promise<string | null> { if (!url || !UrlUtils.isValidUrl(url)) { throw new Error(ResourceManager.getString($r("app.string.download_image_url_invalid_message"))); } let session: rcp.Session | null = null; try { // 创建HTTP会话...
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 downloadImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url ...
public static async downloadImage(url: string, size: number = 64): Promise<string | null> { if (!url || !UrlUtils.isValidUrl(url)) { throw new Error(ResourceManager.getString($r("app.string.download_image_url_invalid_message"))); } let session: rcp.Session | null = null; try { // 创建HTTP会话...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebImageDownloader.ets#L19-L76
2aa259e383283736a7e09f2924c4b6cb2107c96c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets
arkts
toLocaleString
Converts this object to a locale-specific string representation @param { Intl.LocalesArgument } [ locales ] A string with a BCP 47 language tag, or an array of such strings @param { object } [ options ] An object with some or all of the properties of the Intl.NumberFormat options @returns { String } result of the local...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): String { if (options instanceof Intl.NumberFormatOptions) { return this.toLocaleString(locales, options) } return this.toLocaleString(locales, undefined) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Rig...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): String { if (options instanceof Intl.NumberFormatOptions) { return this.toLocaleString(locales, options) } return this.toLocaleString(locales, undefined) }
https://gitcode.com/iop123123/arkts-static-skills
20f68746ebeaee9efb103e2fc6e30f75fd263684
gitcode
LZZLHY/hlib
entry/src/main/ets/api/DomainManifest.ets
arkts
clearRemote
清空远程缓存(不动 enabled / manifestUrl)。设置页"重置同步"用。
static async clearRemote(): Promise<void> { DomainManifest.remoteDomains = []; DomainManifest.lastVersion = ''; DomainManifest.lastTs = 0; await PreferencesStore.remove('settings', KEY_REMOTE_DOMAINS); await PreferencesStore.remove('settings', KEY_REMOTE_DOMAINS_VERSION); await PreferencesStor...
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 clearRemote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
static async clearRemote(): Promise<void> { DomainManifest.remoteDomains = []; DomainManifest.lastVersion = ''; DomainManifest.lastTs = 0; await PreferencesStore.remove('settings', KEY_REMOTE_DOMAINS); await PreferencesStore.remove('settings', KEY_REMOTE_DOMAINS_VERSION); await PreferencesStor...
https://github.com/LZZLHY/hlib
104fd9364f9f74c9df3ee77c5b68ab8740c4ecd2
github
honjow/Next2V
feature/detail/src/main/ets/viewmodel/DetailViewModel.ets
arkts
shouldHoldRepliesPublish
Mirrors the auto-preload branch of triggerThreadPreloadIfNeeded(): hold the page-1 publish only when the follow-up preload is guaranteed to run unattended and publish the full list. Over-limit topics keep the eager publish because preload waits on the user's confirm dialog.
private shouldHoldRepliesPublish(): boolean { return ( this.replyDataSource.totalCount() > 0 && this.isThreadMode() && this.repliesHasMore && !this.allRepliesLoaded && this.estimateTotalReplies() <= DetailViewModel.PRELOAD_REPLY_LIMIT ) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldHoldRepliesPublish AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Le...
private shouldHoldRepliesPublish(): boolean { return ( this.replyDataSource.totalCount() > 0 && this.isThreadMode() && this.repliesHasMore && !this.allRepliesLoaded && this.estimateTotalReplies() <= DetailViewModel.PRELOAD_REPLY_LIMIT ) }
https://github.com/honjow/Next2V
6dc94b0e4d0d98e8486f63a735ca5c5831cc6a16
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Workflow/WorkflowExecutor.ets
arkts
executeWithPagination
执行带分页的工作流
async executeWithPagination( workflow: WorkflowDefinition, context: WorkflowContext, maxPages?: number ): Promise<ExecutionResult[]> { const results: ExecutionResult[] = []; let currentPage = 1; const max = maxPages || 10; while (currentPage <= max) { logger.info(TAG, `执行第 ${curre...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeWithPagination AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left workflow AST#identifier#Right AST#type_annotation#Left AS...
async executeWithPagination( workflow: WorkflowDefinition, context: WorkflowContext, maxPages?: number ): Promise<ExecutionResult[]> { const results: ExecutionResult[] = []; let currentPage = 1; const max = maxPages || 10; while (currentPage <= max) { logger.info(TAG, `执行第 ${curre...
https://github.com/DaLongZhuaZi/manxia
5d9aadb4f2989a9c4145cdfd792df2678f776e01
github
LongLiveY96/chatcube
entry/src/main/ets/models/ChatModels.ets
arkts
fromExtendedJson
从扩展 JSON 对象创建
static fromExtendedJson(json: ModelInfoExtendedJson): ModelInfo { const model = new ModelInfo( json.id, json.name, json.contextLength, json.isEnabled, json.isRecommended ) // 恢复类型和模式 if (json.modelType !== undefined) { model.modelType = json.modelType === 'embeddin...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromExtendedJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static fromExtendedJson(json: ModelInfoExtendedJson): ModelInfo { const model = new ModelInfo( json.id, json.name, json.contextLength, json.isEnabled, json.isRecommended ) // 恢复类型和模式 if (json.modelType !== undefined) { model.modelType = json.modelType === 'embeddin...
https://github.com/LongLiveY96/chatcube
660fc455adb1388b34e73742c680691e34fbcdc1
github
Countly/countly-sdk-hos
library/src/main/ets/internal/RequestQueue.ets
arkts
replaceAllAppKeysWithCurrent
Rewrite the `app_key=` parameter on every queued request to the current app key. Use after an app-key change so previously-queued telemetry gets associated with the new app instead of being discarded by the server.
public async replaceAllAppKeysWithCurrent(): Promise<void> { const encoded: string = encodeURIComponent(this.config.appKey); const rx: RegExp = /(^|&)app_key=[^&]*/g; let changed: boolean = false; for (let i = 0; i < this.queue.length; i++) { const next: string = this.queue[i].replace(rx, `$1app...
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 replaceAllAppKeysWithCurrent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi...
public async replaceAllAppKeysWithCurrent(): Promise<void> { const encoded: string = encodeURIComponent(this.config.appKey); const rx: RegExp = /(^|&)app_key=[^&]*/g; let changed: boolean = false; for (let i = 0; i < this.queue.length; i++) { const next: string = this.queue[i].replace(rx, `$1app...
https://github.com/Countly/countly-sdk-hos
2ade927efa84e7aa3c242d8daa2c3334a69cd7df
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Console.ets
arkts
println
Prints an object to the console and puts newline @param i value to print
public println(i: Object): void { this.print(i); this.println(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#...
public println(i: Object): void { this.print(i); this.println(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
86a7811ae0923eabd2c480538044bcde90861d29
gitee
yongoe1024/RdbPlus
entry/src/main/ets/rdb/MapperMultiple.ets
arkts
getInstance2DB
单例模式 db2
static getInstance2DB() { if (!MapperMultiple.mapper2) { MapperMultiple.mapper2 = BaseMapper.build<Employee>({ class: Employee, config: { name: 'RdbTest2.db', // 数据库文件名 securityLevel: relationalStore.SecurityLevel.S3, // 数据库安全级别 } }) } return MapperM...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance2DB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
static getInstance2DB() { if (!MapperMultiple.mapper2) { MapperMultiple.mapper2 = BaseMapper.build<Employee>({ class: Employee, config: { name: 'RdbTest2.db', // 数据库文件名 securityLevel: relationalStore.SecurityLevel.S3, // 数据库安全级别 } }) } return MapperM...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/entry/src/main/ets/rdb/MapperMultiple.ets#L27-L38
b8486a7edbdbbab86702cd6741f475a53c9782eb
github
LZZLHY/hlib
entry/src/main/ets/utils/I18n.ets
arkts
t
返回 Resource 引用(推荐用法)
static t(key: string): Resource { return $r(`app.string.${key}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri...
static t(key: string): Resource { return $r(`app.string.${key}`); }
https://github.com/LZZLHY/hlib
85f256d40e4925f709957ed49ca3c7a73d4c9018
github
openharmony-sig/applications_calculator
common/src/main/ets/util/DateUtil.ets
arkts
isLocalChange
Check whether the language of the mobile phone changes. @return {boolean} Whether the language of the mobile phone changes.
public isLocalChange(): boolean { let newLocalStr: string = new Intl.Locale().toString(); return newLocalStr !== this.localStr; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLocalChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST...
public isLocalChange(): boolean { let newLocalStr: string = new Intl.Locale().toString(); return newLocalStr !== this.localStr; }
https://gitee.com/openharmony-sig/applications_calculator.git
5db15e4d78cbba11c276220f81417e3a3221bcf2
gitee
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
hideLogoutDialog
隐藏退出登录弹窗 @returns {void} 无返回值
hideLogoutDialog(): void { this.showLogoutDialog = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hideLogoutDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
hideLogoutDialog(): void { this.showLogoutDialog = false; }
https://github.com/Joker-x-dev/CoolMallArkTS
f9c2dec4c8e102fa563341a4d31c42f447ecae7c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
subarray
Creates a Int32Array with the same ArrayBuffer @param begin start index, inclusive @returns new Int32Array with the same ArrayBuffer
public subarray(begin: number): Int32Array { return this.subarray(begin as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number): Int32Array { return this.subarray(begin as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a615c010c7d3ad5c4d8508e5af8787f9e1c7cf44
gitee
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
editTopicWithCookie
Submit an edit. Re-GET the form for a fresh once, overlay title/content (keeping the topic's current syntax), POST to /edit/topic/<id>; success = redirect back to /t/<id>. Editing is free (no 铜币).
async editTopicWithCookie( cookie: string, topicId: number, title: string, content: string, ): Promise<number> { const cleanTitle = (title || '').trim() const cleanContent = (content || '').trim() if (!cookie) { throw ApiErrors.authRequired() } if (topicId <= 0) { thr...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left editTopicWithCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier#Right AST#type_annotation#Left AST#:#...
async editTopicWithCookie( cookie: string, topicId: number, title: string, content: string, ): Promise<number> { const cleanTitle = (title || '').trim() const cleanContent = (content || '').trim() if (!cookie) { throw ApiErrors.authRequired() } if (topicId <= 0) { thr...
https://github.com/honjow/Next2V
57256399e48199c7e0426e77ad3f6ca9f05ef88e
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
startBLEScanInner
扫描蓝牙设备
private startBLEScanInner(): boolean { try { this.mAvailableDevices = []; if (this.mConnectBluetoothDevice.connectionState === ConnectionState.STATE_CONNECTED) { this.mAvailableDevices.push(this.mConnectBluetoothDevice); } AppStorage.setOrCreate('availableDevices', this.mAvailableD...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startBLEScanInner AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left bool...
private startBLEScanInner(): boolean { try { this.mAvailableDevices = []; if (this.mConnectBluetoothDevice.connectionState === ConnectionState.STATE_CONNECTED) { this.mAvailableDevices.push(this.mConnectBluetoothDevice); } AppStorage.setOrCreate('availableDevices', this.mAvailableD...
https://gitcode.com/arkui-x/samples
8cf8b5e0b0fc257d8ee7536bfb62b16118066df4
gitcode
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/view/calendar/WeekView.ets
arkts
onSelectedDateChange
监听回调方法 (这里不需要再加 @Watch 了)
onSelectedDateChange() { // 只有当选中的日期跳出了当前周的范围时,才需要刷新数据 this.refreshData(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onSelectedDateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo...
onSelectedDateChange() { // 只有当选中的日期跳出了当前周的范围时,才需要刷新数据 this.refreshData(); }
https://gitcode.com/openharmony/codelabs
21fc3ad4986802caac2146bf088fc32b084eef2d
gitcode
electronicminer/Harmony-Markdown-Editor
entry/src/main/ets/components/AIChatPanel.ets
arkts
truncate
截断文本用于预览展示
truncate(text: string | undefined, max: number): string { if (!text) { return ''; } const clean = text.replace(/\\n/g, ' ').replace(/\n/g, ' '); return clean.length > max ? clean.substring(0, max) + '…' : clean; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left truncate 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#binary_expression#Left AST#identifier#Left string AST#identifie...
truncate(text: string | undefined, max: number): string { if (!text) { return ''; } const clean = text.replace(/\\n/g, ' ').replace(/\n/g, ' '); return clean.length > max ? clean.substring(0, max) + '…' : clean; }
https://github.com/electronicminer/Harmony-Markdown-Editor
8d32a52918353f7f357467c744189432fd5aee62
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/ColorPickerUtil.ets
arkts
getColorFromRgb
Calculate the color accord to red, blue, green area. @param rgb, rgba(0, 255, 1, 1.00) @returns color number (0-100)
public static getColorFromRgb(rgb: string): number { const rgbArray = ColorPickerUtil.getRgb(rgb); const redArea: number = rgbArray[0]; const greenArea: number = rgbArray[1]; const blueArea: number = rgbArray[2]; let colorArea: number = 0.00; if (redArea === ColorPickerUtil.MAX_RGB_VALUE && bl...
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 getColorFromRgb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rgb AST#identifier#Right AST#:#Left : A...
public static getColorFromRgb(rgb: string): number { const rgbArray = ColorPickerUtil.getRgb(rgb); const redArea: number = rgbArray[0]; const greenArea: number = rgbArray[1]; const blueArea: number = rgbArray[2]; let colorArea: number = 0.00; if (redArea === ColorPickerUtil.MAX_RGB_VALUE && bl...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
3d509a9338bfcd1f6d8be52709f036d84a7892b0
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
update
更新共享账单
static async update(bill: SharedBill): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); bill.updatedAt = new Date().toISOString(); bill.version += 1; const values: relationalStore.ValuesBucket = { amount: bill.amount, note: bill.note || null, t...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bill AST#identifier#Right AST#:#Left : AST#:#Righ...
static async update(bill: SharedBill): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); bill.updatedAt = new Date().toISOString(); bill.version += 1; const values: relationalStore.ValuesBucket = { amount: bill.amount, note: bill.note || null, t...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
5ad03e657f1d2bde8d06cc4dc0e4570a8e026886
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
queryByPids
根据多个插画PID批量查询历史记录 @param pids 插画ID数组 @returns 包含指定pid的历史记录数组
async queryByPids(pids: string[]): Promise<IllustHistoryInfo[]> { logger.debug('queryByPids pids = ' + JSON.stringify(pids)) if (!pids || pids.length === 0) return []; return this.query(this.getPredicates().in('pid', pids)) }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryByPids AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pids AST#identifier#Right AST#type_annotation#Left AST#:#L...
async queryByPids(pids: string[]): Promise<IllustHistoryInfo[]> { logger.debug('queryByPids pids = ' + JSON.stringify(pids)) if (!pids || pids.length === 0) return []; return this.query(this.getPredicates().in('pid', pids)) }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L98-L102
38c1dd9eadcec479707aad451af9cd3f999a0719
github
openharmony/applications_settings
product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets
arkts
getPluralStringValueSync
同步返回单复数大写字符串string值
static getPluralStringValueSync(resource: Resource, num: number): string { if (!resource) { return ''; } try { let context = getContext() as common.UIAbilityContext; return context.resourceManager.getPluralStringValueSync(resource, num).toUpperCase(); } catch (error) { let code...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPluralStringValueSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
static getPluralStringValueSync(resource: Resource, num: number): string { if (!resource) { return ''; } try { let context = getContext() as common.UIAbilityContext; return context.resourceManager.getPluralStringValueSync(resource, num).toUpperCase(); } catch (error) { let code...
https://gitee.com/openharmony/applications_settings.git
c47e334d3a299279800f48e18c5b09547650cfd8
gitee
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/SearchHistoryManager.ets
arkts
getSearchSuggestions
搜索建议(基于历史记录的模糊匹配)
static async getSearchSuggestions(keyword: string, limit: number = 5): Promise<string[]> { try { if (!keyword.trim()) { return [] } const records = await SearchHistoryManager.getSearchHistory() const suggestions: string[] = [] const lowerKeyword = keyword.toLowerCase() ...
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 getSearchSuggestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#...
static async getSearchSuggestions(keyword: string, limit: number = 5): Promise<string[]> { try { if (!keyword.trim()) { return [] } const records = await SearchHistoryManager.getSearchHistory() const suggestions: string[] = [] const lowerKeyword = keyword.toLowerCase() ...
https://github.com/cpdd5201314/harmonyOS-music-app
bb8a034a646ff397bd0f9783e454beaf3e6e119e
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/pages/Index.ets
arkts
onSwiperIndexChanged
卡片切换后刷新列表区标题和操作文案。
onSwiperIndexChanged(): void { this.updateHeaderState(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSwiperIndexChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme...
onSwiperIndexChanged(): void { this.updateHeaderState(); }
https://github.com/ZestBox-18/kitebook-frontend
691f86bf596cba30aa8e8dd302a3a9304e845d1f
github
fangmingtao/Ohs_ArkTs_Eyepetizer
entry/src/main/ets/datasource/BasicDataSource.ets
arkts
notifyDataDelete
通知数据删除
notifyDataDelete(index: number) { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left notifyDataDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#R...
notifyDataDelete(index: number) { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer
cbf0d9c5a543bfd99a9a25a37f5012fce7858be6
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test47_original_index.ets
arkts
padCenter
--- String padding patterns ---
function padCenter(s: string, width: number): string { let padLeft: number = Math.floor((width - s.length) / 2); let padRight: number = width - s.length - padLeft; let left: string = ''; for (let i: number = 0; i < padLeft; i++) { left = left + ' '; } let right: string = ''; for (let i: number = 0; i ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left padCenter AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
function padCenter(s: string, width: number): string { let padLeft: number = Math.floor((width - s.length) / 2); let padRight: number = width - s.length - padLeft; let left: string = ''; for (let i: number = 0; i < padLeft; i++) { left = left + ' '; } let right: string = ''; for (let i: number = 0; i ...
https://github.com/miaochiahao/ark-ghidra
77436100c13901aa3094509565ed68956ab0d653
github
Countly/countly-sdk-hos
library/src/main/ets/internal/LifecycleObserver.ets
arkts
register
Subscribe. Idempotent, calling twice is a no-op so re-init paths don't double-subscribe. Note: HMOS lifecycle events (`applicationStateChange`, `abilityLifecycle`, `environment`) fire on transitions only and never replay the current state. If `register()` is called after the platform has already fired the cold-boot for...
public register(ctx: common.Context | null): void { if (this.appStateObserver !== null) return; if (ctx === null) { this.logger.d('[LifecycleObserver] no context, auto-lifecycle disabled, integrator must drive lifecycleForegroundAll/Background manually'); return; } let appCtx: common.Appli...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left A...
public register(ctx: common.Context | null): void { if (this.appStateObserver !== null) return; if (ctx === null) { this.logger.d('[LifecycleObserver] no context, auto-lifecycle disabled, integrator must drive lifecycleForegroundAll/Background manually'); return; } let appCtx: common.Appli...
https://github.com/Countly/countly-sdk-hos
72b321a693a5761cc3df928fc08aa8fd97335b84
github
openharmony/applications_contacts
entry/src/main/ets/feature/EnvironmentProp.ets
arkts
getDeviceType
Querying the Device Type default:智能手机 tablet:平板 tv:智慧屏 wearable:智能穿戴 liteWearable:轻量级智能穿戴 smartVision:智慧视觉设备
static getDeviceType(): string { return EnvironmentProp.DEVICE_TYPE; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDeviceType 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#s...
static getDeviceType(): string { return EnvironmentProp.DEVICE_TYPE; }
https://gitee.com/openharmony/applications_contacts.git
eeb4552f5908ae5160514eaf1f712d03b15a2412
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/CheatManager.ets
arkts
deleteLocalCheatsXml
删除本地 cheats.xml
deleteLocalCheatsXml(): void { try { fileIo.unlinkSync(this.getLocalCheatsXmlPath()); } catch (_e) { /* ignore */ } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteLocalCheatsXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme...
deleteLocalCheatsXml(): void { try { fileIo.unlinkSync(this.getLocalCheatsXmlPath()); } catch (_e) { /* ignore */ } }
https://github.com/richshaw2015/nds
69db6e6580602a3972508357944058be0bdc2199
github
LongLiveY96/chatcube
entry/src/main/ets/pages/ChatPage.ets
arkts
handleStop
处理停止生成
handleStop(): void { this.cancelActiveSendDispatch() this.getStopFlow().stopCurrentTask() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleStop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
handleStop(): void { this.cancelActiveSendDispatch() this.getStopFlow().stopCurrentTask() }
https://github.com/LongLiveY96/chatcube
e12306b247d971ba9a5b141c8bd3f98e43da7056
github