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 |
|---|---|---|---|---|---|---|---|---|---|---|
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | lookupAndSetIpv6 | 异步查询主机的 IPv6 全局地址并更新到 ComputerInfo
通过 DNS 解析多个候选主机名获取 AAAA 记录,选出最佳 IPv6 全局地址。
候选源(按外网可达性排序):
1. manualAddress:用户输入的 DDNS / 公网域名(外网最优)
2. hostname:服务器自报(通常仅 LAN 可解析)
3. hostname.local:mDNS fallback
必要性:用户反馈"手输 IPv6 字面量可连接、用 AAAA-only 域名超时"。
推断 RCK / native getaddrinfo 对 AAAA-only 域名解析行为有问题。
通过 ETS 层 `connection.getAddre... | private lookupAndSetIpv6(computer: ComputerInfo, hostname: string | undefined, manualAddress?: string): void {
// 不解析已经是 IPv6 字面量的 manualAddress;纯 IPv4 字面量也跳过
const lookupSources: string[] = [];
if (manualAddress && !isIPv6Address(manualAddress) && !isIPv4Address(manualAddress)) {
lookupSources.push... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left lookupAndSetIpv6 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private lookupAndSetIpv6(computer: ComputerInfo, hostname: string | undefined, manualAddress?: string): void {
// 不解析已经是 IPv6 字面量的 manualAddress;纯 IPv4 字面量也跳过
const lookupSources: string[] = [];
if (manualAddress && !isIPv6Address(manualAddress) && !isIPv4Address(manualAddress)) {
lookupSources.push... | https://github.com/AlkaidLab/moonlight-harmony | 1ce9c220f6ea7d367fbb446f8bf93d4f3fdb4dc2 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unsigned_right_shift/unsigned_right_shift_byte.ets | arkts | main | ---
desc: check unsigned right shift operation for byte
--- | function main(): void {
const a: byte = {{v.left}}
const b: int = {{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: byte = {{v.left}}
const b: int = {{v.right}}
assert (a >>> b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | db1e9f9ed2e1d1482f6c5a22cc397df7faa79b8d | gitee |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/view/LoginPage.ets | arkts | build | 构建登录页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") }
}) {
this.LoginContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
AppNavDestination({
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") }
}) {
this.LoginContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | add8e567a46b54df9063c2227b8e189268d185eb | github |
iichen-bycode/ArkTsWanandroid | entry/src/main/ets/viewmodel/HomeViewModel.ets | arkts | unCollectArticle | 取消收藏文章
@param callback | async unCollectArticle(id:number,callback: ResultCallback,extra?: {isCollectList:boolean,originId:number}) {
await this.request({useSource: true})
.promise((extra?.isCollectList || false) ? unCollectListArticle(id,extra?.originId) :unCollectArticle(id))
.then((res) => {
if(res.errorCode == 0) ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unCollectArticle AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async unCollectArticle(id:number,callback: ResultCallback,extra?: {isCollectList:boolean,originId:number}) {
await this.request({useSource: true})
.promise((extra?.isCollectList || false) ? unCollectListArticle(id,extra?.originId) :unCollectArticle(id))
.then((res) => {
if(res.errorCode == 0) ... | https://github.com/iichen-bycode/ArkTsWanandroid | a40f4e9ce0268548611395f73c2e271ecb54e3f0 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/AdminAuthService.ets | arkts | logout | 管理员登出
清除本地存储的认证信息并跳转到管理员登录页 | static async logout(): Promise<void> {
try {
AppStorage.delete('adminToken');
AppStorage.delete('adminInfo');
AppStorage.delete('isAdminLoggedIn');
router.replaceUrl({ url: 'pages/AdminLogin' });
} catch (error) {
console.error('管理员登出失败:', error);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left logout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ... | static async logout(): Promise<void> {
try {
AppStorage.delete('adminToken');
AppStorage.delete('adminInfo');
AppStorage.delete('isAdminLoggedIn');
router.replaceUrl({ url: 'pages/AdminLogin' });
} catch (error) {
console.error('管理员登出失败:', error);
}
} | https://github.com/LJ666-ui/harmony-health-care | 4f65245b803c2549396ab92cd824eb3ddc616848 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RAManager.ets | arkts | onAchievementTriggered | 成就触发回调 (从 Native 层)
对齐 Android: EmulatorManager 中的 onAchievementTriggered | async onAchievementTriggered(achievementId: number): Promise<void> {
if (!this.currentSession) return;
hilog.info(DOMAIN, TAG, 'Achievement triggered: %{public}d', achievementId);
// 提交到服务器
const result = await this.apiClient.awardAchievement(achievementId, this.currentSession.isHardcore);
if (re... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onAchievementTriggered AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#... | async onAchievementTriggered(achievementId: number): Promise<void> {
if (!this.currentSession) return;
hilog.info(DOMAIN, TAG, 'Achievement triggered: %{public}d', achievementId);
// 提交到服务器
const result = await this.apiClient.awardAchievement(achievementId, this.currentSession.isHardcore);
if (re... | https://github.com/richshaw2015/nds | b8b19659b0e604547b4056c2eb7d582b375d70f6 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/dialogs/classes/meowDialogManager.ets | arkts | isEmpty | Checks if the dialog manager is empty.
@returns True if the dialog manager is empty. | isEmpty() {
return this.openedDialogs.length == 0;
} | AST#program#Left AST#ERROR#Left 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#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#return_statement#Left AST#ret... | isEmpty() {
return this.openedDialogs.length == 0;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 324f186c4798b60092a2c5e3cf57a01909fbf95c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates a copy of Uint32Array.
@param other data initializer | public constructor(other: Uint32Array) {
this.buffer = other.buffer.slice(0, other.buffer.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uin... | public constructor(other: Uint32Array) {
this.buffer = other.buffer.slice(0, other.buffer.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 544ceb4484f713fca0a166a0f9dbca4725c2c3dd | gitee |
apap6628114/nga_oh | entry/src/main/ets/store/SettingsStore.ets | arkts | setTtsPerson | --- Media (TTS / Image / Video) --- | setTtsPerson(v: number): void { this.mediaSettings.setTtsPerson(v) } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTtsPerson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)... | setTtsPerson(v: number): void { this.mediaSettings.setTtsPerson(v) } | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L142-L142 | a6f6224023aacec78c83ea30c1274c9fad8a5bc3 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnDateTimePickerViewModel.ets | arkts | onDatetimeConfirm | 日期时间组合选择确认回调
@param value 选中的日期时间 | onDatetimeConfirm(value: string): void {
this.selectedDatetime = value;
this.datetimePickerOpen = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDatetimeConfirm 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#)#Lef... | onDatetimeConfirm(value: string): void {
this.selectedDatetime = value;
this.datetimePickerOpen = false;
} | https://github.com/codelably/tuniao-ui | abe5962cf60ed1025da8f3600c6dd62be82308a4 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test61_original_index.ets | arkts | nextGreaterElement | --- Monotonic stack: next greater element --- | function nextGreaterElement(nums: number[]): number[] {
let result: number[] = [];
let stack: number[] = [];
for (let i: number = 0; i < nums.length; i++) {
result.push(-1);
}
for (let i: number = 0; i < nums.length; i++) {
while (stack.length > 0 && nums[i] > nums[stack[stack.length - 1]]) {
le... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left nextGreaterElement AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nums AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function nextGreaterElement(nums: number[]): number[] {
let result: number[] = [];
let stack: number[] = [];
for (let i: number = 0; i < nums.length; i++) {
result.push(-1);
}
for (let i: number = 0; i < nums.length; i++) {
while (stack.length > 0 && nums[i] > nums[stack[stack.length - 1]]) {
le... | https://github.com/miaochiahao/ark-ghidra | 22242221ecd63d4e6a0e367c5bc543c18d0ca74f | github |
OHPG/FinMusic | entry/src/main/ets/player/AppPlaybackManager.ets | arkts | playAll | 覆写 playAll:如果播放器已存在,使用 replaceAndPlay 替换播放(音乐场景复用播放器) | public playAll(args: Object): boolean {
console.info("FinMusic: AppPlaybackManager.playAll hasPlayer=" + this.hasPlayer())
if (this.hasPlayer()) {
console.info("FinMusic: replaceAndPlay (reuse existing player)")
this.getPlayerContext()!.replaceAndPlay(args).catch((e: Error) => {
console.er... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object A... | public playAll(args: Object): boolean {
console.info("FinMusic: AppPlaybackManager.playAll hasPlayer=" + this.hasPlayer())
if (this.hasPlayer()) {
console.info("FinMusic: replaceAndPlay (reuse existing player)")
this.getPlayerContext()!.replaceAndPlay(args).catch((e: Error) => {
console.er... | https://github.com/OHPG/FinMusic | f1168ff7f0285eb9c07fb466f338f974c8ba6f0e | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/view/LrcView.ets | arkts | drawMiddle | Debug helper: draws a horizontal mid-line on the canvas. | drawMiddle() {
this.context.translate(0, -this.curCanvasOffsetY);
this.context.beginPath();
this.context.strokeStyle = Color.Red;
this.context.moveTo(0, this.viewHeight / 2);
this.context.lineTo(this.viewWidth, this.viewHeight / 2);
this.context.stroke();
this.context.closePath();
this... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawMiddle 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... | drawMiddle() {
this.context.translate(0, -this.curCanvasOffsetY);
this.context.beginPath();
this.context.strokeStyle = Color.Red;
this.context.moveTo(0, this.viewHeight / 2);
this.context.lineTo(this.viewWidth, this.viewHeight / 2);
this.context.stroke();
this.context.closePath();
this... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 3fa8e558d8ee3a89075dae8860ef3db38b47921e | gitcode |
Eklps/harmony-mall-perf | entry/src/main/ets/view/CartView.ets | arkts | getTotalCount | 获取商品总数 | getTotalCount(): number {
return this.cartList.reduce((total, item) => total + item.quantity, 0);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTotalCount 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#statemen... | getTotalCount(): number {
return this.cartList.reduce((total, item) => total + item.quantity, 0);
} | https://github.com/Eklps/harmony-mall-perf | ef8beec55bc0ad50bb7ef2486e7dd20e19ff4c45 | github |
openharmony/applications_mms | entry/src/main/ets/pages/settings/settingsController.ets | arkts | showContact | Display a contact's avatar | showContact(e) {
HiLog.i(TAG, 'showContact, checked = ' + e.checked);
let messageCode = common.route.MESSAGE_CODE_UPDATE_SHOW_CONTACT_PROFILE_PICS_VALUE;
let actionData: LooseObject = {};
this.showContactSwitch = e.checked;
if (this.showContactSwitch) {
actionData... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left e AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression... | showContact(e) {
HiLog.i(TAG, 'showContact, checked = ' + e.checked);
let messageCode = common.route.MESSAGE_CODE_UPDATE_SHOW_CONTACT_PROFILE_PICS_VALUE;
let actionData: LooseObject = {};
this.showContactSwitch = e.checked;
if (this.showContactSwitch) {
actionData... | https://gitee.com/openharmony/applications_mms.git | 1c2fc814bfd724dd70a7f6028740d14201e2c4a4 | gitee |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/library/src/main/ets/HttpProxyCacheServerBuilder.ets | arkts | setFileNameGenerator | Overrides default cache file name generator {@link Md5FileNameGenerator} .
@param fileNameGenerator a new file name generator.
@return a builder. | public setFileNameGenerator(fileNameGenerator: FileNameGenerator): HttpProxyCacheServerBuilder {
this.fileNameGenerator = Preconditions.checkNotNull(fileNameGenerator);
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFileNameGenerator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fileNameGenerator AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | public setFileNameGenerator(fileNameGenerator: FileNameGenerator): HttpProxyCacheServerBuilder {
this.fileNameGenerator = Preconditions.checkNotNull(fileNameGenerator);
return this;
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | a8862d9cc4f4619d8bbe34465152c33c1af770ae | gitee |
erosTeam/NextE | shared/src/main/ets/settings/CookieJarSettings.ets | arkts | clear | Log out: clear the jar, the persisted bundle, and the AuthState mirror. | static async clear(context: common.UIAbilityContext): Promise<void> {
EhCookieStore.getInstance().clear()
CookieJarSettings.expireWebIdentityCookies()
// Refresh visible account UI immediately; persistence deletion may await Preferences I/O.
CookieJarSettings.syncAuthState()
try {
const stor... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Ri... | static async clear(context: common.UIAbilityContext): Promise<void> {
EhCookieStore.getInstance().clear()
CookieJarSettings.expireWebIdentityCookies()
// Refresh visible account UI immediately; persistence deletion may await Preferences I/O.
CookieJarSettings.syncAuthState()
try {
const stor... | https://github.com/erosTeam/NextE | a1f680329ee277bc8c54f402a491a84979c1984d | github |
openharmony/codelabs | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | isEmpty | Check obj is empty.
@param {object} obj
@return {boolean} true(empty) | isEmpty(obj: object | string | number): boolean {
return (obj === undefined || obj === null || obj === '');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#... | isEmpty(obj: object | string | number): boolean {
return (obj === undefined || obj === null || obj === '');
} | https://gitee.com/openharmony/codelabs.git | 9294cf608b627832aada3b940582db49657f4dd8 | gitee |
LZZLHY/hlib | entry/src/main/ets/utils/UrlUtils.ets | arkts | buildQuery | 拼接 query string;undefined / null / 空数组 会被剔除。 | static buildQuery(params?: Record<string, string | number | boolean | string[] | number[] | undefined | null>): string {
if (!params) {
return '';
}
const parts: string[] = [];
const keys = Object.keys(params);
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
const v = ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildQuery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Righ... | static buildQuery(params?: Record<string, string | number | boolean | string[] | number[] | undefined | null>): string {
if (!params) {
return '';
}
const parts: string[] = [];
const keys = Object.keys(params);
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
const v = ... | https://github.com/LZZLHY/hlib | ace16dab6c32aef352578d6b84d9040152a753c4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | after | Executed after each test runs. Can be overridden in derived classes.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | after(): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left after AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | after(): void {} | https://gitcode.com/iop123123/arkts-static-skills | 7033a0ebd93b107cecea1b0d32c715d670f1773c | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | testStringComparison | --- String comparison --- | function testStringComparison(): string {
let a: string = 'apple';
let b: string = 'banana';
let lt: boolean = a < b;
let gt: boolean = a > b;
let eq: boolean = a === b;
return String(lt) + ',' + String(gt) + ',' + String(eq);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringComparison 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#predef... | function testStringComparison(): string {
let a: string = 'apple';
let b: string = 'banana';
let lt: boolean = a < b;
let gt: boolean = a > b;
let eq: boolean = a === b;
return String(lt) + ',' + String(gt) + ',' + String(eq);
} | https://github.com/miaochiahao/ark-ghidra | e9409f768cc3bcfa07c343eac05072aec70e92f0 | github |
Delsin-Yu/JustPDF | entry/src/main/ets/components/PageInfo.ets | arkts | evictHighResolutionCaches | 释放高于预览档的光栅缓存(保留 PREVIEW_RENDER_SCALE),并取消对应 pending。 | public evictHighResolutionCaches(): void {
const scalesToRemove: number[] = [];
for (const pair of this.caches.entries()) {
if (pair[0] > PREVIEW_RENDER_SCALE) {
scalesToRemove.push(pair[0]);
}
}
for (const scale of scalesToRemove) {
const cache = this.caches.get(scale);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left evictHighResolutionCaches 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 vo... | public evictHighResolutionCaches(): void {
const scalesToRemove: number[] = [];
for (const pair of this.caches.entries()) {
if (pair[0] > PREVIEW_RENDER_SCALE) {
scalesToRemove.push(pair[0]);
}
}
for (const scale of scalesToRemove) {
const cache = this.caches.get(scale);
... | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L491-L510 | 1ad94c27171b6aa6a2f379d2a0e56bab7622fa10 | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getMonthDays | 获取每个月的天数
@param year 年
@param month 月
@returns 返回对应天数 | static getMonthDays(year: number, month: number): number {
switch (month) {
// 1月、3月、5月、7月、8月、10月和12月各有31天。
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;
// 4月、6月、9月和11月各有30天。
case 4:
case 6:
case 9:
case 11:
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMonthDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static getMonthDays(year: number, month: number): number {
switch (month) {
// 1月、3月、5月、7月、8月、10月和12月各有31天。
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;
// 4月、6月、9月和11月各有30天。
case 4:
case 6:
case 9:
case 11:
... | https://gitcode.com/arkui-x/samples | 8bc2a960d3528ec28825f7342ea72174d409152b | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/LayoutConfigManager.ets | arkts | getLayouts | ============================================================================
CRUD 操作
============================================================================ | getLayouts(): LayoutConfiguration[] {
return this.layouts;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLayouts 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 LayoutConfiguration AST#identifier#Right AST#[#Left... | getLayouts(): LayoutConfiguration[] {
return this.layouts;
} | https://github.com/richshaw2015/nds | 6b8d665a95bf260d6cdff190351ca214aebed732 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test51_original_index.ets | arkts | matMul | --- Matrix multiplication --- | function matMul(a: number[][], b: number[][]): number[][] {
let rows: number = a.length;
let cols: number = b[0].length;
let inner: number = b.length;
let result: number[][] = [];
for (let i: number = 0; i < rows; i++) {
let row: number[] = [];
for (let j: number = 0; j < cols; j++) {
let sum: n... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left matMul AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ar... | function matMul(a: number[][], b: number[][]): number[][] {
let rows: number = a.length;
let cols: number = b[0].length;
let inner: number = b.length;
let result: number[][] = [];
for (let i: number = 0; i < rows; i++) {
let row: number[] = [];
for (let j: number = 0; j < cols; j++) {
let sum: n... | https://github.com/miaochiahao/ark-ghidra | 1e98c105f7c3a2669087a63bc657d553cc12befa | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/by_av_player.ets | arkts | reset | 初始化 // | reset() {
this.avPlayer?.release()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | reset() {
this.avPlayer?.release()
} | https://github.com/Nekofox-POT/LinMusic | 5b7bb2d3a5eac8a09eff4ec0404ca75722b089c2 | github |
YANGZX22/Voot | entry/src/main/ets/services/ModelDownloadService.ets | arkts | downloadModelFiles | 下载模型文件 | private async downloadModelFiles(context: common.UIAbilityContext, modelDir: string): Promise<void> {
const baseUrl = 'https://hf-mirror.com/csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/resolve/main';
// 文件列表和大小(用于进度计算)
const modelFile: ModelFileInfo = { name: 'model.int8.onnx', size... | 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 downloadModelFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:... | private async downloadModelFiles(context: common.UIAbilityContext, modelDir: string): Promise<void> {
const baseUrl = 'https://hf-mirror.com/csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/resolve/main';
// 文件列表和大小(用于进度计算)
const modelFile: ModelFileInfo = { name: 'model.int8.onnx', size... | https://github.com/YANGZX22/Voot | 43440b2cbdd054612a181cd900aa746485310ed0 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setDragEnabled | Set this to true to enable dragging (moving the chart with the finger)
for the chart (this does not effect scaling).
@param enabled | public setDragEnabled(enabled: boolean): void {
this.mDragXEnabled = enabled;
this.mDragYEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDragEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public setDragEnabled(enabled: boolean): void {
this.mDragXEnabled = enabled;
this.mDragYEnabled = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c9f8474f6b6a361876dca9b797b8747a0e3b63c1 | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/utils/AGCloudFunction.ets | arkts | convertToLoginData | 转换数据为LoginData类型 | private convertToLoginData(result: Object): LoginData {
const data = new LoginData();
const obj = result as Record<string, Object>;
if (obj) {
data.unionId = String(obj['unionId'] || '');
data.openId = String(obj['openId'] || '');
data.nickName = String(obj['nickName'] || '华为账号用户');
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertToLoginData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private convertToLoginData(result: Object): LoginData {
const data = new LoginData();
const obj = result as Record<string, Object>;
if (obj) {
data.unionId = String(obj['unionId'] || '');
data.openId = String(obj['openId'] || '');
data.nickName = String(obj['nickName'] || '华为账号用户');
... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 1d46600f6df5ea27b1017d39eff5ba1e10fc96d7 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets | arkts | saveEvent | 保存或更新日程(主键存在则更新,不存在则插入) | async saveEvent(event: CalendarEvent): Promise<string> {
const rdbStore = await this.initDatabase();
try {
await rdbStore.beginTransaction();
// 1. 确定最终的业务ID:优先使用传入的ID,否则生成新的UUID
let finalId: string;
if (event.id && this.isValidUUID(event.id)) {
finalId = event.id;
} el... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveEvent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left event AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async saveEvent(event: CalendarEvent): Promise<string> {
const rdbStore = await this.initDatabase();
try {
await rdbStore.beginTransaction();
// 1. 确定最终的业务ID:优先使用传入的ID,否则生成新的UUID
let finalId: string;
if (event.id && this.isValidUUID(event.id)) {
finalId = event.id;
} el... | https://gitcode.com/openharmony/codelabs | 26f5889cbb1a11b70b3bfa9a0a0dcf3b5524da01 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/NotificationService.ets | arkts | getUnreadCount | 获取未读通知数量 | getUnreadCount(): number {
return Array.from(this.notifications.values())
.filter((n: Notification) => n.status === 'UNREAD').length;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUnreadCount 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#stateme... | getUnreadCount(): number {
return Array.from(this.notifications.values())
.filter((n: Notification) => n.status === 'UNREAD').length;
} | https://github.com/LJ666-ui/harmony-health-care | 4b6776a0bfeca10a8b539743330ad4feb40054f0 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | imageCrop | 图片裁剪
@param input 输入图片路径
@param output 输出图片路径
@param width 裁剪宽度
@param height 裁剪高度
@param x 起始 X 坐标
@param y 起始 Y 坐标 | public static imageCrop(
input: string,
output: string,
width: number,
height: number,
x: number = 0,
y: number = 0
): string[] {
return [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:${x}:${y}`,
'-q:v', '2',
'-y', output
];
} | 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 imageCrop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:... | public static imageCrop(
input: string,
output: string,
width: number,
height: number,
x: number = 0,
y: number = 0
): string[] {
return [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:${x}:${y}`,
'-q:v', '2',
'-y', output
];
} | https://github.com/jjjjjjava/ffmpeg_tools | 931baaf87bfcc8c849ef44780e60d26d37f957a6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/pages/StreamPage.ets | arkts | setTouchMode | 设置触摸模式 | setTouchMode(mode: string): void {
this.viewModel.setTouchMode(mode as TouchMode);
this.touchInputHandler.setMode(mode as TouchInputMode);
console.info(`StreamPage: 触摸模式切换为 ${mode}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTouchMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AS... | setTouchMode(mode: string): void {
this.viewModel.setTouchMode(mode as TouchMode);
this.touchInputHandler.setMode(mode as TouchInputMode);
console.info(`StreamPage: 触摸模式切换为 ${mode}`);
} | https://github.com/AlkaidLab/moonlight-harmony | e39d7103877a126ffad66aadf59c4433fd785a6b | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGEllipse.ets | arkts | getRX | 获取椭圆X半径 | public getRX(): number{
return this._rx;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getRX 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#:#Rig... | public getRX(): number{
return this._rx;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | f124fe6937a2129041ac3a2d46f9085df17cb4a7 | gitee |
751496032/ZRouter | RouterApi/src/main/ets/api/RouterMgr.ets | arkts | isAtBottomOfHiddenNavbarStack | 是否在隐藏导航栏模式下处于路由栈的栈底
@returns | private isAtBottomOfHiddenNavbarStack(): boolean {
return runCatching(() => {
const isBottomStack = this.hideNavbar && this.getIndexesExceptBottom().length === 0
if (isBottomStack) {
const isIntercept = this.onBackAtBottom()
if (!isIntercept) {
(getContext() as common.UIAbili... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isAtBottomOfHiddenNavbarStack 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#boole... | private isAtBottomOfHiddenNavbarStack(): boolean {
return runCatching(() => {
const isBottomStack = this.hideNavbar && this.getIndexesExceptBottom().length === 0
if (isBottomStack) {
const isIntercept = this.onBackAtBottom()
if (!isIntercept) {
(getContext() as common.UIAbili... | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L505-L516 | cefc179a755d6a859bfd41c50e809cefd24595b6 | github |
openharmony/applications_call | entry/src/main/ets/common/components/FuncBtn.ets | arkts | iconUrl | Button group picture change control
@return {string} - return iconUrl | iconUrl() {
if (this.isDisable && this.iconDisableUrl) {
LogUtils.i(TAG, 'iconUrl this.isDisable : ' + this.isDisable);
return this.iconDisableUrl;
}
return this.isActive && this.iconDefaultUrl ? this.iconActiveUrl : this.iconDefaultUrl;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left iconUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left... | iconUrl() {
if (this.isDisable && this.iconDisableUrl) {
LogUtils.i(TAG, 'iconUrl this.isDisable : ' + this.isDisable);
return this.iconDisableUrl;
}
return this.isActive && this.iconDefaultUrl ? this.iconActiveUrl : this.iconDefaultUrl;
} | https://gitee.com/openharmony/applications_call.git | cc72fcb00ea19d8c8b9dfe0e74997dfa830d0e17 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets | arkts | constructor | Create EAWorker instance with specified name and task
@param { string } name The name of the worker
@param { Task } task The task function to execute
@param { boolean } [needInterop=false] true if need to create JS runtime | constructor(name: string, task: Task, needInterop: boolean = false) {
this.worker = needInterop ? new InteropWorker(name) : new StaticWorker(name);
this.initialTask = task;
} | 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 string AST#identifier#Right A... | constructor(name: string, task: Task, needInterop: boolean = false) {
this.worker = needInterop ? new InteropWorker(name) : new StaticWorker(name);
this.initialTask = task;
} | https://gitcode.com/iop123123/arkts-static-skills | 635b66ce9299434f20ae7b15061e7e74aad55945 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/core/ScopeRegistry.ets | arkts | removeScope | 移除实体的作用域
@param entityName 实体名称
@param scopeName 作用域名称
@returns 是否成功移除 | removeScope(entityName: string, scopeName: string): boolean {
const entityScopes = this.scopes.get(entityName)
if (entityScopes === undefined) {
return false
}
return entityScopes.delete(scopeName)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeScope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,... | removeScope(entityName: string, scopeName: string): boolean {
const entityScopes = this.scopes.get(entityName)
if (entityScopes === undefined) {
return false
}
return entityScopes.delete(scopeName)
} | https://github.com/offlinecat-dev/OCNetORM | 29c0b373a1d8756337de000aa64459044c6a4a60 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/pages/permission-access-record.ets | arkts | getTime | Get time
@param {Number} The time stamp | getTime(time: number, format = 'MM月DD日 NNHH:mm') {
if (this.strings.morning == 'am') { format = 'HH:mm NN MM/DD' }
let date = new Date(time);
let key = ['MM', 'DD', 'NN', 'HH', 'mm'];
let value = [
date.getMonth() + 1,
date.getDate(),
date.getHours() >= 12 ? this.strings.afternoon : ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,... | getTime(time: number, format = 'MM月DD日 NNHH:mm') {
if (this.strings.morning == 'am') { format = 'HH:mm NN MM/DD' }
let date = new Date(time);
let key = ['MM', 'DD', 'NN', 'HH', 'mm'];
let value = [
date.getMonth() + 1,
date.getDate(),
date.getHours() >= 12 ? this.strings.afternoon : ... | https://gitee.com/openharmony/applications_permission_manager.git | 690055b0326a06448763711db370271b3dce9c21 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | whereBetween | 添加 BETWEEN 条件
@param column 列名或属性名
@param min 最小值
@param max 最大值
@returns 当前实例(支持链式调用) | whereBetween(column: string, min: ValueType, max: ValueType): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.between(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left whereBetween AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , ... | whereBetween(column: string, min: ValueType, max: ValueType): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.between(... | https://github.com/offlinecat-dev/OCNetORM | 0895f64febd68b8201f65aea16556c487b2acbed | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/utils/TranslationDisplayManager.ets | arkts | clear | Clear all hidden and translating states | clear(): void {
if (this.hiddenMessageIDs.size > 0 || this.translatingMessageIDs.size > 0) {
this.hiddenMessageIDs.clear();
this.translatingMessageIDs.clear();
this.version++; // Trigger UI update
console.log(`[TranslationDisplayManager] 🗑️ Cleared all states, version: ${this.version}`);
... | 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#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | clear(): void {
if (this.hiddenMessageIDs.size > 0 || this.translatingMessageIDs.size > 0) {
this.hiddenMessageIDs.clear();
this.translatingMessageIDs.clear();
this.version++; // Trigger UI update
console.log(`[TranslationDisplayManager] 🗑️ Cleared all states, version: ${this.version}`);
... | https://github.com/Tencent-RTC/TUIKit_Harmony | 5645c3b725ee269733a3b4c694005a86323a12b3 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/FavoriteModelsService.ets | arkts | toggleFavorite | 切换收藏状态
@param modelId 模型 ID
@param providerId 供应商 ID
@param modelName 模型名称
@param providerName 供应商名称
@returns 新的收藏状态 | async toggleFavorite(modelId: string, providerId: string, modelName: string, providerName: string): Promise<boolean> {
if (this.isFavorite(modelId, providerId)) {
await this.removeFavorite(modelId, providerId)
return false
} else {
await this.addFavorite(modelId, providerId, modelName, provi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left toggleFavorite AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modelId AST#identifier#Right A... | async toggleFavorite(modelId: string, providerId: string, modelName: string, providerName: string): Promise<boolean> {
if (this.isFavorite(modelId, providerId)) {
await this.removeFavorite(modelId, providerId)
return false
} else {
await this.addFavorite(modelId, providerId, modelName, provi... | https://github.com/LongLiveY96/chatcube | e97983ce90a3e60c9797eaffd448bb241a3b740b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | box | Creates a new FloatBox instance with the specified initial value.
@param { float } value - The initial float value to be wrapped
@returns { FloatBox } A new FloatBox instance containing the specified float value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static box(value: float): FloatBox {
return new FloatBox(value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left box AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#id... | public static box(value: float): FloatBox {
return new FloatBox(value);
} | https://gitcode.com/iop123123/arkts-static-skills | d2843256f238351d44b1ba9fcc9bec2ace3a7c72 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/services/FileContentService.ets | arkts | formatFileSize | 格式化文件大小为可读字符串(别名,供 BinaryFileHandler 等外部调用) | static formatFileSize(bytes: number): string {
return FileContentService.formatSize(bytes);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatFileSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static formatFileSize(bytes: number): string {
return FileContentService.formatSize(bytes);
} | https://github.com/XJTUWYD/ArkDiff | 67263a997bd1033b6c2a7d78448ea6765de1c100 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test14_original_index.ets | arkts | getHttpMsg | --- Conditional chaining (manual lookup) --- | function getHttpMsg(code: number): string {
if (code === 200) {
return 'OK';
}
if (code === 301) {
return 'Moved';
}
if (code === 404) {
return 'Not Found';
}
if (code === 500) {
return 'Server Error';
}
return 'Unknown';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getHttpMsg AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function getHttpMsg(code: number): string {
if (code === 200) {
return 'OK';
}
if (code === 301) {
return 'Moved';
}
if (code === 404) {
return 'Not Found';
}
if (code === 500) {
return 'Server Error';
}
return 'Unknown';
} | https://github.com/miaochiahao/ark-ghidra | 5af3990b9102ab66666878678f2f449aaf60335f | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | logResponseError | 打印响应错误日志
@param {AxiosError} error - 响应错误
@returns {void} 无返回值 | function logResponseError(error: AxiosError): void {
const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined;
const response: AxiosResponse | undefined = error.response as AxiosResponse | undefined;
const url: string = response ? buildRequestUrl(response.confi... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left logResponseError AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left error AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function logResponseError(error: AxiosError): void {
const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined;
const response: AxiosResponse | undefined = error.response as AxiosResponse | undefined;
const url: string = response ? buildRequestUrl(response.confi... | https://github.com/Joker-x-dev/CoolMallArkTS | 837bc87af1521fd26c23229a326fb06e4a1bd8ed | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSearchPage.ets | arkts | toggleSourceSelection | 切换书源选择状态 | toggleSourceSelection(sourceId: string): void {
const newSet = new Set(this.selectedSourceIds);
if (newSet.has(sourceId)) {
newSet.delete(sourceId);
} else {
// 检查是否超过并发限制
if (newSet.size >= this.maxConcurrentSources) {
this.getUIContext().getPromptAction().showToast({ message: `... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleSourceSelection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left... | toggleSourceSelection(sourceId: string): void {
const newSet = new Set(this.selectedSourceIds);
if (newSet.has(sourceId)) {
newSet.delete(sourceId);
} else {
// 检查是否超过并发限制
if (newSet.size >= this.maxConcurrentSources) {
this.getUIContext().getPromptAction().showToast({ message: `... | https://github.com/DaLongZhuaZi/manxia | 8c122fbb0db73b09210f9728bf734f306adc3129 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | getCurrentPosition | 获取当前位置 | private async getCurrentPosition(): Promise<Position3D | null> {
let position = this.indoorLocator.getCurrentPosition();
if (!position) {
position = { x: 40, y: 0, z: 5 };
}
return position;
} | 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 getCurrentPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async getCurrentPosition(): Promise<Position3D | null> {
let position = this.indoorLocator.getCurrentPosition();
if (!position) {
position = { x: 40, y: 0, z: 5 };
}
return position;
} | https://github.com/LJ666-ui/harmony-health-care | 02a7c8f3e349f6f4695fc2786d9fe8ad45201b58 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | getAppList | 获取应用列表(仅 HTTPS,匹配 Android 行为)
HTTPS 端口通过 getHttpsBaseUrl() 自动解析;超时时按 frp 规则重试 | async getAppList(): Promise<AppEntry[]> {
console.info(`NvHttp.getAppList: serverCert=${this.serverCert ? '有(长度' + this.serverCert.length + ')' : '无'}, hasCertFiles=${this.hasCertificateFiles()}`);
// 与 Android 一致:只使用 HTTPS + 客户端证书,不 fallback 到 HTTP
const response = await this.doHttpsRequestWithFrpRetry('... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAppList 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#... | async getAppList(): Promise<AppEntry[]> {
console.info(`NvHttp.getAppList: serverCert=${this.serverCert ? '有(长度' + this.serverCert.length + ')' : '无'}, hasCertFiles=${this.hasCertificateFiles()}`);
// 与 Android 一致:只使用 HTTPS + 客户端证书,不 fallback 到 HTTP
const response = await this.doHttpsRequestWithFrpRetry('... | https://github.com/AlkaidLab/moonlight-harmony | 0927b2323745d75789bfde29309be1b6c08bd7ee | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | hasSubQueries | 检查是否有子查询
@returns 是否有子查询 | hasSubQueries(): boolean {
return this.subQueries.length > 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasSubQueries 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... | hasSubQueries(): boolean {
return this.subQueries.length > 0
} | https://github.com/offlinecat-dev/OCNetORM | 857df93ce4d13ca07fe7863defebb23b8da9f22f | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/data/facades/StorageProviderFacade.ets | arkts | initialize | 初始化存储提供者
@param filesDir 文件目录路径
@note API 23 适配:通过依赖注入传入路径,替代直接依赖 UIContextManager | initialize(filesDir: string | undefined): void {
this.filesDir = filesDir || '';
this.sandboxManager.initialize(filesDir);
logger.info(TAG, '存储提供者初始化完成: filesDir=' + filesDir);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left filesDir AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#... | initialize(filesDir: string | undefined): void {
this.filesDir = filesDir || '';
this.sandboxManager.initialize(filesDir);
logger.info(TAG, '存储提供者初始化完成: filesDir=' + filesDir);
} | https://github.com/DaLongZhuaZi/NGF | 51e404e086169594514292caf8ea085a59ca0df8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | replaceObjectVariables | 替换对象中的变量 | private replaceObjectVariables(obj: Record<string, Object | undefined>, variables: Record<string, string>): Record<string, Object | undefined> {
const result: Record<string, Object | undefined> = {};
const keys = Object.keys(obj);
// 只对这些字段进行数字转换,其他字段保持字符串(特别是ID字段)
const numericFields = ['offset'... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left replaceObjectVariables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instant... | private replaceObjectVariables(obj: Record<string, Object | undefined>, variables: Record<string, string>): Record<string, Object | undefined> {
const result: Record<string, Object | undefined> = {};
const keys = Object.keys(obj);
// 只对这些字段进行数字转换,其他字段保持字符串(特别是ID字段)
const numericFields = ['offset'... | https://github.com/DaLongZhuaZi/manxia | 16b278b074ede15d8addb6560b6a94d8533b43f5 | github |
HarmonyOS_Samples/MusicHome | products/watch/src/main/ets/watchability/WatchAbility.ets | arkts | onWindowStageCreate | Loads main watch UI, captures UIContext on main window, and creates MediaService.
@param windowStage Window stage for this ability. | onWindowStageCreate(windowStage: window.WindowStage): void {
Logger.info('WatchAbility: Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
Logger.error(`${err.code} + ${err.message}`);
return;
}
try {
getAppRuntime().uiCo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | onWindowStageCreate(windowStage: window.WindowStage): void {
Logger.info('WatchAbility: Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
Logger.error(`${err.code} + ${err.message}`);
return;
}
try {
getAppRuntime().uiCo... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 44320348eea1bb679b5ecc07fdc5fa36e923251f | gitcode |
xblLab/HarmonyProjectTemplate | commons/lib_common/src/main/ets/utils/AppGalleryUtils.ets | arkts | showUpdateDialog | 显示升级弹窗
@param context | public static showUpdateDialog(context: common.UIAbilityContext) {
try {
updateManager.showUpdateDialog(context)
.then((resultCode: updateManager.ShowUpdateResultCode) => {
Logger.info(TAG, 'Succeeded in showing UpdateDialog resultCode:' + resultCode);
})
.catch((error: Bus... | 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 showUpdateDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Lef... | public static showUpdateDialog(context: common.UIAbilityContext) {
try {
updateManager.showUpdateDialog(context)
.then((resultCode: updateManager.ShowUpdateResultCode) => {
Logger.info(TAG, 'Succeeded in showing UpdateDialog resultCode:' + resultCode);
})
.catch((error: Bus... | https://github.com/xblLab/HarmonyProjectTemplate | 77121f1463be38828bbfe9851b2f560133aa0fcd | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets | arkts | confirmEndDate | 确认结束日期 | confirmEndDate(): void {
const date = new Date(this.scheduleEndTime)
date.setFullYear(this.tempYear, this.tempMonth - 1, this.tempDay)
this.scheduleEndTime = date.getTime()
// 如果结束时间早于开始时间,调整开始时间
if (this.scheduleEndTime < this.scheduleStartTime) {
this.scheduleStartTime = this.scheduleEndTi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmEndDate 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_blo... | confirmEndDate(): void {
const date = new Date(this.scheduleEndTime)
date.setFullYear(this.tempYear, this.tempMonth - 1, this.tempDay)
this.scheduleEndTime = date.getTime()
// 如果结束时间早于开始时间,调整开始时间
if (this.scheduleEndTime < this.scheduleStartTime) {
this.scheduleStartTime = this.scheduleEndTi... | https://gitcode.com/openharmony/codelabs | f0dfc4636744dce2d9b407af23ea3b1c77270d57 | gitcode |
YANGZX22/Voot | entry/src/main/ets/services/ModelDownloadService.ets | arkts | deleteModel | 删除已下载的模型 | public async deleteModel(context: common.UIAbilityContext): Promise<void> {
try {
const modelDir = this.getModelDir(context);
fs.rmdirSync(modelDir);
console.info('[ModelDownloadService] Model deleted successfully');
} catch (e) {
console.error(`[ModelDownloadService] Delete model erro... | 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 deleteModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AS... | public async deleteModel(context: common.UIAbilityContext): Promise<void> {
try {
const modelDir = this.getModelDir(context);
fs.rmdirSync(modelDir);
console.info('[ModelDownloadService] Model deleted successfully');
} catch (e) {
console.error(`[ModelDownloadService] Delete model erro... | https://github.com/YANGZX22/Voot | 705d3b2f6c35b252c3fdc0357e633d58ce765a4f | github |
openharmony/testfwk_arkxtest | uitest/ets/ani/ets/@ohos.UiTest.ets | arkts | doSetupIfNeeded | this function will call concurrency cannot be called in static block or global scope | function doSetupIfNeeded() {
if (UiTest.GetConnectionStat() == 0) {
let domain: int = 0x0000;
hilog.info(domain, 'uitestTag', 'On static loadAndSetUpUiTest: ' + loadAndSetUpUiTest());
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left doSetupIfNeeded 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#if_statemen... | function doSetupIfNeeded() {
if (UiTest.GetConnectionStat() == 0) {
let domain: int = 0x0000;
hilog.info(domain, 'uitestTag', 'On static loadAndSetUpUiTest: ' + loadAndSetUpUiTest());
}
} | https://gitcode.com/openharmony/testfwk_arkxtest | 7e0eb0ae589c7712bdc3d47c7b8329a445dea1ef | gitcode |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/pbr_material.ets | arkts | setRoughness | Adjust the roughness factor of the PBR material | setRoughness(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).material.factor;
f.y = 2 * v / RESO;
(this.material as MetallicRoughnessMaterial).material.factor = f;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setRoughness AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST... | setRoughness(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).material.factor;
f.y = 2 * v / RESO;
(this.material as MetallicRoughnessMaterial).material.factor = f;
}
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | b6033178350772f94a2c28701f111cc309ca9458 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/Preferences/entry/src/main/ets/common/utils/Logger.ets | arkts | error | Outputs error-level logs.
@param args Indicates the log parameters. | error(...args: string[]) {
hilog.error(this.domain, this.prefix, this.format, args);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left error AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right ... | error(...args: string[]) {
hilog.error(this.domain, this.prefix, this.format, args);
} | https://gitee.com/harmonyos/codelabs.git | e5d5cfa7524157bdc4882d8369126f5df780827f | gitee |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/CategoryDao.ets | arkts | deleteCategoriesByType | 删除指定类型的分类
删除前需判断分类是否被交易记录引用
@param categoryType 分类类型 (0=支出分类, 1=收入分类)
@returns 删除的分类数量 | public async deleteCategoriesByType(categoryType: number): Promise<number> {
try {
// 获取指定类型的分类列表
const categories = await this.getCategoriesByType(categoryType);
let deletedCount = 0;
for (const category of categories) {
// 检查每个分类是否被交易记录引用
const hasTransactions = await th... | 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 deleteCategoriesByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryType AST#identifier#Right AST#ERROR#Left... | public async deleteCategoriesByType(categoryType: number): Promise<number> {
try {
// 获取指定类型的分类列表
const categories = await this.getCategoriesByType(categoryType);
let deletedCount = 0;
for (const category of categories) {
// 检查每个分类是否被交易记录引用
const hasTransactions = await th... | https://github.com/fuhhhhhhhh/openharmony | 442e708e1cda1136f01a33342e4af14370249c8f | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/ListDemo6.ets | arkts | notifyDataAdd | 通知 LazyForEach 组件,需要在位置 index 处添加 item | notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDatasetChange([{type: DataOperationType.ADD, index: index}]);
// 上面的相当于下面的,但是在一个 IDataSource 内,onDatasetChange 和 onDataXXX 不能混用,否则可能会报错 Error: onDatasetChange cannot be used with other interface
// listener.onDa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ... | notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDatasetChange([{type: DataOperationType.ADD, index: index}]);
// 上面的相当于下面的,但是在一个 IDataSource 内,onDatasetChange 和 onDataXXX 不能混用,否则可能会报错 Error: onDatasetChange cannot be used with other interface
// listener.onDa... | https://github.com/webabcd/HarmonyDemo | a8c334a9e81e2bbbd8810b1c252c2c7e1eca9a71 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | join | Joins data to a string
@param s separator
@returns joined representation | public join(s: string): string {
let res: StringBuilder = new StringBuilder("")
for (let i = 0; i < this.length - 1; ++i) {
res.append(this.at(i))
res.append(s)
}
if (this.length > 0) {
res.append(this.at(this.length - 1))
}
return ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left join AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | public join(s: string): string {
let res: StringBuilder = new StringBuilder("")
for (let i = 0; i < this.length - 1; ++i) {
res.append(this.at(i))
res.append(s)
}
if (this.length > 0) {
res.append(this.at(this.length - 1))
}
return ... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8c674a88be7cc8716ab958b13d166b844d3efeaa | gitee |
openharmony/codelabs | ETSUI/ECommerce/entry/src/main/ets/model/DataModels.ets | arkts | constructor | 库存:结算时扣减 | constructor(id: number, name: string, price: number, image: string | Resource, category: string, description: string, stock: number = 99) {
this.id = id;
this.name = name;
this.price = price;
this.image = image;
this.category = category;
this.description = description;
this.stock = stock;
... | 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 id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST... | constructor(id: number, name: string, price: number, image: string | Resource, category: string, description: string, stock: number = 99) {
this.id = id;
this.name = name;
this.price = price;
this.image = image;
this.category = category;
this.description = description;
this.stock = stock;
... | https://gitcode.com/openharmony/codelabs | e46cd20e36b16f1e8f345aa056932cdd594d5751 | gitcode |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/canvas/CanvasImage.ets | arkts | copyToPhoto | 保存到指定路径 | copyToPhoto(srcFilePath: string, destFilePath: string) {
const srcFile = fileIo.openSync(srcFilePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE)
const destFile = fileIo.openSync(destFilePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE)
// 读取源文件内容并写入至目的文件
const stat = fileIo.statSync... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left copyToPhoto AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left srcFilePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS... | copyToPhoto(srcFilePath: string, destFilePath: string) {
const srcFile = fileIo.openSync(srcFilePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE)
const destFile = fileIo.openSync(destFilePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE)
// 读取源文件内容并写入至目的文件
const stat = fileIo.statSync... | https://github.com/iHongRen/harmony-study-demo | bb1dd63efbe5208adf79902e6be9a565aa6d0f97 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/pages/Index.ets | arkts | onDropSideArea | Something is dropped to the side area.
We switch the status back to a true expectation and release the drag block. | onDropSideArea() {
setTimeout(() => {
this.myUi.sideAreaShrinkBlock_drag = false;
this.onDropAnyArea();
this.myUi.sideAreaShrinkExpect = false;
}, 10);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDropSideArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | onDropSideArea() {
setTimeout(() => {
this.myUi.sideAreaShrinkBlock_drag = false;
this.onDropAnyArea();
this.myUi.sideAreaShrinkExpect = false;
}, 10);
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 760672aefb122dfe854cf8be6d5f068d3a4c6dc5 | github |
HarmonyOS_Samples/BestPracticeSnippets | UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement2.ets | arkts | updateSAB | [EndExclude updatesab] | @Concurrent
function updateSAB(args: Uint32Array) {
if (args[0] == 0) {
args[0] = 100;
return 100;
} else if (args[0] == 100) {
args[0] = 200;
return 200;
} else if (args[0] == 200) {
args[0] = 300;
return 300;
}
return 0;
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left updateSAB AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requ... | @Concurrent
function updateSAB(args: Uint32Array) {
if (args[0] == 0) {
args[0] = 100;
return 100;
} else if (args[0] == 100) {
args[0] = 200;
return 200;
} else if (args[0] == 200) {
args[0] = 300;
return 300;
}
return 0;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 8c26e02d1a2d6181f460bc510aed043fc424670d | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | link | The link() method creates a string that embeds a string in an <a> element (<a href="...">str</a>), to be
used as a hypertext link to another URL.
@param { String } link
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public link(link: String): String{
return this.CreateHTMLString('a', ' href=\"' + link + '\"')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left link AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left link AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public link(link: String): String{
return this.CreateHTMLString('a', ' href=\"' + link + '\"')
} | https://gitcode.com/iop123123/arkts-static-skills | 500ae4787e71c9f6f8c033a3be1b36eff8d50152 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setUsePercentValues | If this is enabled, values inside the PieChart are drawn in percent and
not with their original value. Values provided for the IValueFormatter to
format are then provided in percent.
@param enabled | public setUsePercentValues(enabled: boolean): void {
this.mUsePercentValues = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUsePercentValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public setUsePercentValues(enabled: boolean): void {
this.mUsePercentValues = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 9709bc03f0c032dba2d3eb6369eb18f919bffa40 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/OmniPopup.ets | arkts | setPopupOptions | 全局设置 - 弹窗
@param options | static setPopupOptions(options: PopupInfo) {
Config.popupOptions = options
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setPopupOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static setPopupOptions(options: PopupInfo) {
Config.popupOptions = options
} | https://github.com/wuba/omni-ui | 8871982ca78708015a46e3df95733aab67acb3e7 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/parts/Bookmarks/BookmarksColumn.ets | arkts | sendDrag | Send drag event.
@param event The event to process and be sent.
@param item The meowBookmarkItem to be sent in the event. | sendDrag(event: DragEvent, item: meowBookmarkItem) {
// Put the item (to be sent) in meowAppHost.
getCreateMyApp().dataTunnelForBookmarks = { item: item, parent: this.folder };
// Fill data :P
let unifiedData = new unifiedDataChannel.UnifiedData();
if (!item.isFolder) {
// URL record
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendDrag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DragEvent AST#identifier#Right ... | sendDrag(event: DragEvent, item: meowBookmarkItem) {
// Put the item (to be sent) in meowAppHost.
getCreateMyApp().dataTunnelForBookmarks = { item: item, parent: this.folder };
// Fill data :P
let unifiedData = new unifiedDataChannel.UnifiedData();
if (!item.isFolder) {
// URL record
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 3985c63456a07cd8b5560f66d399cc79627b661f | github |
xblLab/HarmonyProjectTemplate | components/module_player/src/main/ets/tools/PipManager.ets | arkts | onStateChange | 监听画中画生命周期 | onStateChange(state: PiPWindow.PiPState, _reason: string) {
switch (state) {
// 表示画中画将要启动
case PiPWindow.PiPState.ABOUT_TO_START:
break;
// 表示画中画已经启动
case PiPWindow.PiPState.STARTED:
// 启动画中画
PipManager.getInstance().player.isPipOpen = true;
break;
// ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onStateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left... | onStateChange(state: PiPWindow.PiPState, _reason: string) {
switch (state) {
// 表示画中画将要启动
case PiPWindow.PiPState.ABOUT_TO_START:
break;
// 表示画中画已经启动
case PiPWindow.PiPState.STARTED:
// 启动画中画
PipManager.getInstance().player.isPipOpen = true;
break;
// ... | https://github.com/xblLab/HarmonyProjectTemplate | 91b4c84317adcbda455d082be2757648d0f47be3 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | buildAnnotationSortIndex | Composes Zotero's annotationSortIndex string for ordering annotations
across pages. Format: `pageIdx|verticalOffset|xOffset`, three zero-padded
integer parts joined with `|`. Zotero's own implementation uses the
page's text-character offset as the middle field; we don't compute that
(it'd require running the PDF text e... | function buildAnnotationSortIndex(pageIndex: number, rects: PdfRect[]): string {
let topY: number = 0;
let leftX: number = 0;
if (rects.length > 0) {
const r: PdfRect = rects[0];
if (r.length >= 4) {
topY = Math.max(r[1], r[3]);
leftX = Math.min(r[0], r[2]);
}
}
const pageStr: string =... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildAnnotationSortIndex AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pageIndex AST#identifier#Right AST#type_annotation#Left AST#:... | function buildAnnotationSortIndex(pageIndex: number, rects: PdfRect[]): string {
let topY: number = 0;
let leftX: number = 0;
if (rects.length > 0) {
const r: PdfRect = rects[0];
if (r.length >= 4) {
topY = Math.max(r[1], r[3]);
leftX = Math.min(r[0], r[2]);
}
}
const pageStr: string =... | https://github.com/Vincent-Leon/zotero-harmony | 22b5ae13072011e8a30d8f9046dcff1a21e2b2d4 | github |
honjow/Next2V | shared/src/main/ets/storage/SyncedKv.ets | arkts | remove | Remove one value. Propagates storage errors. | static async remove(
context: common.UIAbilityContext,
namespace: string,
key: string,
): Promise<void> {
const store = await LocalDataStore.open(context)
const args: relationalStore.ValueType[] = [SyncedKv.composeKey(namespace, key)]
await store.executeSql(SQL_DELETE, args)
CloudSyncSch... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#R... | static async remove(
context: common.UIAbilityContext,
namespace: string,
key: string,
): Promise<void> {
const store = await LocalDataStore.open(context)
const args: relationalStore.ValueType[] = [SyncedKv.composeKey(namespace, key)]
await store.executeSql(SQL_DELETE, args)
CloudSyncSch... | https://github.com/honjow/Next2V | b397b3d6b7f675d02bba09154b42e4d413e1c5ec | github |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/pages/Index.ets | arkts | getWeatherDetails | --- 核心功能:获取天气 --- | getWeatherDetails(adcode: string) {
let liveUrl = `https://restapi.amap.com/v3/weather/weatherInfo?city=${adcode}&key=${AMAP_KEY}&extensions=base`;
let reqLive = http.createHttp();
reqLive.request(liveUrl, {
method: http.RequestMethod.GET,
connectTimeout: 3000,
readTimeout: 3000
}, ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWeatherDetails AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left adcode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier... | getWeatherDetails(adcode: string) {
let liveUrl = `https://restapi.amap.com/v3/weather/weatherInfo?city=${adcode}&key=${AMAP_KEY}&extensions=base`;
let reqLive = http.createHttp();
reqLive.request(liveUrl, {
method: http.RequestMethod.GET,
connectTimeout: 3000,
readTimeout: 3000
}, ... | https://github.com/OnceWeWere/Weather_HarmonyOS | fe10cd5c6e95ea9e113c64e3fc79b852a9bfad48 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | getBigUint64 | Gets an unsigned long.
@param byteOffset The byte offset.
@param littleEndian If the value is little endian.
@returns The value. | getBigUint64(byteOffset: number, littleEndian?: boolean): bigint {
return this.dataView?.getBigUint64(byteOffset, littleEndian) ?? BigInt(0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBigUint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | getBigUint64(byteOffset: number, littleEndian?: boolean): bigint {
return this.dataView?.getBigUint64(byteOffset, littleEndian) ?? BigInt(0)
} | https://gitee.com/openharmony-sig/flutter_engine.git | c6a48d9b75a88e313f7a3a48546d5dac283dba8f | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | lastIndexOf | Finds the last occurrence of a character in this String at position <= fromIndex.
All values of fromIndex >= length are equivalent, and negative fromIndex implies no match.
@param ch to find
@param fromIndex to start searching from
@returns index of the character from the beginning of this string, or -1 if not found | public lastIndexOf(ch: char, fromIndex: int): int {
if (fromIndex >= this.length()) {
fromIndex = this.length() - 1;
}
for (let i: int = fromIndex; i >= 0; i--) {
if (this.charAt(i) == ch) {
return i;
}
}
return -1;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left char A... | public lastIndexOf(ch: char, fromIndex: int): int {
if (fromIndex >= this.length()) {
fromIndex = this.length() - 1;
}
for (let i: int = fromIndex; i >= 0; i--) {
if (this.charAt(i) == ch) {
return i;
}
}
return -1;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f6a3a0ae26f1471add1e9f7d12b82aeef11cfceb | gitee |
Gramony/Gramony | features/home/src/main/ets/utils/push.ets | arkts | generatePushEndpoint | 生成推送 token | function generatePushEndpoint(nickname: string, fake = false): string {
return JSON.stringify({
endpoint: `https://gramonotify.dokodemodoor.workers.dev/tg/${fake ? 'fake' : "webpush"}/${encodeURIComponent(nickname)}`,
keys: WEB_PUSH_KEYS
});
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generatePushEndpoint AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nickname AST#identifier#Right AST#type_annotation#Left AST#:#Left... | function generatePushEndpoint(nickname: string, fake = false): string {
return JSON.stringify({
endpoint: `https://gramonotify.dokodemodoor.workers.dev/tg/${fake ? 'fake' : "webpush"}/${encodeURIComponent(nickname)}`,
keys: WEB_PUSH_KEYS
});
} | https://github.com/Gramony/Gramony | 760a6b41e68c35ede5e0a80879d8f745641ef5f8 | github |
HarmonyOS_Samples/guide-snippets | Ability/AgentExtensionAbility/entry/src/main/ets/agentextability/AgentExtAbility.ets | arkts | onAuth | [EndExclude ability_agent_service_three]
[StartExclude ability_agent_service_two]
认证 | onAuth(proxy: common.AgentHostProxy, handshakeData: string) {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onAuth');
try {
// 处理认证逻辑
let authResult = 'auth success';
proxy.authorize(authResult);
} catch (err) {
let code = (err as BusinessError).code;
let msg = (err as... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left proxy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common... | onAuth(proxy: common.AgentHostProxy, handshakeData: string) {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onAuth');
try {
// 处理认证逻辑
let authResult = 'auth success';
proxy.authorize(authResult);
} catch (err) {
let code = (err as BusinessError).code;
let msg = (err as... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 8d05e4714b26e1e44fce44609691b6dfe4ecb234 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/button/index.ets | arkts | getBtnSize | 根据buttonSize换对应的按钮尺寸 | getBtnSize(): BtnSizeType {
if (this.btnWidth || this.btnHeight) {
return {
width: this.btnWidth || "auto",
height: this.btnHeight || 44,
padding: 15,
fontSize: this.btnFontSize || this.baseStyle.fontSizeMd as string
}
}
const buttonSize = this.buttonSize
switch (buttonSize) {
case SIZ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBtnSize 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 BtnSizeType AST#identifier#Right AST#ERROR#Right AS... | getBtnSize(): BtnSizeType {
if (this.btnWidth || this.btnHeight) {
return {
width: this.btnWidth || "auto",
height: this.btnHeight || 44,
padding: 15,
fontSize: this.btnFontSize || this.baseStyle.fontSizeMd as string
}
}
const buttonSize = this.buttonSize
switch (buttonSize) {
case SIZ... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/button/index.ets#L188-L228 | d35ef5afc4c4712bfa67feb6fd829954c975abc2 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/CandleDataSet.ets | arkts | setShowCandleBar | Sets whether the candle bars should show?
@param showCandleBar | public setShowCandleBar(showCandleBar: boolean): void {
this.mShowCandleBar = showCandleBar;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setShowCandleBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left showCandleBar AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | public setShowCandleBar(showCandleBar: boolean): void {
this.mShowCandleBar = showCandleBar;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ca382a04415947a986db782e2193d0b04bea38f1 | gitee |
SMAT-Lab/HapRepair | arkts_files/197.ets | arkts | onIndexPageShow | Callback when the page is show. | onIndexPageShow(): void {
Log.info(TAG, 'onIndexPageShow');
if (this.isShow) {
this.onActive();
this.createAlbum();
} else if (!this.isShow) {
this.onInActive();
} else {
Log.info(TAG, 'other condition');
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onIndexPageShow 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_bl... | onIndexPageShow(): void {
Log.info(TAG, 'onIndexPageShow');
if (this.isShow) {
this.onActive();
this.createAlbum();
} else if (!this.isShow) {
this.onInActive();
} else {
Log.info(TAG, 'other condition');
}
} | https://github.com/SMAT-Lab/HapRepair | a0363729b0f823e657a456198efc2927c98712d9 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/LearningRecordStorageService.ets | arkts | saveCurrentSession | 保存当前学习会话
@param session 当前会话 | static async saveCurrentSession(session: LearningSession | null): Promise<void> {
try {
if (session === null) {
await dataStorage.remove(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_CURRENT_SESSION
);
console.log('[LearningRecordStora... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveCurrentSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left session AST#identifier#Right AST#:#Le... | static async saveCurrentSession(session: LearningSession | null): Promise<void> {
try {
if (session === null) {
await dataStorage.remove(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_CURRENT_SESSION
);
console.log('[LearningRecordStora... | https://github.com/the-wwyang/kids-learning-app | 768bc00dca7340333c605476731d0eb6dcb07898 | github |
ibestservices/ibest-ui | library/src/main/ets/components/contactAddress/index.ets | arkts | getFormValues | 获取表单数据 | getFormValues() {
return {
phone: this.phone,
province: this.provinceCityDistrict.length > 0 ? getResourceStr(this.provinceCityDistrict[0].text) : '',
city: this.provinceCityDistrict.length > 1 ? getResourceStr(this.provinceCityDistrict[1].text) : '',
area: this.provinceCityDistrict.length > 2 ? getResou... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getFormValues 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... | getFormValues() {
return {
phone: this.phone,
province: this.provinceCityDistrict.length > 0 ? getResourceStr(this.provinceCityDistrict[0].text) : '',
city: this.provinceCityDistrict.length > 1 ? getResourceStr(this.provinceCityDistrict[1].text) : '',
area: this.provinceCityDistrict.length > 2 ? getResou... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/contactAddress/index.ets#L125-L138 | bba6ad5e70e17bc411baec79f2c14194c75f56d2 | github |
ibestservices/ibest-ui | library/src/main/ets/components/dialog/dialog.ets | arkts | getCancelBtnBgColor | 取消按钮背景色 | getCancelBtnBgColor() {
return this.cancelButtonBgColor || "transparent"
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getCancelBtnBgColor 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... | getCancelBtnBgColor() {
return this.cancelButtonBgColor || "transparent"
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dialog/dialog.ets#L259-L261 | eb4d80a0af30d57e3db04dd7df3ef3511b0add6e | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/arkts/class/Function.ets | arkts | fff | 闭包函数(closure)
闭包函数能够记住并访问其定义时所在的作用域及其外部变量 | function fff(): () => number {
let count = 0;
return (): number => {
count++;
return count;
};
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fff 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#function_type#Left AST#... | function fff(): () => number {
let count = 0;
return (): number => {
count++;
return count;
};
} | https://github.com/webabcd/HarmonyDemo | a8e8f28fe300fddf7b4ce8702d08bdf89249f4f4 | github |
GrassyUnknown/Health-Life-HarmonyOS-Next | oh_modules/.ohpm/cjcalendar@2.0.4/oh_modules/cjcalendar/src/main/ets/components/components/CJDateItem.ets | arkts | bigThan | 大于日期
@param other
@returns | bigThan(other: CJDateItem, hasEqual: boolean = false) {
if (!other) {
return false
}
if (other) {
if (this.fullYear > other.fullYear) {
return true
} else if (this.fullYear < other.fullYear) {
return false
} else {
if (this.month > other.month) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left bigThan 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 ... | bigThan(other: CJDateItem, hasEqual: boolean = false) {
if (!other) {
return false
}
if (other) {
if (this.fullYear > other.fullYear) {
return true
} else if (this.fullYear < other.fullYear) {
return false
} else {
if (this.month > other.month) {
... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | e3c5b1826a08301c67c2bf68e5e3aa3f724ca876 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | getRarStringContent | 获取rar文件中指定文件的内容(字符串) | async getRarStringContent(url: string, path: string, charsetName?: string): Promise<string> {
logger.warn(TAG, 'rar格式暂不支持,尝试作为zip处理');
return this.getZipStringContent(url, path, charsetName);
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getRarStringContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left ... | async getRarStringContent(url: string, path: string, charsetName?: string): Promise<string> {
logger.warn(TAG, 'rar格式暂不支持,尝试作为zip处理');
return this.getZipStringContent(url, path, charsetName);
} | https://github.com/DaLongZhuaZi/manxia | 3ac64ac9605f0ae4e51fb03e66f590390b0992ed | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | of | Returns Type of value
@param {FixedArray<long>} v value
@returns {Type} Type instance of this value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(v: FixedArray<long>): Type {
return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Long()))
} | 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#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#... | public static of(v: FixedArray<long>): Type {
return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Long()))
} | https://gitcode.com/iop123123/arkts-static-skills | c16282f88086745e826b35c5d06a0d35308cea56 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/Component_Redundancy_Refresh_Optimization/entry/src/main/ets/segment/segment1.ets | arkts | build | Properties of uiStyle used by multiple components | build() {
Column() {
// Components that use state variables
SpecialImage({ specialImageUiStyle: this.uiStyle })
Column() {
// 需要替换为开发者所需的图像资源文件
Image($r('app.media.startIcon'))
.height('150vp')
.width('150vp')
.scale({
x: this.uiStyle.sca... | 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#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
// Components that use state variables
SpecialImage({ specialImageUiStyle: this.uiStyle })
Column() {
// 需要替换为开发者所需的图像资源文件
Image($r('app.media.startIcon'))
.height('150vp')
.width('150vp')
.scale({
x: this.uiStyle.sca... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 36f397d0cd411819f284e028ee7cea6b07e1a5df | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BubbleComponent.ets | arkts | getBubbleLeftPadding | 左部内边距
@returns | getBubbleLeftPadding(): number {
const p = this.mShadowRadius + this.mBubbleBorderSize
const leftPadding =
p + (this.mShadowX < 0 ? -this.mShadowX : 0) + (this.mArrowLocation == ArrowLocation.LEFT ? this.mArrowHeight : 0)
return leftPadding + (this.mBubbleLeftPadding == -1 ? this.mBubblePadding : th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBubbleLeftPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#s... | getBubbleLeftPadding(): number {
const p = this.mShadowRadius + this.mBubbleBorderSize
const leftPadding =
p + (this.mShadowX < 0 ? -this.mShadowX : 0) + (this.mArrowLocation == ArrowLocation.LEFT ? this.mArrowHeight : 0)
return leftPadding + (this.mBubbleLeftPadding == -1 ? this.mBubblePadding : th... | https://github.com/wuba/omni-ui | 3f5506a9e7111d7695db6ba9774ec6b953e87590 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | getLong | Returns the value of an object as a long
@returns { long } The long value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getLong(): long {
let buff = 0 as long
const bytes = this.bytes
const num = Math.min(2, bytes.length)
for (let i = 0; i < num; ++i) {
buff += (bytes[i].toLong() & BigInt.maskSys) << i * BigInt.shiftSys
}
return this.sign * buff
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLong 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 long AST#ident... | public getLong(): long {
let buff = 0 as long
const bytes = this.bytes
const num = Math.min(2, bytes.length)
for (let i = 0; i < num; ++i) {
buff += (bytes[i].toLong() & BigInt.maskSys) << i * BigInt.shiftSys
}
return this.sign * buff
} | https://gitcode.com/iop123123/arkts-static-skills | aedad2ce6e4a7f541a274cfb3eef2946132738e5 | gitcode |
ibestservices/ibest-ui | entry/src/main/ets/pages/ucharts/Column.ets | arkts | getChartData | 获取图表数据 | getChartData(){
IBestToast.showLoading()
setTimeout(() => {
this.opts.categories = ["2018", "2019", "2020", "2021", "2022", "2023"]
this.opts.series = [
{
name: "目标值",
data: this.randomArray()
},
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getChartData 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 ... | getChartData(){
IBestToast.showLoading()
setTimeout(() => {
this.opts.categories = ["2018", "2019", "2020", "2021", "2022", "2023"]
this.opts.series = [
{
name: "目标值",
data: this.randomArray()
},
... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/entry/src/main/ets/pages/ucharts/Column.ets#L237-L254 | ea49cb864fa21e0d57f94149cefb0d97fc81b38f | github |
erosTeam/NextE | shared/src/main/ets/parser/HtmlSelectorUtils.ets | arkts | groupAll | All occurrences of capture group 1 for a global pattern. | static groupAll(text: string, pattern: string): string[] {
const re: RegExp = new RegExp(pattern, 'g')
const out: string[] = []
let m: RegExpExecArray | null = re.exec(text)
while (m !== null) {
if (m.length > 1 && m[1] !== undefined) {
out.push(m[1])
}
m = re.exec(text)
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left groupAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static groupAll(text: string, pattern: string): string[] {
const re: RegExp = new RegExp(pattern, 'g')
const out: string[] = []
let m: RegExpExecArray | null = re.exec(text)
while (m !== null) {
if (m.length > 1 && m[1] !== undefined) {
out.push(m[1])
}
m = re.exec(text)
... | https://github.com/erosTeam/NextE | 2cd34e3657e977be08e07aa608f86c3b99c82409 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | reloadOnForeground | 在应用切换至前台时重新加载被清空的组件图片
API15以下不生效
可以在EntryAbility的onForeground回调中调用
需要配和clearOnBackground使用 | reloadOnForeground() {
nativeNode.reloadOnForeground();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left reloadOnForeground 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... | reloadOnForeground() {
nativeNode.reloadOnForeground();
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L454-L456 | d39f5807c1095f3bb3496a8bdc8bc84b2ecb2fca | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets | arkts | updateSettings | 批量更新动画设置 | public async updateSettings(settings: Partial<AnimationSettings>): Promise<void> {
let changed = false;
if (settings.bookOpenEnabled !== undefined && settings.bookOpenEnabled !== this.currentSettings.bookOpenEnabled) {
this.currentSettings.bookOpenEnabled = settings.bookOpenEnabled;
await this.se... | 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 updateSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left settings AST#identifier#Right AST#:#Left ... | public async updateSettings(settings: Partial<AnimationSettings>): Promise<void> {
let changed = false;
if (settings.bookOpenEnabled !== undefined && settings.bookOpenEnabled !== this.currentSettings.bookOpenEnabled) {
this.currentSettings.bookOpenEnabled = settings.bookOpenEnabled;
await this.se... | https://github.com/DaLongZhuaZi/manxia | b5b55b4705a36dcf604045baa8d1a18e312a7f3f | github |
Jack-TCN/richEditor | src/main/ets/components/SnapshotPreview.ets | arkts | setShareData | [End save_snapshot] | setShareData(fileName: string) {
// 构造ShareData,需配置一条有效数据信息
const contextFaker: Context = getContext(this);
let filePath = contextFaker.filesDir + `/${fileName}`; // 仅为示例 请替换正确的文件路径
// 获取精准的utd类型
let utdTypeId = utd.getUniformDataTypeByFilenameExtension('.png', utd.UniformDataType.IMAGE);
let ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setShareData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#... | setShareData(fileName: string) {
// 构造ShareData,需配置一条有效数据信息
const contextFaker: Context = getContext(this);
let filePath = contextFaker.filesDir + `/${fileName}`; // 仅为示例 请替换正确的文件路径
// 获取精准的utd类型
let utdTypeId = utd.getUniformDataTypeByFilenameExtension('.png', utd.UniformDataType.IMAGE);
let ... | https://github.com/Jack-TCN/richEditor | 55945396b91a4eb81621e14452645af1008a4ce1 | github |
openharmony/testfwk_arkxtest | jsunit/src_static/module/assert/deepEquals/DeepTypeUtils.ets | arkts | isUndefined | 是否是undefined
@param obj | static isUndefined<T>(obj: T): boolean {
return obj === undefined;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left isUndefined AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#R... | static isUndefined<T>(obj: T): boolean {
return obj === undefined;
} | https://gitee.com/openharmony/testfwk_arkxtest.git | d481dd6c4d005beb79e491803cc3502e6972f3b6 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BaseDataSet.ets | arkts | setLabel | ###### ###### OTHER STYLING RELATED METHODS ##### ###### | public setLabel(label: string): void {
this.mLabel = label;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | public setLabel(label: string): void {
this.mLabel = label;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f1265e9fe97bad5183dba6c661cb68e05964e78e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets | arkts | processNextTask | 处理下一个任务 | private processNextTask(): void {
if (this.isProcessing || this.taskQueue.length === 0) {
return;
}
if (!this.isWebViewReady()) {
logger.warn(TAG, 'WebView未就绪,任务等待中');
return;
}
this.isProcessing = true;
this.currentTask = this.taskQueue.shift()!;
this.executeTask(this.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processNextTask 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#... | private processNextTask(): void {
if (this.isProcessing || this.taskQueue.length === 0) {
return;
}
if (!this.isWebViewReady()) {
logger.warn(TAG, 'WebView未就绪,任务等待中');
return;
}
this.isProcessing = true;
this.currentTask = this.taskQueue.shift()!;
this.executeTask(this.... | https://github.com/DaLongZhuaZi/manxia | 496d898ac6811b1e2aa8cedb3d7305ae779290b9 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | notifyListenerOfExistingDevices | 通知 listener 所有已连接的设备
在 setListener 和 loadUsbDriverSetting 完成时调用 | private notifyListenerOfExistingDevices(): void {
const listener = this.listener;
if (!listener) return;
if (this.useGameControllerKit) {
// Game Controller Kit 模式
console.info(`GamepadManager: 设置监听器 (Game Controller Kit 模式)`);
// 确保 GC Kit 回调已设置(可能被测试页面清空)
//... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyListenerOfExistingDevices 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#voi... | private notifyListenerOfExistingDevices(): void {
const listener = this.listener;
if (!listener) return;
if (this.useGameControllerKit) {
// Game Controller Kit 模式
console.info(`GamepadManager: 设置监听器 (Game Controller Kit 模式)`);
// 确保 GC Kit 回调已设置(可能被测试页面清空)
//... | https://github.com/AlkaidLab/moonlight-harmony | db63100f324a2e9568e19b45e3305fcd3a2cc708 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.