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 |
|---|---|---|---|---|---|---|---|---|---|---|
erosTeam/NextE | shared/src/main/ets/network/EhApiService.ets | arkts | deleteUserTags | Delete one or more existing usertags (eros_fe actionDeleteUserTag: usertag_action=mass). | async deleteUserTags(update: MyTagsDeleteUpdate): Promise<void> {
if (update.tagIds.length === 0) {
throw new Error('mytags delete: missing tag')
}
const base: string = EhConstants.baseUrl(update.isEx)
const params: string[] = []
if (update.tagset.length > 0) {
params.push(`tagset=${en... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteUserTags AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left update AST#identifier#Right AS... | async deleteUserTags(update: MyTagsDeleteUpdate): Promise<void> {
if (update.tagIds.length === 0) {
throw new Error('mytags delete: missing tag')
}
const base: string = EhConstants.baseUrl(update.isEx)
const params: string[] = []
if (update.tagset.length > 0) {
params.push(`tagset=${en... | https://github.com/erosTeam/NextE | 3bfadfb5f88ebad833a42a71b9f5eac2a0be7e6c | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/HttpClient.ets | arkts | putForm | PUT 表单并返回文本响应 | async putForm(
path: string,
form: Record<string, Object>,
extraHeaders: Record<string, string> | null = null,
readTimeoutMs: number = 60000,
connectTimeoutMs: number | null = null,
guardOptions: CfGuardOptions | null = null
): Promise<string> {
await this.cookieStore.init();
const u... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left putForm AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async putForm(
path: string,
form: Record<string, Object>,
extraHeaders: Record<string, string> | null = null,
readTimeoutMs: number = 60000,
connectTimeoutMs: number | null = null,
guardOptions: CfGuardOptions | null = null
): Promise<string> {
await this.cookieStore.init();
const u... | https://github.com/Amaz1ny/HarmonyDO-public | de0e2932036fcd197dcb9851edfd5ed4b96ecf1b | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/common/ModifierDemo.ets | arkts | buildCheckbox | 自定义 Checkbox | @Builder function buildCheckbox(config: CheckBoxConfiguration) {
/*
* CheckBoxConfiguration - 自定义 Checkbox 的相关信息
* enabled - 是否可用
* contentModifier - 绑定的 ContentModifier 对象
* name - 多选框的名字
* selected - 是否是选中状态
* triggerChange() - 触发 Checkbox 的 onChange() 回调
*/
Column({ space: 10 }) {
... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left buildCheckbox AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#req... | @Builder function buildCheckbox(config: CheckBoxConfiguration) {
/*
* CheckBoxConfiguration - 自定义 Checkbox 的相关信息
* enabled - 是否可用
* contentModifier - 绑定的 ContentModifier 对象
* name - 多选框的名字
* selected - 是否是选中状态
* triggerChange() - 触发 Checkbox 的 onChange() 回调
*/
Column({ space: 10 }) {
... | https://github.com/webabcd/HarmonyDemo | f36fa935cc453f4d2164e01240755e795f1c752b | github |
OSpark-Team/Free-PCM | entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | === 生命周期 === | aboutToAppear(): void {
window.getLastWindow(getContext(this)).then((win) => {
win.setWindowLayoutFullScreen(true);
win.setWindowSystemBarProperties({ statusBarContentColor: "#000000" });
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
window.getLastWindow(getContext(this)).then((win) => {
win.setWindowLayoutFullScreen(true);
win.setWindowSystemBarProperties({ statusBarContentColor: "#000000" });
});
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/entry/src/main/ets/pages/Index.ets#L154-L159 | 44d65bd3c3e22879339ff1588521e3ad4e01c20b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | sort | Sorts in-place
@param { function } [compareFn] - comparator _ used to determine the order of the elements.
compareFn returns a negative value if first argument is less than second argument,
zero if they're equal and a positive value otherwise.
@returns { this } - sorted Int32Array
@syscap SystemCapability.Utils.Lang
@... | public sort(compareFn?: (a: number, b: number) => int): this {
if (compareFn == undefined) {
this.sort()
return this
}
let cmp = (l: int, r: int): int => {
const result = compareFn!((l).toDouble(), (r).toDouble())
return result.toInt()
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left compareFn AST#identifi... | public sort(compareFn?: (a: number, b: number) => int): this {
if (compareFn == undefined) {
this.sort()
return this
}
let cmp = (l: int, r: int): int => {
const result = compareFn!((l).toDouble(), (r).toDouble())
return result.toInt()
... | https://gitcode.com/iop123123/arkts-static-skills | fe97ece39020deee4d6ad59bcfcbd90d4c530b82 | gitcode |
heeh02/superconnect | harmony/entry/src/main/ets/services/FullscreenNotification.ets | arkts | enable | Ask once for notification permission (modal prompt attached to the ability). | static enable(context: common.UIAbilityContext, onLog?: (msg: string) => void): void {
notificationManager.requestEnableNotification(context).catch((e: Object): void => { onLog?.('notifyEnable ' + JSON.stringify(e)); });
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left enable AST#identifier#Right AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left context AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left common AST#identifier#Right AST#ERROR#R... | static enable(context: common.UIAbilityContext, onLog?: (msg: string) => void): void {
notificationManager.requestEnableNotification(context).catch((e: Object): void => { onLog?.('notifyEnable ' + JSON.stringify(e)); });
} | https://github.com/heeh02/superconnect | 141657380dc8194b1c2fffc9d02ccf08393b58a2 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | base64Encode | Base64 编码 | static base64Encode(data: Uint8Array): string {
const base64Helper = new util.Base64Helper();
return base64Helper.encodeToStringSync(data);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left base64Encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uin... | static base64Encode(data: Uint8Array): string {
const base64Helper = new util.Base64Helper();
return base64Helper.encodeToStringSync(data);
} | https://github.com/AlkaidLab/moonlight-harmony | 4a392699bbb3beb517c5fd6dcaab51b67987429d | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test22_original_index.ets | arkts | testStringCompare | --- String.localeCompare --- | function testStringCompare(): string {
let a: string = 'apple';
let b: string = 'banana';
let cmp: number = a.localeCompare(b);
if (cmp < 0) {
return 'a<b';
}
if (cmp > 0) {
return 'a>b';
}
return 'equal';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringCompare AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testStringCompare(): string {
let a: string = 'apple';
let b: string = 'banana';
let cmp: number = a.localeCompare(b);
if (cmp < 0) {
return 'a<b';
}
if (cmp > 0) {
return 'a>b';
}
return 'equal';
} | https://github.com/miaochiahao/ark-ghidra | 28a2044dd0c51ec6da89b3558aa00c13a389e051 | github |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/AutoMenuManager.ets | arkts | _verificationUri | Verify showControlAbilityUri | private async _verificationUri(context: Context, uri: string): Promise<string> {
try {
let data: dataShare.DataShareHelper = await dataShare.createDataShareHelper(context, uri, { isProxy: false });
if (data !== undefined) {
let resultSet: DataShareResultSet = await data.query(uri, this._predic... | 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 _verificationUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L... | private async _verificationUri(context: Context, uri: string): Promise<string> {
try {
let data: dataShare.DataShareHelper = await dataShare.createDataShareHelper(context, uri, { isProxy: false });
if (data !== undefined) {
let resultSet: DataShareResultSet = await data.query(uri, this._predic... | https://gitee.com/openharmony/security_privacy_center.git | d814b78be1031d218707e37215714755541612fa | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test47_original_index.ets | arkts | testArrayFrom | --- Array.from with mapping function --- | function testArrayFrom(): string {
let range: number[] = Array.from({ length: 5 } as ArrayLike<number>, (_, i: number): number => {
return i * i;
});
let sum: number = 0;
for (let i: number = 0; i < range.length; i++) {
sum = sum + range[i];
}
return String(range.length) + ',' + String(sum);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayFrom 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_ty... | function testArrayFrom(): string {
let range: number[] = Array.from({ length: 5 } as ArrayLike<number>, (_, i: number): number => {
return i * i;
});
let sum: number = 0;
for (let i: number = 0; i < range.length; i++) {
sum = sum + range[i];
}
return String(range.length) + ',' + String(sum);
} | https://github.com/miaochiahao/ark-ghidra | b1ad8a031f9a251b979640dc8a0b20b3215dea4a | github |
HarmonyOS_Samples/MusicHome | products/default/src/main/ets/entryability/EntryAbility.ets | arkts | onBackground | App moved to background; notifies media layer for background-task policy. | onBackground() {
// Ability has back to background
Logger.info('EntryAbility: Ability onBackground');
MediaService.getInstance().onApplicationBackground();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackground 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 ... | onBackground() {
// Ability has back to background
Logger.info('EntryAbility: Ability onBackground');
MediaService.getInstance().onApplicationBackground();
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | afcff2a6b5972e74e0c592c90a4141d50cb2a2df | gitcode |
HarmonyOS_Samples/MusicHome | products/pc/src/main/ets/pcability/PcAbility.ets | arkts | onForeground | Logs foreground. | onForeground(): void {
Logger.info('PcAbility: Ability onForeground');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | onForeground(): void {
Logger.info('PcAbility: Ability onForeground');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 16a94636e862c17f12b7ffb4a5ad6d044346216e | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/utils/TimeUtil.ets | arkts | getNumberDay | Get the number of the current day in a year.
@param a timestamp
@return Number of days corresponding to the current timestamp | static getNumberDay(time?: number): number {
let dateArr = MONTH_LIST;
let date = time ? new Date(time) : new Date();
let day = date.getDate();
let month = date.getMonth();
let year = date.getFullYear();
let netYear = AppStorage.get<HolidaysType>(CACHE_HOLIDAYS_LIST)?.year || new Date().getFul... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNumberDay 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#:#Left : AST#:#Right AST#ERROR#Righ... | static getNumberDay(time?: number): number {
let dateArr = MONTH_LIST;
let date = time ? new Date(time) : new Date();
let day = date.getDate();
let month = date.getMonth();
let year = date.getFullYear();
let netYear = AppStorage.get<HolidaysType>(CACHE_HOLIDAYS_LIST)?.year || new Date().getFul... | https://gitee.com/openharmony-sig/applications_clock.git | 884a0a0c9318ae7a57754076757e7ac7d422d821 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarChartModel.ets | arkts | getHighlightByTouchPoint | Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
point
inside the BarChart.
@param x
@param y
@return
@Override | public getHighlightByTouchPoint(x: number, y: number): Highlight | null {
if (this.mData == null) {
LogUtil.error(ChartModel.LOG_TAG, "Can't select by touch. No data set.");
return null;
} else {
let highLighter: IHighlighter | null = this.getHighlighter();
if (highLighter) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighlightByTouchPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public getHighlightByTouchPoint(x: number, y: number): Highlight | null {
if (this.mData == null) {
LogUtil.error(ChartModel.LOG_TAG, "Can't select by touch. No data set.");
return null;
} else {
let highLighter: IHighlighter | null = this.getHighlighter();
if (highLighter) {
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 3205fd9f207223d9bdc3fc7d5f3c07e6fb48b7fe | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CartManager.ets | arkts | initialize | Initialize and validate cart data (同步方法,用于兼容旧代码) | static initialize(): void {
// 从 AppStorage 初始化缓存(兼容旧代码)
const cartList = AppStorage.get<ICartItemData[]>('shopping_cart_list') || [];
cachedCartList = cartList;
console.log(`CartManager.initialize: found ${cachedCartList.length} items`);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left initialize 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#Rig... | static initialize(): void {
// 从 AppStorage 初始化缓存(兼容旧代码)
const cartList = AppStorage.get<ICartItemData[]>('shopping_cart_list') || [];
cachedCartList = cartList;
console.log(`CartManager.initialize: found ${cachedCartList.length} items`);
} | https://github.com/Harrisonls2004/WaterFlow | cf3b6cf56177b54562df456e710dfae59c173983 | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/modal/CouponModal.ets | arkts | build | 构建优惠券弹窗
@returns {void} 无返回值 | build(): void {
BottomModal({
visible: this.visible,
title: this.title,
onDismiss: this.onDismiss,
containerColor: $r("app.color.bg_grey"),
content: (): void => this.ModalContent()
});
} | 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 {
BottomModal({
visible: this.visible,
title: this.title,
onDismiss: this.onDismiss,
containerColor: $r("app.color.bg_grey"),
content: (): void => this.ModalContent()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | 6e53f26a9c8691ef17cddf29380efadbf03d0a27 | github |
CsCesium/KantaiHomo | entry/src/main/ets/app/pages/components/info/EquipInfoPage.ets | arkts | buildEquipperIndex | Build slot uid → ship-name map by scanning every ship's slots + exSlot. | function buildEquipperIndex(): Map<number, TmpEntry> {
const out = new Map<number, TmpEntry>();
const state = getGameState().getState();
state.ships.forEach((ship) => {
const entry: TmpEntry = { uid: ship.uid, name: ship.name };
for (const slotUid of ship.slots) {
if (slotUid > 0) out.set(slotUid, e... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildEquipperIndex 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#generic_... | function buildEquipperIndex(): Map<number, TmpEntry> {
const out = new Map<number, TmpEntry>();
const state = getGameState().getState();
state.ships.forEach((ship) => {
const entry: TmpEntry = { uid: ship.uid, name: ship.name };
for (const slotUid of ship.slots) {
if (slotUid > 0) out.set(slotUid, e... | https://github.com/CsCesium/KantaiHomo | e63efb126ff731a2ad2f3819a5d8f747524fe808 | github |
openharmony/xts_acts | ability/ability_runtime/actsabilityamstest/actsdeeplinktest/entry/src/main/ets/specifedprocessability/SpecifedProcessAbility.ets | arkts | onForeground | 切换到前台时 | onForeground(): void {
// Ability has brought to foreground
let applicationContext = this.context.getApplicationContext();
applicationContext.getRunningProcessInformation((err, data) => {
if (err) {
console.error(`getRunningProcessInformation fail, error: ${JSON.stringify(err)}`);
} ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | onForeground(): void {
// Ability has brought to foreground
let applicationContext = this.context.getApplicationContext();
applicationContext.getRunningProcessInformation((err, data) => {
if (err) {
console.error(`getRunningProcessInformation fail, error: ${JSON.stringify(err)}`);
} ... | https://gitee.com/openharmony/xts_acts.git | ac08e809f4b881aab14a980879589bd525d07dbd | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamIMEManager.ets | arkts | readyTime | IME 就绪时间戳(防止弹出瞬间 onBackPress 误关) | get readyTime(): number {
return this.imeReadyTime;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left readyTime 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 A... | get readyTime(): number {
return this.imeReadyTime;
} | https://github.com/AlkaidLab/moonlight-harmony | db75d7a981f7941e9dd31c4853db20015ee58790 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/left_shift/left_shift_uint.ets | arkts | main | ---
desc: check left shift operation for unsigned integer
--- | function main(): void {
const a: uint = {{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: uint = {{v.left}}
const b: int = {{v.right}}
assert (a << b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | db4a032a7e706cd9d0361ed4203314f3f1173807 | gitee |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/IWebDownloadFile.ets | arkts | ensureFileExtension | 确保文件扩展名正确 | private ensureFileExtension(path: string): string {
const suggestedName = this.webDownloadItem?.getSuggestedFileName() || ''
const expectedExt = suggestedName.split('.').pop() || ''
const currentExt = path.split('.').pop() || ''
return currentExt === expectedExt ? path : `${path}.${expectedExt}`
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureFileExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private ensureFileExtension(path: string): string {
const suggestedName = this.webDownloadItem?.getSuggestedFileName() || ''
const expectedExt = suggestedName.split('.').pop() || ''
const currentExt = path.split('.').pop() || ''
return currentExt === expectedExt ? path : `${path}.${expectedExt}`
} | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | 0cc597ec10170fd404a2a432f1350266acb66675 | github |
lidaixian999/Smart_Car | entry/src/main/ets/model/SsapManager.ets | arkts | startScan | 开始扫描设备 | public startScan(scanFilter?: scan.ScanFilters): Promise<void> {
return new Promise((resolve, reject) => {
if (this.isScanning) {
const message = 'Already scanning';
hilog.warn(this.domainId, this.logTag, message);
reject(new Error(message));
return;
}
hilog.info... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startScan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left scanFilter AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Lef... | public startScan(scanFilter?: scan.ScanFilters): Promise<void> {
return new Promise((resolve, reject) => {
if (this.isScanning) {
const message = 'Already scanning';
hilog.warn(this.domainId, this.logTag, message);
reject(new Error(message));
return;
}
hilog.info... | https://github.com/lidaixian999/Smart_Car | 468e7ada3750ed66874fbbca01a4a1ced355a4c9 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | resetAVPlayer | 重置AVPlayer | async resetAVPlayer() : Promise<void> {
if (!this.avPlayer) {
return;
}
await this.avPlayer.reset();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resetAVPlayer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left A... | async resetAVPlayer() : Promise<void> {
if (!this.avPlayer) {
return;
}
await this.avPlayer.reset();
} | https://gitcode.com/arkui-x/samples | 438f36670fe4716864878497ad455eb395ff4a8e | gitcode |
Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onForeground | Called when the app comes to the foreground | onForeground() {
LifeCycleLog.add('🟩 onForeground: App brought to foreground.');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ... | onForeground() {
LifeCycleLog.add('🟩 onForeground: App brought to foreground.');
} | https://github.com/Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle | 18feb3b80b343d4ec669c2ad0b68a45904bf9a5b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DependencyContainer.ets | arkts | validateDependencyGraph | 验证依赖图 | public validateDependencyGraph(): ValidationResult {
// 确保dependencies Map已初始化
if (!this.dependencies) {
this.dependencies = new Map<string, DependencyDescriptor>();
logger.warn('DI', 'validateDependencyGraph方法:检测到dependencies Map未初始化,已重新创建');
}
const errors: string[] = [];
const ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left validateDependencyGraph 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#Lef... | public validateDependencyGraph(): ValidationResult {
// 确保dependencies Map已初始化
if (!this.dependencies) {
this.dependencies = new Map<string, DependencyDescriptor>();
logger.warn('DI', 'validateDependencyGraph方法:检测到dependencies Map未初始化,已重新创建');
}
const errors: string[] = [];
const ... | https://github.com/DaLongZhuaZi/manxia | 0fb6d2c7fa75bf10689ff4ebd5d7b5e48c4a7153 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveStorage.ets | arkts | notifyTokenUpdated | 通知令牌已更新
@param token 更新后的令牌 | private async notifyTokenUpdated(token: OAuth2Token): Promise<void> {
try {
// 保存到首选项
const storageService = OAuth2TokenStorageService.getInstance();
await storageService.updateToken(token, {
provider: OAuth2Provider.ONEDRIVE,
encrypt: true
});
hilog.info(DOMAI... | 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 notifyTokenUpdated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#L... | private async notifyTokenUpdated(token: OAuth2Token): Promise<void> {
try {
// 保存到首选项
const storageService = OAuth2TokenStorageService.getInstance();
await storageService.updateToken(token, {
provider: OAuth2Provider.ONEDRIVE,
encrypt: true
});
hilog.info(DOMAI... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveStorage.ets#L139-L152 | f60569b8e51be7f5d6228e4edd313f8917923619 | github |
arkui-x/samples | CodeLab/Cases/feature/eraser/src/main/ets/model/RenderNodeModel.ets | arkts | draw | 记录撤销时从pixelMapHistory中出栈的pixelMap,恢复时使用
RenderNode进行绘制时会调用draw方法 | draw(context: DrawContext): void {
const canvas = context.canvas;
if (this.pixelMapHistory.length !== 0) {
// 使用drawImage绘制pixelMapHistory栈顶的pixelMap
canvas.drawImage(this.pixelMapHistory[this.pixelMapHistory.length - 1], 0, 0);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left draw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DrawContext AST#identifier#Right AST#)#Left ) AS... | draw(context: DrawContext): void {
const canvas = context.canvas;
if (this.pixelMapHistory.length !== 0) {
// 使用drawImage绘制pixelMapHistory栈顶的pixelMap
canvas.drawImage(this.pixelMapHistory[this.pixelMapHistory.length - 1], 0, 0);
}
} | https://gitcode.com/arkui-x/samples | 3c2f270ec83bbf3e2ea8c29877b73005a7cc7df8 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/TotpService.ets | arkts | truncateSteamHmac | 截断HMAC并生成Steam令牌
@param hmac HMAC字节数组
@returns 生成的Steam令牌 | private truncateSteamHmac(hmac: Uint8Array): string {
// 获取偏移量(最后一个字节的低4位)
const offset = hmac[19] & 0x0f;
// 从偏移量开始提取4个字节并转换为整数
let fullCode = ((hmac[offset] & 0x7f) << 24) |
((hmac[offset + 1] & 0xff) << 16) |
((hmac[offset + 2] & 0xff) << 8) |
(hmac[offset + 3] & 0xff);
// S... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left truncateSteamHmac AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hmac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private truncateSteamHmac(hmac: Uint8Array): string {
// 获取偏移量(最后一个字节的低4位)
const offset = hmac[19] & 0x0f;
// 从偏移量开始提取4个字节并转换为整数
let fullCode = ((hmac[offset] & 0x7f) << 24) |
((hmac[offset + 1] & 0xff) << 16) |
((hmac[offset + 2] & 0xff) << 8) |
(hmac[offset + 3] & 0xff);
// S... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L258-L279 | 4321480e6c694fa42cc627704b3e3d66ce4f6608 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an object of FixedArray<BigInt>.
@param { FixedArray<BigInt> } arr - An instance of the FixedArray type to convert to an array.
@returns { BigUint64Array } - A new BigUint64Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: FixedArray<BigInt>): BigUint64Array {
let result = new BigUint64Array(arr.length)
result.ofBigInt(arr)
return result
} | 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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: FixedArray<BigInt>): BigUint64Array {
let result = new BigUint64Array(arr.length)
result.ofBigInt(arr)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | cd058fdaa97eb335d358599c057f9e15a094cddd | gitcode |
LZZLHY/hlib | entry/src/main/ets/utils/Format.ets | arkts | size | 字节数 → 人类可读(GB/MB/KB/B)。<=0 返回 "—"。 | static size(bytes: number): string {
if (bytes <= 0) {
return '—';
}
if (bytes >= GB) {
return `${(bytes / GB).toFixed(2)} GB`;
}
if (bytes >= MB) {
return `${(bytes / MB).toFixed(1)} MB`;
}
if (bytes >= KB) {
return `${(bytes / KB).toFixed(0)} KB`;
}
return... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | static size(bytes: number): string {
if (bytes <= 0) {
return '—';
}
if (bytes >= GB) {
return `${(bytes / GB).toFixed(2)} GB`;
}
if (bytes >= MB) {
return `${(bytes / MB).toFixed(1)} MB`;
}
if (bytes >= KB) {
return `${(bytes / KB).toFixed(0)} KB`;
}
return... | https://github.com/LZZLHY/hlib | 6d36e4b7679dc805e79e1a1ea8ed38d10a9537eb | github |
m-harmongos/harmongos-projects | AlarmClock/entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets | arkts | aboutToAppear | = new CustomDialogController({
builder: RepeatDialog(),
autoCancel: true
}); | aboutToAppear() {
// 深拷贝
let newObj: number[] = [];
for (let i = 0; i < this.alarmItem.repeatDays.length; i++) {
newObj[i] = JSON.parse(JSON.stringify(this.alarmItem.repeatDays[i]));
}
this.selects = newObj;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 深拷贝
let newObj: number[] = [];
for (let i = 0; i < this.alarmItem.repeatDays.length; i++) {
newObj[i] = JSON.parse(JSON.stringify(this.alarmItem.repeatDays[i]));
}
this.selects = newObj;
} | https://github.com/m-harmongos/harmongos-projects | fc766661ec412cf084f4d12eecc9993a85d757c6 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | updateProviderSortOrder | 更新供应商排序顺序 | async updateProviderSortOrder(providerId: string, sortOrder: number): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
sort_order: sortOrder
}
const predicates = new relationalStore.RdbPred... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateProviderSortOrder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier... | async updateProviderSortOrder(providerId: string, sortOrder: number): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
sort_order: sortOrder
}
const predicates = new relationalStore.RdbPred... | https://github.com/LongLiveY96/chatcube | 6abd3f4bb144261aa60867a00b4f374d132958ed | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/DatabaseService.ets | arkts | markEpisodeAsPlayed | 标记单集为已播放 | async markEpisodeAsPlayed(episodeId: string): Promise<void> {
if (!this.rdbStore) {
console.error('[DatabaseService] rdbStore is null');
return;
}
try {
const valueBucket: relationalStore.ValuesBucket = {
isPlayed: 1
};
const predicates = new relationalStore.RdbPred... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left markEpisodeAsPlayed AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left episodeId AST#identifier#... | async markEpisodeAsPlayed(episodeId: string): Promise<void> {
if (!this.rdbStore) {
console.error('[DatabaseService] rdbStore is null');
return;
}
try {
const valueBucket: relationalStore.ValuesBucket = {
isPlayed: 1
};
const predicates = new relationalStore.RdbPred... | https://github.com/pangpang20/antennaPodHM | 2efa2e43bb625f1b269adb09ca069a5383db4df6 | github |
RoooyHe/toona-ohos | toona/src/main/ets/pages/MainPage.ets | arkts | navigateToJoinSpace | ✅ 新增:动态跳转到加入/创建空间页 | navigateToJoinSpace() {
if (this.isNavigating) {
return;
}
this.isNavigating = true;
const param: Record<string, Object> = {
"pathStack": this.pathStack
};
this.pathStack.pushPathByName('JoinSpacePage', param);
const self = this;
setTimeout(() => { self.isNavigating = false... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left navigateToJoinSpace 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... | navigateToJoinSpace() {
if (this.isNavigating) {
return;
}
this.isNavigating = true;
const param: Record<string, Object> = {
"pathStack": this.pathStack
};
this.pathStack.pushPathByName('JoinSpacePage', param);
const self = this;
setTimeout(() => { self.isNavigating = false... | https://github.com/RoooyHe/toona-ohos | 5a621b9b00c086dd6470cbd56e3f4903630ee221 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | getUserAvatar | 获取用户头像 | async getUserAvatar(): Promise<EngineResult<string>> {
const startTime = Date.now();
try {
if (!this.config) {
logger.error(TAG, '配置未加载,无法获取用户头像');
return {
success: false,
error: '配置未加载',
duration: Date.now() - startTime,
actionCount: 0
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserAvatar AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi... | async getUserAvatar(): Promise<EngineResult<string>> {
const startTime = Date.now();
try {
if (!this.config) {
logger.error(TAG, '配置未加载,无法获取用户头像');
return {
success: false,
error: '配置未加载',
duration: Date.now() - startTime,
actionCount: 0
... | https://github.com/DaLongZhuaZi/manxia | 5645dbca3a8f2a748a3e4a61600cbd45610e83b3 | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/ParentAdminFlow.ui.test.ets | arkts | scrollParentAdminToPublish | Bring the ParentAdminPage publishCard into view. The page is a
Scroll() that lays out: title → server label → statsCard →
lessonImportCard → draftListCard → publishCard. Once the local
mock server (server/mock_ui_server.py) responds, statsCard renders
8 stat lines and draftListCard renders ≥1 row, which pushes the
publ... | async function scrollParentAdminToPublish(driver: Driver): Promise<void> {
try {
await driver.swipe(360, 1000, 360, 300, 600);
await driver.delayMs(400);
} catch (err) {
throw err as Error;
}
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left scrollParentAdminToPublish AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#... | async function scrollParentAdminToPublish(driver: Driver): Promise<void> {
try {
await driver.swipe(360, 1000, 360, 300, 600);
await driver.delayMs(400);
} catch (err) {
throw err as Error;
}
} | https://github.com/terryma2024/happyword | 99a2f3e01f3e7cc1f9d06100ddcf0c129aae6a4c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/AvifTranscoder.ets | arkts | extFromFormat | 根据格式返回文件扩展名 | private extFromFormat(format: TranscodeFormat): string {
if (format === TranscodeFormat.WEBP) {
return '.webp';
}
if (format === TranscodeFormat.PNG) {
return '.png';
}
if (format === TranscodeFormat.JPEG) {
return '.jpg';
}
if (format === TranscodeFormat.HEIF) {
re... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extFromFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private extFromFormat(format: TranscodeFormat): string {
if (format === TranscodeFormat.WEBP) {
return '.webp';
}
if (format === TranscodeFormat.PNG) {
return '.png';
}
if (format === TranscodeFormat.JPEG) {
return '.jpg';
}
if (format === TranscodeFormat.HEIF) {
re... | https://github.com/DaLongZhuaZi/manxia | 36d893af27d0a8a8ec8319ce5665cfafd3d777e3 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/ResourceUtil.ets | arkts | isEmptyObj | Check whether the object is empty.
@param obj Objects to be checked.
@returns Return true if the object is empty or has no properties; Otherwise return false. | private static isEmptyObj(obj: Object): boolean {
if (obj === null || typeof obj !== 'object') {
return true;
}
return Object.keys(obj).length === 0;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isEmptyObj AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST... | private static isEmptyObj(obj: Object): boolean {
if (obj === null || typeof obj !== 'object') {
return true;
}
return Object.keys(obj).length === 0;
} | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 97eed5fa74c473f3fa200d253ff86343f42ff300 | gitcode |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/HomeVisibilityToggleComponent.ets | arkts | build | 构建金额显隐切换按钮。 | build() {
Button() {
SymbolGlyph(this.hidden ? $r('sys.symbol.eye_slash') : $r('sys.symbol.eye'))
.fontSize(16)
.fontColor([this.themeState.fontPrimary as ResourceColor])
}
.width(34)
.height(34)
.padding(0)
.backgroundColor('#FCFAF6')
.border({ width: 1, color: '#EEE... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Button() {
SymbolGlyph(this.hidden ? $r('sys.symbol.eye_slash') : $r('sys.symbol.eye'))
.fontSize(16)
.fontColor([this.themeState.fontPrimary as ResourceColor])
}
.width(34)
.height(34)
.padding(0)
.backgroundColor('#FCFAF6')
.border({ width: 1, color: '#EEE... | https://github.com/ZestBox-18/kitebook-frontend | fe1be6643ac2d6899b5f89484da5bd01596bdf92 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | userProfile | 获取用户信息 | static userProfile(username: string): string {
return `/u/${username}.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left userProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | static userProfile(username: string): string {
return `/u/${username}.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 9dad48ffe7fb9cd57c282e836bce017f52a5e391 | github |
anhao0226/harmony-music-player | entry/src/main/ets/common/utils/AudioService.ets | arkts | getAudioId | @returns | public getAudioId() {
return this._shareData.audioId;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAudioId 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 { AS... | public getAudioId() {
return this._shareData.audioId;
} | https://github.com/anhao0226/harmony-music-player | 1e95f8161a9153b894564ca793aec7a72861ee6f | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/FileContentService.ets | arkts | isBinaryContent | 检测内容是否为二进制
启发式:前 N 字节中 NUL 字节占比超过 10% 判定为二进制。
用比例而非"任一 NUL"可避免 UTF-16 等合法文本被误判。 | private static isBinaryContent(arr: Uint8Array): boolean {
const checkLen = Math.min(arr.length, BINARY_CHECK_SIZE);
if (checkLen === 0) return false;
const threshold = Math.max(1, Math.floor(checkLen * BINARY_NULL_RATIO));
let nullCount = 0;
for (let i = 0; i < checkLen; i++) {
if (arr[i] =... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isBinaryContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left ... | private static isBinaryContent(arr: Uint8Array): boolean {
const checkLen = Math.min(arr.length, BINARY_CHECK_SIZE);
if (checkLen === 0) return false;
const threshold = Math.max(1, Math.floor(checkLen * BINARY_NULL_RATIO));
let nullCount = 0;
for (let i = 0; i < checkLen; i++) {
if (arr[i] =... | https://github.com/XJTUWYD/ArkDiff | cfdcfacc5c445da2c0accedd9c173254d5e981f4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | setBookGroup | 设置书籍分组 | async setBookGroup(bookId: string, groupName: string): Promise<void> {
const store = this.getStore();
await store.executeSql(
'UPDATE novel_book SET groupName = ?, updateTime = ? WHERE id = ?',
[groupName, Date.now(), bookId]
);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setBookGroup AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async setBookGroup(bookId: string, groupName: string): Promise<void> {
const store = this.getStore();
await store.executeSql(
'UPDATE novel_book SET groupName = ?, updateTime = ? WHERE id = ?',
[groupName, Date.now(), bookId]
);
} | https://github.com/DaLongZhuaZi/manxia | f344df830c1f06c8c4947bed851982964f04cf1d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | toLocaleString | Returns a locale string representing the specified array and its elements.
@param options
@returns string representation | public toLocaleString(locales: Object): string {
return this.toLocaleString(new Object(), new Object())
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object): string {
return this.toLocaleString(new Object(), new Object())
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3ecff44bd41f7f39e768a3ea42fc69a00938a5bb | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Distributed/DistributedDataSyncManager.ets | arkts | getCurrentState | 提取当前状态 | public getCurrentState(): SyncReadingState | null {
if (!this.syncObj) return null;
return this.extractState();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left... | public getCurrentState(): SyncReadingState | null {
if (!this.syncObj) return null;
return this.extractState();
} | https://github.com/DaLongZhuaZi/manxia | 0703cc9b0043f16a8e13ea9f08634c9d5b510454 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/VoiceGuide.ets | arkts | speak | 执行TTS播报
@param text 播报文本 | private async speak(text: string): Promise<void> {
console.log('[VoiceGuide] 播报:', text);
this.isSpeaking = true;
this.lastAnnounceTime = Date.now();
try {
// 实际实现需要调用HarmonyOS TTS API
// await tts.speak(text, {
// speed: this.speed,
// pitch: this.pitch
// });
... | 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 speak AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Ri... | private async speak(text: string): Promise<void> {
console.log('[VoiceGuide] 播报:', text);
this.isSpeaking = true;
this.lastAnnounceTime = Date.now();
try {
// 实际实现需要调用HarmonyOS TTS API
// await tts.speak(text, {
// speed: this.speed,
// pitch: this.pitch
// });
... | https://github.com/LJ666-ui/harmony-health-care | c32954cf464502c4ed9ca8c29b887cc9a7db2741 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets | arkts | getStringByResource | 获取字符串资源
@param context 上下文对象
@param resource 资源对象
@returns Promise<string> 字符串资源内容 | public static async getStringByResource(context: common.UIAbilityContext, resource: Resource): Promise<string> {
try {
return await context.resourceManager.getStringValue(resource);
} catch (error) {
logger.warn(`Failed to get string resource by Resource:`, error);
return '';
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getStringByResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | public static async getStringByResource(context: common.UIAbilityContext, resource: Resource): Promise<string> {
try {
return await context.resourceManager.getStringValue(resource);
} catch (error) {
logger.warn(`Failed to get string resource by Resource:`, error);
return '';
}
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 3a9286205eb3945435d6d384a58b61a730f2ae36 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | isHighlightByXDistance | 检查是否仅通过X轴距离来判断是否高亮点
@returns 是否仅通过X轴距离来判断是否高亮点的布尔值 | public isHighlightByXDistance(): boolean{
return this.mHighlightByXDistance;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isHighlightByXDistance 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 bo... | public isHighlightByXDistance(): boolean{
return this.mHighlightByXDistance;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 34f98bef62c313015e3b4eccefa10fdc3bd6f15b | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/Xbox360Controller.ets | arkts | rumbleTriggers | 扳机震动(Xbox 360 不支持) | rumbleTriggers(_leftTrigger: number, _rightTrigger: number): void {
// Xbox 360 控制器不支持扳机震动
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rumbleTriggers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _leftTrigger AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , ... | rumbleTriggers(_leftTrigger: number, _rightTrigger: number): void {
// Xbox 360 控制器不支持扳机震动
} | https://github.com/AlkaidLab/moonlight-harmony | 1f2109a1959c3ce44f036280565b2ff4b55b8761 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets | arkts | getDebugInfoString | 获取详细的调试信息字符串 | getDebugInfoString(): string {
const dump = this.dumpActiveTasks();
const lines: string[] = [
'========== 全局任务状态 ==========',
`时间: ${new Date(dump.timestamp).toLocaleString()}`,
`活跃页面: ${dump.globalStats.totalPages}`,
`总定时器: ${dump.globalStats.totalTimers}`,
`总 Promise: ${dump.gl... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDebugInfoString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta... | getDebugInfoString(): string {
const dump = this.dumpActiveTasks();
const lines: string[] = [
'========== 全局任务状态 ==========',
`时间: ${new Date(dump.timestamp).toLocaleString()}`,
`活跃页面: ${dump.globalStats.totalPages}`,
`总定时器: ${dump.globalStats.totalTimers}`,
`总 Promise: ${dump.gl... | https://github.com/DaLongZhuaZi/manxia | 00098861a1780d80a0ec177dfc69796fc1bc6afe | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | forEach | Executes a provided function once for each array element.
@param fn to apply for each element of the Array | public forEach(fn: (a: T) => void): void {
for(let i = 0; i < this.data.length; i++) {
fn(this.data[i])
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left forEach AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | public forEach(fn: (a: T) => void): void {
for(let i = 0; i < this.data.length; i++) {
fn(this.data[i])
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 55dd1ac1caf1a6a29077b8a1cd7f3f3a64560b20 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | toLocaleDateString | Returns a string with a language-sensitive representation of
the date portion of the specified date
in the user agent's timezone.
of the date portion of the specified date in the user agent's timezone.
@param { Intl.LocalesArgument } [ locales ]
@param { Intl.DateTimeFormatOptions } [ options ]
@returns { string }
@thr... | public toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string {
if (options && options.timeStyle) {
throw new TypeError("Invalid option : timeStyle")
}
const effectiveOptions = !options ? Date.DATE_FORMAT_OPTIONS : this.appendDefaultDate... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleDateString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST... | public toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string {
if (options && options.timeStyle) {
throw new TypeError("Invalid option : timeStyle")
}
const effectiveOptions = !options ? Date.DATE_FORMAT_OPTIONS : this.appendDefaultDate... | https://gitcode.com/iop123123/arkts-static-skills | e86ed1969bc71c39602871d7960c87c5ac165fcc | gitcode |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/security/SecurityService.ets | arkts | decryptLogFields | Decrypt encrypted database row back to plain event log | static decryptLogFields(row: EncryptedEventLogRow): PlainEventLog {
const detail: string | undefined = row.enc_detail
? CryptoUtil.decrypt({
cipherText: row.enc_detail,
iv: row.enc_iv ?? '',
algorithm: row.enc_alg ?? '',
keyVersion: row.enc_key_ver ?? 0,
timestamp: ro... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left decryptLogFields AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left row AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static decryptLogFields(row: EncryptedEventLogRow): PlainEventLog {
const detail: string | undefined = row.enc_detail
? CryptoUtil.decrypt({
cipherText: row.enc_detail,
iv: row.enc_iv ?? '',
algorithm: row.enc_alg ?? '',
keyVersion: row.enc_key_ver ?? 0,
timestamp: ro... | https://gitcode.com/openharmony/codelabs | 03fb1436ddb3af570b375e27c64768578d87de86 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/FormManager.ets | arkts | deleteFormToSp | delete formInfo to preferences
@param formId 删除的卡片信息ID | public async deleteFormToSp(formId: string): Promise<void> {
const preferences = await this.getPreferences();
LogUtil.info(TAG, 'deleteFormToSp formId:' + formId);
await preferences.delete(formId);
await preferences.flush();
} | 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 deleteFormToSp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : ... | public async deleteFormToSp(formId: string): Promise<void> {
const preferences = await this.getPreferences();
LogUtil.info(TAG, 'deleteFormToSp formId:' + formId);
await preferences.delete(formId);
await preferences.flush();
} | https://gitee.com/openharmony-sig/applications_clock.git | 43e156dde93e60004954db77bad1b74006a9f011 | gitee |
apap6628114/nga_oh | entry/src/main/ets/service/api/AuthApi.ets | arkts | fetchNickNameFromNga | 通过 ucp 接口拉取目标用户的昵称/头像 | async function fetchNickNameFromNga(uid: string, cid: string, targetUid: string): Promise<UserInfo | null> {
try {
const params: Record<string, string> = {
'__lib': 'ucp', '__act': 'get', 'lite': 'js', 'noprefix': '', 'uid': targetUid,
};
const raw = await ngaClient.get('/nuke.php', params, { uid, c... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left fetchNickNameFromNga AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uid AST#identifier#Right AST... | async function fetchNickNameFromNga(uid: string, cid: string, targetUid: string): Promise<UserInfo | null> {
try {
const params: Record<string, string> = {
'__lib': 'ucp', '__act': 'get', 'lite': 'js', 'noprefix': '', 'uid': targetUid,
};
const raw = await ngaClient.get('/nuke.php', params, { uid, c... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/service/api/AuthApi.ets#L159-L177 | 061379f3ffcebb738039ee6f8872c618d7bfedfd | github |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanEngine.ets | arkts | compressSingle | 压缩单张图片
@param sourcePath 源图片路径
@param targetPath 目标路径
@param focusAlpha 是否保留透明通道
@returns 压缩结果 | static async compressSingle(
sourcePath: string,
targetPath: string,
focusAlpha: boolean = false,
ignoreBy: number = 100,
quality?: number
): Promise<CompressResult> {
let sourceFd: number | undefined = undefined;
let targetFd: number | undefined = undefined;
let pixelMap: image.Pixe... | 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 compressSingle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static async compressSingle(
sourcePath: string,
targetPath: string,
focusAlpha: boolean = false,
ignoreBy: number = 100,
quality?: number
): Promise<CompressResult> {
let sourceFd: number | undefined = undefined;
let targetFd: number | undefined = undefined;
let pixelMap: image.Pixe... | https://github.com/kumaleap/ArkLuban | 7c33773a2e0f2e4d862497f308f50c43a6102198 | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/model/MessagesProvider.ets | arkts | updateMessageSendStatus | 更新指定指纹码的消息的发送状态(更新单条消息)。
@param fingerPrint 消息指纹码(消息id)
@param sendStatus 发送状态,see {@link MsgSendStatus} | updateMessageSendStatus(fingerPrint: string, sendStatus: MsgSendStatus): void {
// 遍历消息列表
for(let i = 0; i < this.messages.length; i++) {
let m = this.messages[i];
// 对符合条件的消息对象进行消息发送状态的设置
if(m && m.isOutgoing() && m.fingerPrintOfProtocal === fingerPrint) {
// 更新状态
m.sendStat... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateMessageSendStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fingerPrint AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,... | updateMessageSendStatus(fingerPrint: string, sendStatus: MsgSendStatus): void {
// 遍历消息列表
for(let i = 0; i < this.messages.length; i++) {
let m = this.messages[i];
// 对符合条件的消息对象进行消息发送状态的设置
if(m && m.isOutgoing() && m.fingerPrintOfProtocal === fingerPrint) {
// 更新状态
m.sendStat... | https://github.com/JackJiang2011/harmonychat | aff00ff537527d4efb1190417739cc5093627265 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_int.ets | arkts | main | ---
desc: check not equal operation for two integer operands
--- | function main(): void {
const a: int = {{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: int = {{v.left}}
const b: int = {{v.right}}
assert (a != b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f36d5c2643ca89c5f05ae32536ccf18d69bb8b33 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getElementsByCSSChain | 处理CSS选择器链(@分隔)
支持属性+JS组合:a@href<js>...</js> | private getElementsByCSSChain(selector: string): string[] {
// 检查是否包含<js>标签,需要特殊处理@分隔
// 例如 a@href<js>...</js> 应该分为 [a, href<js>...</js>]
let parts: string[] = [];
if (selector.includes('<js>')) {
// 使用智能分割,避免分割<js>标签内的@
parts = this.splitSelectorWithJs(selector);
} else {
parts ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsByCSSChain AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | private getElementsByCSSChain(selector: string): string[] {
// 检查是否包含<js>标签,需要特殊处理@分隔
// 例如 a@href<js>...</js> 应该分为 [a, href<js>...</js>]
let parts: string[] = [];
if (selector.includes('<js>')) {
// 使用智能分割,避免分割<js>标签内的@
parts = this.splitSelectorWithJs(selector);
} else {
parts ... | https://github.com/DaLongZhuaZi/manxia | 46ca87d9daaa1b6d05e062aa1b41b159003b45e7 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/favorite/EditFavoriteListPresenter.ets | arkts | cancelAllFavoriteSelectInfo | Deselect all data
@param favoriteId | cancelAllFavoriteSelectInfo(favoriteList: FavoriteBean[], isEditSelectList: string[]): string[] {
HiLog.i(TAG, 'cancelAllFavoriteSelectInfo start.');
for (let i = 0; i < favoriteList.length; i++) {
this.favoriteList[i].isEditSelect = false;
favoriteList[i].isEditSelect = false;
isEditSelectL... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left cancelAllFavoriteSelectInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left favoriteList AST#identifier#Right AST#:#Left : A... | cancelAllFavoriteSelectInfo(favoriteList: FavoriteBean[], isEditSelectList: string[]): string[] {
HiLog.i(TAG, 'cancelAllFavoriteSelectInfo start.');
for (let i = 0; i < favoriteList.length; i++) {
this.favoriteList[i].isEditSelect = false;
favoriteList[i].isEditSelect = false;
isEditSelectL... | https://gitee.com/openharmony/applications_contacts.git | 8d5d972a9aea31e1b9b3cda7afe639bd1bd354fe | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/DistributedKVService.ets | arkts | isInitialized | 检查 KVStore 是否已初始化 | public static isInitialized(): boolean {
return DistributedKVService.kvStore !== undefined;
} | 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 isInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public static isInitialized(): boolean {
return DistributedKVService.kvStore !== undefined;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L254-L256 | 34de94b64c4b2e07148f6d54c546bf5028c16eed | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | getAllKeys | 获取所有键 | static async getAllKeys(): Promise<string[]> {
try {
const prefs = await PreferencesUtil.getPreferences();
return await prefs.getAllKeys();
} catch (error) {
console.error('获取所有键失败:', error);
return [];
}
} | 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 getAllKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | static async getAllKeys(): Promise<string[]> {
try {
const prefs = await PreferencesUtil.getPreferences();
return await prefs.getAllKeys();
} catch (error) {
console.error('获取所有键失败:', error);
return [];
}
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 86ca45d8c31bbc32d8577c185dbf8c32c205b1a5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | $_invoke | Constructs a new NonIntegralIndexError instance with provided message and error specific information
@param { String } [message] - Error text
@param { ErrorOptions } [options] - Error options
@returns { NonIntegralIndexError } - Newly created NonIntegralIndexError instance
@static
@syscap SystemCapability.Utils.Lang
@F... | static $_invoke(message?: String, options?: ErrorOptions): NonIntegralIndexError {
return new NonIntegralIndexError(message, options)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#... | static $_invoke(message?: String, options?: ErrorOptions): NonIntegralIndexError {
return new NonIntegralIndexError(message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 39b967df8dfde38f002607e36f806491f3032dfe | gitcode |
openharmony-sig/knowledge_demo_entainment | FA/DistrubutedWhiteBoard/entry/src/main/ets/MainAbility/pages/index.ets | arkts | aboutToDisappear | async startAbilityRandom(deviceId: string, layers: Array<LayerInfo>, del_layers: Array<LayerInfo>) {
Logger.info('featureAbility.startAbility deviceId=' + deviceId)
let wantValue = {
bundleName: 'com.example.drawingboard',
abilityName: 'com.example.drawingboard.MainAbility',
deviceId: deviceId,
parameters: {
layers: la... | aboutToDisappear() {
Logger.info('aboutToDisappear');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | aboutToDisappear() {
Logger.info('aboutToDisappear');
} | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 38049144191862aeff44387d070c59671765b6cf | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets | arkts | isSameDay | 检查是否是同一天 | isSameDay(date1: Date, date2: Date): boolean {
return date1.getDate() === date2.getDate() &&
date1.getMonth() === date2.getMonth() &&
date1.getFullYear() === date2.getFullYear()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSameDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left date1 AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#... | isSameDay(date1: Date, date2: Date): boolean {
return date1.getDate() === date2.getDate() &&
date1.getMonth() === date2.getMonth() &&
date1.getFullYear() === date2.getFullYear()
} | https://gitcode.com/openharmony/codelabs | b0300cc3ec1ba8d19a7de5e0795f93590b249697 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/24.equality_expressions/01.reference_equality_operators/array_types_equality_operator.ets | arkts | main | ---
desc: "The value equality operator a == b semantically equals a === null ? b === null : a.equals(b) if both of its operands are of reference types."
params: {{eq.left}} {{eq.op}} {{eq.right}} is {{eq.result}}
--- | function main(): void {
let a: int[] = [1, 2, 3];
let b: int[] = [1, 2, 3];
let c: int[] = [1, 2, 4];
let d: int[] = [1, 2, 3, 4];
let e: int[]|null = null;
assert ({{eq.left}} {{eq.op}} {{eq.right}}) == {{eq.result}}; | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let a: int[] = [1, 2, 3];
let b: int[] = [1, 2, 3];
let c: int[] = [1, 2, 4];
let d: int[] = [1, 2, 3, 4];
let e: int[]|null = null;
assert ({{eq.left}} {{eq.op}} {{eq.right}}) == {{eq.result}}; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e9f4f6b1101fe5434d59188c1da66442aa203452 | gitee |
CLMC2025/Vignette | entry/src/main/ets/sync/VersionControl.ets | arkts | getCurrentVersion | 获取当前版本 | getCurrentVersion(): VersionInfo {
return this.currentVersion;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentVersion 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 VersionInfo AST#identifier#Right AST#ERROR#R... | getCurrentVersion(): VersionInfo {
return this.currentVersion;
} | https://github.com/CLMC2025/Vignette | 5adde65d3b806fc2bd7af48205534c9860f74d3f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | advanceStringIndex | Advances the string index according to the Unicode flag.
@param { String } s Original string.
@param { int } index Current index.
@param { boolean } unicode Whether to enable Unicode mode.
@returns { int } Next index.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static advanceStringIndex(s: String, index: int, unicode: boolean): int {
const HIGH_SURROGATE_START = 0xD800;
const HIGH_SURROGATE_END = 0xDBFF;
const LOW_SURROGATE_START = 0xDC00;
const LOW_SURROGATE_END = 0xDFFF;
const length = s.getLength();
if (!unic... | 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 advanceStringIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : ... | public static advanceStringIndex(s: String, index: int, unicode: boolean): int {
const HIGH_SURROGATE_START = 0xD800;
const HIGH_SURROGATE_END = 0xDBFF;
const LOW_SURROGATE_START = 0xDC00;
const LOW_SURROGATE_END = 0xDFFF;
const length = s.getLength();
if (!unic... | https://gitcode.com/iop123123/arkts-static-skills | ebb47725f0270b0e5ed95c45c57a0a012e5339e6 | gitcode |
LZZLHY/hlib | entry/src/main/ets/storage/PreferencesStore.ets | arkts | putObject | ─── 复杂对象(JSON 化) ─── | static async putObject<T>(group: PrefGroup, key: string, value: T): Promise<void> {
try {
const json: string = JSON.stringify(value);
await PreferencesStore.putString(group, key, json);
} catch (err) {
PreferencesStore.logErr(`putObject(${key})`, err);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left putObject AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AS... | static async putObject<T>(group: PrefGroup, key: string, value: T): Promise<void> {
try {
const json: string = JSON.stringify(value);
await PreferencesStore.putString(group, key, json);
} catch (err) {
PreferencesStore.logErr(`putObject(${key})`, err);
}
} | https://github.com/LZZLHY/hlib | d2177c7419f7f24e03ef328adb4187b8c8fe3647 | github |
Joker-x-dev/CoolMallArkTS | feature/market/src/main/ets/viewmodel/CouponViewModel.ets | arkts | requestListData | 请求优惠券分页数据
@returns {Promise<NetworkResponse<NetworkPageData<Coupon>>>} 网络请求 Promise | protected requestListData(): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
const request: PageRequest = new PageRequest();
request.page = this.currentPage;
request.size = this.pageSize;
return this.couponRepository.getUserCouponPage(request);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestListData 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 A... | protected requestListData(): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
const request: PageRequest = new PageRequest();
request.page = this.currentPage;
request.size = this.pageSize;
return this.couponRepository.getUserCouponPage(request);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2263331a2ed8a589a39420df785ff4504e47d80e | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MedicalAgent.ets | arkts | formatConversationHistory | 格式化对话历史
@param context 对话上下文
@returns 格式化的历史文本 | protected formatConversationHistory(context: ConversationContext): string {
const messages = context.messages.slice(-10); // 最多10轮对话
let history = '';
for (const message of messages) {
const role = message.role === 'user' ? '患者' : '医生';
history += `${role}:${message.content}\n`;
}
r... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left formatConversationHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ... | protected formatConversationHistory(context: ConversationContext): string {
const messages = context.messages.slice(-10); // 最多10轮对话
let history = '';
for (const message of messages) {
const role = message.role === 'user' ? '患者' : '医生';
history += `${role}:${message.content}\n`;
}
r... | https://github.com/LJ666-ui/harmony-health-care | d03a42635e62339e1e2e0895aafd85a9ba249a7a | github |
openharmony-sig/fluttertpc_qr_code_scanner | ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets | arkts | activeCamera | 获取当前激活相机 | activeCamera(): string | undefined {
return this.curcamerasDevice?.cameraId;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left activeCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#L... | activeCamera(): string | undefined {
return this.curcamerasDevice?.cameraId;
} | https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git | 2aeaacff58de787ae60c9fb306dec97bc708f4a4 | gitee |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | determineMaxScaleFactor | Calc max scale factor. | private determineMaxScaleFactor(): void {
if (this.input == undefined) {
return;
}
let scaleFactorW = this.input.width / px2vp(CommonConstants.DEFAULT_MIN_SIDE_LENGTH_EDIT);
let scaleFactorH = this.input.height / px2vp(CommonConstants.DEFAULT_MIN_SIDE_LENGTH_EDIT);
this.cropShow.setMaxScaleF... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left determineMaxScaleFactor 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 v... | private determineMaxScaleFactor(): void {
if (this.input == undefined) {
return;
}
let scaleFactorW = this.input.width / px2vp(CommonConstants.DEFAULT_MIN_SIDE_LENGTH_EDIT);
let scaleFactorH = this.input.height / px2vp(CommonConstants.DEFAULT_MIN_SIDE_LENGTH_EDIT);
this.cropShow.setMaxScaleF... | https://gitee.com/openharmony/codelabs.git | 6e25655d27f399cc604e88ffdfb90f2408efe729 | gitee |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/AudioRouteManager.ets | arkts | enableAvRoutePickerMode | v1 stub: HarmonyOS has no AVRoutePickerView equivalent. | static enableAvRoutePickerMode(): void {
Logger.info('AudioRouteManager.enableAvRoutePickerMode: not supported on HarmonyOS (TODO)');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left enableAvRoutePickerMode 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 AS... | static enableAvRoutePickerMode(): void {
Logger.info('AudioRouteManager.enableAvRoutePickerMode: not supported on HarmonyOS (TODO)');
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 8067e3ddf3e9580024a615382db21cce8e3287fc | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | length | Returns the number of elements in the Array.
@returns Element count in the `Array` instance. | public length(): int {
return this.data.length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identif... | public length(): int {
return this.data.length;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 93752a0c96d361bf61631c9300074cc9b1014c8f | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/AchievementService.ets | arkts | getAllAchievements | 获取所有成就配置
@returns 成就配置列表 | static getAllAchievements(): AchievementConfig[] {
return [...AchievementService.ACHIEVEMENT_CONFIGS];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllAchievements 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 Ach... | static getAllAchievements(): AchievementConfig[] {
return [...AchievementService.ACHIEVEMENT_CONFIGS];
} | https://github.com/the-wwyang/kids-learning-app | 1953e64055632774dcaf2dcc7945f951b138383b | github |
HarmonyOS_Samples/guide-snippets | Ability/ApplicationContextDemo/entry/src/main/ets/entrylifecycleability/EntryLifecycleAbility.ets | arkts | onAbilityCreate | 当UIAbility创建时被调用 | onAbilityCreate(uiAbility) {
hilog.info(DOMAIN_NUMBER, TAG, `onAbilityCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAbilityCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left uiAbility AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AS... | onAbilityCreate(uiAbility) {
hilog.info(DOMAIN_NUMBER, TAG, `onAbilityCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
}, | https://gitcode.com/HarmonyOS_Samples/guide-snippets | d60426299ed68104edfd1a6d4f947eef9ba91f5b | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveStorage.ets | arkts | getConfig | 获取当前配置
@returns OneDriveStorageConfig 存储配置 | public getConfig(): OneDriveStorageConfig | undefined {
return this.config;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#i... | public getConfig(): OneDriveStorageConfig | undefined {
return this.config;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveStorage.ets#L336-L338 | a0455caeb101abd0cb5832d05c463eebf1c4a856 | github |
openharmony/applications_app_samples | code/BasicFeature/Ability/AbilityRuntime/entry/src/main/ets/abilitylifecyclecallback/AbilityLifecycleCallback.ets | arkts | onNewWant | 注册监听应用上下文的生命周期后,在UIAbility的[onNewWant]触发后回调。 | onNewWant(ability) {
hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onNewWant');
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ability AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expres... | onNewWant(ability) {
hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onNewWant');
}, | https://github.com/openharmony/applications_app_samples | 5b095b5637378f185fd663cd7d5614b3999d11c2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | $_set | Assigns val as element on index.
@param { int } index - index to change
@param { BigInt } val - value to set
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public $_set(index: int, val: BigInt): void {
this.$_set(index, val.getLong())
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public $_set(index: int, val: BigInt): void {
this.$_set(index, val.getLong())
} | https://gitcode.com/iop123123/arkts-static-skills | bb809fbdccbfd5fb893c19eb23e70e8ea5ad7cee | gitcode |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/SunAngleHelper.ets | arkts | solarDeclination | 简化的太阳赤纬计算(用于快速估算) | static solarDeclination(dayOfYear: number): number {
return 23.45 * Math.sin((360 / 365) * (dayOfYear + 284) * SunAngleHelper.DEGREE_TO_RADIAN);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left solarDeclination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dayOfYear AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | static solarDeclination(dayOfYear: number): number {
return 23.45 * Math.sin((360 / 365) * (dayOfYear + 284) * SunAngleHelper.DEGREE_TO_RADIAN);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 320a511bc6b2194eeacfa7b06d9e2cd8bf7e6d18 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Boolean.ets | arkts | compareTo | Compares this instance to other Boolean object
The result is less than 0 if this instance lesser than provided object
0 if they are equal
and greater than 0 otherwise.
@param other Boolean object to compare with
@returns result of the comparison | public override compareTo(other: Boolean): int {
return this.hashCode() - other.hashCode();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST... | public override compareTo(other: Boolean): int {
return this.hashCode() - other.hashCode();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | dc3eec2bc8820a0befa0ca8df4bd79ca5c4260ca | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateService.ets | arkts | getUserTemplateById | 根据ID获取用户模板 | getUserTemplateById(kdbx: Kdbx, templateId: string): IUserTemplate | null {
const userTemplates = this.getUserTemplates(kdbx);
for (let i = 0; i < userTemplates.length; i++) {
if (userTemplates[i].uuid.id === templateId) {
return userTemplates[i];
}
}
return null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUserTemplateById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kdbx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | getUserTemplateById(kdbx: Kdbx, templateId: string): IUserTemplate | null {
const userTemplates = this.getUserTemplates(kdbx);
for (let i = 0; i < userTemplates.length; i++) {
if (userTemplates[i].uuid.id === templateId) {
return userTemplates[i];
}
}
return null;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L124-L132 | e6a283f98c4e61e73fb9919b340fc23b9517336f | github |
2763981847/Clock-Alarm | entry/src/main/ets/view/Detail/dialog/CommonDialog.ets | arkts | actionBtnStyle | 扩展 Button 样式 | @Extend(Button) function actionBtnStyle() {
.fontSize(DimensionUtil.getFp($r('app.float.common_dialog_button_font_size')))
.height(DimensionUtil.getVp($r('app.float.common_dialog_button_height')))
.layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT)
.fontColor($r('app.color.green_light'))
.backgroundColor($r(... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Button AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | @Extend(Button) function actionBtnStyle() {
.fontSize(DimensionUtil.getFp($r('app.float.common_dialog_button_font_size')))
.height(DimensionUtil.getVp($r('app.float.common_dialog_button_height')))
.layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT)
.fontColor($r('app.color.green_light'))
.backgroundColor($r(... | https://github.com/2763981847/Clock-Alarm | 5ae208e82713e181baab00c25028919f6250e205 | github |
openharmony-sig/knowledge_demo_entainment | FA/BombGame/entry/src/main/ets/MainAbility/pages/RemoteDeviceManager.ets | arkts | authDevice | 认证设备
@param remoteDevice 远程设备 | async authDevice(remoteDevice: RemoteDevice) {
CommonLog.info("authDevice:deviceName=" + remoteDevice.deviceName + " deviceId=" + remoteDevice.deviceId)
await this.init()
return new Promise((resolve, reject) => {
if (remoteDevice.status != RemoteDeviceStatus.UNTRUSTED) {
CommonLog.info("authDevice:device ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left authDevice AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remoteDevice AST#identifier#Right AST#type_annotation#Left ... | async authDevice(remoteDevice: RemoteDevice) {
CommonLog.info("authDevice:deviceName=" + remoteDevice.deviceName + " deviceId=" + remoteDevice.deviceId)
await this.init()
return new Promise((resolve, reject) => {
if (remoteDevice.status != RemoteDeviceStatus.UNTRUSTED) {
CommonLog.info("authDevice:device ... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | fccbcdeff6fdd93fe15436a27224296f28c72bf4 | gitee |
codelably/HCompass | core/navigation/src/main/ets/NavigationService.ets | arkts | constructor | 构造函数
@param navStack 导航栈实例
@param enableLog 是否启用日志 | constructor(navStack: NavPathStack, enableLog: boolean = true) {
this.stack = navStack;
this.enableLog = enableLog;
this.guardManager = new GuardManager(enableLog);
} | 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 navStack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NavPathStack AST#identifi... | constructor(navStack: NavPathStack, enableLog: boolean = true) {
this.stack = navStack;
this.enableLog = enableLog;
this.guardManager = new GuardManager(enableLog);
} | https://github.com/codelably/HCompass | 66174f800f9e06e9eb4c9c425e4a90b20ab7a340 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/AppNav.ets | arkts | resolveMainRouteByTab | 将标签枚举映射到主路由名。 | private resolveMainRouteByTab(tab: AppTab): string {
if (tab === AppTab.TODO) {
return AppRoute.TODO;
}
if (tab === AppTab.IDEA) {
return AppRoute.IDEA;
}
if (tab === AppTab.USER) {
return AppRoute.USER;
}
return AppRoute.PLAN;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveMainRouteByTab AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tab AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private resolveMainRouteByTab(tab: AppTab): string {
if (tab === AppTab.TODO) {
return AppRoute.TODO;
}
if (tab === AppTab.IDEA) {
return AppRoute.IDEA;
}
if (tab === AppTab.USER) {
return AppRoute.USER;
}
return AppRoute.PLAN;
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L129-L140 | 8d1717ec8eed238945ddbedbcf5f7ba58372ab9b | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/common/MooStringItem.ets | arkts | save | Save the edited item. | save() {
// Set display.
this.displayLabel = this.editingLabel;
// meow(`call this.onEdit([${this.editingLabel}, ${this.editingLink}])`, 'MooMooStringItem][save', meowLevel.WARN);
this.onEdited([this.editingLabel, this.editingLink]); // This works.
// Close editing.
animateToImmediately(defa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left save AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // Set display. AST... | save() {
// Set display.
this.displayLabel = this.editingLabel;
// meow(`call this.onEdit([${this.editingLabel}, ${this.editingLink}])`, 'MooMooStringItem][save', meowLevel.WARN);
this.onEdited([this.editingLabel, this.editingLink]); // This works.
// Close editing.
animateToImmediately(defa... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 35ef0503e64d2b4ccbd58334ef21669e1bad818d | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets | arkts | onTouch | view 调用的触摸事件 此事件可分发 缩放、平移两个事件,缩放 监听为两指
@param event | public onTouch(event: TouchEvent) {
/**
* 监听按下手指的数量,最大监听两个手指
*/
if (event.type === TouchType.Down) {
this.firstTouch = event.touches[0];
if (event.touches.length > 1) {
this.secondTouch = event.touches[1];
} else {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onTouch 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 TouchEv... | public onTouch(event: TouchEvent) {
/**
* 监听按下手指的数量,最大监听两个手指
*/
if (event.type === TouchType.Down) {
this.firstTouch = event.touches[0];
if (event.touches.length > 1) {
this.secondTouch = event.touches[1];
} else {
... | https://gitee.com/openharmony/developtools_profiler.git | e6d84c39d32e4147c85c91166aa7968187ef83f9 | gitee |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/PreferenceUtil.ets | arkts | setValue | 设置首选项
@param key 键
@param value 值
@returns Promise<void> | public async setValue<T>(key: string, value: T): Promise<void> {
if (this.preferences) {
this.preferences.put(key, JSON.stringify(value))
.then(() => {
this.saveValue()
})
.catch((error: BusinessError) => {
Logger.error(TAG, `设置首选项失败, 错误码: ${error.code}, 错误信息: ${e... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left setValue AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST... | public async setValue<T>(key: string, value: T): Promise<void> {
if (this.preferences) {
this.preferences.put(key, JSON.stringify(value))
.then(() => {
this.saveValue()
})
.catch((error: BusinessError) => {
Logger.error(TAG, `设置首选项失败, 错误码: ${error.code}, 错误信息: ${e... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 37317eff13fbf308966ce3d9a1da43547c0f4b84 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/TypeShelfManager.ets | arkts | ensureSystemShelves | 确保系统书架存在 | private ensureSystemShelves(): void {
for (const defaultShelf of DEFAULT_SYSTEM_SHELVES) {
const exists = this.shelves.some(s => s.id === defaultShelf.id);
if (!exists) {
this.shelves.push(this.copyShelfWithTimestamp(defaultShelf));
}
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureSystemShelves 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... | private ensureSystemShelves(): void {
for (const defaultShelf of DEFAULT_SYSTEM_SHELVES) {
const exists = this.shelves.some(s => s.id === defaultShelf.id);
if (!exists) {
this.shelves.push(this.copyShelfWithTimestamp(defaultShelf));
}
}
} | https://github.com/DaLongZhuaZi/manxia | 3b17ec34923e93345fee640b10602b18cc44f22a | github |
openharmony-tpc/mp4parser | library/src/main/ets/mp4parser/utils/FileUtils.ets | arkts | fileNameClip | String file path processing
@param filePath | static fileNameClip(filePath: string): string{
if (filePath == null) return "";
let fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
let removeSuffixName = fileName.substring(0, fileName.lastIndexOf("."));
let tempPath = filePath.substring(0, filePath.lastIndexOf("/")) + "/" + removeSuffi... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fileNameClip AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | static fileNameClip(filePath: string): string{
if (filePath == null) return "";
let fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
let removeSuffixName = fileName.substring(0, fileName.lastIndexOf("."));
let tempPath = filePath.substring(0, filePath.lastIndexOf("/")) + "/" + removeSuffi... | https://gitee.com/openharmony-tpc/mp4parser.git | 7efa7c5167ef80cb97cf2cf12267b46c8366960e | gitee |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/model/BreakpointModel.ets | arkts | getValue | Returns the corresponding value from the provided options based on the current width breakpoint. | getValue<T>(param: BreakpointTypes<T>): T {
switch (this.currentWidthBreakpoint) {
case WidthBreakpoint.WIDTH_XS:
return param.xs ?? param.sm;
case WidthBreakpoint.WIDTH_SM:
return param.sm;
case WidthBreakpoint.WIDTH_MD:
return param.md;
case WidthBreakpoint.WIDTH_... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameters#Left AST#(#... | getValue<T>(param: BreakpointTypes<T>): T {
switch (this.currentWidthBreakpoint) {
case WidthBreakpoint.WIDTH_XS:
return param.xs ?? param.sm;
case WidthBreakpoint.WIDTH_SM:
return param.sm;
case WidthBreakpoint.WIDTH_MD:
return param.md;
case WidthBreakpoint.WIDTH_... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 26e497d69e61bc874d4f424b5f53827b60b15d2a | gitcode |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/GraphPassPage.ets | arkts | handleTouchMove | 处理触摸移动 | handleTouchMove(event: TouchEvent) {
if (!this.isDrawing || this.isVerifying) return;
const t = event.touches[0];
this.checkTouchPoint({ x: t.x, y: t.y });
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleTouchMove 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 TouchEvent AST#identifie... | handleTouchMove(event: TouchEvent) {
if (!this.isDrawing || this.isVerifying) return;
const t = event.touches[0];
this.checkTouchPoint({ x: t.x, y: t.y });
} | https://gitcode.com/openharmony/codelabs | 9c5c98cf7a97ea6fd4305d185f2dc361dad5dd3c | gitcode |
CLMC2025/Vignette | entry/src/main/ets/context/ContextValidator.ets | arkts | validateGrammar | 验证语法正确性 | private validateGrammar(context: string, result: ValidationResult): void {
// 检查句子结构
if (!context.trim().endsWith('.')) {
result.addIssue(new ValidationIssue(
ValidationIssueType.GRAMMAR_ERROR,
IssueSeverity.WARNING,
'句子应以句号结尾',
'在句子末尾添加句号'
));
}
// 检查连续空格
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateGrammar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left context AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | private validateGrammar(context: string, result: ValidationResult): void {
// 检查句子结构
if (!context.trim().endsWith('.')) {
result.addIssue(new ValidationIssue(
ValidationIssueType.GRAMMAR_ERROR,
IssueSeverity.WARNING,
'句子应以句号结尾',
'在句子末尾添加句号'
));
}
// 检查连续空格
... | https://github.com/CLMC2025/Vignette | 82d1629517f368324913e2e4b261bdfb1fc83e6e | github |
electronicminer/Harmony-Markdown-Editor | entry/src/main/ets/utils/AIService.ets | arkts | chat | 发送聊天请求到 AI API
@param config AI 配置
@param messages 消息历史
@param currentContent 当前编辑器里的文档内容(可选,附加在系统提示中)
@returns AI 响应结果 | static async chat(config: AIConfigClass, messages: ChatMessage[], currentContent?: string): Promise<AIResponse> {
try {
if (!config.apiUrl || !config.apiKey) {
return {
success: false,
error: 'API 配置不完整,请先设置 API URL 和 API Key'
};
}
let injectedSystemPrompt = ... | 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 chat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Righ... | static async chat(config: AIConfigClass, messages: ChatMessage[], currentContent?: string): Promise<AIResponse> {
try {
if (!config.apiUrl || !config.apiKey) {
return {
success: false,
error: 'API 配置不完整,请先设置 API URL 和 API Key'
};
}
let injectedSystemPrompt = ... | https://github.com/electronicminer/Harmony-Markdown-Editor | be8bef3abd1266dbe34fed6e83a130f952797aed | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/calendar/TnCalendar.ets | arkts | findHolidayType | 查找节假日类型
@param dateStr 日期字符串 YYYY-MM-DD
@param holidays 节假日列表
@returns 节假日类型("holiday"/"workday"/"") | function findHolidayType(dateStr: string, holidays: TnCalendarHolidayItem[]): string {
for (let i: number = 0; i < holidays.length; i++) {
if (holidays[i].date === dateStr) {
return holidays[i].type;
}
}
return "";
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left findHolidayType AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dateStr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function findHolidayType(dateStr: string, holidays: TnCalendarHolidayItem[]): string {
for (let i: number = 0; i < holidays.length; i++) {
if (holidays[i].date === dateStr) {
return holidays[i].type;
}
}
return "";
} | https://github.com/codelably/tuniao-ui | 345e0655700390bb00acc25c3df6494add44dbe2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVNativeClient.ets | arkts | createDirectory | 创建目录 (MKCOL) | async createDirectory(remotePath: string): Promise<WebDAVNativeResult> {
if (!this.initialized) {
await this.initialize();
}
try {
logger.info(TAG, `创建目录: ${remotePath}`);
const result: WebDAVNativeResult = getNativeModule().createDirectory(remotePath);
if (result.succe... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createDirectory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Rig... | async createDirectory(remotePath: string): Promise<WebDAVNativeResult> {
if (!this.initialized) {
await this.initialize();
}
try {
logger.info(TAG, `创建目录: ${remotePath}`);
const result: WebDAVNativeResult = getNativeModule().createDirectory(remotePath);
if (result.succe... | https://github.com/DaLongZhuaZi/manxia | 96051b188e945870d176f88953fcf1529ca038d2 | github |
arkui-x/samples | CodeLab/Cases/feature/cuberotateanimation/src/main/ets/components/CubeRotateAnimationSwiper.ets | arkts | aboutToAppear | 轮播控制器 | aboutToAppear(): void {
// 校验父组件是否传入合法的items和swiperItemSlotParam,不合法进行初始化
if (this.items.length === 0 || this.swiperItemSlotParam === undefined) {
this.items = IMAGES;
this.swiperItemSlotParam = this.defaultSwiperItem;
}
this.swiperData.setData(this.items);
this.resetAnimationAttr();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#L... | aboutToAppear(): void {
// 校验父组件是否传入合法的items和swiperItemSlotParam,不合法进行初始化
if (this.items.length === 0 || this.swiperItemSlotParam === undefined) {
this.items = IMAGES;
this.swiperItemSlotParam = this.defaultSwiperItem;
}
this.swiperData.setData(this.items);
this.resetAnimationAttr();
... | https://gitcode.com/arkui-x/samples | fccc8a1e2b3e145c52df5507fa5333c1e74f544c | gitcode |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/components/MusicPlayerInfoComp.ets | arkts | updateWithOrientation | 屏幕方向变更时,修改展示样式
@param mediaQueryResult 媒体查询横屏结论
@returns {void} | updateWithOrientation(mediaQueryResult: mediaquery.MediaQueryResult): void {
this.isLandscape = mediaQueryResult.matches;
this.updateWithFoldStatus();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateWithOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left mediaQueryResult AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left mediaquery ... | updateWithOrientation(mediaQueryResult: mediaquery.MediaQueryResult): void {
this.isLandscape = mediaQueryResult.matches;
this.updateWithFoldStatus();
} | https://gitcode.com/arkui-x/samples | 9871e650fb24badb8d10a6df53de85e5828e7a41 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.