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 |
|---|---|---|---|---|---|---|---|---|---|---|
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | parseSearchResults | 解析搜索结果 | private parseSearchResults(response: string): Podcast[] {
try {
const data: Record<string, Object> = JSON.parse(response) as Record<string, Object>;
const podcasts: Podcast[] = [];
const results = data['results'] as Array<Record<string, Object>>;
if (results && Array.isArray(results... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseSearchResults AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private parseSearchResults(response: string): Podcast[] {
try {
const data: Record<string, Object> = JSON.parse(response) as Record<string, Object>;
const podcasts: Podcast[] = [];
const results = data['results'] as Array<Record<string, Object>>;
if (results && Array.isArray(results... | https://github.com/pangpang20/antennaPodHM | ecc68c671fcd798c416d166bcce3d13095d6d666 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | $_get | Gets a JSON element from an object by key.
@param {string} key - The key to look up
@returns {JsonElement} The JSON element associated with the key
@throws {JsonTypeError} If this element is not an object
@throws {RangeError} If the key is not found in the object | $_get(key: string): JsonElement {
if (this.jsonType != JsonType.JsonObject) {
throw new JsonTypeError("This value's ValueKind is not Object.")
}
if (this.maybeObjectValues == undefined || !this.maybeObjectValues!.has(key)) {
throw new RangeErro... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left $_get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Righ... | $_get(key: string): JsonElement {
if (this.jsonType != JsonType.JsonObject) {
throw new JsonTypeError("This value's ValueKind is not Object.")
}
if (this.maybeObjectValues == undefined || !this.maybeObjectValues!.has(key)) {
throw new RangeErro... | https://gitcode.com/iop123123/arkts-static-skills | 51284f7cab269de54c3cab9ce18a73bdd2020711 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | getUTCMonth | Returns the month of the specified date according to universal time
as a zero-based value (where zero indicates the first month of the year).
@returns { int } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getUTCMonth(): int {
return ecmaMonthFromTime(this.ms);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCMonth 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#id... | public getUTCMonth(): int {
return ecmaMonthFromTime(this.ms);
} | https://gitcode.com/iop123123/arkts-static-skills | e92382adc7dfbea955fc9afb72b5dd20d95aded8 | gitcode |
GrassyUnknown/Health-Life-HarmonyOS-Next | oh_modules/.ohpm/cjcalendar@2.0.4/oh_modules/cjcalendar/src/main/ets/components/components/CJDateItem.ets | arkts | compareDay | 日期比较, this - other
@param other 另一天
@returns == 0 : 等于, > 0:大于,< 0:小于 | compareDay(other: CJDateItem): number {
if (other) {
if (this.fullYear < other.fullYear) {
return -1
} else if (this.fullYear > other.fullYear) {
return 1
} else {
if (this.month < other.month) {
return -1
} else if (this.month > other.month) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left compareDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CJDateItem AST#identifier#Right AST#)#Left )... | compareDay(other: CJDateItem): number {
if (other) {
if (this.fullYear < other.fullYear) {
return -1
} else if (this.fullYear > other.fullYear) {
return 1
} else {
if (this.month < other.month) {
return -1
} else if (this.month > other.month) {
... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | 300b5c8dfd4c2d5ba7a18e7783adf65c5e02ac8e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an array-like or iterable object.
@param { ArrayLike<T> } arrayLike - An array-like or iterable object to convert to an array.
@param { function } mapfn - A mapping function to call on every element of the array.
@returns { Float64Array } - A new Float64Array
@static
@syscap SystemCapability.Utils... | public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Float64Array {
let res = new Float64Array(arrayLike.length)
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by un... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identif... | public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Float64Array {
let res = new Float64Array(arrayLike.length)
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by un... | https://gitcode.com/iop123123/arkts-static-skills | ac3f5d8b67e4f1c4f52f3fd7e98cbaf1c90c57d4 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/Node.ets | arkts | textContent | 获取文本内容(会解码 HTML 实体) | get textContent(): string {
return this.decodeHtmlEntities(this.rawText);
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left textContent 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... | get textContent(): string {
return this.decodeHtmlEntities(this.rawText);
} | https://github.com/DaLongZhuaZi/manxia | e4c2ade16aadbe9d0abfea6557ac22435b560308 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_than/less_than_short.ets | arkts | main | ---
desc: check less than operation for short integer
--- | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a < b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a < b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2a940e936ccabfb7a6337884d6d3b9a3a3b1c2bd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets | arkts | loadAuthState | 加载认证状态 | protected async loadAuthState(): Promise<void> {
try {
const stateJson = this.settingsManager.getString(ANILIST_AUTH_STATE_KEY, '');
if (stateJson) {
const state: AuthStateStorage = SafeUtils.parseObj(stateJson) as AuthStateStorage;
this.authState = {
isLoggedIn: state.isLogg... | 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 loadAuthState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | protected async loadAuthState(): Promise<void> {
try {
const stateJson = this.settingsManager.getString(ANILIST_AUTH_STATE_KEY, '');
if (stateJson) {
const state: AuthStateStorage = SafeUtils.parseObj(stateJson) as AuthStateStorage;
this.authState = {
isLoggedIn: state.isLogg... | https://github.com/DaLongZhuaZi/manxia | 29861e63fbd04fcd6438f238e89303639684ab8c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | calculateSimilarity | 计算两个字符串的相似度 | private calculateSimilarity(str1: string, str2: string): number {
// 移除空格和标点符号,转小写
const normalize = (s: string) => s.replace(/[\s\p{P}]/gu, '').toLowerCase();
const s1 = normalize(str1);
const s2 = normalize(str2);
// 完全匹配
if (s1 === s2) return 1.0;
// 包含关系
if (s1.includes(s... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateSimilarity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private calculateSimilarity(str1: string, str2: string): number {
// 移除空格和标点符号,转小写
const normalize = (s: string) => s.replace(/[\s\p{P}]/gu, '').toLowerCase();
const s1 = normalize(str1);
const s2 = normalize(str2);
// 完全匹配
if (s1 === s2) return 1.0;
// 包含关系
if (s1.includes(s... | https://github.com/DaLongZhuaZi/manxia | d1b98c3fd990a1c4bae885c509e5dfa6a6e882e9 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setPopupPosition | 手动指定弹窗位置,只有Attach、Drawer、PartShadow类型有效,PartShadow类型只支持上下
@param popupPosition
@returns | setPopupPosition(popupPosition: PopupPosition): Builder {
this.popupConfig.popupPosition = popupPosition
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPopupPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left popupPosition AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PopupPosition AST#identifier#R... | setPopupPosition(popupPosition: PopupPosition): Builder {
this.popupConfig.popupPosition = popupPosition
return this
} | https://github.com/wuba/omni-ui | f97633289e20353f44ddba5b5b2911039ebfb697 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceSearchService.ets | arkts | search | 执行通用搜索
@param config 搜索配置
@param callback 进度回调
@returns 搜索任务句柄 | search(config: SearchTaskConfig, callback?: SearchProgressCallback): SearchTaskHandle {
// 生成新的任务ID,取消之前的搜索
this.currentTaskId++;
const taskId = this.currentTaskId;
let isCancelled = false;
const handle: SearchTaskHandle = {
cancel: () => {
if (taskId === this.currentTaskId) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left search 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 SearchTaskConfig AST#identifier#Right AST#,#Lef... | search(config: SearchTaskConfig, callback?: SearchProgressCallback): SearchTaskHandle {
// 生成新的任务ID,取消之前的搜索
this.currentTaskId++;
const taskId = this.currentTaskId;
let isCancelled = false;
const handle: SearchTaskHandle = {
cancel: () => {
if (taskId === this.currentTaskId) {
... | https://github.com/DaLongZhuaZi/manxia | eb41d92eb53de0b51bc5069de26ac91ab5ab7f84 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ModelCapabilityMatcher.ets | arkts | fetchAndBuildCache | 从 models.dev 拉取数据并构建扁平化缓存 | private async fetchAndBuildCache(): Promise<boolean> {
try {
const prefs = getPreferencesService()
const baseUrl = await prefs.getString(PreferenceKeys.MODELS_DEV_BASE_URL, DEFAULT_MODELS_DEV_BASE_URL)
const url = `${baseUrl}/api.json`
const httpRequest = http.createHttp()
const res... | 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 fetchAndBuildCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async fetchAndBuildCache(): Promise<boolean> {
try {
const prefs = getPreferencesService()
const baseUrl = await prefs.getString(PreferenceKeys.MODELS_DEV_BASE_URL, DEFAULT_MODELS_DEV_BASE_URL)
const url = `${baseUrl}/api.json`
const httpRequest = http.createHttp()
const res... | https://github.com/LongLiveY96/chatcube | 3473d22daa7a4cbfb851c15e414c6781b05e566d | github |
Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onDestroy | Called when the ability is destroyed | onDestroy() {
LifeCycleLog.add('❌ onDestroy: Ability destroyed.');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDestroy 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... | onDestroy() {
LifeCycleLog.add('❌ onDestroy: Ability destroyed.');
} | https://github.com/Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle | 2159e16dfb72ff5dbc497a1a59cd67b19fe1aa1e | github |
harmonyos/codelabs | CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets | arkts | draw | Draw the raffle round turntable.
@param canvasContext canvasContext.
@param screenWidth screenWidth.
@param screenHeight screenHeight. | draw(canvasContext: CanvasRenderingContext2D, screenWidth: number, screenHeight: number) {
if (CheckEmptyUtils.isEmptyObj(canvasContext)) {
Logger.error('[DrawModel][draw] canvasContext is empty.');
return;
}
this.canvasContext = canvasContext;
this.screenWidth = screenWidth;
this.canv... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left draw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left canvasContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AS... | draw(canvasContext: CanvasRenderingContext2D, screenWidth: number, screenHeight: number) {
if (CheckEmptyUtils.isEmptyObj(canvasContext)) {
Logger.error('[DrawModel][draw] canvasContext is empty.');
return;
}
this.canvasContext = canvasContext;
this.screenWidth = screenWidth;
this.canv... | https://gitee.com/harmonyos/codelabs.git | d404fe96878188c6894ae08496d3df62017af526 | gitee |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets | arkts | pushData | Add position to position list.
@param isFirstPosition Indicates whether the position is the start position of the track.
@param isEndPosition Indicates whether the position is the end position of the track.
@param positionX Horizontal coordinate information.
@param positionY Indicates the vertical coordinate informatio... | pushData(isFirstPosition: boolean, isEndPosition: boolean, positionX: number, positionY: number): void {
let position = new Position(isFirstPosition, isEndPosition, positionX, positionY);
this.positionList.push(position);
if (position.isEndPosition) {
this.kvStoreModel.put(CommonConstants.CHANGE_POS... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFirstPosition AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#,#Left , ... | pushData(isFirstPosition: boolean, isEndPosition: boolean, positionX: number, positionY: number): void {
let position = new Position(isFirstPosition, isEndPosition, positionX, positionY);
this.positionList.push(position);
if (position.isEndPosition) {
this.kvStoreModel.put(CommonConstants.CHANGE_POS... | https://gitee.com/openharmony/codelabs.git | f962f40cf050c3430b8f04ada24882d1c26615be | gitee |
codelably/HCompass | core/network/src/main/ets/RequestHelper.ets | arkts | execute | 执行请求,返回数据
@returns 数据 Promise | async execute(): Promise<T> {
const result = await this.executeInternal();
if (!result.isSuccess) {
throw new Error(result.message ?? '请求失败');
}
return result.data as T;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left execute AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type... | async execute(): Promise<T> {
const result = await this.executeInternal();
if (!result.isSuccess) {
throw new Error(result.message ?? '请求失败');
}
return result.data as T;
} | https://github.com/codelably/HCompass | 936a3556e19f097a30682ee3954c87e282d7592a | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RomConfigManager.ets | arkts | updateConfig | 更新游戏配置的某个字段 | public async updateConfig(romPath: string, updater: (config: RomConfig) => RomConfig): Promise<RomConfig> {
const current = this.getConfig(romPath);
const updated = updater(current);
await this.saveConfig(romPath, updated);
return updated;
} | 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 updateConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left romPath AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public async updateConfig(romPath: string, updater: (config: RomConfig) => RomConfig): Promise<RomConfig> {
const current = this.getConfig(romPath);
const updated = updater(current);
await this.saveConfig(romPath, updated);
return updated;
} | https://github.com/richshaw2015/nds | fa1849dd06c6dc65f6e9e56300998882df6e232f | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | clear | 清空所有键值并 flush
@returns {Promise<void>} Promise<void> | async clear(): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.clear();
await prefs.flush();
} catch (error) {
throw this.wrapError(error, "清空偏好数据失败");
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clear 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#L... | async clear(): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.clear();
await prefs.flush();
} catch (error) {
throw this.wrapError(error, "清空偏好数据失败");
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 3573e656de43b8bf3223c8053197d0b6640ebffd | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | deleteToolEvents | 删除消息相关的工具事件 | async deleteToolEvents(messageId: string): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const predicates = new relationalStore.RdbPredicates(TableNames.TOOL_EVENTS)
predicates.equalTo('message_id', messageId)
try {
await this.rdbStore.... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteToolEvents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left messageId AST#identifier#Right AST#type_annotation#Left AST#:#... | async deleteToolEvents(messageId: string): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const predicates = new relationalStore.RdbPredicates(TableNames.TOOL_EVENTS)
predicates.equalTo('message_id', messageId)
try {
await this.rdbStore.... | https://github.com/LongLiveY96/chatcube | 24a2c13cc5a6117decbd8be765c94379458beee7 | github |
HarmonyCandies/extended_text | extended_text/src/main/ets/builder/SpecialTextSpanBuilder.ets | arkts | isEnd | 判断是否是 SpecialText 的结束标记 | isEnd(value: string): boolean {
return value.endsWith(this.endFlag);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Ri... | isEnd(value: string): boolean {
return value.endsWith(this.endFlag);
} | https://github.com/HarmonyCandies/extended_text | 4d7e43c5430dd5dea947a78bc876b6ac895bec20 | github |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/utils/HomeIndexCalculator.ets | arkts | getNextBillSortType | 返回首页账单列表下一个排序模式。 | static getNextBillSortType(billSortType: BillSortTypeEnum): BillSortTypeEnum {
if (billSortType === BillSortTypeEnum.DATE_DESC) {
return BillSortTypeEnum.DAY_TOTAL_DESC;
}
if (billSortType === BillSortTypeEnum.DAY_TOTAL_DESC) {
return BillSortTypeEnum.AMOUNT_DESC;
}
return BillSortType... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNextBillSortType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billSortType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | static getNextBillSortType(billSortType: BillSortTypeEnum): BillSortTypeEnum {
if (billSortType === BillSortTypeEnum.DATE_DESC) {
return BillSortTypeEnum.DAY_TOTAL_DESC;
}
if (billSortType === BillSortTypeEnum.DAY_TOTAL_DESC) {
return BillSortTypeEnum.AMOUNT_DESC;
}
return BillSortType... | https://github.com/ZestBox-18/kitebook-frontend | 68951fe101461180291b937b56aca1ceaefd8e8c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | $_set | Set the matching result at the specified index.
@param { int } index The index to be set.
@param { String | undefined } val The value to be set.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public $_set(index: int, val: String | undefined): void {
super.$_set(index, val)
} | 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#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public $_set(index: int, val: String | undefined): void {
super.$_set(index, val)
} | https://gitcode.com/iop123123/arkts-static-skills | 401f75850f41977386e680baf7e37d41e02d9dd2 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | getCurrentVersion | 获取聚合的当前版本号
@param events 事件列表
@param aggregateType 聚合类型
@param aggregateId 聚合ID | static getCurrentVersion(
events: DomainEvent[],
aggregateType: string,
aggregateId: number
): number {
let maxVersion = 0;
for (let i = 0; i < events.length; i++) {
const event = events[i];
if (event.aggregateType === aggregateType && event.aggregateId === aggregateId) {
if ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left events AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex... | static getCurrentVersion(
events: DomainEvent[],
aggregateType: string,
aggregateId: number
): number {
let maxVersion = 0;
for (let i = 0; i < events.length; i++) {
const event = events[i];
if (event.aggregateType === aggregateType && event.aggregateId === aggregateId) {
if ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ec42db613d89c3481746123023ee80a6c8563996 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | restoreWebState | Tries to restore web state. Does nothing if no available state files exist.
@returns True if succeeded, false if failed. | async restoreWebState() {
if (!this.restoringWebState) {
return;
}
const statePath = `${this.myUi.myTabs.workingDir}/${this.webStateId}`;
// Read and restore web state.
const arrayBuffer = await readArrayBuffer(statePath);
if (arrayBuffer && arrayBuffer.byteLength < 512000) {
cons... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left restoreWebState AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#... | async restoreWebState() {
if (!this.restoringWebState) {
return;
}
const statePath = `${this.myUi.myTabs.workingDir}/${this.webStateId}`;
// Read and restore web state.
const arrayBuffer = await readArrayBuffer(statePath);
if (arrayBuffer && arrayBuffer.byteLength < 512000) {
cons... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 921659587407d8b2d752bad023d9ee54f9421b29 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Assigns val as element on insertPos.
@param { int } insertPos - index to change
@param { short } val - value to set
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(insertPos: int, val: short): void {
this.$_set(insertPos, val)
} | 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#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | public set(insertPos: int, val: short): void {
this.$_set(insertPos, val)
} | https://gitcode.com/iop123123/arkts-static-skills | f3977ec83c77054782dd304db40b6069f10c5201 | gitcode |
2763981847/Clock-Alarm | entry/src/main/ets/view/AlarmClock/AlarmListItem.ets | arkts | build | 构建闹钟项视图 | build() {
Row() {
Column() {
// 闹钟时间文本
Text(this.mainModel.getTaskTimeContent(this.alarmItem.hour, this.alarmItem.minute))
.CommonTextAttr(DimensionUtil.getFp($r('app.float.alarms_item_time_font_size')),
FontWeight.Regular,
{ left: DimensionUtil.getVp($r('ap... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Row() {
Column() {
// 闹钟时间文本
Text(this.mainModel.getTaskTimeContent(this.alarmItem.hour, this.alarmItem.minute))
.CommonTextAttr(DimensionUtil.getFp($r('app.float.alarms_item_time_font_size')),
FontWeight.Regular,
{ left: DimensionUtil.getVp($r('ap... | https://github.com/2763981847/Clock-Alarm | 906c0a4c6c35584d64da5796aa9468f7b4e5af14 | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/bridge/NativeWriterCoreBridge.ets | arkts | listWorkspaces | ── Workspace ── | async listWorkspaces(): Promise<ResultEnvelope<WorkspaceSummary[]>> {
try {
const jsonStr: string = this.getNativeModule().nativeListWorkspaces()
return this.parseEnvelope<WorkspaceSummary[]>(jsonStr)
} catch (e) {
return this.notImplemented<WorkspaceSummary[]>()
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left listWorkspaces 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 listWorkspaces(): Promise<ResultEnvelope<WorkspaceSummary[]>> {
try {
const jsonStr: string = this.getNativeModule().nativeListWorkspaces()
return this.parseEnvelope<WorkspaceSummary[]>(jsonStr)
} catch (e) {
return this.notImplemented<WorkspaceSummary[]>()
}
} | https://github.com/Xiwei753/xiezuoruanjian | 5c522e19245d15b793460c04c0e0afdba138e5d3 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/utils/DAOHelper.ets | arkts | now | 获取当前时间戳(ISO格式)
@returns ISO格式的时间字符串 | static now(): string {
return new Date().toISOString();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left now AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right... | static now(): string {
return new Date().toISOString();
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0435bb8111bb22ab4f0c29509b398bd139c5b637 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Returns a new array from a set of elements.
@returns { Uint8Array } - a new Uint8Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(): Uint8Array {
return new Uint8Array(0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | public static of(): Uint8Array {
return new Uint8Array(0)
} | https://gitcode.com/iop123123/arkts-static-skills | d2284e41aa5c7c78cbab8d173dc52df843e4884a | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | unsubscribePodcast | 取消订阅播客 | async unsubscribePodcast(podcastId: string): Promise<void> {
// 删除播客相关的所有单集
await this.dbService.deleteEpisodesByPodcastId(podcastId);
// 删除播客
await this.dbService.deletePodcast(podcastId);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unsubscribePodcast AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left podcastId AST#identifier#Right AST#type_annotation#Left AST#... | async unsubscribePodcast(podcastId: string): Promise<void> {
// 删除播客相关的所有单集
await this.dbService.deleteEpisodesByPodcastId(podcastId);
// 删除播客
await this.dbService.deletePodcast(podcastId);
} | https://github.com/pangpang20/antennaPodHM | 4d71452600735296f375d79919d2c10d57486674 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | getAllProviders | 获取所有服务商配置 | async getAllProviders(): Promise<ProviderConfig[]> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return []
}
const providers: ProviderConfig[] = []
const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS)
predicates.orderByAsc('sort_order')
try ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllProviders 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#gene... | async getAllProviders(): Promise<ProviderConfig[]> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return []
}
const providers: ProviderConfig[] = []
const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS)
predicates.orderByAsc('sort_order')
try ... | https://github.com/LongLiveY96/chatcube | 4e77ab4327e6cf6154430e1cec74451cd2c9b93b | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/FileContentService.ets | arkts | countReplacementChars | 统计字符串中 Unicode 替换字符 (U+FFFD) 的个数
用于判断 UTF-8 解码是否正确 | private static countReplacementChars(str: string): number {
let count = 0;
for (let i = 0; i < str.length; i++) {
if (str.charCodeAt(i) === 0xFFFD) {
count++;
}
}
return count;
} | 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 countReplacementChars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:... | private static countReplacementChars(str: string): number {
let count = 0;
for (let i = 0; i < str.length; i++) {
if (str.charCodeAt(i) === 0xFFFD) {
count++;
}
}
return count;
} | https://github.com/XJTUWYD/ArkDiff | 4c1d7a9c94a120bdf879af226518d20e44dbec25 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/state/LinkDemo.ets | arkts | constructor | age 是 Person 的属性 | constructor(name: Name, age: number) {
this.name = name;
this.age = age;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Name AST#identifier#Right AST... | constructor(name: Name, age: number) {
this.name = name;
this.age = age;
} | https://github.com/webabcd/HarmonyDemo | b721e8d2836283d561b525969a304237860734a2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | setInt16 | Sets bytes as they represent given type
@param { int } byteOffset zero index to write
@param { int } value
@param { boolean } littleEndian read as little or big endian
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setInt16(byteOffset: int, value: int, littleEndian: boolean): void {
if (littleEndian) {
this.setInt16Little(byteOffset, value)
} else {
this.setInt16Big(byteOffset, value)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setInt16 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#identifie... | public setInt16(byteOffset: int, value: int, littleEndian: boolean): void {
if (littleEndian) {
this.setInt16Little(byteOffset, value)
} else {
this.setInt16Big(byteOffset, value)
}
} | https://gitcode.com/iop123123/arkts-static-skills | bcbbdd8c6dcbaeb152310b18d49d74d0b73680e8 | gitcode |
LZZLHY/hlib | entry/src/main/ets/api/DomainManifest.ets | arkts | cleanDomains | ─── 内部 ────────────────────────────────────────────
严格清洗:去 schema、小写、去尾斜杠、白名单匹配。 | private static cleanDomains(input?: string[]): string[] {
if (input === undefined || !Array.isArray(input)) {
return [];
}
const out: string[] = [];
const seen: Set<string> = new Set<string>();
for (let i = 0; i < input.length; i++) {
const raw: string = input[i];
if (typeof raw ... | 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 cleanDomains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#?#Left ?... | private static cleanDomains(input?: string[]): string[] {
if (input === undefined || !Array.isArray(input)) {
return [];
}
const out: string[] = [];
const seen: Set<string> = new Set<string>();
for (let i = 0; i < input.length; i++) {
const raw: string = input[i];
if (typeof raw ... | https://github.com/LZZLHY/hlib | 485a9b2768b532703246396a400f488fe11ee079 | github |
arkui-x/samples | CodeLab/Cases/feature/imagecompression/src/main/ets/view/ImageCompression.ets | arkts | afterCompressChange | 压缩后图片大小,仅用于自动化用例验证 | afterCompressChange() {
emitter.emit('ImageCompression0', {
data: {
afterCompressionSize: this.afterCompressionSize
}
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left afterCompressChange 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_bloc... | afterCompressChange() {
emitter.emit('ImageCompression0', {
data: {
afterCompressionSize: this.afterCompressionSize
}
});
} | https://gitcode.com/arkui-x/samples | 237ab4b156c2e1ee8358def7cc21ed3092e54606 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncArrayConcurrentQueue.ets | arkts | isEmpty | Checks if the ConcurrentQueue is empty.
@returns { boolean } True if a ConcurrentQueue has no elements, otherwise false.
@syscap SystemCapability.Utils.Lang | public override isEmpty(): boolean {
return this.size == 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public override isEmpty(): boolean {
return this.size == 0;
} | https://gitcode.com/iop123123/arkts-static-skills | dfb76589eafaf0abb3227233db48e8077f67f0fd | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isLetter | isLetter(char) checks whether the char is a letter.
@param { char } value a char to be tested.
@returns { boolean }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isLetter(value: char): boolean {
return (0 <= value.compareTo(c'A')) && (value.compareTo(c'Z') <= 0)
|| (0 <= value.compareTo(c'a')) && (value.compareTo(c'z') <= 0);
} | 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 isLetter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public static isLetter(value: char): boolean {
return (0 <= value.compareTo(c'A')) && (value.compareTo(c'Z') <= 0)
|| (0 <= value.compareTo(c'a')) && (value.compareTo(c'z') <= 0);
} | https://gitcode.com/iop123123/arkts-static-skills | 113c65e4d77af63460e04b21b50db542fc0b152a | gitcode |
xiebyapps/ClipLink | entry/src/main/ets/services/SyncClipboardService.ets | arkts | contentToProfile | Convert ClipboardContent to ProfileDto | async contentToProfile(content: ClipboardContent): Promise<ProfileDto> {
let hash = content.profileHash;
if (!hash && content.text) {
hash = await HashUtil.calculateTextHash(content.text);
}
return {
type: content.type,
text: content.text || '',
hash: hash,
hasData: cont... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left contentToProfile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left... | async contentToProfile(content: ClipboardContent): Promise<ProfileDto> {
let hash = content.profileHash;
if (!hash && content.text) {
hash = await HashUtil.calculateTextHash(content.text);
}
return {
type: content.type,
text: content.text || '',
hash: hash,
hasData: cont... | https://github.com/xiebyapps/ClipLink | a747fc4188d263f699e14c59bebe18b258b04b62 | github |
bhengubv/aether-protocol | arkts/src/main/ets/protocol/MeshPacket.ets | arkts | isExpired | True when the packet's age exceeds `maxAgeSeconds`. | isExpired(maxAgeSeconds: number): boolean {
const nowMs: bigint = BigInt(Date.now());
const ageMs: bigint = nowMs - this.timestampMs;
return ageMs > BigInt(maxAgeSeconds) * 1000n;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isExpired AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxAgeSeconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#... | isExpired(maxAgeSeconds: number): boolean {
const nowMs: bigint = BigInt(Date.now());
const ageMs: bigint = nowMs - this.timestampMs;
return ageMs > BigInt(maxAgeSeconds) * 1000n;
} | https://github.com/bhengubv/aether-protocol | 145765fd28023d5d98d759d707608303a4e54b3e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/StatusEnums.ets | arkts | isValidDownloadStatus | 验证DownloadStatus是否有效 | static isValidDownloadStatus(status: string): boolean {
return DOWNLOAD_STATUS_VALUES.includes(status as DownloadStatus);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidDownloadStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | static isValidDownloadStatus(status: string): boolean {
return DOWNLOAD_STATUS_VALUES.includes(status as DownloadStatus);
} | https://github.com/DaLongZhuaZi/manxia | 1f21d17a0de234dd6b98c335b99a44b0d4268530 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Message.ets | arkts | isInitialized | 检查所有 required 字段是否已设置(递归检查)
用于 proto2 语法
@returns true 如果所有 required 字段都已设置 | isInitialized(): boolean {
return this.isValid()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state... | isInitialized(): boolean {
return this.isValid()
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 5d940128fed637c134ef66caadfd4760b2dc7c71 | gitcode |
honjow/Next2V | shared/src/main/ets/utils/V2exRouteNavigator.ets | arkts | openInApp | Parse `url` and push its native page. Returns false when the URL has no native destination. | static openInApp(stack: NavPathStack, url: string): boolean {
const route: V2exRoute | null = V2exUrlRouter.parse(url)
if (!route) {
return false
}
return V2exRouteNavigator.pushRoute(stack, route)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left openInApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NavPa... | static openInApp(stack: NavPathStack, url: string): boolean {
const route: V2exRoute | null = V2exUrlRouter.parse(url)
if (!route) {
return false
}
return V2exRouteNavigator.pushRoute(stack, route)
} | https://github.com/honjow/Next2V | 4b67e8a1d34eba92f75dd4b6c6688310052e6ec8 | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/FolderUtil.ets | arkts | getFolderData | Get Folder Data
@param folderDataArray - Folder data list
@param folderUuid - fold uuid
@return FolderData | getFolderData(folderDataArray: FolderData[], folderUuid: string): FolderData {
LogUtil.info(TAG, "get folder uuid " + folderUuid)
let folderData = folderDataArray.find((folder) => {
return folder.uuid == folderUuid
})
if (folderData == undefined) {
LogUtil.info(TAG, "no folder get " + fold... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFolderData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left FolderData AST#identifier#Right AST#[#Left [ AS... | getFolderData(folderDataArray: FolderData[], folderUuid: string): FolderData {
LogUtil.info(TAG, "get folder uuid " + folderUuid)
let folderData = folderDataArray.find((folder) => {
return folder.uuid == folderUuid
})
if (folderData == undefined) {
LogUtil.info(TAG, "no folder get " + fold... | https://gitee.com/openharmony/applications_notes.git | 549cb2498f8bcff12c5774493685ef9b645a2e40 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getExtraLeftOffset | @return the extra offset to be appended to the viewport's left | public getExtraLeftOffset(): number {
return this.mExtraLeftOffset;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getExtraLeftOffset 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 ... | public getExtraLeftOffset(): number {
return this.mExtraLeftOffset;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f4d7237672ce0355be48803d8424703d047b8466 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | codePointAt | Gets the codepoint at the specified index in this string.
Is similar to charAt(index), but if the character at the
index is the beginning of a surrogate pair, the int
representation for this codepoint is returned. Otherwise,
the character at the index is returned.
@param index index of the potential surrogate pair
@thr... | public codePointAt(index: number): number {
return this.codePointAt(index as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left codePointAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | public codePointAt(index: number): number {
return this.codePointAt(index as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b403099b14ca0d878eb7f6413216d7cba6f9a397 | gitee |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | test_struct | 测试自定义的 struct 类型 | function test_struct() {
let mystruct: test_overload.Mystruct = {
testNum: 2147483647,
testStr: "path/to/source"
};
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc(mystruct)
arktest.assertEQ(res, "path/to/source")... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_struct AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declara... | function test_struct() {
let mystruct: test_overload.Mystruct = {
testNum: 2147483647,
testStr: "path/to/source"
};
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc(mystruct)
arktest.assertEQ(res, "path/to/source")... | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 4bd349382f1af3b65816cabb1ff2333a7c709594 | gitcode |
erosTeam/NextE | shared/src/main/ets/network/EhApiService.ets | arkts | saveUserConfig | Write the EH user config (POST uconfig.php). Non-idempotent: it overwrites the user's server-side
profile, so the caller must have the user's intent (a Save action), not auto-save. | async saveUserConfig(isEx: boolean, settings: EhProfileSettings): Promise<void> {
const url: string = `${EhConstants.baseUrl(isEx)}/uconfig.php`
const body: string = EhUconfigParser.buildPostBody(settings)
let resp: EhTextResponse
try {
resp = await EhHttpClient.getInstance().postFormUrlEncoded(... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveUserConfig AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isEx AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async saveUserConfig(isEx: boolean, settings: EhProfileSettings): Promise<void> {
const url: string = `${EhConstants.baseUrl(isEx)}/uconfig.php`
const body: string = EhUconfigParser.buildPostBody(settings)
let resp: EhTextResponse
try {
resp = await EhHttpClient.getInstance().postFormUrlEncoded(... | https://github.com/erosTeam/NextE | 2756313ddf23ab45a80383570a565c8113a37ce3 | github |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/view/PlaylistDetailPage.ets | arkts | build | Composes the HDS nav destination, title bar, and scrollable playlist content. | build() {
HdsNavDestination() {
this.PlaylistNavDestinationSlot();
}
.hideTitleBar(false)
.titleBar(this.getPlaylistDetailTitleBar())
.backgroundColor($r('app.color.background_secondary'))
.systemBarStyle(
{ statusBarContentColor: this.isWidthBreakpointSmOrMd() ? '#FFFFFF' : '#0000... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
HdsNavDestination() {
this.PlaylistNavDestinationSlot();
}
.hideTitleBar(false)
.titleBar(this.getPlaylistDetailTitleBar())
.backgroundColor($r('app.color.background_secondary'))
.systemBarStyle(
{ statusBarContentColor: this.isWidthBreakpointSmOrMd() ? '#FFFFFF' : '#0000... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 2ab4cfdad69597ad1ed89526c63ae5f0971711c8 | gitcode |
openharmony/applications_print_spooler | entry/src/main/ets/pages/PrintPage.ets | arkts | saveLastedUsedPrinter | 保存成功连接并执行过打印的打印机
@param printer 打印机信息 | saveLastedUsedPrinter(printer: PrinterInfo | undefined) {
Log.info(TAG, 'saveLastedUsedPrinter printer: ' + StringUtil.encodeCommonString(printer?.printerName));
if (CheckEmptyUtils.isEmpty(printer)) {
Log.error(TAG, 'printer is null')
return;
}
let printerString = JSON.stringify(printer!)... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveLastedUsedPrinter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left printer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#ident... | saveLastedUsedPrinter(printer: PrinterInfo | undefined) {
Log.info(TAG, 'saveLastedUsedPrinter printer: ' + StringUtil.encodeCommonString(printer?.printerName));
if (CheckEmptyUtils.isEmpty(printer)) {
Log.error(TAG, 'printer is null')
return;
}
let printerString = JSON.stringify(printer!)... | https://gitee.com/openharmony/applications_print_spooler.git | d6c0115aea596a7429539911c716daf2ef6af223 | gitee |
honjow/Next2V | feature/detail/src/main/ets/viewmodel/DetailViewModel.ets | arkts | triggerThreadPreloadIfNeeded | Called after load() completes. Checks if thread mode needs preloading
and either auto-preloads or sets needsPreloadConfirm for the UI to show a dialog. | triggerThreadPreloadIfNeeded(hotRepliesEnabled: boolean = false): void {
if ((!this.isThreadMode() && !hotRepliesEnabled) || !this.repliesHasMore || this.allRepliesLoaded) {
this.flushHeldRepliesPublish()
return
}
const estimatedTotal = this.estimateTotalReplies()
if (estimatedTotal > Deta... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left triggerThreadPreloadIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hotRepliesEnabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST... | triggerThreadPreloadIfNeeded(hotRepliesEnabled: boolean = false): void {
if ((!this.isThreadMode() && !hotRepliesEnabled) || !this.repliesHasMore || this.allRepliesLoaded) {
this.flushHeldRepliesPublish()
return
}
const estimatedTotal = this.estimateTotalReplies()
if (estimatedTotal > Deta... | https://github.com/honjow/Next2V | 91f81271619bfaa766105bf109b53747244636fb | github |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/pages/eventpages/ScreenPage.ets | arkts | getEventColor | 语义化颜色映射
根据消息内容返回对应的主题色,增强日志的可读性。 | getEventColor(msg: string): string {
if (msg.includes('锁定')) return '#FF9500'; // 橙色表示安全锁定
if (msg.includes('熄灭')) return '#666666'; // 灰色表示进入休眠
return '#007DFF'; // 蓝色表示常规操作
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEventColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AS... | getEventColor(msg: string): string {
if (msg.includes('锁定')) return '#FF9500'; // 橙色表示安全锁定
if (msg.includes('熄灭')) return '#666666'; // 灰色表示进入休眠
return '#007DFF'; // 蓝色表示常规操作
} | https://gitcode.com/openharmony/codelabs | fa449c0dafadae8499791518e3597ce47130908a | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | getBitsByRange | Returns the bit values in a range of indices in a bit vector.
@param { int } fromIndex - The starting position of the index, containing the value at that index position.
@param { int } toIndex - The end of the index, excluding the value at that index.
@returns { BitVector } The BitVector type, returns the bit values in... | public getBitsByRange(fromIndex: int, toIndex: int): BitVector {
this.checkRange(fromIndex, toIndex);
let fromElem = this.computeElementIdAndBitId(fromIndex);
let toElem = this.computeElementIdAndBitId(toIndex);
let newBitVector = new BitVector(toIndex - fromIn... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBitsByRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fromIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#iden... | public getBitsByRange(fromIndex: int, toIndex: int): BitVector {
this.checkRange(fromIndex, toIndex);
let fromElem = this.computeElementIdAndBitId(fromIndex);
let toElem = this.computeElementIdAndBitId(toIndex);
let newBitVector = new BitVector(toIndex - fromIn... | https://gitcode.com/iop123123/arkts-static-skills | 866922506b75b4cf9fbfaf163866495375055f84 | gitcode |
seagazer/cclyric | lib/src/main/ets/CcLyricController.ets | arkts | setTextSize | Set the text size of lyric, must set before bind the CcLyricView.
@param size The text size, the unit is vp. | public setTextSize(size: number): CcLyricController {
this._textSize = size
this.resize()
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTextSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | public setTextSize(size: number): CcLyricController {
this._textSize = size
this.resize()
return this
} | https://github.com/seagazer/cclyric | fefbc3a7aa4da82746dd48cc3c65c76a1ebe012f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | runJavaScriptWithTimeout | 带超时的JavaScript执行
防止无限循环导致永久卡住 | private async runJavaScriptWithTimeout(script: string, timeoutMs: number): Promise<string> {
if (!this.webviewController) {
throw new Error('WebView未初始化');
}
return new Promise<string>((resolve, reject) => {
let isResolved = false;
// 超时定时器
const timeoutId = setTimeout(() =... | 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 runJavaScriptWithTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left script AST#identifier#Right ... | private async runJavaScriptWithTimeout(script: string, timeoutMs: number): Promise<string> {
if (!this.webviewController) {
throw new Error('WebView未初始化');
}
return new Promise<string>((resolve, reject) => {
let isResolved = false;
// 超时定时器
const timeoutId = setTimeout(() =... | https://github.com/DaLongZhuaZi/manxia | 7a5d3b26379128639a2735b15b2a1aef8b65e7cc | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | clone | Creates a shallow copy of the ArrayList.
@returns A new ArrayList that is a shallow copy of the original ArrayList. | public clone(): ArrayList<T> {
let newBuffer: ArrayList<T> = new ArrayList<T>(this.capacity);
for (let i: int = 0; i < this.length; i++) {
newBuffer.add(this.buffer[i]);
}
return newBuffer;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clone AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right... | public clone(): ArrayList<T> {
let newBuffer: ArrayList<T> = new ArrayList<T>(this.capacity);
for (let i: int = 0; i < this.length; i++) {
newBuffer.add(this.buffer[i]);
}
return newBuffer;
} | https://gitcode.com/iop123123/arkts-static-skills | 5876a695daa9fc7e450595e8f93616da9fbd236d | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test2_original_index.ets | arkts | testStringMethods | === Method overloading pattern (multiple calls with different args) === | function testStringMethods(): string {
let s: string = 'Hello, World!';
let lower: string = s.toLowerCase();
let upper: string = s.toUpperCase();
let sub: string = s.substring(0, 5);
let len: number = s.length;
return lower + '|' + upper + '|' + sub + '|' + String(len);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringMethods AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testStringMethods(): string {
let s: string = 'Hello, World!';
let lower: string = s.toLowerCase();
let upper: string = s.toUpperCase();
let sub: string = s.substring(0, 5);
let len: number = s.length;
return lower + '|' + upper + '|' + sub + '|' + String(len);
} | https://github.com/miaochiahao/ark-ghidra | f7034d2a857d17540846bbd0d8fd0c9712fd9486 | github |
openharmony-sig/ohos_checksum | library/src/main/ets/md5.ets | arkts | rstr_hmac_md5 | Calculate the HMAC-MD5, of a key and some data (raw strings) | rstr_hmac_md5(key: string, data: string): string {
let bkey: number[] = this.rstr2binl(key);
if (bkey.length > 16) bkey = this.binl_md5(bkey, key.length * 8);
let ipad: number[] = Array(16), opad: number[] = Array(16);
for (let i = 0; i < 16; i++) {
ipad[i] = bkey[i] ^ 0... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rstr_hmac_md5 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS... | rstr_hmac_md5(key: string, data: string): string {
let bkey: number[] = this.rstr2binl(key);
if (bkey.length > 16) bkey = this.binl_md5(bkey, key.length * 8);
let ipad: number[] = Array(16), opad: number[] = Array(16);
for (let i = 0; i < 16; i++) {
ipad[i] = bkey[i] ^ 0... | https://gitee.com/openharmony-sig/ohos_checksum.git | af42d8cba73663e829f64061c0b4f7d3bd30bc17 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/ModelManager.ets | arkts | getEstimatedMemoryUsage | 获取模型内存占用估算(MB)
@returns 内存占用 | getEstimatedMemoryUsage(): number {
// 每个模型估算约20MB
const modelSizeMB = 20;
return this.getLoadedModelCount() * modelSizeMB;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEstimatedMemoryUsage 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 AS... | getEstimatedMemoryUsage(): number {
// 每个模型估算约20MB
const modelSizeMB = 20;
return this.getLoadedModelCount() * modelSizeMB;
} | https://github.com/LJ666-ui/harmony-health-care | 206a2f729ca3a4535a24f6600ad39bfd90301081 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | concat | concat
@param { String } s1
@param { String } s2
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public concat(s1: String, s2: String): String {
return String.concat3(this, s1, s2);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left concat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST#... | public concat(s1: String, s2: String): String {
return String.concat3(this, s1, s2);
} | https://gitcode.com/iop123123/arkts-static-skills | 32f9ec74fc0f5d9cf30bc524af8f66a479d67eb6 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/MoonBridge.ets | arkts | nativeMicStop | 停止 native 麦克风采集 | nativeMicStop(): void {
nativeLib.nativeMicStop();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nativeMicStop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | nativeMicStop(): void {
nativeLib.nativeMicStop();
} | https://github.com/AlkaidLab/moonlight-harmony | edfd6b50b07bb1b81c2f80b86bfd8ca37ed776c4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | hasImageFiles | 检查目录是否包含图片文件
@param directory 目录路径
@returns 是否包含图片文件 | private async hasImageFiles(directory: string): Promise<boolean> {
try {
const files = await this.sandboxManager.listDirectory(directory);
for (const fileName of files) {
const extension = this.getFileExtension(fileName).toLowerCase();
if (['.jpg', '.jpeg', '.png', '.webp', '.gi... | 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 hasImageFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left directory AST#identifier#Right AST#ERROR#Left AST#:#Le... | private async hasImageFiles(directory: string): Promise<boolean> {
try {
const files = await this.sandboxManager.listDirectory(directory);
for (const fileName of files) {
const extension = this.getFileExtension(fileName).toLowerCase();
if (['.jpg', '.jpeg', '.png', '.webp', '.gi... | https://github.com/DaLongZhuaZi/manxia | de3fe3746ece5c75d61bbd913b695fb472076456 | github |
arkui-x/samples | CodeLab/Cases/feature/danmakuplayer/src/main/ets/view/VideoView.ets | arkts | onPageShow | 页面展示时重新播放 | onPageShow() {
const player: BaseVideoPlayer = GlobalContext.getContext().getObject('currentPlayer') as BaseVideoPlayer;
if (!player) {
return;
}
player.resumePlay();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
const player: BaseVideoPlayer = GlobalContext.getContext().getObject('currentPlayer') as BaseVideoPlayer;
if (!player) {
return;
}
player.resumePlay();
} | https://gitcode.com/arkui-x/samples | 3d8e2b7594f04080910dd646d2dcea61c87fde91 | gitcode |
openharmony-sig/amountinputtext | libamountinput/src/main/ets/widget/AmountInputText.ets | arkts | getAmount | 获取当前金额 | getAmount(): string {
if (this.amountStr != null && this.amountStr != this.defTips) {
return this.amountStr
}
return "";
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAmount 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_bl... | getAmount(): string {
if (this.amountStr != null && this.amountStr != this.defTips) {
return this.amountStr
}
return "";
} | https://gitee.com/openharmony-sig/amountinputtext.git | 48b951122fdb58ecf125e44ca1b2aa2316a6591b | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/components/ImageLoadStateManager.ets | arkts | getLoadingCount | 获取当前正在加载的数量(O(1)复杂度)
避免每次调用时遍历所有页面 | getLoadingCount(): number {
return this.loadingCount;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLoadingCount 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#statem... | getLoadingCount(): number {
return this.loadingCount;
} | https://github.com/DaLongZhuaZi/manxia | 727d022ddb1746a21ba629b08f410a038700f08a | github |
terryma2024/happyword | harmonyos/entry/src/test/LocalUnit.test.ets | arkts | pickWrongOption | Pick any option from `q` that is not the correct answer. | function pickWrongOption(q: Question): string {
for (let i = 0; i < q.options.length; i++) {
if (q.options[i] !== q.answer) {
return q.options[i];
}
}
return '';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left pickWrongOption AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left q AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function pickWrongOption(q: Question): string {
for (let i = 0; i < q.options.length; i++) {
if (q.options[i] !== q.answer) {
return q.options[i];
}
}
return '';
} | https://github.com/terryma2024/happyword | 0b7824742c0b8e153030c1fc78035498c7fa7e36 | github |
YANGZX22/Voot | entry/src/main/ets/services/ContinuityService.ets | arkts | getDeviceTypeName | 获取设备类型名称 | static getDeviceTypeName(deviceType: number): string {
// DeviceType枚举: 0-UNKNOWN, 0x0E-PHONE, 0x11-TABLET, 0x6D-2in1, 0x0A-PC
switch (deviceType) {
case 0x0E:
return '手机';
case 0x11:
return '平板';
case 0x6D:
return '折叠屏';
case 0x0A:
return '电脑';
de... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDeviceTypeName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | static getDeviceTypeName(deviceType: number): string {
// DeviceType枚举: 0-UNKNOWN, 0x0E-PHONE, 0x11-TABLET, 0x6D-2in1, 0x0A-PC
switch (deviceType) {
case 0x0E:
return '手机';
case 0x11:
return '平板';
case 0x6D:
return '折叠屏';
case 0x0A:
return '电脑';
de... | https://github.com/YANGZX22/Voot | 0bdcf48a59cc0b8ef690abfe099c11bc79903e50 | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Card.ets | arkts | constructor | 点数 (A=1, J=11, Q=12, K=13) | constructor(suit: Suit, rank: number) {
this.suit = suit;
this.rank = rank;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left suit AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Suit AST#identifier#Right AST... | constructor(suit: Suit, rank: number) {
this.suit = suit;
this.rank = rank;
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | af71dd151e9930c13e8ea4120ce02811f7ad6f99 | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t3_arrayNotation | T3: Array notation a[]=1&a[]=2 | t3_arrayNotation(): void {
const r: Record<string, Object> = parse('a[]=1&a[]=2&a[]=3');
const rec: Record<string, Object> = r as Record<string, Object>;
const arr: Object[] = rec['a'] as Object[];
const passed: boolean = Array.isArray(arr) && arr.length === 3 &&
arr[0] === '1' && arr[1] === '2'... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t3_arrayNotation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | t3_arrayNotation(): void {
const r: Record<string, Object> = parse('a[]=1&a[]=2&a[]=3');
const rec: Record<string, Object> = r as Record<string, Object>;
const arr: Object[] = rec['a'] as Object[];
const passed: boolean = Array.isArray(arr) && arr.length === 3 &&
arr[0] === '1' && arr[1] === '2'... | https://github.com/wgli-collab/qs-arkts | b5ed9c62d7e7dcbe73ab47b05db46643268bf1cc | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/SearchHistoryManager.ets | arkts | checkInitialized | 检查存储是否已初始化 | private static checkInitialized(): boolean {
return SearchHistoryManager.preferencesStore !== null
} | 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 checkInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private static checkInitialized(): boolean {
return SearchHistoryManager.preferencesStore !== null
} | https://github.com/cpdd5201314/harmonyOS-music-app | 0bc44a269422e9cfd7c9e2cbe24878bb773832c8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | HasWriters | Checks if there are any waiting writers.
@param { long } state Current lock state
@returns { boolean } True if there are waiting writers, false otherwise
@syscap SystemCapability.Utils.Lang | public static HasWriters(state: long): boolean {
return (state & State.WRITERS_MASK) != 0;
} | 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 HasWriters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static HasWriters(state: long): boolean {
return (state & State.WRITERS_MASK) != 0;
} | https://gitcode.com/iop123123/arkts-static-skills | 6e99ac7bcc0f0dc8903a1bb8b10d24bb5d08b5a7 | gitcode |
Nekofox-POT/LinMusic | entry/src/main/ets/example.ets | arkts | aboutToAppear | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
环境准备 //
//////////
变量池 //
更新池 //
类 //
继承池 //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
基础函数 //
//////////
进入app操作 // | aboutToAppear(): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear 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#L... | aboutToAppear(): void {} | https://github.com/Nekofox-POT/LinMusic | ad2c7fb4699dc7bf5564047ce1391b1c2583d8a3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | formatDisplay | 格式化时间戳为显示字符串
@param timestamp - 时间戳(毫秒)
@param format - 格式类型
@returns 格式化的时间字符串 | static formatDisplay(timestamp: number, format: 'date' | 'datetime' | 'time' | 'relative' = 'datetime'): string {
const date = new Date(timestamp);
switch (format) {
case 'date':
return date.toLocaleDateString('zh-CN');
case 'time':
return date.toLocaleTimeString('zh-CN');
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDisplay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | static formatDisplay(timestamp: number, format: 'date' | 'datetime' | 'time' | 'relative' = 'datetime'): string {
const date = new Date(timestamp);
switch (format) {
case 'date':
return date.toLocaleDateString('zh-CN');
case 'time':
return date.toLocaleTimeString('zh-CN');
... | https://github.com/DaLongZhuaZi/manxia | 70912ab9fa41289d7a043c884ebbc7baa3c9cbf0 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | isReference | Checks whether type is reference or composite
@returns {boolean} true if type is reference and false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override isReference(): boolean {
return true
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left isReference AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public override isReference(): boolean {
return true
} | https://gitcode.com/iop123123/arkts-static-skills | c1a843e8416da72199c3cba7a8aa401fad9b1a0b | gitcode |
codelably/HCompass | core/network/src/main/ets/DefaultResponseParser.ets | arkts | getConfig | 获取当前配置
@returns 解析器配置 | getConfig(): ResponseParserConfig {
return ObjectAssign({} as ResponseParserConfig, this.config);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfig 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 ResponseParserConfig AST#identifier#Right AST#ERROR#... | getConfig(): ResponseParserConfig {
return ObjectAssign({} as ResponseParserConfig, this.config);
} | https://github.com/codelably/HCompass | a984d126a9c1481f2bbe40e8672d970aa53ef6df | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/ImageLoadStateManager.ets | arkts | setStateChangeCallback | 设置状态变化回调 | setStateChangeCallback(callback: (pageId: string, state: PageState) => void): void {
this.onStateChange = callback;
} | AST#program#Left AST#ERROR#Left AST#identifier#Left setStateChangeCallback 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#(#Right AST#ERROR#Left AST#ident... | setStateChangeCallback(callback: (pageId: string, state: PageState) => void): void {
this.onStateChange = callback;
} | https://github.com/DaLongZhuaZi/manxia | efe158cae072046c233b0700100f634222a3fa4a | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MedicalAgent.ets | arkts | getName | 获取智能体名称 | getName(): string {
return this.agentName;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getName 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_bloc... | getName(): string {
return this.agentName;
} | https://github.com/LJ666-ui/harmony-health-care | b41a7feb63e8453ae3b2538de702f262441e2bfc | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/StringUtils.ets | arkts | removePrefix | 移除字符串开头的指定前缀;若不匹配则原样返回 | static removePrefix(value: string, prefix: string): string {
if (prefix.length === 0) {
return value;
}
if (value.length >= prefix.length && value.substring(0, prefix.length) === prefix) {
return value.substring(prefix.length);
}
return value;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left removePrefix 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 st... | static removePrefix(value: string, prefix: string): string {
if (prefix.length === 0) {
return value;
}
if (value.length >= prefix.length && value.substring(0, prefix.length) === prefix) {
return value.substring(prefix.length);
}
return value;
} | https://github.com/DaLongZhuaZi/NGF | d6fca2e5432460ad5e2e4bde39997650c7466e3f | github |
popsiclelmlm/Hey | entry/src/main/ets/features/assets/AssetsController.ets | arkts | deleteCustomAsset | 删除自定义 URL 链接及本地 dat 文件 | async deleteCustomAsset(context: common.Context, item: CustomAssetUrl, customAssets: Array<CustomAssetUrl>, language: AppLanguage): Promise<Array<CustomAssetUrl>> {
const path = `${context.filesDir}/${item.name}.dat`;
try {
if (fs.accessSync(path)) {
fs.unlinkSync(path);
}
} catch (e) ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteCustomAsset AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#L... | async deleteCustomAsset(context: common.Context, item: CustomAssetUrl, customAssets: Array<CustomAssetUrl>, language: AppLanguage): Promise<Array<CustomAssetUrl>> {
const path = `${context.filesDir}/${item.name}.dat`;
try {
if (fs.accessSync(path)) {
fs.unlinkSync(path);
}
} catch (e) ... | https://github.com/popsiclelmlm/Hey | b27161577e980f80fbbe939811709ea53fd786f4 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readBigUint64 | Reads the next unsigned long.
@param littleEndian If the value is little endian.
@returns The value. | readBigUint64(littleEndian?: boolean): bigint {
const value = this.getBigUint64(this.mByteOffset, littleEndian)
this.mByteOffset += 8
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readBigUint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left littleEndian AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AS... | readBigUint64(littleEndian?: boolean): bigint {
const value = this.getBigUint64(this.mByteOffset, littleEndian)
this.mByteOffset += 8
return value
} | https://gitee.com/openharmony-sig/flutter_engine.git | a6f1efdf03527e8fd3703663f26db4892ecd3743 | gitee |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/CominLog/PlayerManager.ets | arkts | setProgressTimer | 启动定时器,通过回调,设置进度条和时间信息 | setProgressTimer() {
this.cancelProgressTimer()
this.progressIntervalID = setInterval(() => {
if (typeof (this.playingProgressListener) != "undefined" && this.playingProgressListener != null) {
var timeMs = this.player.currentTime;
this.currentTimeMs = ti... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setProgressTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | setProgressTimer() {
this.cancelProgressTimer()
this.progressIntervalID = setInterval(() => {
if (typeof (this.playingProgressListener) != "undefined" && this.playingProgressListener != null) {
var timeMs = this.player.currentTime;
this.currentTimeMs = ti... | https://gitee.com/openharmony-sig/online_event.git | 67c30eedc8640c6e98c9e7402cfa92cc9fe6e5e9 | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets | arkts | setFallbackNotification | 备用通知方案 | private async setFallbackNotification(event: CalendarEvent, remindTime: number): Promise<boolean> {
try {
// 创建通知内容
const notificationContent: notificationManager.NotificationContent = {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: e... | 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 setFallbackNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AS... | private async setFallbackNotification(event: CalendarEvent, remindTime: number): Promise<boolean> {
try {
// 创建通知内容
const notificationContent: notificationManager.NotificationContent = {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: e... | https://gitcode.com/openharmony/codelabs | 03beb9604e46a6912a10585bfbb204a5c615ee76 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/startup/StartupTask1.ets | arkts | init | 自定义任务开始执行,在此处写任务的具体逻辑 | async init(context: common.AbilityStageContext) {
MyLog.d(`StartupTask1 init`)
// 睡 2 秒
// 我这里测试发现,当这里执行异步任务时
// 如果当前任务执行在 mainThread(在 startup_config.json 中配置的),则一切正常
// 如果当前任务执行在 taskPool(在 startup_config.json 中配置的),则无法获知当前任务执行完成,最后会在 StartupConfigEntry 中得到启动任务超时的回调
await new Promise<vo... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async init(context: common.AbilityStageContext) {
MyLog.d(`StartupTask1 init`)
// 睡 2 秒
// 我这里测试发现,当这里执行异步任务时
// 如果当前任务执行在 mainThread(在 startup_config.json 中配置的),则一切正常
// 如果当前任务执行在 taskPool(在 startup_config.json 中配置的),则无法获知当前任务执行完成,最后会在 StartupConfigEntry 中得到启动任务超时的回调
await new Promise<vo... | https://github.com/webabcd/HarmonyDemo | c8b799ea79fd8a0d4555d1db137626b9366b1904 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/PageStateManager.ets | arkts | getTabIndex | Obtains tab index.
@return tabIndex | async getTabIndex(): Promise<number> {
const preferences = await this.getPreferences();
const tabIndex = await preferences.get(tabIndexKey, 0);
LogUtil.info(TAG, 'get tabIndex from Sp:' + tabIndex);
return Number(tabIndex);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTabIndex AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getTabIndex(): Promise<number> {
const preferences = await this.getPreferences();
const tabIndex = await preferences.get(tabIndexKey, 0);
LogUtil.info(TAG, 'get tabIndex from Sp:' + tabIndex);
return Number(tabIndex);
} | https://gitee.com/openharmony-sig/applications_clock.git | ede2828febf070df69bfee1b2bff08a51b7f2a9f | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/WhereCondition.ets | arkts | equal | 创建等于条件
@param column 列名
@param value 值
@returns WhereCondition 实例 | static equal(column: string, value: ValueType): WhereCondition {
const condition = new WhereCondition()
condition.column = column
condition.operator = ConditionOperator.EQUAL
condition.value = value
return condition
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left equal AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#E... | static equal(column: string, value: ValueType): WhereCondition {
const condition = new WhereCondition()
condition.column = column
condition.operator = ConditionOperator.EQUAL
condition.value = value
return condition
} | https://github.com/offlinecat-dev/OCNetORM | cee4f82757c5e31fe7841cad1e76ea1b9a3b675d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | onNewWant | 应用已在后台运行时接收新的Want请求(如从文件管理器打开文件) | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
logger.info('EntryAbility', 'onNewWant: 接收到新的Want请求');
// 打印Want详情辅助调试
logger.info('EntryAbility', `📋 onNewWant Want: uri=${want.uri || 'null'}, type=${want.type || 'null'}`);
if (want.parameters) {
logger.info('EntryAbilit... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant 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#,#R... | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
logger.info('EntryAbility', 'onNewWant: 接收到新的Want请求');
// 打印Want详情辅助调试
logger.info('EntryAbility', `📋 onNewWant Want: uri=${want.uri || 'null'}, type=${want.type || 'null'}`);
if (want.parameters) {
logger.info('EntryAbilit... | https://github.com/DaLongZhuaZi/manxia | eb61130d02ecb4ba2e52c06335fa369ea8422eac | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets | arkts | clearAllTasks | 清除所有预加载任务 | public clearAllTasks(): void {
this.tasks.clear();
this.activeTaskCount = 0;
logger.info(TAG, '清除所有预加载任务');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearAllTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressi... | public clearAllTasks(): void {
this.tasks.clear();
this.activeTaskCount = 0;
logger.info(TAG, '清除所有预加载任务');
} | https://github.com/DaLongZhuaZi/manxia | 3d57810cd9e8e4351debfb0efb85f3a36dd22f7c | github |
GrassyUnknown/Health-Life-HarmonyOS-Next | entry/src/main/ets/common/database/tables/SelfInfoApi.ets | arkts | updateData | Update selfInfo.
@param selfInfo
@param callback | updateData(selfInfo: SelfInfo, callback : Function): void {
const valueBucket = generateBucket(selfInfo);
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(Const.SELF_INFO.tableName ? Const.SELF_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.update(valueBuc... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selfInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SelfInfo AST#identifier#Right AST#,#Left ... | updateData(selfInfo: SelfInfo, callback : Function): void {
const valueBucket = generateBucket(selfInfo);
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(Const.SELF_INFO.tableName ? Const.SELF_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.update(valueBuc... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | 59b150b1d1b9b619dc54f509f9d9c50c97a3f61f | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | parseUpstreamConfig | Parse upstream.txt into the auto flag + the manual/fallback resolver list. An
"__AUTO__" first line turns on auto mode; the rest is the fallback. | private parseUpstreamConfig(): void {
const content: string = this.readTextFile(this.upstreamDnsFilePath);
const lines: string[] = content.split(/[\r\n]+/).map((l: string) => l.trim()).filter((l: string) => l.length > 0);
if (lines.length > 0 && lines[0] === UPSTREAM_AUTO_MARKER) {
this.upstreamAuto... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseUpstreamConfig 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 ... | private parseUpstreamConfig(): void {
const content: string = this.readTextFile(this.upstreamDnsFilePath);
const lines: string[] = content.split(/[\r\n]+/).map((l: string) => l.trim()).filter((l: string) => l.length > 0);
if (lines.length > 0 && lines[0] === UPSTREAM_AUTO_MARKER) {
this.upstreamAuto... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1232-L1242 | 9e8a8ec80981c9ebd2c5ebef3e05b0fc54d20a22 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | requestRefreshRect | Request partial screen refresh for specific area | static requestRefreshRect(inst: number, x: number, y: number, width: number, height: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpRequestRefreshRect(inst, x, y, width, height);
}... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left requestRefreshRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static requestRefreshRect(inst: number, x: number, y: number, width: number, height: number): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
if (inst === 0) {
return false;
}
try {
return freerdpNative!.freerdpRequestRefreshRect(inst, x, y, width, height);
}... | https://github.com/tangwengang-del/freerdp-harmonyos | 96deecd6fd9db60d0b30ef7aed54f88ab59e50fd | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/UserLibraryApi.ets | arkts | unmarkFavoriteItem | Unmarks item as a favorite.
@summary Unmarks item as a favorite.
@param {UserLibraryApiUnmarkFavoriteItemRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UserLibraryApi | public async unmarkFavoriteItem(requestParameters: UserLibraryApiUnmarkFavoriteItemRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.delete({path: `/UserFavoriteItems/${requestParameters.itemId}`, parameters: requestParameters, excludeParams: ['itemId']})
... | 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 unmarkFavoriteItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Righ... | public async unmarkFavoriteItem(requestParameters: UserLibraryApiUnmarkFavoriteItemRequest): Promise<UserItemDataDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.delete({path: `/UserFavoriteItems/${requestParameters.itemId}`, parameters: requestParameters, excludeParams: ['itemId']})
... | https://github.com/OHPG/FinSdk | 3df70019eb1795042a13f08c5ac67d8027258857 | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/NoteUtil.ets | arkts | getNoteBgColor | Get note background color
@param folderDataArray - Folder data list
@param uuid - note's folder_uuid
@param selectFolderUuid - selected folder's uuid
@param isSelected - is selected or not
@return Resource | string - color value | getNoteBgColor(folderDataArray: FolderData[], uuid: string, selectFolderUuid: string, isSelected: boolean): Resource | string {
let folderData: FolderData = FolderUtil.getFolderData(folderDataArray, uuid)
if (folderData == undefined || (selectFolderUuid != SysDefFolderUuid.AllNotes && !isSelected)) {
Lo... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getNoteBgColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Fold... | getNoteBgColor(folderDataArray: FolderData[], uuid: string, selectFolderUuid: string, isSelected: boolean): Resource | string {
let folderData: FolderData = FolderUtil.getFolderData(folderDataArray, uuid)
if (folderData == undefined || (selectFolderUuid != SysDefFolderUuid.AllNotes && !isSelected)) {
Lo... | https://gitee.com/openharmony/applications_notes.git | 2ec9bef1722b8790bcf3c80ac461c855a72599d2 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | getLabelPosition | returns the position of the y-labels | public getLabelPosition(): YAxisLabelPosition {
return this.mPosition;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabelPosition 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 YAxis... | public getLabelPosition(): YAxisLabelPosition {
return this.mPosition;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 25d596421bba8b000277f9ca2636580aab2dc6ef | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/FamilyPackService.ets | arkts | warmFromCache | Pre-load the in-memory cache from preferences. Tests call this
manually after injecting their stub. | async warmFromCache(): Promise<FamilyPacksBlob | null> {
const env: CachedEnvelope | null = await this.readCache();
if (env === null) {
this.memoryBlob = null;
this.memoryEnvelope = null;
return null;
}
this.memoryEnvelope = env;
this.memoryBlob = parseFamilyPacksBlob(env.body, e... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left warmFromCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi... | async warmFromCache(): Promise<FamilyPacksBlob | null> {
const env: CachedEnvelope | null = await this.readCache();
if (env === null) {
this.memoryBlob = null;
this.memoryEnvelope = null;
return null;
}
this.memoryEnvelope = env;
this.memoryBlob = parseFamilyPacksBlob(env.body, e... | https://github.com/terryma2024/happyword | dbe6cd66904bfef360db66a31ad15e040001faf2 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | expandNamespace | Expand EH's short namespace prefixes to their full names (eros_fe prefixToNameSpaceMap):
'a'→'artist', 'f'→'female', 'cos'→'cosplayer', … . EH writes a tag's namespace as EITHER the
full word ('artist:x') OR the abbreviation ('a:x'); bucketing and coloring must treat both the
same. Full names (and anything unknown) pas... | static expandNamespace(ns: string): string {
if (EhConstants.nsPrefixMap === null) {
const m: Map<string, string> = new Map<string, string>()
m.set('a', 'artist')
m.set('c', 'character')
m.set('f', 'female')
m.set('g', 'group')
m.set('l', 'language')
m.set('loc', 'locatio... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left expandNamespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ns AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static expandNamespace(ns: string): string {
if (EhConstants.nsPrefixMap === null) {
const m: Map<string, string> = new Map<string, string>()
m.set('a', 'artist')
m.set('c', 'character')
m.set('f', 'female')
m.set('g', 'group')
m.set('l', 'language')
m.set('loc', 'locatio... | https://github.com/erosTeam/NextE | 6c8d80b44ff7ad002d1dc88f99ddfa0f380eade1 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | reduceRight | Reduces data into a single value using right-to-left traversal
@param fn condition
@param init initial value
@returns reduction result | public reduceRight(fn: (acc: byte, curVal: byte, curIndex: int, array: Int8Array) => byte, init: byte): byte {
let acc = init
for (let i = this.length - 1; i >= 0; --i) {
acc = fn(acc, this.at(i), i, this)
}
return acc
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public reduceRight(fn: (acc: byte, curVal: byte, curIndex: int, array: Int8Array) => byte, init: byte): byte {
let acc = init
for (let i = this.length - 1; i >= 0; --i) {
acc = fn(acc, this.at(i), i, this)
}
return acc
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 502cfe06582feb396b85c005ac48df50ddbfda3f | gitee |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/SearchFilter.ets | arkts | clear | 清除所有过滤条件(保留 inType) | clear(): SearchFilter {
return new SearchFilter(null, null, null, null, [], null, null, null, this.inType);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear 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 SearchFilter AST#identifier#Right AST#ERROR#Right AST#st... | clear(): SearchFilter {
return new SearchFilter(null, null, null, null, [], null, null, null, this.inType);
} | https://github.com/Amaz1ny/HarmonyDO-public | 00a376ab945db81b335d84775da1fed7864aae9a | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | getInfo | 获取文件信息
优先从本地缓存获取
@param path 文件路径
@returns 文件信息
@throws 如果获取失败则抛出异常 | public async getInfo(path: string): Promise<FileInfo> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.getInfo(path);
}
const cachePath: string = CacheConstants.getCacheFilePath(path);
const onlyUseCache: boolean = CacheConstants.getOnlyCache();
const... | 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 getInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Rig... | public async getInfo(path: string): Promise<FileInfo> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.getInfo(path);
}
const cachePath: string = CacheConstants.getCacheFilePath(path);
const onlyUseCache: boolean = CacheConstants.getOnlyCache();
const... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L155-L183 | 85478af9202b20deb979543a2a5cdbdb4030c780 | github |
codelably/HCompass | core/network/src/main/ets/NetworkResult.ets | arkts | success | 创建成功响应
@param data 响应数据
@param message 响应消息
@returns NetworkResult 实例 | static success<T>(data: T, message?: string): NetworkResult<T> {
return new NetworkResult<T>({
code: 200,
data,
message: message ?? 'success'
} as StandardResponse<T>);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left success AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right... | static success<T>(data: T, message?: string): NetworkResult<T> {
return new NetworkResult<T>({
code: 200,
data,
message: message ?? 'success'
} as StandardResponse<T>);
} | https://github.com/codelably/HCompass | 4c2e35aecc81a42c4346e24c80171a376cf4fb50 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | onRequestSuccess | 请求成功后处理分类树数据
@param {Category[]} data - 分类列表
@returns {void} 无返回值 | protected onRequestSuccess(data: Category[]): void {
this.categoryTrees = this.convertToTree(data);
this.categoryTitles = this.categoryTrees.map((item: CategoryTree): string => item.name);
this.isSideBarScrolling = false;
this.lastSideBarIndex = 0;
this.clearSideBarUnlockTimer();
if (this.cate... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left onRequestSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr... | protected onRequestSuccess(data: Category[]): void {
this.categoryTrees = this.convertToTree(data);
this.categoryTitles = this.categoryTrees.map((item: CategoryTree): string => item.name);
this.isSideBarScrolling = false;
this.lastSideBarIndex = 0;
this.clearSideBarUnlockTimer();
if (this.cate... | https://github.com/Joker-x-dev/CoolMallArkTS | 9862af279191355058457126910eeea10f07ddcf | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.