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 |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | reloadSettings | 重新加载字体设置(用于备份恢复后) | async reloadSettings(): Promise<void> {
if (!this.isInitialized || !this.preferences) {
logger.warn(TAG, '字体管理器未初始化,无法重新加载设置');
return;
}
try {
logger.info(TAG, '开始重新加载字体设置...');
// 重新加载设置
await this.loadSettings();
// 重新加载自定义字体列表
await this.loa... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reloadSettings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ... | async reloadSettings(): Promise<void> {
if (!this.isInitialized || !this.preferences) {
logger.warn(TAG, '字体管理器未初始化,无法重新加载设置');
return;
}
try {
logger.info(TAG, '开始重新加载字体设置...');
// 重新加载设置
await this.loadSettings();
// 重新加载自定义字体列表
await this.loa... | https://github.com/DaLongZhuaZi/manxia | be028ccbef3d7a46825296ce145514389472a571 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Char.ets | arkts | isBinDigit | isBinDigit() checks whether the char represents a binary digit.
@param value a char to check.
@returns true if the char is a binary digit. | public static isBinDigit(value: char): boolean {
let diff: int = value - c'0';
return (0 == diff) || (diff == 1);
} | 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 isBinDigit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static isBinDigit(value: char): boolean {
let diff: int = value - c'0';
return (0 == diff) || (diff == 1);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4ae52d6e8a44476ced01873423f5011aeed7f1e6 | gitee |
axiomaster/bonio | harmonyos/entry/src/main/ets/node/NodeRuntime.ets | arkts | <arrow> | hasRecordAudioPermission | () => this.prefs.getManualTls() | AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#=>#Left => AST#=>#Right AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#this#Left this AST#this#Right AST... | () => this.prefs.getManualTls() | https://github.com/axiomaster/bonio | c07daad248209f57aa41c8883eae64b7527797d8 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/PanZoomHandler.ets | arkts | isZoomed | 是否处于缩放状态(scale > 1) | isZoomed(): boolean {
return this.scaleFactor > 1.01;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isZoomed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_... | isZoomed(): boolean {
return this.scaleFactor > 1.01;
} | https://github.com/AlkaidLab/moonlight-harmony | b8e1b478ded9a0657d54b43dc7ebcf6e56bae78f | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | setProviderEnabled | 改启用状态:写 DB + 同步到内存数组 | async setProviderEnabled(providerId: string, isEnabled: boolean): Promise<void> {
await this.db.updateProviderEnabled(providerId, isEnabled)
const current = this.getProviders()
const next: ModelProvider[] = []
for (let i = 0; i < current.length; i++) {
const p = current[i]
if (p.id === pro... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setProviderEnabled AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left providerId AST#identifier#Right AST#type_annotation#Left AST... | async setProviderEnabled(providerId: string, isEnabled: boolean): Promise<void> {
await this.db.updateProviderEnabled(providerId, isEnabled)
const current = this.getProviders()
const next: ModelProvider[] = []
for (let i = 0; i < current.length; i++) {
const p = current[i]
if (p.id === pro... | https://github.com/LongLiveY96/chatcube | a3c894c0d1d7b0b0b42c0cccb9c30dec7171be94 | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets | arkts | changeImageCollapseSource | change collapse image node source
@param nodeStatus node status
@param isImageCollapse whether collapse image or white collapse image
@returns collapse image node | static changeImageCollapseSource(nodeStatus: NodeStatus, isImageCollapse?: boolean): CollapseImageNode | undefined {
if (isImageCollapse === undefined) {
return undefined;
}
if (!isImageCollapse) {
if (nodeStatus === NodeStatus.COLLAPSE) {
return CollapseImageNodeFlyweightFactory.getCo... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left changeImageCollapseSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeStatus AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | static changeImageCollapseSource(nodeStatus: NodeStatus, isImageCollapse?: boolean): CollapseImageNode | undefined {
if (isImageCollapse === undefined) {
return undefined;
}
if (!isImageCollapse) {
if (nodeStatus === NodeStatus.COLLAPSE) {
return CollapseImageNodeFlyweightFactory.getCo... | https://gitcode.com/openharmony/arkui_ace_engine | 52cbbd098efa52b060b5dabccc8c10eb811dd822 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | sumArray | --- Manual rest parameters via array --- | function sumArray(nums: number[]): number {
let total: number = 0;
for (let i: number = 0; i < nums.length; i++) {
total = total + nums[i];
}
return total;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left sumArray AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nums AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function sumArray(nums: number[]): number {
let total: number = 0;
for (let i: number = 0; i < nums.length; i++) {
total = total + nums[i];
}
return total;
} | https://github.com/miaochiahao/ark-ghidra | 3cd1feae4b34a499accdda5787eaa4c134969ab4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | map | Creates a new Uint32Array using fn(arr[i]) over all elements of current Uint32Array.
@param fn a function to apply for each element of current Uint32Array
@returns a new Uint32Array where for each element from current Uint32Array fn was applied | public map(fn: (val: number, index: int) => number): Uint32Array {
let resBuf = new ArrayBuffer(this.length * Uint32Array.BYTES_PER_ELEMENT)
let res = new Uint32Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: number, index: int) => number): Uint32Array {
let resBuf = new ArrayBuffer(this.length * Uint32Array.BYTES_PER_ELEMENT)
let res = new Uint32Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2da86c11a7d28322b868d3e63fad98831eba1123 | gitee |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/validation/ValidationUtil.ets | arkts | isValidPhone | 验证手机号是否有效
@param {string} phone - 手机号
@returns {boolean} 是否有效 | static isValidPhone(phone: string): boolean {
return phone.length === 11 && ValidationUtil.PHONE_REGEX.test(phone);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static isValidPhone(phone: string): boolean {
return phone.length === 11 && ValidationUtil.PHONE_REGEX.test(phone);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 6ad71fa91125574b0a869a8a4c79f3d996a6d6ed | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/Options.ets | arkts | addOptionGroup | Add the specified option group.
@param group the OptionGroup that is to be added
@return the resulting Options instance | public addOptionGroup(group: OptionGroup): Options{
if (group.isRequired()) {
this.requiredOpts.insert(group);
}
for (let index = 0;index < group.getOptions().length(); index++) {
// an Option cannot be required if it is in an
// OptionGroup, either the group is required or
// noth... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addOptionGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public addOptionGroup(group: OptionGroup): Options{
if (group.isRequired()) {
this.requiredOpts.insert(group);
}
for (let index = 0;index < group.getOptions().length(); index++) {
// an Option cannot be required if it is in an
// OptionGroup, either the group is required or
// noth... | https://gitee.com/openharmony-sig/commons-cli.git | 0e32727d4885a08892f14beffc0467b2ca509e95 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/otp/parsers/KeeOtpParser.ets | arkts | parse | 解析指定字段的 OTP 数据
@param fieldName 字段名称
@param fieldValue 字段值
@param entry KeePass 条目
@returns OTPURL 数组 | parse(fieldName: string, fieldValue: string, entry: KdbxEntry): string[] {
if (!this.canParse(fieldName, fieldValue)) {
return [];
}
try {
// 解析查询参数格式
const params = new url.URLParams(fieldValue);
const secret = params.get('key');
if (!secret) {
return [];
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left parse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fieldName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Right ... | parse(fieldName: string, fieldValue: string, entry: KdbxEntry): string[] {
if (!this.canParse(fieldName, fieldValue)) {
return [];
}
try {
// 解析查询参数格式
const params = new url.URLParams(fieldValue);
const secret = params.get('key');
if (!secret) {
return [];
}
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/parsers/KeeOtpParser.ets#L38-L65 | 4839cc6044828a77e92c367ed6ae60d88524eeab | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/WantAgentUtil.ets | arkts | triggerCloseAlarm | Trigger the alarm to turn off
@param alarmInfo AlarmInfo | static async triggerCloseAlarm(alarmInfo: AlarmInfo): Promise<void> {
if (!alarmInfo) {
LogUtil.error(TAG, 'Trigger close alarm failed, params is incorrect.');
return;
}
const triggerWantAgent = await WantAgentUtil.getAlarmWantAgent(alarmInfo, AlarmServiceType.Close);
if (triggerWantAgent)... | 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 triggerCloseAlarm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#:#L... | static async triggerCloseAlarm(alarmInfo: AlarmInfo): Promise<void> {
if (!alarmInfo) {
LogUtil.error(TAG, 'Trigger close alarm failed, params is incorrect.');
return;
}
const triggerWantAgent = await WantAgentUtil.getAlarmWantAgent(alarmInfo, AlarmServiceType.Close);
if (triggerWantAgent)... | https://gitee.com/openharmony-sig/applications_clock.git | 7f0dcd47a4f7bec1d7d22f70aaaa44695e2316c6 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | sub | Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
using rounding mode `rounding`.
@param { Value } x {double | string | Decimal}
@param { Value } y {double | string | Decimal}
@returns { Decimal } the Decimal type | static sub(x: Value, y: Value): Decimal {
return new Decimal(x).sub(y);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left sub AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static sub(x: Value, y: Value): Decimal {
return new Decimal(x).sub(y);
} | https://gitcode.com/iop123123/arkts-static-skills | dd21e8354a40f03b69b5c0eb23cb9241509b4e78 | gitcode |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/defaultError.ets | arkts | object1 | tuple element is not readonly
the above examples work the same if you use ReadonlyArray<T> instead | function object1(arg: { prop: string }) {} // property is not readonly | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left object1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function object1(arg: { prop: string }) {} // property is not readonly | https://github.com/SMAT-Lab/Homecheck-Sec2026 | a437887336d6de3dbdfad92cc8e921ee72ddac03 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/PlaylistsApi.ets | arkts | moveItem | @summary Moves a playlist item.
@param {PlaylistsApiMoveItemRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof PlaylistsApi | public moveItem(requestParameters: PlaylistsApiMoveItemRequest): Promise<void> {
return this.apiClient.post({path: `/Playlists/${requestParameters.playlistId}/Items/${requestParameters.itemId}/Move/${requestParameters.newIndex}`})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left moveItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public moveItem(requestParameters: PlaylistsApiMoveItemRequest): Promise<void> {
return this.apiClient.post({path: `/Playlists/${requestParameters.playlistId}/Items/${requestParameters.itemId}/Move/${requestParameters.newIndex}`})
} | https://github.com/OHPG/FinSdk | 5b3b0dc5ebfe7507a381b2b276411e99f6cd2bcc | github |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue132.ets.audit.ets | arkts | unregisterDataChangeListener | 注销数据改变的监听器 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
console.info('remove listener')
this.listeners.splice(pos, 1)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
console.info('remove listener')
this.listeners.splice(pos, 1)
}
} | https://gitee.com/openharmony-sig/earth.git | 24d59e002f57e50a2a658e8af60da0805be407d5 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | getFileNameFromPath | 从路径获取文件名 | private getFileNameFromPath(filePath: string): string {
const lastSlash = filePath.lastIndexOf('/');
return lastSlash >= 0 ? filePath.substring(lastSlash + 1) : filePath;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileNameFromPath 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 AS... | private getFileNameFromPath(filePath: string): string {
const lastSlash = filePath.lastIndexOf('/');
return lastSlash >= 0 ? filePath.substring(lastSlash + 1) : filePath;
} | https://github.com/DaLongZhuaZi/manxia | 04f9d27405b18fbcf110a65879563113255ab498 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | loadAllTotpEntries | ==================== TotpEntry CRUD ==================== | loadAllTotpEntries(): TotpEntry[] {
if (!this.store) { return []; }
try {
const predicates = new relationalStore.RdbPredicates('totpentries');
predicates.orderByDesc('createdat');
const rs = this.store.querySync(predicates);
const result: TotpEntry[] = [];
while (rs.goToNextRow()... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadAllTotpEntries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left TotpEntry AST#identifier#Rig... | loadAllTotpEntries(): TotpEntry[] {
if (!this.store) { return []; }
try {
const predicates = new relationalStore.RdbPredicates('totpentries');
predicates.orderByDesc('createdat');
const rs = this.store.querySync(predicates);
const result: TotpEntry[] = [];
while (rs.goToNextRow()... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 85e2c3e63b78c3fa23ae77cf40039b10703b7d1b | github |
anhao0226/harmony-music-player | entry/src/main/ets/common/utils/AudioService.ets | arkts | seek | @param ms | public seek(ms: number) {
if (this._isPrepare && this._avPlayerState != AvPlayerState.ERROR) {
const finalTime = ms <= 0 ? 0 : (ms >= this._avPlayer.duration ? this._avPlayer.duration : ms);
if (this._avPlayer) this._avPlayer.seek(finalTime);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left seek AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#R... | public seek(ms: number) {
if (this._isPrepare && this._avPlayerState != AvPlayerState.ERROR) {
const finalTime = ms <= 0 ? 0 : (ms >= this._avPlayer.duration ? this._avPlayer.duration : ms);
if (this._avPlayer) this._avPlayer.seek(finalTime);
}
} | https://github.com/anhao0226/harmony-music-player | 0b5487d71fb356586531f3c090c30400b0dfde8c | github |
xblLab/HarmonyProjectTemplate | products/phone/src/main/ets/common/WantUtils.ets | arkts | handleFormCardCall | 服务卡片事件处理
@param want | public static handleFormCardCall(want: Want) {
if (want?.parameters?.source === SOURCE_FORM_CARD) {
const formCardRouter: FormCardRouter =
AppStorageV2.connect(FormCardRouter, () => new FormCardRouter())!;
formCardRouter.id = new Date().getTime();
formCardRouter.pageUrl = want?.parameter... | 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 handleFormCardCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left... | public static handleFormCardCall(want: Want) {
if (want?.parameters?.source === SOURCE_FORM_CARD) {
const formCardRouter: FormCardRouter =
AppStorageV2.connect(FormCardRouter, () => new FormCardRouter())!;
formCardRouter.id = new Date().getTime();
formCardRouter.pageUrl = want?.parameter... | https://github.com/xblLab/HarmonyProjectTemplate | 93075c2bb0c67ac5ae0d6d34f1401cc9ea19b4a0 | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/XiaoyiSkillManager.ets | arkts | getSkill | 获取特定技能 | getSkill(skillId: string): any {
return this.skills.get(skillId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSkill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left skillId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Right... | getSkill(skillId: string): any {
return this.skills.get(skillId);
} | https://github.com/LJ666-ui/harmony-health-care | a64f2ce2f9f1818fc9f6fa0881b3dcf90afe7bf7 | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | play | 用于播放多媒体。 | async play() {
const avPlayer = await this.init();
avPlayer.play();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left play AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST... | async play() {
const avPlayer = await this.init();
avPlayer.play();
} | https://github.com/yangyongzhen/hmmovie | 62be18ff573829bc8bc8aa14ade1ae0822aff636 | github |
IoTAccessControl/ArkTSAnalysis | TestApps1/9.PaymentKit_CodelabDemo/entry/src/main/ets/pages/Index.ets | arkts | generateNonceStr | 生成随机字符串 | generateNonceStr(length: number = 32): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateNonceStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left number... | generateNonceStr(length: number = 32): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
} | https://github.com/IoTAccessControl/ArkTSAnalysis | 001388ede6e1de7d797736494d9a91e2caa2a747 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets | arkts | enableDashedHighlightLine | Enables the highlight-line to be drawn in dashed mode, e.g. like this "- - - - - -"
@param lineLength the length of the line pieces
@param spaceLength the length of space in between the line-pieces
@param phase offset, in degrees (normally, use 0) | public enableDashedHighlightLine(lineLength: number, spaceLength: number, phase: number): void {
let arr = [lineLength, spaceLength];
this.mHighlightDashPathEffect = new DashPathEffect(arr,
phase);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableDashedHighlightLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb... | public enableDashedHighlightLine(lineLength: number, spaceLength: number, phase: number): void {
let arr = [lineLength, spaceLength];
this.mHighlightDashPathEffect = new DashPathEffect(arr,
phase);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6f07131e81a0d70d55dfda4826f21fc533b63ca8 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | logDebug | 记录调试日志
仅在 DEBUG 级别记录
@param debugMessage 调试信息 | logDebug(debugMessage: string): void {
// 调试日志仅在 DEBUG 级别记录
if (!this.shouldLog(LogLevel.DEBUG)) {
return
}
const message = this.formatMessage(LOG_TYPE_DEBUG, '-', debugMessage)
this.recordToHistory(message)
hilog.debug(this.domain, this.tag, message)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logDebug AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left debugMessage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#... | logDebug(debugMessage: string): void {
// 调试日志仅在 DEBUG 级别记录
if (!this.shouldLog(LogLevel.DEBUG)) {
return
}
const message = this.formatMessage(LOG_TYPE_DEBUG, '-', debugMessage)
this.recordToHistory(message)
hilog.debug(this.domain, this.tag, message)
} | https://github.com/offlinecat-dev/OCNetORM | 94629c99eaf12b8e057f75f3dd32a7b1aa442405 | github |
openharmony-tpc/openharmony_tpc_samples | dialogs/library/src/main/ets/components/progress/base/LVBase.ets | arkts | setAnimValue | 设置动画的开始值和结束值 | setAnimValue(start:number, end:number) {
this.animStartValue = start
this.animEndValue = end
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setAnimValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right... | setAnimValue(start:number, end:number) {
this.animStartValue = start
this.animEndValue = end
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | ba01a11b3e80c721bccc670e2475c024815653ba | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnWaterFallViewModel.ets | arkts | initThreeColData | 初始化三列数据 | private initThreeColData(): void {
const items: Object[] = [];
for (let i = 0; i < 18; i++) {
const height = 80 + Math.floor(Math.random() * 100);
const color = this.colors[(i + 3) % this.colors.length];
items.push(new WaterFallDemoItem(i, height, color, `Col3-${i + 1}`));
}
this.thr... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initThreeColData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST... | private initThreeColData(): void {
const items: Object[] = [];
for (let i = 0; i < 18; i++) {
const height = 80 + Math.floor(Math.random() * 100);
const color = this.colors[(i + 3) % this.colors.length];
items.push(new WaterFallDemoItem(i, height, color, `Col3-${i + 1}`));
}
this.thr... | https://github.com/codelably/tuniao-ui | e0bce4b96d9b9e9a8f665bb549e8f7f75a657290 | github |
openharmony-sig/knowledge_demo_travel | FA/WeatherForeCast/entry/src/main/ets/MainAbility/pages/Main.ets | arkts | getWeekRequest | 请求方式:GET 获取一周天气预报 | getWeekRequest() {
// 每一个httpRequest对应一个http请求任务,不可复用
let httpRequest = http.createHttp()
let url = 'https://devapi.qweather.com/v7/weather/7d?location=101010100&key=48fbadf80bbc43ce853ab9a92408373e'
httpRequest.request(url, (err, data) => {
if (!err) {
if (data.responseCode == 200) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWeekRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | getWeekRequest() {
// 每一个httpRequest对应一个http请求任务,不可复用
let httpRequest = http.createHttp()
let url = 'https://devapi.qweather.com/v7/weather/7d?location=101010100&key=48fbadf80bbc43ce853ab9a92408373e'
httpRequest.request(url, (err, data) => {
if (!err) {
if (data.responseCode == 200) {
... | https://gitee.com/openharmony-sig/knowledge_demo_travel.git | 7a37834f778e9b9a078926e12a4ce22bdc3b3024 | gitee |
openharmony-tpc/MMKV | entry/src/main/ets/pages/index.ets | arkts | testCrud | test crud | testCrud() {
LogUtil.i('testCrud start')
let cryptKey = 'Tencent MMKV'
let otherDir = filePath + '/mmkv_3'
LogUtil.i('testCrud - MMKV.pageSize() :' + MMKV.pageSize())
let ashemMMKV = MMKV.getMMKVWithMMapID('testCrud', MMKV.SINGLE_PROCESS_MODE, cryptKey, otherDir)
ashemMMKV.encodeBool('boolData... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left testCrud AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS... | testCrud() {
LogUtil.i('testCrud start')
let cryptKey = 'Tencent MMKV'
let otherDir = filePath + '/mmkv_3'
LogUtil.i('testCrud - MMKV.pageSize() :' + MMKV.pageSize())
let ashemMMKV = MMKV.getMMKVWithMMapID('testCrud', MMKV.SINGLE_PROCESS_MODE, cryptKey, otherDir)
ashemMMKV.encodeBool('boolData... | https://gitee.com/openharmony-tpc/MMKV.git | a5564230c8636d5f8f9de460968914d5a9815185 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | createLong | Creates a new JSON element containing an long value.
@param {long} value - The long value to store
@returns {JsonElement} A new JsonElement containing the long value | static createLong(value: long): JsonElement {
const element = new JsonElement()
element.maybeLongValue = value
return element
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createLong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#... | static createLong(value: long): JsonElement {
const element = new JsonElement()
element.maybeLongValue = value
return element
} | https://gitcode.com/iop123123/arkts-static-skills | a5a2539b281d6ec4e1f1589e5903efe2da691392 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/services/BinaryFileHandler.ets | arkts | detectBinary | 综合判断:路径 + 内容 | static detectBinary(filePath: string, content?: string): BinaryDetectionResult {
// 扩展名判断
if (this.isBinaryByExtension(filePath)) {
const ext = filePath.split('.').pop()?.toLowerCase() || '';
return {
isBinary: true,
reason: `文件扩展名 .${ext} 为已知二进制格式`,
mimeType: this.guessMim... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectBinary 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 detectBinary(filePath: string, content?: string): BinaryDetectionResult {
// 扩展名判断
if (this.isBinaryByExtension(filePath)) {
const ext = filePath.split('.').pop()?.toLowerCase() || '';
return {
isBinary: true,
reason: `文件扩展名 .${ext} 为已知二进制格式`,
mimeType: this.guessMim... | https://github.com/XJTUWYD/ArkDiff | 312937fb31d096a6861d1042c92b8ccc4fcb5676 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets | arkts | any | Create a promise that will be resolved after all promises are completed and at least one is resolved
@param promises iterable object of promise-like objects
@returns { Promise } promise that will be resolved if at least one promise is resolved with the result of resolved promise
or rejected with AggregateError if all p... | static any<U>(promises: Iterable<PromiseLike<U>|U>): Promise<Awaited<U>> {
try {
return Promise.any<U>(Promise.toArray(promises));
} catch (e) {
// NOTE(csaba.osztrogonac): remove as cast once e has Error type
return Promise.reject<U>(e as Error);
}
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left any AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_param... | static any<U>(promises: Iterable<PromiseLike<U>|U>): Promise<Awaited<U>> {
try {
return Promise.any<U>(Promise.toArray(promises));
} catch (e) {
// NOTE(csaba.osztrogonac): remove as cast once e has Error type
return Promise.reject<U>(e as Error);
}
} | https://gitcode.com/iop123123/arkts-static-skills | ec88f6f8ecf2008e4a0b57febc584ba36737cc49 | gitcode |
Dige945/EmoCollector | entry/src/main/ets/service/AIService.ets | arkts | callKimiAPI | 调用 Kimi API | private async callKimiAPI(userMessage: string): Promise<string> {
return new Promise((resolve, reject) => {
const httpRequest = http.createHttp();
const systemMessage: APIMessage = {
role: 'system',
content: '你是一位温暖、专业的心理健康顾问,擅长分析情绪状态并给出积极实用的建议。你的回答要简洁、温暖、有针对性。'
};
const ... | 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 callKimiAPI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userMessage AST#identifier#Right AST#ERROR#Left AST#:#Le... | private async callKimiAPI(userMessage: string): Promise<string> {
return new Promise((resolve, reject) => {
const httpRequest = http.createHttp();
const systemMessage: APIMessage = {
role: 'system',
content: '你是一位温暖、专业的心理健康顾问,擅长分析情绪状态并给出积极实用的建议。你的回答要简洁、温暖、有针对性。'
};
const ... | https://github.com/Dige945/EmoCollector | d62ba8c714fc5ee6a0f9e0c53af81caffe5d45bc | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setLastHighlighted | Sets the last highlighted value for the touchlistener.
@param highs | protected setLastHighlighted(highs: Highlight[]) {
if (this.mChartTouchListener) {
if (highs == null || highs.length <= 0 || highs[0] == null) {
this.mChartTouchListener.setLastHighlighted();
} else {
this.mChartTouchListener.setLastHighlighted(highs[0]);
}
}
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left setLastHighlighted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left highs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#sub... | protected setLastHighlighted(highs: Highlight[]) {
if (this.mChartTouchListener) {
if (highs == null || highs.length <= 0 || highs[0] == null) {
this.mChartTouchListener.setLastHighlighted();
} else {
this.mChartTouchListener.setLastHighlighted(highs[0]);
}
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c4a57a39746cf9da9a891f0b948b865a1b4570c0 | gitee |
openharmony/arkui_ace_engine | advanced_ui_component/treeviewv2/source/treeviewv2.ets | arkts | getTreeListener | Get treeListenerV2.
@return treeListenerV2 object
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 26 | public getTreeListener(): TreeListenerV2 {
return this.appEventBus;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTreeListener 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 TreeLi... | public getTreeListener(): TreeListenerV2 {
return this.appEventBus;
} | https://gitcode.com/openharmony/arkui_ace_engine | eae7649d9498a3998238ffe5dc8ebbcb34d482ca | gitcode |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/profile/profile.ets | arkts | onPageShow | 界面show的生命周期,进行数据的初始化操作 | onPageShow() {
if (this.profileViewModel.isProfileInit === false) {
this.profileViewModel.initProfile()
}
if (this.profileViewModel.isReposInit === false) {
this.profileViewModel.initRepos()
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
if (this.profileViewModel.isProfileInit === false) {
this.profileViewModel.initProfile()
}
if (this.profileViewModel.isReposInit === false) {
this.profileViewModel.initRepos()
}
} | https://gitee.com/openharmony-sig/online_event.git | b7d82e20e0e692543e35b983aa4b2fbc1d50ecad | gitee |
openharmony/applications_launcher | feature/form/src/main/ets/default/view/FormServiceComponent.ets | arkts | cancelFormDialog | When click cancel dialog, this function will be called. | cancelFormDialog(): void {
this.clearForm();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelFormDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | cancelFormDialog(): void {
this.clearForm();
} | https://gitee.com/openharmony/applications_launcher.git | 919ab2b350626206ad91ab7eb8f8dedd0834fa02 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | remove | Remove the key - value pair for the key.
@param key the key of the element to remove
@returns the value of the key, or undefined if the key is not found | public remove(key: int): T | undefined {
return this.buckets.remove(key);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#id... | public remove(key: int): T | undefined {
return this.buckets.remove(key);
} | https://gitcode.com/iop123123/arkts-static-skills | 047ada78716bfbde5d38006c244578d9ca31d8a2 | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/viewmodel/PlayerViewModel.ets | arkts | openFullScreen | Opens full-screen playback immediately (no animation). | public openFullScreen(): void {
this.appState.isShowPlay = true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left openFullScreen 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#express... | public openFullScreen(): void {
this.appState.isShowPlay = true;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 27f36b3c1ba97c34bcbc10ee34b6444e1c799eeb | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | testSingleUrl | 测试单个URL | private async testSingleUrl(url: string, index: number): Promise<void> {
// 更新状态为测试中
if (index >= 0) {
this.updateProxyTestSiteStatus(index, 'testing');
} else {
this.proxyTestResults = '正在测试...';
}
this.isTestingProxy = true;
try {
// 先保存配置
await ProxyManager... | 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 testSingleUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : A... | private async testSingleUrl(url: string, index: number): Promise<void> {
// 更新状态为测试中
if (index >= 0) {
this.updateProxyTestSiteStatus(index, 'testing');
} else {
this.proxyTestResults = '正在测试...';
}
this.isTestingProxy = true;
try {
// 先保存配置
await ProxyManager... | https://github.com/DaLongZhuaZi/manxia | a941dd69734946c748dd32eadc133f7c190894b2 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | put | 通用设置方法 | static async put(key: string, value: preferences.ValueType): Promise<void> {
const prefs = await PreferencesUtil.getPreferences();
await prefs.put(key, value);
await prefs.flush();
} | 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 put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AS... | static async put(key: string, value: preferences.ValueType): Promise<void> {
const prefs = await PreferencesUtil.getPreferences();
await prefs.put(key, value);
await prefs.flush();
} | https://github.com/AlkaidLab/moonlight-harmony | de2a5124a8b5dbe7dbb8521fd4b75465b727ffb5 | github |
PollenWang6/HiXD | entry/src/main/ets/utils/HttpUtil.ets | arkts | getArrayBuffer | 浜岃繘鍒?GET 锛堢敤浜庨獙璇佺爜鍥剧墖绛夛級锛岃繑鍥?ArrayBuffer | async getArrayBuffer(url: string, headers?: Record<string, string>): Promise<ArrayBuffer> {
await this.loadCookies();
return new Promise<ArrayBuffer>((resolve, reject) => {
const req = http.createHttp();
const reqHeaders: Record<string, string> = {};
if (headers) {
for (const key of ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getArrayBuffer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async getArrayBuffer(url: string, headers?: Record<string, string>): Promise<ArrayBuffer> {
await this.loadCookies();
return new Promise<ArrayBuffer>((resolve, reject) => {
const req = http.createHttp();
const reqHeaders: Record<string, string> = {};
if (headers) {
for (const key of ... | https://github.com/PollenWang6/HiXD | 669f975d70e887ab05c231d340bad45af05c932c | github |
HarmonyOS_Samples/BestPracticeSnippets | UseSendable/entry/src/main/ets/pages/ConcurrencyCapabilitySelection1.ets | arkts | foo | [EndExclude taskpool] | @Concurrent
async function foo(a: number, b: number) {
return a + b;
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#formal_parameters#Left AS... | @Concurrent
async function foo(a: number, b: number) {
return a + b;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | dc894f5a9d6c1fc795785c146980442412ffa203 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceField.ets | arkts | setValue | Writes a value to the instance field.
@param { Object } thisObj The target object as the `this` context.
@param { Any } value The value to write.
@throws { TypeError } Throws when `thisObj` is incompatible with the field or the value type doesn't match.
@throws { TypeError } Throws when the field is readonly.
@syscap S... | public setValue(thisObj: Object, value: Any): void {
if (this.isReadonly()) {
throw new TypeError("setValue to a readonly field")
}
super.setValueInternal(thisObj, value)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left thisObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#identifie... | public setValue(thisObj: Object, value: Any): void {
if (this.isReadonly()) {
throw new TypeError("setValue to a readonly field")
}
super.setValueInternal(thisObj, value)
} | https://gitcode.com/iop123123/arkts-static-skills | 39e186b5460110194bba399a0b188f17e77c9e3d | gitcode |
mybricks/comlib-harmony-normal | packages/rt-arkts/comlib/src/main/ets/ContainerList.ets | arkts | insertItems | 插入数据方法 | insertItems(startIndex: number, items: DataSourceItem[]): void {
items.forEach((item, i) => {
const insertPos = startIndex + i;
this.data.splice(insertPos, 0, item);
// 为每个项单独触发事件
this.listeners.forEach(listener => listener.onDataAdd(insertPos));
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,... | insertItems(startIndex: number, items: DataSourceItem[]): void {
items.forEach((item, i) => {
const insertPos = startIndex + i;
this.data.splice(insertPos, 0, item);
// 为每个项单独触发事件
this.listeners.forEach(listener => listener.onDataAdd(insertPos));
});
} | https://github.com/mybricks/comlib-harmony-normal | f0ead9c110defb595e712062d8f6438733232a34 | github |
Explore-In-HMOS-Wearable/water-tracker | entry/src/main/ets/core/services/WaterService.ets | arkts | instance | Ensure only one instance of this Service has created | static instance() {
if (!WaterService._instance) {
WaterService._instance = new WaterService();
}
return WaterService._instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left instance 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#... | static instance() {
if (!WaterService._instance) {
WaterService._instance = new WaterService();
}
return WaterService._instance;
} | https://github.com/Explore-In-HMOS-Wearable/water-tracker | f4894ba37fe4a8b373d78e3e763fa8d10d274424 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/ui/web_ui.ets | arkts | listen_system_volume | 音量监听 // | listen_system_volume() {
// 打开音量条 //
if (this.show_volume) {
log('音量条打开')
// 传入初始音量 //
this.volume_level = this.audio_volume_manager.getVolumeByStream(audio.StreamUsage.STREAM_USAGE_MUSIC)
this.web_ui_core.runJavaScript(`set_vol(${this.volume_level})`)
// 音量监听 //
this.a... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left listen_system_volume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | listen_system_volume() {
// 打开音量条 //
if (this.show_volume) {
log('音量条打开')
// 传入初始音量 //
this.volume_level = this.audio_volume_manager.getVolumeByStream(audio.StreamUsage.STREAM_USAGE_MUSIC)
this.web_ui_core.runJavaScript(`set_vol(${this.volume_level})`)
// 音量监听 //
this.a... | https://github.com/Nekofox-POT/LinMusic | 0ea878cb87334b14698c5a56fe5ef803925771bd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SyncPrimitives.ets | arkts | notifyAll | precondition: mutex is locked
Unblocks ALL suspended coroutine associated with this CondVar.
This method is thread-safe in relation to other methods of the CondVar | public notifyAll(mutex: Mutex) {
CondVar.notifyAll(this, mutex);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mutex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Mutex... | public notifyAll(mutex: Mutex) {
CondVar.notifyAll(this, mutex);
} | https://gitcode.com/iop123123/arkts-static-skills | 6f2b358be7deb87572138849a09c1c4532726d23 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSource.ets | arkts | getServerUrl | 获取规范化后的服务器地址(包含协议) | public getServerUrl(): string {
return this.getNormalizedServerUrl();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getServerUrl 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#st... | public getServerUrl(): string {
return this.getNormalizedServerUrl();
} | https://github.com/DaLongZhuaZi/manxia | b870118fd99c3868da6ba0cee5208c33848bfa57 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test32_original_index.ets | arkts | testObjectAccumulate | --- Object.keys traversal with accumulator --- | function testObjectAccumulate(): string {
let scores: Record<string, number> = {};
scores['alice'] = 85;
scores['bob'] = 92;
scores['carol'] = 78;
let keys: string[] = Object.keys(scores);
let total: number = 0;
for (let i: number = 0; i < keys.length; i++) {
let val: number = scores[keys[i]];
tot... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectAccumulate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predef... | function testObjectAccumulate(): string {
let scores: Record<string, number> = {};
scores['alice'] = 85;
scores['bob'] = 92;
scores['carol'] = 78;
let keys: string[] = Object.keys(scores);
let total: number = 0;
for (let i: number = 0; i < keys.length; i++) {
let val: number = scores[keys[i]];
tot... | https://github.com/miaochiahao/ark-ghidra | f4de1326bbcecf51ab2a302c0a395b765bdc3d01 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/StringUtils.ets | arkts | isNullOrEmpty | 判断字符串是否为 null、undefined 或空字符串 | static isNullOrEmpty(value: string | null | undefined): boolean {
if (value === null || value === undefined) {
return true;
}
return value.length === 0;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNullOrEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression... | static isNullOrEmpty(value: string | null | undefined): boolean {
if (value === null || value === undefined) {
return true;
}
return value.length === 0;
} | https://github.com/DaLongZhuaZi/NGF | d1230ec9ce309e4710ea0c33ec22bcb5b10df5d9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | timeEnd | Stops a timer and logs its final duration
Removes the timer and prints a warning if it doesn't exist
@param {string} [label='default'] - Label of the timer to stop
@returns {void}
@see time | public timeEnd(label?: string): void {
if (label != undefined) {
Console.isNullCharacter(label);
}
this.timeLog(label)
this.timers.delete(label ?? 'default')
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left timeEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | public timeEnd(label?: string): void {
if (label != undefined) {
Console.isNullCharacter(label);
}
this.timeLog(label)
this.timers.delete(label ?? 'default')
} | https://gitcode.com/iop123123/arkts-static-skills | c47cce52869114fb3b59967ba49275cef9ed8af4 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Set.ets | arkts | add | Puts a value into the Set
@param v the value to put into the Set | add(v: K): void {
this.map.set(v, true);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left K AST#identifier#Right AST#)#Left ) AST#)#Right AST#arg... | add(v: K): void {
this.map.set(v, true);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 036d4083f9188d41b3bff3c2783b66beacb2cd73 | gitee |
silence17/harmonydemo | entry/src/main/ets/view/refresh/DialogUtils.ets | arkts | getBirthDateValue | Get default birth date
@param {number} year year
@param {number} month month
@param {number} day day
@returns {string} return birth date | static getBirthDateValue(year: number, month: number, day: number): string {
let birthdate: string = `${year}年${month}` + `月${day}日`;
return birthdate;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getBirthDateValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static getBirthDateValue(year: number, month: number, day: number): string {
let birthdate: string = `${year}年${month}` + `月${day}日`;
return birthdate;
} | https://github.com/silence17/harmonydemo | 7095f96e69e9d7a0cf2f456b5f94d33a7960bb53 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | copyDirectoryRecursive | 递归复制目录
@returns 复制的文件数量 | private async copyDirectoryRecursive(sourceDir: string, targetDir: string): Promise<number> {
if (!SafeFileUtils.accessSync(targetDir)) {
SafeFileUtils.mkdirSyncStrict(targetDir, true);
}
let fileCount = 0;
const entries = SafeFileUtils.listFileSync(sourceDir);
for (const entry of ... | 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 copyDirectoryRecursive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceDir AST#identifier#Right AST#ERROR#Left... | private async copyDirectoryRecursive(sourceDir: string, targetDir: string): Promise<number> {
if (!SafeFileUtils.accessSync(targetDir)) {
SafeFileUtils.mkdirSyncStrict(targetDir, true);
}
let fileCount = 0;
const entries = SafeFileUtils.listFileSync(sourceDir);
for (const entry of ... | https://github.com/DaLongZhuaZi/manxia | 22aafab3fe25db4eeeb9ddb55325efb91931bca6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_plus/unary_plus_long.ets | arkts | main | ---
desc: check unary plus operation for long integer operand
--- | function main(): void {
const v: long = {{v.value}}
assert +(v) == {{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 v: long = {{v.value}}
assert +(v) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7974c67abed0536b38b37e992d610a0e251aeecc | gitee |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/pages/BluetoothClient.ets | arkts | onAvailableDevicesChange | 当前连的设备
可用设备变化事件 | onAvailableDevicesChange(): void {
Log.showInfo(TAG, `onAvailableDevicesChange: availableDevices = ${JSON.stringify(this.availableDevices)}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onAvailableDevicesChange 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#sta... | onAvailableDevicesChange(): void {
Log.showInfo(TAG, `onAvailableDevicesChange: availableDevices = ${JSON.stringify(this.availableDevices)}`);
} | https://gitcode.com/arkui-x/samples | 1a1ad4d781126a3b098a7fc9e3f30836209ec2ce | gitcode |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/PlanQuestionSource.ets | arkts | peekNextWordIdForTest | Test seam — peek at the next slot without advancing. | peekNextWordIdForTest(): string {
const slot: WordSlot | undefined = this.peekSlot();
return slot !== undefined ? slot.wordId : '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left peekNextWordIdForTest 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#... | peekNextWordIdForTest(): string {
const slot: WordSlot | undefined = this.peekSlot();
return slot !== undefined ? slot.wordId : '';
} | https://github.com/terryma2024/happyword | ed6a11ed1c2e65e4017d1fe385c90a96d723716b | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | syncRelaysFromCloud | 从 cryptoparams 读取 relay JSON → 合并到本地 rustdeskrelays 表 | syncRelaysFromCloud(): RustDeskRelayConfig[] {
const result: RustDeskRelayConfig[] = [];
if (!this.store) { return result; }
try {
const predicates = new relationalStore.RdbPredicates('cryptoparams');
predicates.equalTo('key', 'rustdesk_relays');
const rs = this.store.querySync(predicate... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left syncRelaysFromCloud AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left RustDeskRela... | syncRelaysFromCloud(): RustDeskRelayConfig[] {
const result: RustDeskRelayConfig[] = [];
if (!this.store) { return result; }
try {
const predicates = new relationalStore.RdbPredicates('cryptoparams');
predicates.equalTo('key', 'rustdesk_relays');
const rs = this.store.querySync(predicate... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | ff14e00caa8b1ff8397a5a323faa34aff8f39ee5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an array-like object.
@param { ArrayLike<number> } arr - An array-like object to convert to an array.
@returns { Uint8ClampedArray } - A new Uint8ClampedArray
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: ArrayLike<number>): Uint8ClampedArray {
const len = arr.length;
const result = new Uint8ClampedArray(len);
for (let i: int = 0; i < len; ++i) {
result.setUnsafeClamp(i, Uint8ClampedArray.toUint8Clamped(arr[i]))
}
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: ArrayLike<number>): Uint8ClampedArray {
const len = arr.length;
const result = new Uint8ClampedArray(len);
for (let i: int = 0; i < len; ++i) {
result.setUnsafeClamp(i, Uint8ClampedArray.toUint8Clamped(arr[i]))
}
return result;
} | https://gitcode.com/iop123123/arkts-static-skills | 7f51d2fba2645a507aacdcb7a57eb95904ae1f26 | gitcode |
PollenWang6/HiXD | entry/src/main/ets/utils/AccentColors.ets | arkts | init | 初始化(应用启动时调用一次) | static init(): void {
const custom: string = PreferenceUtil.getString(CUSTOM_KEY);
if (custom.length === 7 && custom.startsWith('#')) {
AppStorage.setOrCreate('accent_color', custom);
AppStorage.setOrCreate('accent_index', -1);
return;
}
const saved: number = PreferenceUtil.getNumber... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | static init(): void {
const custom: string = PreferenceUtil.getString(CUSTOM_KEY);
if (custom.length === 7 && custom.startsWith('#')) {
AppStorage.setOrCreate('accent_color', custom);
AppStorage.setOrCreate('accent_index', -1);
return;
}
const saved: number = PreferenceUtil.getNumber... | https://github.com/PollenWang6/HiXD | 59ed2fdd37dd849866b1ca533ae0936c552ae7c9 | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets | arkts | updateSafeAreaValues | 更新预计算的安全区值(单位:vp) | private updateSafeAreaValues(): void {
if (!this.uiContext) return;
// 顶部安全区(状态栏)
this.mainWindowInfo.safeAreaTop = this.uiContext.px2vp(this.mainWindowInfo.AvoidSystem?.topRect.height ?? 0);
// 底部安全区
this.mainWindowInfo.safeAreaBottom = this.uiContext.px2vp(this.mainWindowInfo.AvoidSystem?.botto... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateSafeAreaValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void... | private updateSafeAreaValues(): void {
if (!this.uiContext) return;
// 顶部安全区(状态栏)
this.mainWindowInfo.safeAreaTop = this.uiContext.px2vp(this.mainWindowInfo.AvoidSystem?.topRect.height ?? 0);
// 底部安全区
this.mainWindowInfo.safeAreaBottom = this.uiContext.px2vp(this.mainWindowInfo.AvoidSystem?.botto... | https://github.com/ZestBox-18/kitebook-frontend | 2b1aa63a38cb667b8502bbee5e1a6d7ebf847500 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/ReminderDAO.ets | arkts | insertMany | 批量插入提醒 | static async insertMany(reminders: Reminder[]): Promise<void> {
await DAOHelper.transaction(async () => {
for (const reminder of reminders) {
await ReminderDAO.insert(reminder);
}
}, '[ReminderDAO] 批量插入');
} | 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 insertMany AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reminders AST#identifier#Right AST#:#Left : A... | static async insertMany(reminders: Reminder[]): Promise<void> {
await DAOHelper.transaction(async () => {
for (const reminder of reminders) {
await ReminderDAO.insert(reminder);
}
}, '[ReminderDAO] 批量插入');
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 60a8e3cf0b17eb8b11eb87940332285f137ce725 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/XAxis.ets | arkts | getLabelXOffset | 获取标签在 X 轴上的偏移量
@returns 偏移量 | public getLabelXOffset(): number {
return this.mLabelXOffset;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabelXOffset 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... | public getLabelXOffset(): number {
return this.mLabelXOffset;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c194224d6396757550caa19f95049c8132d23fec | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets | arkts | executeFallbackStrategy | 执行降级策略 | private async executeFallbackStrategy(failureType: StartupFailureType): Promise<RecoveryResult> {
logger.info('StartupRecovery', '📉 执行降级策略');
try {
switch (failureType) {
case StartupFailureType.PERMISSION_FAILURE:
// 进入受限模式
logger.info('StartupRecovery', '进入受限模式');
... | 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 executeFallbackStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left failureType AST#identifier#Ri... | private async executeFallbackStrategy(failureType: StartupFailureType): Promise<RecoveryResult> {
logger.info('StartupRecovery', '📉 执行降级策略');
try {
switch (failureType) {
case StartupFailureType.PERMISSION_FAILURE:
// 进入受限模式
logger.info('StartupRecovery', '进入受限模式');
... | https://github.com/DaLongZhuaZi/manxia | 9aba851e124b893f3c276de0808b24ed2f444cf3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSource.ets | arkts | browseSource | 获取浏览源的漫画列表(热门/最新)
使用 mutation,input 需要 source 字段而不是 sourceId | public async browseSource(sourceId: string, type: 'POPULAR' | 'LATEST' = 'POPULAR', page: number = 1): Promise<ComicInfo[]> {
const query = `
mutation FetchSourceManga($source: LongString!, $type: FetchSourceMangaType!, $page: Int!) {
fetchSourceManga(input: { source: $source, type: $type, page: $pa... | 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 browseSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public async browseSource(sourceId: string, type: 'POPULAR' | 'LATEST' = 'POPULAR', page: number = 1): Promise<ComicInfo[]> {
const query = `
mutation FetchSourceManga($source: LongString!, $type: FetchSourceMangaType!, $page: Int!) {
fetchSourceManga(input: { source: $source, type: $type, page: $pa... | https://github.com/DaLongZhuaZi/manxia | 6d3044c1a11032127e175715a4fb44372760ecda | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/PermissionDemo.ets | arkts | requestPermissionsFromUser | 申请指定的用户授权 | requestPermissionsFromUser(permissions: Array<Permissions>): void {
let context: Context = this.getUIContext().getHostContext()!
/*
* abilityAccessCtrl.createAtManager() - 创建权限管理器
* requestPermissionsFromUser() - 根据授权状态,弹出指定权限的授权框(返回值是一个 PermissionRequestResult 对象)
* permissions - 此次请求的每个... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left requestPermissionsFromUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left permissions AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Arra... | requestPermissionsFromUser(permissions: Array<Permissions>): void {
let context: Context = this.getUIContext().getHostContext()!
/*
* abilityAccessCtrl.createAtManager() - 创建权限管理器
* requestPermissionsFromUser() - 根据授权状态,弹出指定权限的授权框(返回值是一个 PermissionRequestResult 对象)
* permissions - 此次请求的每个... | https://github.com/webabcd/HarmonyDemo | bcc4d40f45b27283a02e9d5dc940d54919e8256e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getLiteral | Returns literal of type if exists
@returns {string} type literal
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override getLiteral(): string {
return "null"
} | 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 getLiteral AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public override getLiteral(): string {
return "null"
} | https://gitcode.com/iop123123/arkts-static-skills | 4237f7ac133ae5900490da81603b5e6fc0f7e3b8 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets | arkts | get | GET请求 | async get<T>(url: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<ApiResponse<T>> {
let queryString = ''
if (params) {
queryString = '?' + Object.entries(params)
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
.join('&')
}
re... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#Right AST... | async get<T>(url: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<ApiResponse<T>> {
let queryString = ''
if (params) {
queryString = '?' + Object.entries(params)
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
.join('&')
}
re... | https://github.com/David8Idira/AI-OA | c29cf29544f8ebf6250b7a4a3186157fadaba9cd | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/AudioService.ets | arkts | play | Fire-and-forget playback. Safe to call before `preload` resolves — if
the slot isn't `ready` yet, the call is dropped on the floor rather
than queued, because the common case (a tap burst during a crit) is
ok to drop: the visual feedback is the dominant signal and stacking
up stale audio would sound worse than silence. | play(key: string): void {
if (this.disposed) {
return;
}
const slot: PlayerSlot | undefined = this.slots.get(key);
if (slot === undefined) {
console.warn(`AudioService.play: key "${key}" not preloaded, dropping.`);
return;
}
if (slot.muted || !slot.ready) {
return;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left play AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Right... | play(key: string): void {
if (this.disposed) {
return;
}
const slot: PlayerSlot | undefined = this.slots.get(key);
if (slot === undefined) {
console.warn(`AudioService.play: key "${key}" not preloaded, dropping.`);
return;
}
if (slot.muted || !slot.ready) {
return;
... | https://github.com/terryma2024/happyword | 1057b6e7bcb10b8c066ddd2c58cff6deb0b55287 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterEngineCache.ets | arkts | clear | 移除cachedEngines所有中所有的FlutterEngine | clear():void {
this.cachedEngines.clear();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | clear():void {
this.cachedEngines.clear();
} | https://gitee.com/openharmony-sig/flutter_engine.git | 9dc7024b72f94b8d21a9e6ecfe51d9e8de6989ca | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | copyEBookFiles | 复制电子书文件(使用文件夹结构:每个电子书一个文件夹,包含文件本身和封面)
[重构] 与漫画保持一致的存储结构 | private async copyEBookFiles(targetDir: string, ebookList: EBookBackupItem[]): Promise<void> {
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
const sandboxEbooksDir = `${this.sandboxManager.getDirectory('files')}/ebooks`;
try {
let copiedCount = 0;
const failures: ... | 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 copyEBookFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetDir AST#identifier#Right AST#ERROR#Left AST#:#L... | private async copyEBookFiles(targetDir: string, ebookList: EBookBackupItem[]): Promise<void> {
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
const sandboxEbooksDir = `${this.sandboxManager.getDirectory('files')}/ebooks`;
try {
let copiedCount = 0;
const failures: ... | https://github.com/DaLongZhuaZi/manxia | 7c6d4a2c618d9ab9b0d18da868437ef1f7bf780f | github |
lidaixian999/Smart_Car | entry/src/main/ets/model/SsapManager.ets | arkts | stringToArrayBuffer | 工具函数:字符串转ArrayBuffer | function stringToArrayBuffer(str: string): ArrayBuffer {
const encoder: util.TextEncoder = new util.TextEncoder();
const uint8Array: Uint8Array = encoder.encodeInto(str);
return uint8Array.buffer;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left stringToArrayBuffer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left str AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function stringToArrayBuffer(str: string): ArrayBuffer {
const encoder: util.TextEncoder = new util.TextEncoder();
const uint8Array: Uint8Array = encoder.encodeInto(str);
return uint8Array.buffer;
} | https://github.com/lidaixian999/Smart_Car | f70f20fff6e92fbd16ee9913a8d04d5c24359c1d | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGRoot.ets | arkts | setWidth | 设置SVG图形的宽度
@param width 宽度 | public setWidth(width: number): void {
this.attributesObj[SVGXMLConstants.SVG_WIDTH_ATTRIBUTE] = width;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public setWidth(width: number): void {
this.attributesObj[SVGXMLConstants.SVG_WIDTH_ATTRIBUTE] = width;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 748c165082af1e8ad10317869955708a54ae6f59 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/PredicateBuilder.ets | arkts | toPredicateArray | 将 ValueType 数组转换为 RdbPredicates 支持的数组 | private static toPredicateArray(values: Array<ValueType>): Array<relationalStore.ValueType> {
const result: Array<relationalStore.ValueType> = []
for (let i = 0; i < values.length; i++) {
const converted = PredicateBuilder.singleValueToPredicateValue(values[i])
result.push(converted)
}
ret... | 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 toPredicateArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#L... | private static toPredicateArray(values: Array<ValueType>): Array<relationalStore.ValueType> {
const result: Array<relationalStore.ValueType> = []
for (let i = 0; i < values.length; i++) {
const converted = PredicateBuilder.singleValueToPredicateValue(values[i])
result.push(converted)
}
ret... | https://github.com/offlinecat-dev/OCNetORM | 28c4b8310dd664456b41ed7f040b7cf3b0736084 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | parseBookInfoAsync | 解析书籍详情
注意:即使name规则为空,也会尝试解析其他字段(如tocUrl),返回部分结果
调用方可以使用fallback信息补充缺失的字段 | private async parseBookInfoAsync(html: string, baseUrl: string, bookUrl: string): Promise<LegadoBook | null> {
const rule = this.source.ruleBookInfo;
const analyzer = this.createRuleAnalyzer();
let contentToAnalyze = html;
if (rule && rule.init) {
const initAnalyzer = this.createRuleAnalyzer()... | 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 parseBookInfoAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Le... | private async parseBookInfoAsync(html: string, baseUrl: string, bookUrl: string): Promise<LegadoBook | null> {
const rule = this.source.ruleBookInfo;
const analyzer = this.createRuleAnalyzer();
let contentToAnalyze = html;
if (rule && rule.init) {
const initAnalyzer = this.createRuleAnalyzer()... | https://github.com/DaLongZhuaZi/manxia | d4773622a709726c6f3dd6333aab8d0c8b0fffed | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/ContactManager.ets | arkts | searchContacts | 搜索联系人 | public async searchContacts(keyword: string): Promise<ContactsItem[]> {
if (!keyword || keyword.trim() === '') {
return await this.getAllContacts();
}
try {
return await this.contactDao.searchContacts(keyword);
} catch (error) {
console.error('[ContactManager] 搜索联系人失败:', error);
... | 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 searchContacts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public async searchContacts(keyword: string): Promise<ContactsItem[]> {
if (!keyword || keyword.trim() === '') {
return await this.getAllContacts();
}
try {
return await this.contactDao.searchContacts(keyword);
} catch (error) {
console.error('[ContactManager] 搜索联系人失败:', error);
... | https://gitcode.com/openharmony/codelabs | c15fda4502d5328f43ef3190b7e8c6d77d5ef360 | gitcode |
xiaofenger_705/protobuf-arkts-generator | test/Address.ets | arkts | traverse | ⭐ Core: traverse method for Visitor pattern | traverse(v: Visitor): void {
if (this.street !== '') {
v.visitString(this.street, 1)
}
if (this.city !== '') {
v.visitString(this.city, 2)
}
if (this.zipCode !== '') {
v.visitString(this.zipCode, 3)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left traverse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Visitor AST#identifier#Right AST#)#Left ) AST#)#Ri... | traverse(v: Visitor): void {
if (this.street !== '') {
v.visitString(this.street, 1)
}
if (this.city !== '') {
v.visitString(this.city, 2)
}
if (this.zipCode !== '') {
v.visitString(this.zipCode, 3)
}
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 167c72ea685676bb705dbc31674f888204954ce5 | gitcode |
openharmony-sig/flutter_audioplayers | packages/audioplayers_ohos/ohos/src/main/ets/components/plugin/player/SoundPoolPlayer.ets | arkts | getSoundPoolWrapper | Get the [SoundPoolWrapper] with the given [audioContext]. | getSoundPoolWrapper(audioContext: AudioContextOhos): SoundPoolWrapper | null {
let attrs = audioContext.buildAttributes();
let key = attrs.usage + "" + attrs.rendererFlags;
return this.soundPoolWrappers.hasKey(key) ? this.soundPoolWrappers.get(key) : null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSoundPoolWrapper AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left audioContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | getSoundPoolWrapper(audioContext: AudioContextOhos): SoundPoolWrapper | null {
let attrs = audioContext.buildAttributes();
let key = attrs.usage + "" + attrs.rendererFlags;
return this.soundPoolWrappers.hasKey(key) ? this.soundPoolWrappers.get(key) : null;
} | https://gitee.com/openharmony-sig/flutter_audioplayers.git | dda0b705c8cb5c17176d28f1c7b0e62f44b0853d | gitee |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/router/XRouter.ets | arkts | getRouteNameFirstIndex | 获取路由中第一个匹配的索引 | public static getRouteNameFirstIndex(routeName: string): number {
const indexs = XRouter.getRouter().getIndexByName(routeName)
if (indexs.length) {
return indexs[0]
}
return -1
} | 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 getRouteNameFirstIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routeName AST#identifier#Right AST#ERROR#Left A... | public static getRouteNameFirstIndex(routeName: string): number {
const indexs = XRouter.getRouter().getIndexByName(routeName)
if (indexs.length) {
return indexs[0]
}
return -1
} | https://github.com/iHongRen/harmony-study-demo | f41d2032671f3c186ed69329d31af55297d0a30b | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getWindowHeightPx | 获取屏幕高度
@returns | public getWindowHeightPx(): number {
return WindowUtils.windowHeight_px
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWindowHeightPx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number A... | public getWindowHeightPx(): number {
return WindowUtils.windowHeight_px
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L195-L197 | c6d4ac99872e7f8c128168cec668875386592617 | github |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/main/MainNavigator.ets | arkts | toHome | 跳转到首页
@returns {void} 无返回值 | static toHome(): void {
navigateTo(MainRoutes.Home);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toHome 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_stat... | static toHome(): void {
navigateTo(MainRoutes.Home);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 5832cfe867ba9949452613c50b12ec7170740cff | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/ContactListPresenter.ets | arkts | onDeleteDialogCancel | Cancel button for deleting a dialog box. | onDeleteDialogCancel() {
HiLog.i(TAG, 'onDeleteDialogCancel !!!');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDeleteDialogCancel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | onDeleteDialogCancel() {
HiLog.i(TAG, 'onDeleteDialogCancel !!!');
} | https://gitee.com/openharmony/applications_contacts.git | 955a26fd130e211e648bae4ff082c9d8b95b434a | gitee |
azhu0001/localsend-harmony | entry/src/main/ets/model/FileReceiveQueueModel.ets | arkts | constructor | 文件总大小 | constructor(session: string, file: FileInfoModel, fileToken: string, otherside: string, remoteIp: string) {
this.session = session
this.file = file
this.fileToken = fileToken
this.otherside = otherside
this.total = file.size
this.remoteIp = remoteIp
} | 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#identifier#Left session AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#... | constructor(session: string, file: FileInfoModel, fileToken: string, otherside: string, remoteIp: string) {
this.session = session
this.file = file
this.fileToken = fileToken
this.otherside = otherside
this.total = file.size
this.remoteIp = remoteIp
} | https://gitcode.com/azhu0001/localsend-harmony | 9370f8e6cf0b157afa5ba8cf484d25b90d6db7ea | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/ComponentBase.ets | arkts | setXOffset | Sets the used x-axis offset for the labels on this axis.
@param xOffset | public setXOffset(xOffset: number): void {
this.mXOffset = Utils.handleDataValues(xOffset);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setXOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Righ... | public setXOffset(xOffset: number): void {
this.mXOffset = Utils.handleDataValues(xOffset);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fd1101a93a958db858499f182b93218bebea8ce3 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | fill | Fills the BigUint64Array with specified value
@param value new valuy
@returns modified BigUint64Array | public fill(value: BigInt, start: number): BigUint64Array {
return this.fill(new BigInt(value), start as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public fill(value: BigInt, start: number): BigUint64Array {
return this.fill(new BigInt(value), start as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4c0f234819981d75532963f64324abd7745e01db | gitee |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets | arkts | registerSessionListener | 注册AVSession实例事件
播控中心有多种操作,播放、暂停、停止、下一首、上一首、拖进度、标记喜好、播放循环模式切换、快进、快退
@returns {void} | registerSessionListener(eventListener: AVSessionEventListener): void {
// 播放
this.session?.on('play', () => {
logger.info('avsession on play');
eventListener.onPlay();
});
// 暂停
this.session?.on('pause', () => {
logger.info('avsession on pause');
eventListener.onPause();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerSessionListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventListener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AVSessionEventListener ... | registerSessionListener(eventListener: AVSessionEventListener): void {
// 播放
this.session?.on('play', () => {
logger.info('avsession on play');
eventListener.onPlay();
});
// 暂停
this.session?.on('pause', () => {
logger.info('avsession on pause');
eventListener.onPause();
... | https://gitcode.com/arkui-x/samples | 1eafc7af77985ae31bc97dbd76cecd7ffc66cbc7 | gitcode |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/utils/fileUtils.ets | arkts | saveUserData | 存储用户数据(核心方法)
@param userData 后端返回的用户数据 | static async saveUserData(userData: User): Promise<boolean> {
try {
const preferences = await PreferencesUtil.getPreferencesInstance();
// Preferences 不支持直接存储对象,需要序列化为 JSON 字符串
await preferences.put('user_data', JSON.stringify(userData));
await preferences.flush(); // 强制持久化到本地
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 saveUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userData AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async saveUserData(userData: User): Promise<boolean> {
try {
const preferences = await PreferencesUtil.getPreferencesInstance();
// Preferences 不支持直接存储对象,需要序列化为 JSON 字符串
await preferences.put('user_data', JSON.stringify(userData));
await preferences.flush(); // 强制持久化到本地
return... | https://github.com/luojiang001/Pulse | fc91a892c5125dbfc01ae48f9c8308b8b7588c3b | github |
openharmony/developtools_ace_ets2bundle | compiler/sample/pages/testcases/showcaseCovid19.ets | arkts | reverseDirection | reverse sorting direction of visible countries | reverseDirection(): void {
this.countriesSortDirection *= -1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reverseDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | reverseDirection(): void {
this.countriesSortDirection *= -1;
} | https://gitee.com/openharmony/developtools_ace_ets2bundle.git | 25971c7f75e9b98e4f6139a62f340bc331cce4bd | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/model/ReminderModel.ets | arkts | getAllReminderConfigs | 获取所有提醒配置 | getAllReminderConfigs(): ReminderConfig[] {
return Array.from(this.settings.values());
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllReminderConfigs 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... | getAllReminderConfigs(): ReminderConfig[] {
return Array.from(this.settings.values());
} | https://gitcode.com/openharmony/codelabs | 8c6a7bc77b8af19d7cdd400a4aa1acd6c635c297 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/SettingSlider.ets | arkts | logToLinear | 将实际值转换为线性滑块位置 (0-100)
@param logValue 实际值(对数缩放的)
@param min 最小实际值
@param max 最大实际值
@returns 线性滑块位置 (0-100) | static logToLinear(logValue: number, min: number, max: number): number {
if (logValue <= min) return 0;
if (logValue >= max) return 100;
const minLog = Math.log(min);
const maxLog = Math.log(max);
const logRange = maxLog - minLog;
// 对数值 -> 线性位置 (0-100)
const normalizedValue = (Math.log(... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left logToLinear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left logValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | static logToLinear(logValue: number, min: number, max: number): number {
if (logValue <= min) return 0;
if (logValue >= max) return 100;
const minLog = Math.log(min);
const maxLog = Math.log(max);
const logRange = maxLog - minLog;
// 对数值 -> 线性位置 (0-100)
const normalizedValue = (Math.log(... | https://github.com/AlkaidLab/moonlight-harmony | 346fdea64ccfc6c604ff92f003028ca4dc7d1807 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/BatchInsertResult.ets | arkts | isAllFailed | 检查是否全部失败
@returns 是否全部失败 | isAllFailed(): boolean {
return this.insertedCount === 0 && this.totalCount > 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAllFailed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isAllFailed(): boolean {
return this.insertedCount === 0 && this.totalCount > 0
} | https://github.com/offlinecat-dev/OCNetORM | 809d58a42574baeb9ddc20775f4b222f5d953211 | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | moveTopicNodeWithCookie | Move a topic to another node. Like edit, this is author-only and available only within the 600s
window; the move form lives under 管理功能 on the topic page (NOT the edit form) and, like edit, takes
its once as a ?once= query param (no hidden once input). GET /move/topic/<id> for the once + to verify
the form is served, th... | async moveTopicNodeWithCookie(cookie: string, topicId: number, destinationNode: string): Promise<number> {
const cleanNode = (destinationNode || '').trim()
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
if (!cleanNode) {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left moveTopicNodeWithCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier#Right AST#type_annotation#Left AS... | async moveTopicNodeWithCookie(cookie: string, topicId: number, destinationNode: string): Promise<number> {
const cleanNode = (destinationNode || '').trim()
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
if (!cleanNode) {
... | https://github.com/honjow/Next2V | 65ff8191c749b806e847e1548a45dfe220b52ff0 | github |
genjishare/snake-game | entry/src/main/ets/entryability/EntryAbility.ets | arkts | restoreContinuationGameDataObject | 恢复接续的数据 | restoreContinuationGameDataObject(want: Want) {
if (!want.parameters || !want.parameters.continueSessionId) {
console.error(TAG + 'missing continueSessionId');
return;
}
// 2.1 调用create接口创建并得到一个分布式数据对象实例
let restoredGameData = new RestoredGameData(undefined);
continueGameDataObject = d... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left restoreContinuationGameDataObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AS... | restoreContinuationGameDataObject(want: Want) {
if (!want.parameters || !want.parameters.continueSessionId) {
console.error(TAG + 'missing continueSessionId');
return;
}
// 2.1 调用create接口创建并得到一个分布式数据对象实例
let restoredGameData = new RestoredGameData(undefined);
continueGameDataObject = d... | https://github.com/genjishare/snake-game | 090f8548affa9ff900659c8db19f4caf5dbd803d | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicPlayerService.ets | arkts | getCurrentState | 获取当前播放器状态 | getCurrentState(): string {
return this.currentState;
} | AST#program#Left AST#ERROR#Left 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#string#Left string AST#string#Right AST#ERROR#Right AST#statem... | getCurrentState(): string {
return this.currentState;
} | https://github.com/cpdd5201314/harmonyOS-music-app | 86a1114319a69f73e1b3734b3957660683eff8f6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyStore.ets | arkts | saveKeys | 批量更新按键(编辑模式完成后一次性保存) | static async saveKeys(keys: CustomKeyDef[]): Promise<void> {
const profile = await CustomKeyStore.getActiveProfile();
profile.keys = keys;
await CustomKeyStore.save();
} | 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 saveKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#:#Left : AST#:#Ri... | static async saveKeys(keys: CustomKeyDef[]): Promise<void> {
const profile = await CustomKeyStore.getActiveProfile();
profile.keys = keys;
await CustomKeyStore.save();
} | https://github.com/AlkaidLab/moonlight-harmony | e71f90eaf9f41c07aab512c3d62faebd3db389d8 | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | splitNumber | 粘贴插入位置及附近数字小数点判断及转换
@param numberArr: 操作的字符数组
@param setIndex: 位置索引
@returns 插入后获取的字符串 | public static splitNumber(numberArr: string[], setIndex: number): string {
numberArr = CommonUtil.formatPasteNumber(numberArr, setIndex);
// 将粘贴内容与前面的数字拼接并去除逗号和0
let frontNum: string = '';
if ((numberArr[setIndex].length > 1 && numberArr[setIndex][0] === '.') ||
(numberArr[setIndex].length > 2 &... | 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 splitNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left numberArr AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public static splitNumber(numberArr: string[], setIndex: number): string {
numberArr = CommonUtil.formatPasteNumber(numberArr, setIndex);
// 将粘贴内容与前面的数字拼接并去除逗号和0
let frontNum: string = '';
if ((numberArr[setIndex].length > 1 && numberArr[setIndex][0] === '.') ||
(numberArr[setIndex].length > 2 &... | https://gitee.com/openharmony-sig/applications_calculator.git | 7c60c9529fa2f59d0b68b794b71e1b9c4775a1e2 | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/GridDemo3.ets | arkts | exchangeData | 交换数据(this.array 是 @State 装饰的,更新后会刷新绑定的组件) | exchangeData(index1: number, index2: number) {
let temp = this.array[index1];
this.array[index1] = this.array[index2];
this.array[index2] = temp;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left exchangeData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ... | exchangeData(index1: number, index2: number) {
let temp = this.array[index1];
this.array[index1] = this.array[index2];
this.array[index2] = temp;
} | https://github.com/webabcd/HarmonyDemo | e99a5717c567006d9f89003d1b205e2a81c0ee07 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Math.ets | arkts | sign | @param x arbitrary number
@returns -1 if `x` is negative, 1 if `x` is positive, 0 if `x` is close to zero (epsilon is 1e-13) | public static sign(x: double): double {
if (isNaN(x)) {
return x;
}
return sign(x).toDouble();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left sign AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#ident... | public static sign(x: double): double {
if (isNaN(x)) {
return x;
}
return sign(x).toDouble();
} | https://gitcode.com/iop123123/arkts-static-skills | 9e17bf6683ae44cd29b74154743af1d6b8487f8b | gitcode |
arkui-x/samples | CodeLab/Cases/feature/componentstack/src/main/ets/model/DataSource.ets | arkts | pushData | 存储数据到懒加载数据源中 | pushData(data: ProductDataModel[]): void {
this.ProductList.push(...data);
this.notifyDataReload();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ProductDataModel ... | pushData(data: ProductDataModel[]): void {
this.ProductList.push(...data);
this.notifyDataReload();
} | https://gitcode.com/arkui-x/samples | 6e2d84f7dcea11e0c188dbb04aefdad34d8b5fe9 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.