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 |
|---|---|---|---|---|---|---|---|---|---|---|
CLMC2025/Vignette | entry/src/main/ets/vocabulary/VocabularyTracker.ets | arkts | getLearningCurve | 获取学习曲线数据 | getLearningCurve(days: number = 30): LearningCurvePoint[] {
const curve: LearningCurvePoint[] = [];
const now = Date.now();
const dayMs = 24 * 60 * 60 * 1000;
for (let i = 0; i < days; i++) {
const date = now - (days - i - 1) * dayMs;
// 模拟数据(实际应从历史记录获取)
const reviewed = Math... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLearningCurve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left days AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifie... | getLearningCurve(days: number = 30): LearningCurvePoint[] {
const curve: LearningCurvePoint[] = [];
const now = Date.now();
const dayMs = 24 * 60 * 60 * 1000;
for (let i = 0; i < days; i++) {
const date = now - (days - i - 1) * dayMs;
// 模拟数据(实际应从历史记录获取)
const reviewed = Math... | https://github.com/CLMC2025/Vignette | 5c9a0083fab3162521f890e83c10bf6cb4758def | github |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | getChatInputEnterKeySend | 获取聊天输入框回车键是否发送 | async getChatInputEnterKeySend(): Promise<boolean> {
return await this.getBoolean(PreferenceKeys.CHAT_INPUT_ENTER_KEY_SEND, false)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getChatInputEnterKeySend 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... | async getChatInputEnterKeySend(): Promise<boolean> {
return await this.getBoolean(PreferenceKeys.CHAT_INPUT_ENTER_KEY_SEND, false)
} | https://github.com/LongLiveY96/chatcube | 40453a75d25e71cf03834d57ddcaf4fe3d06224f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | getFromPermanentCache | 从永久缓存获取图片 | private async getFromPermanentCache(
url: string,
options: LoadOptions
): Promise<image.PixelMap | null> {
try {
const permanentCache = PermanentImageCacheManager.getInstance();
const cachedPath = await permanentCache.getCachedImagePath(
options.sourceId!,
options.mangaId!,
... | 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 getFromPermanentCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#... | private async getFromPermanentCache(
url: string,
options: LoadOptions
): Promise<image.PixelMap | null> {
try {
const permanentCache = PermanentImageCacheManager.getInstance();
const cachedPath = await permanentCache.getCachedImagePath(
options.sourceId!,
options.mangaId!,
... | https://github.com/DaLongZhuaZi/manxia | 91c61f556802ca7297039095f1e6988f3d354605 | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | setAVMetadata | Updates AVSession metadata (title, artist, duration, optional cover) for the current track. | private async setAVMetadata(): Promise<void> {
const id = this.musicIndex;
try {
if (!this.abilityContext) {
return;
}
const ctx = this.abilityContext;
const metaSong = this.getSongItemAtQueueIndex(this.musicIndex);
if (!metaSong) {
return;
}
let media... | 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 setAVMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async setAVMetadata(): Promise<void> {
const id = this.musicIndex;
try {
if (!this.abilityContext) {
return;
}
const ctx = this.abilityContext;
const metaSong = this.getSongItemAtQueueIndex(this.musicIndex);
if (!metaSong) {
return;
}
let media... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 63fbe77968e687c2704a9ce1c733574a47b1feb7 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/handwritingtoimage/src/main/ets/view/HandWritingToImage.ets | arkts | getTimeStr | 获取当前时间的拼接字符串,用于图片命名 | function getTimeStr(): string {
const now: Date = new Date();
const year: number = now.getFullYear();
const month: number = now.getMonth() + 1;
const day: number = now.getDate();
const hours: number = now.getHours();
const minutes: number = now.getMinutes();
const seconds: number = now.getSeconds();
ret... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getTimeStr 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#... | function getTimeStr(): string {
const now: Date = new Date();
const year: number = now.getFullYear();
const month: number = now.getMonth() + 1;
const day: number = now.getDate();
const hours: number = now.getHours();
const minutes: number = now.getMinutes();
const seconds: number = now.getSeconds();
ret... | https://gitcode.com/arkui-x/samples | e327608dfde3cefec91de3d255c34075ceb44044 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneManager.ets | arkts | isMicrophoneAvailable | 检查主机是否支持麦克风 | isMicrophoneAvailable(): boolean {
return this.microphoneStream?.isMicrophoneAvailable() || false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isMicrophoneAvailable 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 A... | isMicrophoneAvailable(): boolean {
return this.microphoneStream?.isMicrophoneAvailable() || false;
} | https://github.com/AlkaidLab/moonlight-harmony | 08a8e376f52e860521ef8b5f953b8f8145ccf97a | github |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | isComplexWord | 判断是否为复杂词 | private isComplexWord(word: string): boolean {
// 复杂词汇(长单词、专业词汇)
return word.length >= 10 || word.includes('-') || word.includes('_');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isComplexWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private isComplexWord(word: string): boolean {
// 复杂词汇(长单词、专业词汇)
return word.length >= 10 || word.includes('-') || word.includes('_');
} | https://github.com/CLMC2025/Vignette | 7cfc5dd1175205ab917a4c597057c5d73b94c629 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/DiffEngine.ets | arkts | make | ========== 工具 ========== | private static make(
la: number, lb: number, c: string, oc: string,
t: DiffType, s: CharSegment[] = []
): DiffLine {
return { lineNumberA: la, lineNumberB: lb, content: c, oldContent: oc, type: t, charSegments: s };
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left make AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left la AST#ide... | private static make(
la: number, lb: number, c: string, oc: string,
t: DiffType, s: CharSegment[] = []
): DiffLine {
return { lineNumberA: la, lineNumberB: lb, content: c, oldContent: oc, type: t, charSegments: s };
} | https://github.com/XJTUWYD/ArkDiff | 1727d93d2dc6a8a221f79b8dabd7ccfdf072fcda | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ModelCapabilityMatcher.ets | arkts | getLogoUrl | 获取模型的 models.dev logo URL,优先实时缓存,失败回退本地持久化索引 | getLogoUrl(modelId: string): string {
const onlineLogoUrl = this.getLogoUrlFromCache(modelId)
if (onlineLogoUrl !== '') {
this.recordModelLogo(modelId, onlineLogoUrl)
return onlineLogoUrl
}
return this.getPersistedLogoUrl(modelId)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLogoUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left modelId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig... | getLogoUrl(modelId: string): string {
const onlineLogoUrl = this.getLogoUrlFromCache(modelId)
if (onlineLogoUrl !== '') {
this.recordModelLogo(modelId, onlineLogoUrl)
return onlineLogoUrl
}
return this.getPersistedLogoUrl(modelId)
} | https://github.com/LongLiveY96/chatcube | 417c0b5acb8d394afdf32a96ded9f2044c9f048d | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/FootprintViewModel.ets | arkts | toGoodsDetail | 跳转商品详情
@param {number} goodsId - 商品 ID
@returns {void} 无返回值 | toGoodsDetail(goodsId: number): void {
GoodsNavigator.toDetail(goodsId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toGoodsDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#... | toGoodsDetail(goodsId: number): void {
GoodsNavigator.toDetail(goodsId);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 727cf8e5fb8a1f09c8ca4fe82911d1a92e9af10c | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | sendCachedIceCandidates | v42: 发送缓存的 ICE 候选给所有已知对端
在 peerRoomMap 更新后调用,确保 ICE 候选能发送给对端 | public sendCachedIceCandidates(): void {
if (this.cachedIceCandidates.length === 0) {
return;
}
if (this.peerRoomMap.size === 0) {
LogUtil.debug(`[WebRTC] v42 peerRoomMap 为空,暂不发送 ICE 候选`);
return;
}
if (!this.signaling) {
LogUtil.warn(`[WebRTC] v42 信令未初始化,无法发送 ICE 候选`);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendCachedIceCandidates 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... | public sendCachedIceCandidates(): void {
if (this.cachedIceCandidates.length === 0) {
return;
}
if (this.peerRoomMap.size === 0) {
LogUtil.debug(`[WebRTC] v42 peerRoomMap 为空,暂不发送 ICE 候选`);
return;
}
if (!this.signaling) {
LogUtil.warn(`[WebRTC] v42 信令未初始化,无法发送 ICE 候选`);
... | https://github.com/tdcare/tdwebrtc | 6eaa8b029bb459a3829071a4474ea80d9fab72f9 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets | arkts | getDiagonal | Get diagonal.
@returns | getDiagonal(): number {
return Math.hypot(this.getWidth(), this.getHeight());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDiagonal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_... | getDiagonal(): number {
return Math.hypot(this.getWidth(), this.getHeight());
} | https://gitee.com/openharmony/codelabs.git | fcc72cbab8169633654a98e6abb45c8cc6656b0a | gitee |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Row.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
RowSpaceEvenlyBottom() { Text("A"); Text("B"); Text("C"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | https://github.com/Joker-x-dev/CoolMallArkTS | 122f82253e55aaa39e35c0b5783700c102880f03 | github |
openharmony-sig/arkui_composite_component | source/TreeView/TreeView.ets | arkts | getListNodeDataSource | After the addNode interface is invoked,
this interface is used to obtain the initialization data of
the tree view component for creating a tree view component.
@return ListNodeDataSource Obtains the initialization data of the tree view component.
@since 10 | public getListNodeDataSource(): ListNodeDataSource {
return this.listNodeDataSource;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getListNodeDataSource 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 ... | public getListNodeDataSource(): ListNodeDataSource {
return this.listNodeDataSource;
} | https://gitee.com/openharmony-sig/arkui_composite_component.git | 38808c8fc51ea89d1e2c6e1e5e078f57a6aeccde | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/QuestionGenerator.ets | arkts | nextQuestion | Generate the next question, optionally avoiding a word that was just used.
Throws if the repository has fewer than `OPTIONS_PER_QUESTION` total words;
BattleEngine is expected to guard against this at startup. | nextQuestion(lastWordId?: string): Question {
const all: WordEntry[] = this.repo.all();
if (all.length < OPTIONS_PER_QUESTION) {
throw new Error(
`QuestionGenerator: repository has ${all.length} words, need at least ${OPTIONS_PER_QUESTION}`
);
}
const answerEntry: WordEntry = this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nextQuestion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lastWordId AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERRO... | nextQuestion(lastWordId?: string): Question {
const all: WordEntry[] = this.repo.all();
if (all.length < OPTIONS_PER_QUESTION) {
throw new Error(
`QuestionGenerator: repository has ${all.length} words, need at least ${OPTIONS_PER_QUESTION}`
);
}
const answerEntry: WordEntry = this... | https://github.com/terryma2024/happyword | fcfe5edec58878e6e7a1cc4c6b5c23d2df08fe27 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/yearlySpendingChart.ets | arkts | calculateYearlyData | 计算本年度消费金额(1月到12月) | calculateYearlyData(): void {
const now = new Date()
const currentYear = now.getFullYear()
// 初始化
this.yearlySpending = new Array(12).fill(0)
this.totalSpending = 0
this.chartTitle = `${currentYear}年`
// 统计本年度每月的消费
this.records.forEach((record: CoffeeRecord) => {
const recordDa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateYearlyData 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#statemen... | calculateYearlyData(): void {
const now = new Date()
const currentYear = now.getFullYear()
// 初始化
this.yearlySpending = new Array(12).fill(0)
this.totalSpending = 0
this.chartTitle = `${currentYear}年`
// 统计本年度每月的消费
this.records.forEach((record: CoffeeRecord) => {
const recordDa... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | b02b172cc9417d6b867f46ce095c5ee5a0b96134 | github |
dingzhilin1990/zhilinclaw | src/security/OAuthGateway.ets | arkts | getSessionStats | 获取会话统计 | public getSessionStats(): Record<string, any> {
return {
totalSessions: this.sessions.size,
providers: Array.from(this.sessions.keys()),
authenticated: this.getAuthenticatedProviders()
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSessionStats 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 getSessionStats(): Record<string, any> {
return {
totalSessions: this.sessions.size,
providers: Array.from(this.sessions.keys()),
authenticated: this.getAuthenticatedProviders()
};
} | https://github.com/dingzhilin1990/zhilinclaw | dd79b70a4b22d21bc1b1ae8bfa418027772e0722 | github |
OHPG/FinSdk | emby/src/main/ets/api/UserApi.ets | arkts | updateUser | updateUser
@summary Updates a user.
@param {UserApiUpdateUserRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UserApi | public async updateUser(requestParameters: UserApiUpdateUserRequest): Promise<void> {
let params: Record<string, string | undefined> = {
"userId": requestParameters.userId
}
return this.apiClient.post({ path: "/Users", parameters: params, data: requestParameters.userDto })
} | 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 updateUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#... | public async updateUser(requestParameters: UserApiUpdateUserRequest): Promise<void> {
let params: Record<string, string | undefined> = {
"userId": requestParameters.userId
}
return this.apiClient.post({ path: "/Users", parameters: params, data: requestParameters.userDto })
} | https://github.com/OHPG/FinSdk | 11d7aa207e0a1de9342417b86a9e6836950aa955 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Diagnostics/StartupDiagnostics.ets | arkts | logDiagnosticsReport | 输出诊断报告 | private logDiagnosticsReport(report: StartupDiagnosticsReport): void {
// 构建完整的诊断报告
const reportLines: string[] = [];
reportLines.push('📊 ========== 启动诊断报告 ==========');
reportLines.push(`⏱️ 总启动时间: ${report.totalStartupTime}ms`);
// 添加各阶段信息
if (report.phases.length > 0) {
reportLin... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left logDiagnosticsReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left report AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private logDiagnosticsReport(report: StartupDiagnosticsReport): void {
// 构建完整的诊断报告
const reportLines: string[] = [];
reportLines.push('📊 ========== 启动诊断报告 ==========');
reportLines.push(`⏱️ 总启动时间: ${report.totalStartupTime}ms`);
// 添加各阶段信息
if (report.phases.length > 0) {
reportLin... | https://github.com/DaLongZhuaZi/manxia | 36e48fbc4bc84518ffb3eedee6b4e06d84c8c965 | github |
HarmonyOS_Samples/BestPracticeSnippets | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | clearCache | Clear the cached data and reset the size of lruCache | public clearCache(): void {
this.lruCache.clear();
this.lruCache.updateCapacity(64);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | public clearCache(): void {
this.lruCache.clear();
this.lruCache.updateCapacity(64);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | e9f2b6944e42ef96b763c42348be47c091f693d6 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/ScoreService.ets | arkts | calculateLevel | 计算等级(根据总经验值) | public calculateLevel(totalExp: number): number {
return Math.floor(totalExp / LevelConfig.EXP_PER_LEVEL) + 1;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calculateLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left totalExp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public calculateLevel(totalExp: number): number {
return Math.floor(totalExp / LevelConfig.EXP_PER_LEVEL) + 1;
} | https://github.com/the-wwyang/kids-learning-app | 8fe26909edef44c13fe5474dd0950abb999041a8 | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/database/BillDatabase.ets | arkts | queryBillsByCategory | 按分类查询账单 | async queryBillsByCategory(category: string): Promise<BillModel[]> {
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME);
predicates.equalTo('category', category);
predicates.orderByDesc('date'... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryBillsByCategory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left category AST#identifier#... | async queryBillsByCategory(category: string): Promise<BillModel[]> {
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME);
predicates.equalTo('category', category);
predicates.orderByDesc('date'... | https://github.com/qiuhaotc/HarmonyOSPlayground | 187c64c48a5b5b60a3550bc6a859c0b30a9d55c8 | github |
XHXYT/Pixark | entry/src/main/ets/entryability/EntryAbility.ets | arkts | initAppStateAndAuth | 初始化账号状态与授权逻辑 (决定进入主页还是登录页) | private async initAppStateAndAuth() {
// 标记进入初始化阶段
PixState.isLoading = true;
PixState.isInitializing = true;
// 初始化账号信息 (仅读取本地,速度极快)
await this.initAccounts()
// 只要本地有账号,立即关闭 Loading,优先渲染出主界面
if (pixiv.isLogin()) {
PixState.isLoggedIn = true;
const currentUser = pixiv.getCur... | 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 initAppStateAndAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async initAppStateAndAuth() {
// 标记进入初始化阶段
PixState.isLoading = true;
PixState.isInitializing = true;
// 初始化账号信息 (仅读取本地,速度极快)
await this.initAccounts()
// 只要本地有账号,立即关闭 Loading,优先渲染出主界面
if (pixiv.isLogin()) {
PixState.isLoggedIn = true;
const currentUser = pixiv.getCur... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/entryability/EntryAbility.ets#L142-L174 | 246f13ff98d11437a7fa5731e3b7b6ae72b70451 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | onMessage | 订阅消息
@param callback | public onMessage(callback: (data: string) => void): void {
this.mSocket?.setOnMessageReceivedListener((buffer: ArrayBuffer) => {
// 获取数据 解析
let data = this.decodeMsg(buffer);
callback(data);
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left onMessage AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Rig... | public onMessage(callback: (data: string) => void): void {
this.mSocket?.setOnMessageReceivedListener((buffer: ArrayBuffer) => {
// 获取数据 解析
let data = this.decodeMsg(buffer);
callback(data);
});
} | https://github.com/openharmony/applications_app_samples | b2e9f4c288eec28fbb12030a44dd8b22b8cc1c26 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/LearningRecorder.ets | arkts | snapshotVersionForTest | Test seam — assert the snapshot version after recordAnswer ran. | snapshotVersionForTest(): number {
return this.snapshot.version;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left snapshotVersionForTest 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... | snapshotVersionForTest(): number {
return this.snapshot.version;
} | https://github.com/terryma2024/happyword | 52729c05c19cc676742cf13a66c015eb1b7e0618 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/FTPHandler.ets | arkts | uploadTo | 上传本地文件到远程 | public async uploadTo(localPath: string, remotePath: string): Promise<void> {
if (!this.client) {
throw new Error('FTP client is not connected');
}
hilog.info(DOMAIN, TAG, `Uploading ${localPath} to ${remotePath}`);
await this.client.uploadFrom(localPath, remotePath).then(result=>{
hilog.i... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left uploadTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left localPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | public async uploadTo(localPath: string, remotePath: string): Promise<void> {
if (!this.client) {
throw new Error('FTP client is not connected');
}
hilog.info(DOMAIN, TAG, `Uploading ${localPath} to ${remotePath}`);
await this.client.uploadFrom(localPath, remotePath).then(result=>{
hilog.i... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPHandler.ets#L91-L100 | ac2fcd9443b8412b5e65e4ad7953d2b12213256f | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/model/ReminderHelper.ets | arkts | publishReminder | 发布一个重复的闹钟提醒
@param title 提醒标题 (习惯名称)
@param hour 小时
@param minute 分钟
@returns Promise<number> 返回提醒ID | static async publishReminder(title: string, hour: number, minute: number): Promise<number> {
const now = new Date();
const reminderTime = new Date();
reminderTime.setHours(hour, minute, 0, 0);
let isTomorrow = false;
if (reminderTime <= now) {
reminderTime.setDate(reminderTime.getDate() + 1... | 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 publishReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : ... | static async publishReminder(title: string, hour: number, minute: number): Promise<number> {
const now = new Date();
const reminderTime = new Date();
reminderTime.setHours(hour, minute, 0, 0);
let isTomorrow = false;
if (reminderTime <= now) {
reminderTime.setDate(reminderTime.getDate() + 1... | https://gitcode.com/openharmony/codelabs | 738e2412d68e803eea14b0515c72f1dc2d0d6a84 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/services/BinaryFileHandler.ets | arkts | getRecommendedAction | 获取二进制文件推荐操作 | static getRecommendedAction(filePath: string): string {
if (this.isBinaryByExtension(filePath)) {
return 'metadata_only'; // 仅元数据对比
}
return 'text_diff'; // 文本对比
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRecommendedAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | static getRecommendedAction(filePath: string): string {
if (this.isBinaryByExtension(filePath)) {
return 'metadata_only'; // 仅元数据对比
}
return 'text_diff'; // 文本对比
} | https://github.com/XJTUWYD/ArkDiff | 1060d22d168a47dd7c4a46e7e14ea92fc7f26b73 | github |
erosTeam/NextE | shared/src/main/ets/settings/CookieJarSettings.ets | arkts | restore | Restore the persisted bundle into the jar + AuthState at startup (best-effort). | static async restore(context: common.UIAbilityContext): Promise<void> {
try {
const store: preferences.Preferences = await preferences.getPreferences(
context,
StorageKeys.STORE_SETTINGS,
)
const serialized: string = store.getSync(StorageKeys.COOKIE_JAR, '') as string
if (s... | 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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#... | static async restore(context: common.UIAbilityContext): Promise<void> {
try {
const store: preferences.Preferences = await preferences.getPreferences(
context,
StorageKeys.STORE_SETTINGS,
)
const serialized: string = store.getSync(StorageKeys.COOKIE_JAR, '') as string
if (s... | https://github.com/erosTeam/NextE | 0babfd47f40d01549169a2aabfec61857969dffa | github |
LiHuaJZOAQ/GuardSysAPP | entry/src/main/ets/pages/SettingsPage.ets | arkts | toggleAutoReport | ---- 自动上报 ---- | toggleAutoReport(): void {
if (this.autoReport) {
this.stopAutoReport();
} else {
this.startAutoReport();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleAutoReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressio... | toggleAutoReport(): void {
if (this.autoReport) {
this.stopAutoReport();
} else {
this.startAutoReport();
}
} | https://github.com/LiHuaJZOAQ/GuardSysAPP | 6c077b5410cd05460c1e30a8b486b3502babf9c4 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ai/AIOrchestrator.ets | arkts | routeToCozeBot | 智能路由到Coze Bot | private async routeToCozeBot(query: string, specialty: string, userId: string): Promise<string> {
switch (specialty.toLowerCase()) {
case 'internal':
case '内科':
return cozeApiClient.consultInternalMedicine(query, request.data?.patientInfo || {});
case 'ophthalmology':
case '眼科':
... | 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 routeToCozeBot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left ... | private async routeToCozeBot(query: string, specialty: string, userId: string): Promise<string> {
switch (specialty.toLowerCase()) {
case 'internal':
case '内科':
return cozeApiClient.consultInternalMedicine(query, request.data?.patientInfo || {});
case 'ophthalmology':
case '眼科':
... | https://github.com/LJ666-ui/harmony-health-care | 12417bf214df9f1c40836ce35a0f2a1831190511 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistoryEntry.ets | arkts | toString | Converts this meowHistory entry to a string representation.
@returns The string representation of the meowHistory entry. | toString(): string {
// trim if too long
if (this.url.length > 32) this.url = this.url.substring(0, 32) + ' ...';
if (this.title.length > 32) this.title = this.title.substring(0, 32) + ' ...';
return `[${this.url}] ${this.title} @ ${this.time} (${new Date(this.time).toLocaleString()})`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | toString(): string {
// trim if too long
if (this.url.length > 32) this.url = this.url.substring(0, 32) + ' ...';
if (this.title.length > 32) this.title = this.title.substring(0, 32) + ' ...';
return `[${this.url}] ${this.title} @ ${this.time} (${new Date(this.time).toLocaleString()})`;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 6a48b7a7b78f750358fd358d99e31d39bf40a994 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setHoleColor | Sets the color for the hole that is drawn in the center of the PieChart
(if enabled).
@param color | public setHoleColor(color: number): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHoleColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public setHoleColor(color: number): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0112964d65e07618bfa2fb53180a6369abce00f9 | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/PlanService.ets | arkts | updatePlanProgress | 更新计划进度 | async updatePlanProgress(plan: Plan): Promise<void> {
if (plan.status === PlanStatus.COMPLETED || plan.status === PlanStatus.CANCELLED) {
return; // 已完成或已取消的计划不再更新进度
}
// 检查计划是否已过期
if (plan.isExpired()) {
plan.status = PlanStatus.COMPLETED;
plan.completionRate = 100;
return;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updatePlanProgress AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left plan AST#identifier#Right ... | async updatePlanProgress(plan: Plan): Promise<void> {
if (plan.status === PlanStatus.COMPLETED || plan.status === PlanStatus.CANCELLED) {
return; // 已完成或已取消的计划不再更新进度
}
// 检查计划是否已过期
if (plan.isExpired()) {
plan.status = PlanStatus.COMPLETED;
plan.completionRate = 100;
return;
... | https://gitcode.com/openharmony/codelabs | 2a28056040935677326d96f21850ff5a5d887376 | gitcode |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/BaseEventUtil.ets | arkts | clearEvent | 清除指定事件的所有监听器
@param eventName 事件名称 | clearEvent(eventName: string): void {
this.off(eventName)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#R... | clearEvent(eventName: string): void {
this.off(eventName)
} | https://github.com/Yebingiscn/SweetVideo | 054c94f4baaa75be58a6134160e7e6d5c7b2f85c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Returns index of specified element
@param e search element
@param fromIndex start index to search from
@returns index of element if it presents, -1 otherwise
public | /* public */ internal indexOf(e: number, fromIndex: int): int {
throw new Error("not implemented")
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left indexOf AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#... | /* public */ internal indexOf(e: number, fromIndex: int): int {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 056a6d1a83f47d1a14673ad6abaeeba2675936c7 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test38_original_index.ets | arkts | testComputedKeys | --- Object property enumeration with computed keys --- | function testComputedKeys(): string {
let fields: string[] = ['name', 'age', 'city'];
let data: Record<string, string> = {};
for (let i: number = 0; i < fields.length; i++) {
let key: string = fields[i];
if (key === 'name') {
data[key] = 'Alice';
} else if (key === 'age') {
data[key] = '30... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testComputedKeys 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... | function testComputedKeys(): string {
let fields: string[] = ['name', 'age', 'city'];
let data: Record<string, string> = {};
for (let i: number = 0; i < fields.length; i++) {
let key: string = fields[i];
if (key === 'name') {
data[key] = 'Alice';
} else if (key === 'age') {
data[key] = '30... | https://github.com/miaochiahao/ark-ghidra | e2bb00616241d74bdf23948fa3bd8163316668f5 | github |
jjjjjjava/ffmpeg_tools | example/BasicUsage.ets | arkts | remux | ============================================================
零拷贝(最快)
============================================================
封装格式转换 | remux(): void {
const cmd = FFmpegFactory.remux('/input.mp4', '/output.mkv', ContainerFormat.MKV);
this.run(cmd);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left remux AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | remux(): void {
const cmd = FFmpegFactory.remux('/input.mp4', '/output.mkv', ContainerFormat.MKV);
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools | 648da76871459d6417ac5a5f44fffd59987b86d4 | github |
openharmony/applications_mms | entry/src/main/ets/utils/MmsPreferences.ets | arkts | asyncGetValueFromPreferences | Async get value from preferences | async asyncGetValueFromPreferences(key: string): Promise<string> {
if (this.preferences == null) {
HiLog.i(TAG, `asyncGetValueByKeyFromPreferences preferences is null`);
return common.string.EMPTY_STR;
}
let getPromise = this.preferences.get(key, common.string.EMPTY_STR);
getPromise.then((... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left asyncGetValueFromPreferences AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifi... | async asyncGetValueFromPreferences(key: string): Promise<string> {
if (this.preferences == null) {
HiLog.i(TAG, `asyncGetValueByKeyFromPreferences preferences is null`);
return common.string.EMPTY_STR;
}
let getPromise = this.preferences.get(key, common.string.EMPTY_STR);
getPromise.then((... | https://gitee.com/openharmony/applications_mms.git | d28aafcf3fbfc01753bf3b6ba6f11de1386823c5 | gitee |
openharmony-sig/ohos_react_native | tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNAbility.ets | arkts | onWindowSetup | Override this method if you want to specify screen orientation, window dimensions etc. | protected async onWindowSetup(window: window.Window) {
// NOTE: disabling full screen breaks the SafeAreaView component
await window.setWindowLayoutFullScreen(true)
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left onWindowSetup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left window AST#identifier#Right AST#:... | protected async onWindowSetup(window: window.Window) {
// NOTE: disabling full screen breaks the SafeAreaView component
await window.setWindowLayoutFullScreen(true)
} | https://gitee.com/openharmony-sig/ohos_react_native.git | 6e0afe2f1da22c42dee04d3d963349da04078b98 | gitee |
kumaleap/ArkLuban | library/src/main/ets/luban/Luban.ets | arkts | setOnStart | 设置压缩开始回调函数
@param callback 开始压缩时的回调函数
@returns 构建器实例 | setOnStart(callback: () => void): LubanBuilder {
this.config.onStart = callback;
return this;
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left setOnStart AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#... | setOnStart(callback: () => void): LubanBuilder {
this.config.onStart = callback;
return this;
} | https://github.com/kumaleap/ArkLuban | 6312ba201242adfa938dbb52964609749a5ac7ed | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoader.ets | arkts | loadOneToMany | 加载 ONE_TO_MANY 关联数据
根据主实体的主键值查询关联实体列表
@param entities 主实体数据数组
@param relation 关联关系元数据
@returns 带有关联数据的实体数组 | private async loadOneToMany(
entities: Array<EntityData>,
relation: RelationMetadata,
options: RelationQueryOptions | null = null
): Promise<Array<EntityData>> {
return await this.coreRelationSupport.loadOneToMany(entities, relation, options)
} | 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 loadOneToMany AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left entities AST#identif... | private async loadOneToMany(
entities: Array<EntityData>,
relation: RelationMetadata,
options: RelationQueryOptions | null = null
): Promise<Array<EntityData>> {
return await this.coreRelationSupport.loadOneToMany(entities, relation, options)
} | https://github.com/offlinecat-dev/OCNetORM | d6a2e429bc20213582c441d0268302c957184fcb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new BooleanBox instance with an initial value of false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.value = false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.value = false;
} | https://gitcode.com/iop123123/arkts-static-skills | aa0dceb6980ecd8d944d8cf69fbe3254cb83236b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | getAvailableSuwayomiSources | 获取可用的Suwayomi扩展源列表 | async getAvailableSuwayomiSources(): Promise<SuwayomiExtensionSource[]> {
try {
if (!this.suwayomiExecutor.isConfigured()) {
return [];
}
return await this.suwayomiExecutor.getAvailableSources();
} catch (error) {
logger.error(TAG, `获取Suwayomi源失败: ${error}`);
return [];
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAvailableSuwayomiSources 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#:#Ri... | async getAvailableSuwayomiSources(): Promise<SuwayomiExtensionSource[]> {
try {
if (!this.suwayomiExecutor.isConfigured()) {
return [];
}
return await this.suwayomiExecutor.getAvailableSources();
} catch (error) {
logger.error(TAG, `获取Suwayomi源失败: ${error}`);
return [];
... | https://github.com/DaLongZhuaZi/manxia | a28655f292e81cc754cb25c17e01a9b8d5043e04 | github |
openharmony-sig/amountinputtext | libamountinput/src/main/ets/widget/AmountInputKeyboardView.ets | arkts | isVIEW4X4 | 是否4*4布局 | isVIEW4X4() {
return this.keyboardViewAttribute.keyboardViewType == KeyboardViewType.VIEW4X4;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isVIEW4X4 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | isVIEW4X4() {
return this.keyboardViewAttribute.keyboardViewType == KeyboardViewType.VIEW4X4;
} | https://gitee.com/openharmony-sig/amountinputtext.git | 53469754b6432668611aa8951c972372e0630e44 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | titleTopCanShift | In free window mode, and title top (major) area is empty, and is in wide mode then is true. | get titleTopCanShift() {
return this.titleTopEmpty && getCreateMyApp().freeWindow && this.myLayout.wideMode;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left titleTopCanShift 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#{... | get titleTopCanShift() {
return this.titleTopEmpty && getCreateMyApp().freeWindow && this.myLayout.wideMode;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | adb04f06ef6be62c85c97c660407a9f845951bcc | github |
HarmonyOS_Samples/MusicHome | products/watch/src/main/ets/watchability/WatchAbility.ets | arkts | onForeground | Logs transition to foreground. | onForeground(): void {
Logger.info('WatchAbility: Ability onForeground');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | onForeground(): void {
Logger.info('WatchAbility: Ability onForeground');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 060da30fd916286572870c9aba0ff7dd3d0b4f44 | gitcode |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/aiinsight/AIInsightState.ets | arkts | prepareContent | ---- 私有方法 ---- | private prepareContent(ideas: Idea[]): string {
const recent = ideas.slice(0, 20);
const lines: string[] = [];
recent.forEach((idea: Idea, index: number) => {
const title = idea.title.length > 0 ? `【${idea.title}】` : '';
const content = idea.content.length > 200 ? idea.content.substring(0, 200... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left prepareContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ideas AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_exp... | private prepareContent(ideas: Idea[]): string {
const recent = ideas.slice(0, 20);
const lines: string[] = [];
recent.forEach((idea: Idea, index: number) => {
const title = idea.title.length > 0 ? `【${idea.title}】` : '';
const content = idea.content.length > 200 ? idea.content.substring(0, 200... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/aiinsight/AIInsightState.ets#L426-L435 | 872735bfd64b29b39abf914e855e6ee7c2e8476a | github |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/WeeklyBillListSectionComponent.ets | arkts | DeleteSwipeBuilder | 构建右滑删除操作按钮。 | private DeleteSwipeBuilder(billId: number) {
DeleteSwipeButtonComponent({
onDelete: () => {
this.onDeleteBill(billId);
}
})
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left DeleteSwipeBuilder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private DeleteSwipeBuilder(billId: number) {
DeleteSwipeButtonComponent({
onDelete: () => {
this.onDeleteBill(billId);
}
})
} | https://github.com/ZestBox-18/kitebook-frontend | 2017f7345347191e5ff16e9ac559b920c66ad800 | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/ThemeUtil.ets | arkts | addThemeChangeListener | 添加主题变更监听器 | static addThemeChangeListener(listener: (theme: ThemeType) => void): void {
ThemeUtil.listeners.push(listener);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left addThemeChangeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Lef... | static addThemeChangeListener(listener: (theme: ThemeType) => void): void {
ThemeUtil.listeners.push(listener);
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | e1bdd8b923e8db4d6eefd15e732661d1586b93a3 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | previous | 上一首 // | previous() {
// 防0检测 //
if (this.play_list.length == 0) {return}
// 随机模式
if (this.play_mode == 3) {
// 防1死锁 //
if (this.play_list.length == 1) {this.set_audio(); return}
// 随机抽取 //
let random_index = 0
while (true) {
random_index = Math.floor(Math.random() * t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left previous AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // 防0检测 // AST#... | previous() {
// 防0检测 //
if (this.play_list.length == 0) {return}
// 随机模式
if (this.play_mode == 3) {
// 防1死锁 //
if (this.play_list.length == 1) {this.set_audio(); return}
// 随机抽取 //
let random_index = 0
while (true) {
random_index = Math.floor(Math.random() * t... | https://github.com/Nekofox-POT/LinMusic | f06a78f29f659724003b23ad226e79d177a93b5a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | getBigUint64 | === Uint64 ===
Read bytes as they represent given type
@param { int } byteOffset zero index to read
@returns { int } return byteOffset's BigUint64 value
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getBigUint64(byteOffset: int): bigint {
return this.getBigUint64Big(byteOffset)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBigUint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#ident... | public getBigUint64(byteOffset: int): bigint {
return this.getBigUint64Big(byteOffset)
} | https://gitcode.com/iop123123/arkts-static-skills | d429438afbc534ff339e807c7a46691b4b1d9d2a | gitcode |
zmuxuny/ai-guardian-star | entry/src/main/ets/database/DatabaseHelper.ets | arkts | _deleteVideosBefore | 内部:删除 recordTime 早于 beforeTs 的视频记录(返回删除条数) | private async _deleteVideosBefore(beforeTs: number): Promise<number> {
const predicates = new relationalStore.RdbPredicates("t_video_record");
predicates.lessThan("record_time", beforeTs);
try {
const rows = await this.getStore().delete(predicates);
if (rows > 0) hilog.info(DOMAIN, TAG, `滚动清理视... | 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 _deleteVideosBefore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left beforeTs AST#identifier#Right AST#ERROR#Left AST... | private async _deleteVideosBefore(beforeTs: number): Promise<number> {
const predicates = new relationalStore.RdbPredicates("t_video_record");
predicates.lessThan("record_time", beforeTs);
try {
const rows = await this.getStore().delete(predicates);
if (rows > 0) hilog.info(DOMAIN, TAG, `滚动清理视... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L683-L695 | 5906f91b0ab63fb59e12929f75be30f7654fb8c7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | clearPage | 清除指定页面的状态 | clearPage(pageIndex: number): void {
this.removeFromQueue(pageIndex);
this.loading.delete(pageIndex);
this.completed.delete(pageIndex);
this.failed.delete(pageIndex);
this.pageStatusMap.delete(pageIndex);
this.updateDebugInfo();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | clearPage(pageIndex: number): void {
this.removeFromQueue(pageIndex);
this.loading.delete(pageIndex);
this.completed.delete(pageIndex);
this.failed.delete(pageIndex);
this.pageStatusMap.delete(pageIndex);
this.updateDebugInfo();
} | https://github.com/DaLongZhuaZi/manxia | c97c786685486144025ddf41fbbf55ae62f56842 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets | arkts | init | 初始化偏好设置存储 | async init(): Promise<void> {
try {
await this.dao.init();
} catch (err) {
const error = err instanceof Error ? err : new Error(String(err));
Logger.error(this.LOG_TAG, `Failed to initialize preference repository: ${error.message}`);
throw error;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Le... | async init(): Promise<void> {
try {
await this.dao.init();
} catch (err) {
const error = err instanceof Error ? err : new Error(String(err));
Logger.error(this.LOG_TAG, `Failed to initialize preference repository: ${error.message}`);
throw error;
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | 0649c29bd898081111388023d467db54727809d3 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | writeInt32LE | Writes a signed 32-bit integer to the buffer at the specified offset using little-endian format
@param {long} value - Value to write
@param {int} [offset=0] - Number of bytes to skip before writing
@returns {int} Offset plus the number of bytes written | public writeInt32LE(value: long, offset: int = 0): int {
this.checkOffset(offset, 4);
this.checkValue(value, (-Math.pow(2, 31).toLong()), (Math.pow(2, 31).toLong() - 1), (-Math.pow(2, 31)).toString(), (Math.pow(2, 31) - 1).toString());
this.getDataView().setInt32(offset, valu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeInt32LE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifie... | public writeInt32LE(value: long, offset: int = 0): int {
this.checkOffset(offset, 4);
this.checkValue(value, (-Math.pow(2, 31).toLong()), (Math.pow(2, 31).toLong() - 1), (-Math.pow(2, 31)).toString(), (Math.pow(2, 31) - 1).toString());
this.getDataView().setInt32(offset, valu... | https://gitcode.com/iop123123/arkts-static-skills | 7c323e9324fd69e225b1b97e98fffe7a4177912c | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/AnswerValidator.ets | arkts | isValidInput | 判断答案输入是否有效
@param answer 答案字符串
@param questionType 题目类型
@returns 是否有效 | static isValidInput(answer: string, questionType: QuestionType): boolean {
if (!answer || answer === '') {
return false;
}
// 比较题只接受比较符号
if (questionType === QuestionType.COMPARISON) {
return answer === '>' || answer === '=' || answer === '<';
}
// 其他题型只接受数字
return /^\d+$/.te... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left answer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | static isValidInput(answer: string, questionType: QuestionType): boolean {
if (!answer || answer === '') {
return false;
}
// 比较题只接受比较符号
if (questionType === QuestionType.COMPARISON) {
return answer === '>' || answer === '=' || answer === '<';
}
// 其他题型只接受数字
return /^\d+$/.te... | https://github.com/the-wwyang/kids-learning-app | a1e49572c2e248a672d2b1de8ba4994e43d06acf | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/RAGRetriever.ets | arkts | embed | 文本向量化
@param text 文本内容
@returns 向量表示 | async embed(text: string): Promise<number[]> {
// 检查缓存
if (this.config.enableCache && this.embeddingCache.has(text)) {
return this.embeddingCache.get(text)!;
}
// 模拟向量化(实际项目中应调用Embedding模型)
const vector = this.simulateEmbedding(text);
// 存入缓存
if (this.config.enableCache) {
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 embed AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right AST#type_anno... | async embed(text: string): Promise<number[]> {
// 检查缓存
if (this.config.enableCache && this.embeddingCache.has(text)) {
return this.embeddingCache.get(text)!;
}
// 模拟向量化(实际项目中应调用Embedding模型)
const vector = this.simulateEmbedding(text);
// 存入缓存
if (this.config.enableCache) {
th... | https://github.com/LJ666-ui/harmony-health-care | 4aec322e2badcafd38f7753b55ce7cca500e4fc1 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | getFieldName | 获取字段名(如果没有映射,返回 "field_N") | private getFieldName(fieldNumber: number): string {
const name = this.fieldNames.get(fieldNumber)
if (name !== undefined) {
return name
}
// 临时实现:使用 field_N 作为字段名
return `field_${fieldNumber}`
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFieldName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fieldNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | private getFieldName(fieldNumber: number): string {
const name = this.fieldNames.get(fieldNumber)
if (name !== undefined) {
return name
}
// 临时实现:使用 field_N 作为字段名
return `field_${fieldNumber}`
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | b671e93cb8109f8ad1cfa28d541671ab077ec450 | gitcode |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | addExpression | add expression
@param pButton PhysicsButtonInfo
@param callBack Function | addExpression(callBack: Function, pButton?: PhysicsButtonInfo, pValue?: string): void {
if (this.calculatorState !== CalculatorState.RESULT) {
this.calculatorState = AppStorage.get('calculatorState') || CalculatorState.ERROR;
}
if (this.calculatorState === CalculatorState.RESULT && this.result !== '... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addExpression AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callBack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#,#Le... | addExpression(callBack: Function, pButton?: PhysicsButtonInfo, pValue?: string): void {
if (this.calculatorState !== CalculatorState.RESULT) {
this.calculatorState = AppStorage.get('calculatorState') || CalculatorState.ERROR;
}
if (this.calculatorState === CalculatorState.RESULT && this.result !== '... | https://gitee.com/openharmony-sig/applications_calculator.git | ffd45ff8bf03be39531effe505fa1947c4aa407e | gitee |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/clog/Clog.ets | arkts | getCombinedFilePath | 返回汇总日志文件路径(包含 info/warn/error 的合并内容)
未配置保存目录时返回 undefined | private static getCombinedFilePath(): string | undefined {
if (!Clog.SAVE_DIR) {
return undefined;
}
return `${Clog.SAVE_DIR}/clog_all.json`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCombinedFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | private static getCombinedFilePath(): string | undefined {
if (!Clog.SAVE_DIR) {
return undefined;
}
return `${Clog.SAVE_DIR}/clog_all.json`;
} | https://github.com/ZestBox-18/kitebook-frontend | caef5bbb6ec9ea2ad4eed0e3072106713f3b6dec | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | getMaxSizePercent | The maximum relative size out of the whole chart view. / If the legend is
to the right/left of the chart, then this affects the width of the
legend. / If the legend is to the top/bottom of the chart, then this
affects the height of the legend. / If the legend is the center of the
piechart, then this defines the size of... | public getMaxSizePercent(): number {
return this.mMaxSizePercent;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMaxSizePercent 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 A... | public getMaxSizePercent(): number {
return this.mMaxSizePercent;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | cbfdede64a585c637132d15aed60e65e1c36f8a2 | gitee |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityUsage/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | [StartExclude onWindowStageCreate] | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 获取UIAbility实例的上下文
let context = this.context;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 获取UIAbility实例的上下文
let context = this.context;
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | cfcd1a52cdd58ed701bc68087f89c007f85f6607 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/webdav/WebDAVStorage.ets | arkts | closeClient | 关闭 WebDAV 客户端连接 | private closeClient() {
if (this.client) {
try {
this.client.close();
} catch (e) {
hilog.warn(DOMAIN, TAG, 'Close old WebDAV client error: %{public}s', e?.message);
}
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left closeClient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private closeClient() {
if (this.client) {
try {
this.client.close();
} catch (e) {
hilog.warn(DOMAIN, TAG, 'Close old WebDAV client error: %{public}s', e?.message);
}
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/webdav/WebDAVStorage.ets#L48-L56 | 64df813d1159ec33c82b59bbe2a34038352fa3f2 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/PersistedUriManager.ets | arkts | isSupported | 检查设备是否支持持久化权限 | public static isSupported(): boolean {
return canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization');
} | 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 isSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static isSupported(): boolean {
return canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization');
} | https://github.com/richshaw2015/nds | a309fb51fc4eaff5407b7f5184fa4c74ff15889e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | getLocalCachePath | 获取本地缓存的图片路径 | getLocalCachePath(): string {
return this.localCachePath;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLocalCachePath 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#stat... | getLocalCachePath(): string {
return this.localCachePath;
} | https://github.com/AlkaidLab/moonlight-harmony | 60d0490257681a6017b7badffa3778774ce8a44d | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/LoginStateManager.ets | arkts | initDatabase | 初始化数据库表 | private async initDatabase(): Promise<void> {
if (!this.context) return;
const config: relationalStore.StoreConfig = {
name: 'login_state.db',
securityLevel: relationalStore.SecurityLevel.S1
};
this.rdbStore = await relationalStore.getRdbStore(this.context, config);
const sqlCreateT... | 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 initDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | private async initDatabase(): Promise<void> {
if (!this.context) return;
const config: relationalStore.StoreConfig = {
name: 'login_state.db',
securityLevel: relationalStore.SecurityLevel.S1
};
this.rdbStore = await relationalStore.getRdbStore(this.context, config);
const sqlCreateT... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 54764a10f3f75539bb428c60aa9c9774d02b5f8c | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | readableHighWatermark | Returns the value of highWatermark passed when creating this Readable. | get readableHighWatermark(): int {
return this.readableHighWatermarkInner;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left readableHighWatermark 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#i... | get readableHighWatermark(): int {
return this.readableHighWatermarkInner;
} | https://gitcode.com/iop123123/arkts-static-skills | d102eb0bd42b8846380c6fde82c10b8e27f7c012 | gitcode |
smarthane/DrawerLayout | DrawerLayout/src/main/ets/components/DrawerLayout.ets | arkts | getDeviceHeight | 获取屏幕高度
@param dpi
@returns | public static getDeviceHeight(dpi?: number): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI);
... | 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 getDeviceHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dpi AST#identifier#Right AST#?#Left ? A... | public static getDeviceHeight(dpi?: number): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI);
... | https://github.com/smarthane/DrawerLayout | 3f4cb667bdd8c3cbc963d5e7e891d5d8816498fa | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/FuzzyMatchUtil.ets | arkts | fuzzyMatchKeywordWithoutWeight | match intents one by one, returns <string>id of best matched page.
@param stringParam param got from Xiaoyi
@param userOriText the whole sentence that user inputted to Xiaoyi
@param matchThreshold
@returns | public static fuzzyMatchKeywordWithoutWeight(stringParam: string,
userOriText: string = '', defaultIdx?: number): IntentJsonEnumDetail | undefined {
Logger.info(TAG_FM, `@fuzzyMatchKeywordWithoutWeight stringParam: ${stringParam}`);
const intentPageList =
RawfileIO.loadJsonObject('pages_keywords_li... | 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 fuzzyMatchKeywordWithoutWeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stringParam AST#identifier#Right AST#ER... | public static fuzzyMatchKeywordWithoutWeight(stringParam: string,
userOriText: string = '', defaultIdx?: number): IntentJsonEnumDetail | undefined {
Logger.info(TAG_FM, `@fuzzyMatchKeywordWithoutWeight stringParam: ${stringParam}`);
const intentPageList =
RawfileIO.loadJsonObject('pages_keywords_li... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 58b4521319091327b8e3f43a31f9459f2e479f22 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryCache.ets | arkts | configure | 配置缓存
@param config 缓存配置 | configure(config: QueryCacheConfig): void {
if (config.maxSize !== undefined) {
this.maxSize = config.maxSize
}
if (config.ttlMs !== undefined) {
this.ttlMs = config.ttlMs
}
if (config.enabled !== undefined) {
this.enabled = config.enabled
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left configure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left QueryCacheConfig AST#identifier#Right AST#)#... | configure(config: QueryCacheConfig): void {
if (config.maxSize !== undefined) {
this.maxSize = config.maxSize
}
if (config.ttlMs !== undefined) {
this.ttlMs = config.ttlMs
}
if (config.enabled !== undefined) {
this.enabled = config.enabled
}
} | https://github.com/offlinecat-dev/OCNetORM | 02a00e5d5e8f693142916427976ae3534fda6df8 | github |
openharmony/codelabs | ETSUI/SimpleCalculator/entry/src/main/ets/common/util/CalculateUtil.ets | arkts | calResult | Calculation result.
@param arg1 Number 1.
@param arg2 Number 2.
@param symbol Operators.
@return Calculation result. | calResult(arg1: string, arg2: string, symbol: string): string {
if (CheckEmptyUtil.isEmpty(arg1) || CheckEmptyUtil.isEmpty(arg2) || CheckEmptyUtil.isEmpty(symbol)) {
return 'NaN';
}
let result = 0;
switch (symbol) {
case CommonConstants.ADD:
result = this.add(arg1, arg2, CommonCons... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arg1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,... | calResult(arg1: string, arg2: string, symbol: string): string {
if (CheckEmptyUtil.isEmpty(arg1) || CheckEmptyUtil.isEmpty(arg2) || CheckEmptyUtil.isEmpty(symbol)) {
return 'NaN';
}
let result = 0;
switch (symbol) {
case CommonConstants.ADD:
result = this.add(arg1, arg2, CommonCons... | https://gitee.com/openharmony/codelabs.git | 0bd976dca6c3bdaa0a9e19b881cebbc1b19e7dbf | gitee |
richshaw2015/nds | ohos/entry/src/test/BiosValidatorProperty.test.ets | arkts | validateDirectoryTestable | Testable validateDirectory - mirrors BiosValidator.validateDirectory | function validateDirectoryTestable(
consoleType: 'ds' | 'dsi',
dirPath: string,
requiredFiles: Array<[string, number[]]>
): BiosValidationResult {
if (!dirPath) {
return { consoleType, status: BiosValidationStatus.UNSET, files: [] };
}
const files: BiosFileResult[] = [];
let allValid = true;
for (... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left validateDirectoryTestable AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left consoleType AST#identifier#Right AST#type_annotation#Left AS... | function validateDirectoryTestable(
consoleType: 'ds' | 'dsi',
dirPath: string,
requiredFiles: Array<[string, number[]]>
): BiosValidationResult {
if (!dirPath) {
return { consoleType, status: BiosValidationStatus.UNSET, files: [] };
}
const files: BiosFileResult[] = [];
let allValid = true;
for (... | https://github.com/richshaw2015/nds | a556ef0de91abe74ff672226918b42a1a8a6ee25 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | forEach | Executes a provided function once for each list element.
@param callbackfn - The function to execute on each element, taking the value, index, and List as arguments. | public forEach(callbackfn: ListForEachCb<T>): void {
this.buffer.forEach((value: T, index: int) => {
callbackfn(value, index, 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: ListForEachCb<T>): void {
this.buffer.forEach((value: T, index: int) => {
callbackfn(value, index, this);
})
} | https://gitcode.com/iop123123/arkts-static-skills | d7c9a3b66777a1af11bf48b5f7b3588b8e1b20b7 | gitcode |
OHPG/FinMusic | entry/src/main/ets/player/AppPlayer.ets | arkts | extractCacheKey | 从流地址中提取 cacheKey。
优先提取 Jellyfin itemId,提取不到则用 MD5(url) 保底。 | private extractCacheKey(url: string): string {
try {
let match = url.match(/\/Audio\/([a-f0-9\-]+)\//i)
if (match && match[1]) {
return match[1]
}
match = url.match(/\/Items\/([a-f0-9\-]+)\//i)
if (match && match[1]) {
return match[1]
}
} catch (_) {
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractCacheKey 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#Lef... | private extractCacheKey(url: string): string {
try {
let match = url.match(/\/Audio\/([a-f0-9\-]+)\//i)
if (match && match[1]) {
return match[1]
}
match = url.match(/\/Items\/([a-f0-9\-]+)\//i)
if (match && match[1]) {
return match[1]
}
} catch (_) {
}
... | https://github.com/OHPG/FinMusic | 1419e868e88b337123a1cd2ffbc54e3d0c7fe919 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/accessibility/AccessibilityConfig.ets | arkts | persistSettings | 持久化配置到本地存储 | private async persistSettings(): Promise<void> {
try {
const configString = JSON.stringify(this.settings);
AppStorage.setOrCreate('accessibility_config', configString);
} catch (error) {
console.error('[AccessibilityConfig] 持久化配置失败:', error);
}
} | 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 persistSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async persistSettings(): Promise<void> {
try {
const configString = JSON.stringify(this.settings);
AppStorage.setOrCreate('accessibility_config', configString);
} catch (error) {
console.error('[AccessibilityConfig] 持久化配置失败:', error);
}
} | https://github.com/LJ666-ui/harmony-health-care | c2cd53a49361cca1b98aab6d1ef36801d08e78dc | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WrongAnswerStore.ets | arkts | injectPreferences | Overrides the preferences backend. Used only from unit tests. | injectPreferences(prefs: StringPreferencesLike): void {
this.prefs = prefs;
this.loaded = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left injectPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left StringPreferencesLike AST#identifier#... | injectPreferences(prefs: StringPreferencesLike): void {
this.prefs = prefs;
this.loaded = true;
} | https://github.com/terryma2024/happyword | 92ecd5a387ca3e716c91efdc0ea121f0b5ca6f50 | github |
PollenWang6/HiXD | entry/src/main/ets/pages/calendar_export/CalendarExportPage.ets | arkts | getEn | ==================== getter/setter ==================== | getEn(t: string): boolean {
if (t === 'c') { return this.cEnabled; }
if (t === 'e') { return this.eEnabled; }
return this.xEnabled;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Right ... | getEn(t: string): boolean {
if (t === 'c') { return this.cEnabled; }
if (t === 'e') { return this.eEnabled; }
return this.xEnabled;
} | https://github.com/PollenWang6/HiXD | 4dbf90a9ca235aa53af5d6564a89792ac937a45c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets | arkts | getContent | 获取原始内容 | getContent(): string {
return this.content;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getContent 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_b... | getContent(): string {
return this.content;
} | https://github.com/DaLongZhuaZi/manxia | 81a901ee0a7e07ff717cac5676a8b3913fbdd6ba | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/utils/CommonUtils.ets | arkts | getColorMetrics | Converts ResourceColor to ColorMetrics
@param color The source resource color
@param fallbackColor Fallback color when parsing fails (optional)
@returns ColorMetrics instance | static getColorMetrics(color?: ResourceColor,
fallbackColor: ColorMetrics = CommonConstants.DEFAULT_THEME_COLOR): ColorMetrics {
// Intercept null values to avoid triggering unnecessary system exceptions
if (color === undefined || color === null) {
Logger.warn('getColorMetrics: color is null or unde... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getColorMetrics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#... | static getColorMetrics(color?: ResourceColor,
fallbackColor: ColorMetrics = CommonConstants.DEFAULT_THEME_COLOR): ColorMetrics {
// Intercept null values to avoid triggering unnecessary system exceptions
if (color === undefined || color === null) {
Logger.warn('getColorMetrics: color is null or unde... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | cb39adad8dd954c8afd9b41f3246663f00102b1a | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/database/DatabaseManager.ets | arkts | stopHealthCheck | 停止健康检查 | private stopHealthCheck(): void {
if (this.healthCheckIntervalId !== 0) {
clearInterval(this.healthCheckIntervalId)
this.healthCheckIntervalId = 0
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopHealthCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp... | private stopHealthCheck(): void {
if (this.healthCheckIntervalId !== 0) {
clearInterval(this.healthCheckIntervalId)
this.healthCheckIntervalId = 0
}
} | https://github.com/offlinecat-dev/OCNetORM | eab84eedc33189c49918bfc6c73805ba0121ead1 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies all elements of arr to the current Int16Array.
@param { FixedArray<short> } arr - array to copy data from
@throws { RangeError } - If the number of assigned elements exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(arr: FixedArray<short>): void {
this.set(arr, 0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: FixedArray<short>): void {
this.set(arr, 0)
} | https://gitcode.com/iop123123/arkts-static-skills | 3793afc923dba110e0b1000a33d125dd4d5c3d3a | gitcode |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGRect.ets | arkts | getWidth | 获取矩形宽度 | public getWidth(): number{
return this._width;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWidth 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... | public getWidth(): number{
return this._width;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 152a5d62013ea94c3acd24d172029b7684eee7bc | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setMinOffset | Sets the minimum offset (padding) around the chart, defaults to 15.f | public setMinOffset(minOffset: number): void {
this.mMinOffset = minOffset;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | public setMinOffset(minOffset: number): void {
this.mMinOffset = minOffset;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5486f8dece22f511ce6313831ab12318b7a494e9 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getLabelCount | Returns the number of label entries the y-axis should have
@return | public getLabelCount(): number {
return this.mLabelCount;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabelCount 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#n... | public getLabelCount(): number {
return this.mLabelCount;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 55e21be3bfff3de097ebc0920ed76d54647366f2 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test41_original_index.ets | arkts | testSortComparator | --- Array.sort with complex comparator --- | function testSortComparator(): string {
let items: string[] = ['banana', 'apple', 'cherry', 'date'];
items.sort((a: string, b: string): number => {
let la: string = a.charAt(0);
let lb: string = b.charAt(0);
if (la !== lb) {
return la < lb ? -1 : 1;
}
return a.length - b.length;
});
re... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSortComparator 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#predefin... | function testSortComparator(): string {
let items: string[] = ['banana', 'apple', 'cherry', 'date'];
items.sort((a: string, b: string): number => {
let la: string = a.charAt(0);
let lb: string = b.charAt(0);
if (la !== lb) {
return la < lb ? -1 : 1;
}
return a.length - b.length;
});
re... | https://github.com/miaochiahao/ark-ghidra | 50d60176b5c66e108b4e769eaf543062cdf3a572 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets | arkts | getPermissionRecoveryOptions | 获取权限恢复选项 | private getPermissionRecoveryOptions(attempts: number): RecoveryOption[] {
const options: RecoveryOption[] = [];
const fallbackOption: RecoveryOption = {
strategy: RecoveryStrategy.FALLBACK,
description: '使用受限模式启动(部分功能不可用)',
priority: 75,
canAutoExecute: false,
estimatedTime... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getPermissionRecoveryOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left attempts AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left ... | private getPermissionRecoveryOptions(attempts: number): RecoveryOption[] {
const options: RecoveryOption[] = [];
const fallbackOption: RecoveryOption = {
strategy: RecoveryStrategy.FALLBACK,
description: '使用受限模式启动(部分功能不可用)',
priority: 75,
canAutoExecute: false,
estimatedTime... | https://github.com/DaLongZhuaZi/manxia | 9f45590fafc6c393cafff65768d269fe410f5f32 | github |
openharmony-sig/flutter_packages | packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets | arkts | chooseImageFromGallery | 选择单个图片 | chooseImageFromGallery(options: ImageSelectionOptions, usePhotoPicker: boolean, result: Result<ArrayList<string>>) {
Log.i(ImagePickerDelegate.TAG, "chooseImageFromGallery enter");
if (!this.setPendingOptionsAndResult(options, null, result)) {
this.finishWithAlreadyActiveError(result);
return;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left chooseImageFromGallery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageSelectionO... | chooseImageFromGallery(options: ImageSelectionOptions, usePhotoPicker: boolean, result: Result<ArrayList<string>>) {
Log.i(ImagePickerDelegate.TAG, "chooseImageFromGallery enter");
if (!this.setPendingOptionsAndResult(options, null, result)) {
this.finishWithAlreadyActiveError(result);
return;
... | https://gitee.com/openharmony-sig/flutter_packages.git | 1c6eb0d9b313e20274524410a42bcd2197760221 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ColorTemplate.ets | arkts | getHoloBlue | @return | public static getHoloBlue(): number {
return ChartColor.rgb(51, 181, 229)
} | 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 getHoloBlue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getHoloBlue(): number {
return ChartColor.rgb(51, 181, 229)
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 3377d1182820a7a5d36e981e04ccb2f32cf164ae | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | registerGamepadCallbacks | ============================================================================
手柄管理接口 (Game UI Port)
Requirements: 3.1
============================================================================
注册手柄事件回调
@param onButton 按键事件回调
@param onAxis 轴事件回调
@param onConnection 连接状态回调
@returns 注册是否成功 | static registerGamepadCallbacks(
onButton: (buttonCode: number, isDown: boolean) => void,
onAxis: (axisId: number, value: number) => void,
onConnection: (connected: boolean) => void
): boolean {
return MelonDSNative.native.registerGamepadCallbacks(onButton, onAxis, onConnection);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left registerGamepadCallbacks AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#binary_expression#Left AST#call_expression#Left A... | static registerGamepadCallbacks(
onButton: (buttonCode: number, isDown: boolean) => void,
onAxis: (axisId: number, value: number) => void,
onConnection: (connected: boolean) => void
): boolean {
return MelonDSNative.native.registerGamepadCallbacks(onButton, onAxis, onConnection);
} | https://github.com/richshaw2015/nds | 6c50604afe6e10eb1c75557a2c69cb0aff3728dc | github |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/CredentialService.ets | arkts | save | 保存(覆盖)凭据:username 存 DATA_LABEL_NORMAL_1,password 存 SECRET。 | static save(cred: Credential): void {
// 先删旧的,避免 24000003 already exists
CredentialService.remove();
const attr: asset.AssetMap = new Map();
attr.set(asset.Tag.ALIAS, strToU8(ALIAS));
attr.set(asset.Tag.SECRET, strToU8(cred.password));
attr.set(asset.Tag.DATA_LABEL_NORMAL_1, strToU8(cred.usern... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left save AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cred AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | static save(cred: Credential): void {
// 先删旧的,避免 24000003 already exists
CredentialService.remove();
const attr: asset.AssetMap = new Map();
attr.set(asset.Tag.ALIAS, strToU8(ALIAS));
attr.set(asset.Tag.SECRET, strToU8(cred.password));
attr.set(asset.Tag.DATA_LABEL_NORMAL_1, strToU8(cred.usern... | https://github.com/picklerick422/zju-learning-assistant-OH | 3a9a819cf0d5603f6e3bd1fb091acb49b7bbd302 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ulong.ets | arkts | main | ---
desc: check postfix increment for unsigned long integer operand
--- | function main(): void {
let value: ulong = {{v.value}}
let result: ulong = value++
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: ulong = {{v.value}}
let result: ulong = value++
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 431e13bf56e229b803bd56630dd981f6841502fb | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/UnionCase.ets | arkts | isType | Check if the current UnionCase instance represents a type.
@returns { boolean } Returns true if it represents a type; otherwise, returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isType(): boolean {
return false
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isType 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#boolea... | public isType(): boolean {
return false
} | https://gitcode.com/iop123123/arkts-static-skills | 5ecc5c81222b255c40ddce27e660251ab4c2393c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | printRest | @section Variadics | private printRest(level: LogLevel, ...vals: Any[]) {
let sb = new StringBuilder()
if (vals.length != 0) {
sb.append(this.indent)
const dFst = vals[0]
const hasFmt = (dFst instanceof String) && (dFst as String).indexOf(c'%') != -1
if (hasFmt) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left printRest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Lo... | private printRest(level: LogLevel, ...vals: Any[]) {
let sb = new StringBuilder()
if (vals.length != 0) {
sb.append(this.indent)
const dFst = vals[0]
const hasFmt = (dFst instanceof String) && (dFst as String).indexOf(c'%') != -1
if (hasFmt) {
... | https://gitcode.com/iop123123/arkts-static-skills | 2a919f38e0e6b4e9bf9e4763bcd18994fe730e5f | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new FloatBox instance with an initial value of 0.0f.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.value = 0.0f;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.value = 0.0f;
} | https://gitcode.com/iop123123/arkts-static-skills | 52b16b7f84ca4da5edd96692d0a56f89b87bd134 | gitcode |
openharmony-sig/fluttertpc_qr_code_scanner | ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets | arkts | decodeImageBuffer | 从ImageReceiver获取imgComponent: image.Component,预览流设置的宽高: width, height | decodeImageBuffer(imgComponent: image.Component, width: number, height: number, channel: MethodChannel | null,
barcodeFormats: Array<number> = []) {
if (MyDebounceSingletonUtil.getInstance().isDebounced(TAG + 'Debounced', 800)) {
return;
}
let byteImg: detectBarcode.ByteImage = {
byteBuffe... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left decodeImageBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left imgComponent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left imag... | decodeImageBuffer(imgComponent: image.Component, width: number, height: number, channel: MethodChannel | null,
barcodeFormats: Array<number> = []) {
if (MyDebounceSingletonUtil.getInstance().isDebounced(TAG + 'Debounced', 800)) {
return;
}
let byteImg: detectBarcode.ByteImage = {
byteBuffe... | https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git | 6f0336c5588dcbafbea192fde527c038f21de3ab | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | getCurrentProfile | ==================== 公开API ====================
获取当前配置 | public getCurrentProfile(): UserThemeProfile {
return {
id: this.currentProfile.id,
name: this.currentProfile.name,
lastModified: this.currentProfile.lastModified,
transparency: copyTransparency(this.currentProfile.transparency),
effects: copyEffects(this.currentProfile.effects),
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left User... | public getCurrentProfile(): UserThemeProfile {
return {
id: this.currentProfile.id,
name: this.currentProfile.name,
lastModified: this.currentProfile.lastModified,
transparency: copyTransparency(this.currentProfile.transparency),
effects: copyEffects(this.currentProfile.effects),
... | https://github.com/DaLongZhuaZi/manxia | eff8fa43738ecb1562b414e019dfbd5d6b5ab4f6 | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/viewmodel/PlayerViewModel.ets | arkts | togglePlayPause | Toggles play/pause using current appState and MediaService first-load rules. | public togglePlayPause(): void {
PlayerDataUtil.togglePlayPause(this.appState);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left togglePlayPause AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | public togglePlayPause(): void {
PlayerDataUtil.togglePlayPause(this.appState);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 0511980a7a60d5e2f361b9b3ad5c63289bf8e6cb | gitcode |
arkui-x/samples | CodeLab/Cases/feature/citysearch/src/main/ets/view/CitySearch.ets | arkts | searchCityList | 搜索城市展示逻辑 | searchCityList(value: string) {
let cityNames: string[] = [];
CITY_DATA.forEach(item => {
if (item.name.includes(value.toUpperCase())) {
// 当搜索城市拼音首字母,将相关城市信息展示。例如输入"a",会出现"阿尔山"、"阿勒泰地区"、"安庆"、"安阳"。
// 输入"b",会出现"北京"、"亳州"、"包头"、"宝鸡"。
cityNames = item.dataList;
return;
}... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchCityList 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#Rig... | searchCityList(value: string) {
let cityNames: string[] = [];
CITY_DATA.forEach(item => {
if (item.name.includes(value.toUpperCase())) {
// 当搜索城市拼音首字母,将相关城市信息展示。例如输入"a",会出现"阿尔山"、"阿勒泰地区"、"安庆"、"安阳"。
// 输入"b",会出现"北京"、"亳州"、"包头"、"宝鸡"。
cityNames = item.dataList;
return;
}... | https://gitcode.com/arkui-x/samples | 347ec3600f0b17d9462d18d10ec496a4e0881530 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | deleteSelected | 删除选中的商品
@returns {Promise<void>} Promise<void> | async deleteSelected(): Promise<void> {
const selectedKeys = Array.from(this.selectedSpecIds);
for (const key of selectedKeys) {
const parts = key.split('_');
const goodsId = parseInt(parts[0]);
const specId = parseInt(parts[1]);
await this.cartRepository.removeSpecFromCart(goodsId, sp... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteSelected AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener... | async deleteSelected(): Promise<void> {
const selectedKeys = Array.from(this.selectedSpecIds);
for (const key of selectedKeys) {
const parts = key.split('_');
const goodsId = parseInt(parts[0]);
const specId = parseInt(parts[1]);
await this.cartRepository.removeSpecFromCart(goodsId, sp... | https://github.com/Joker-x-dev/CoolMallArkTS | e81ac125602064128e4fa537d3d2bbabf32bf061 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.