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 |
|---|---|---|---|---|---|---|---|---|---|---|
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitMapStringBool | 访问 map<string, bool> 字段
JSON: object with boolean values | visitMapStringBool(value: Map<string, boolean>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
obj[k] = v as Object
})
this.json[fieldName] = obj as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapStringBool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifier... | visitMapStringBool(value: Map<string, boolean>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
obj[k] = v as Object
})
this.json[fieldName] = obj as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 1e6b61081f0e5e90ed708f2018939704ba8c4509 | gitcode |
darcycui/DarcyHarmonyNext | entry/src/main/ets/learn/Person.ets | arkts | fullName | 普通方法 TODO:不需要function关键字
默认可见性为 public | fullName(): string {
return this.name + " " + this.supername;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fullName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | fullName(): string {
return this.name + " " + this.supername;
} | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/learn/Person.ets#L33-L35 | 5a53a8387534fde3fcad86711e4555228c2f5ad0 | github |
openharmony/applications_app_samples | code/BasicFeature/Ability/AbilityRuntime/entry/src/main/ets/abilitylifecyclecallback/AbilityLifecycleCallback.ets | arkts | onAbilityWillSaveState | 注册监听应用上下文的生命周期后,在UIAbility的[onSaveState]触发前回调。 | onAbilityWillSaveState(ability: UIAbility) {
hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onAbilityWillSaveState.');
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAbilityWillSaveState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ability AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIAbility AST#i... | onAbilityWillSaveState(ability: UIAbility) {
hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onAbilityWillSaveState.');
}, | https://github.com/openharmony/applications_app_samples | 18827f59688cbe71e6a6644d00d61b016e280ede | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/AppStateService.ets | arkts | addListener | 添加状态变化监听器 | addListener(callback: (state: AppState) => void): void {
this.listeners.add(callback);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left addListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | addListener(callback: (state: AppState) => void): void {
this.listeners.add(callback);
} | https://github.com/AlkaidLab/moonlight-harmony | ef37bfa2c9258ffdfebe25a00c8d370d52c1f1a2 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | setNamespace | Sets the namespace for the current XML element.
@param {string} prefix - The namespace prefix to be set.
@param {string} namespace - The namespace URI associated with the prefix. | public setNamespace(prefix: string, namespace: string): void {
this.checkEmptyParameter(prefix);
if (namespace.length === 0) {
throw createBusinessError(TypeErrorCodeId,
`Parameter error. The type of ${namespace} must be string`);
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNamespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | public setNamespace(prefix: string, namespace: string): void {
this.checkEmptyParameter(prefix);
if (namespace.length === 0) {
throw createBusinessError(TypeErrorCodeId,
`Parameter error. The type of ${namespace} must be string`);
}
... | https://gitcode.com/iop123123/arkts-static-skills | e2afcb4b6f3ce552c740f8bf56e355fbfb9aea2c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new IndexOutOfBoundsError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super(message, options)
this.name = "IndexOutOfBoundsError"
} | 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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super(message, options)
this.name = "IndexOutOfBoundsError"
} | https://gitcode.com/iop123123/arkts-static-skills | f591e271770df8283e573736bbd8a1b5210df4d8 | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | isLoggedIn | Check if user is logged in. | static async isLoggedIn(): Promise<boolean> {
try {
if (!UserManager.dataPreferences) {
return false;
}
const currentUser = await UserManager.dataPreferences.get(UserManager.KEY_CURRENT_USER, '') as string;
return currentUser !== '';
} catch (err) {
Logger.error('UserMan... | 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 isLoggedIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | static async isLoggedIn(): Promise<boolean> {
try {
if (!UserManager.dataPreferences) {
return false;
}
const currentUser = await UserManager.dataPreferences.get(UserManager.KEY_CURRENT_USER, '') as string;
return currentUser !== '';
} catch (err) {
Logger.error('UserMan... | https://github.com/Harrisonls2004/WaterFlow | b674900ae7a7f63738bf63718f28ef9857939c69 | github |
LZZLHY/hlib | entry/src/main/ets/utils/Layout.ets | arkts | contentMaxWidth | 内容容器最大宽度(vp):sm 不限,md+ 限宽避免过宽行长。 | static contentMaxWidth(bp: Breakpoint): number {
if (bp === 'sm') return -1; // 不限制;UI 层判断 <0 不施加
if (bp === 'md') return 720;
if (bp === 'lg') return 960;
return 1080;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left contentMaxWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Br... | static contentMaxWidth(bp: Breakpoint): number {
if (bp === 'sm') return -1; // 不限制;UI 层判断 <0 不施加
if (bp === 'md') return 720;
if (bp === 'lg') return 960;
return 1080;
} | https://github.com/LZZLHY/hlib | a06fc3e280b45de4d4a810a7d9866a59bfe33afc | github |
xblLab/HarmonyProjectTemplate | commons/lib_common/src/main/ets/utils/FileUtils.ets | arkts | handleUri | 写入沙箱
@param uri
@returns | static handleUri(uri: string) {
if (!uri) {
return '';
}
let file: fs.File | null = null;
try {
file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
const newPath: string = getContext().filesDir + `/${util.generateRandomUUID(false)}.png`;
fs.copyFileSync(file.fd, newPath);
ret... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left handleUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static handleUri(uri: string) {
if (!uri) {
return '';
}
let file: fs.File | null = null;
try {
file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
const newPath: string = getContext().filesDir + `/${util.generateRandomUUID(false)}.png`;
fs.copyFileSync(file.fd, newPath);
ret... | https://github.com/xblLab/HarmonyProjectTemplate | 6c787a58724aa0babccb1fcd2204827076fbb47e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<int> } items - a set of elements to include in the new array object.
@returns { Uint16Array } - a new Uint16Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<int>): Uint16Array {
let res = new Uint16Array(items.length.toInt())
res.ofInt(stub.toValueArray(items))
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 static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<int>): Uint16Array {
let res = new Uint16Array(items.length.toInt())
res.ofInt(stub.toValueArray(items))
return res
} | https://gitcode.com/iop123123/arkts-static-skills | 96661e5e6130de807a0e9b073782eb5ee1c2cdda | gitcode |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityLifecycle/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | [EndExclude onWindowStageWillDestroy]
[EndExclude onWindowStageCreate]
[EndExclude onWindowStageDestroy]
[StartExclude onDestroy] | onWindowStageCreate(windowStage: window.WindowStage): void {
// [StartExclude onWindowStageCreate]
// 加载UI资源
// [EndExclude onWindowStageCreate]
// [StartExclude onWindowStageDestroy]
// [StartExclude onWindowStageCreate]
this.windowStage = windowStage;
// [EndExclude onWindowStageCreate]... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | onWindowStageCreate(windowStage: window.WindowStage): void {
// [StartExclude onWindowStageCreate]
// 加载UI资源
// [EndExclude onWindowStageCreate]
// [StartExclude onWindowStageDestroy]
// [StartExclude onWindowStageCreate]
this.windowStage = windowStage;
// [EndExclude onWindowStageCreate]... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | cd3babe58bd909d56e18b17099e902b8fdb64e60 | gitcode |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/ExportManager.ets | arkts | clearAllExportedFiles | 清空所有导出文件 | async clearAllExportedFiles(context: Context): Promise<number> {
try {
const files = await this.getExportedFiles(context);
let deletedCount = 0;
for (const fileName of files) {
const success = await this.deleteExportedFile(context, fileName);
if (success) {
deletedCoun... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAllExportedFiles AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST... | async clearAllExportedFiles(context: Context): Promise<number> {
try {
const files = await this.getExportedFiles(context);
let deletedCount = 0;
for (const fileName of files) {
const success = await this.deleteExportedFile(context, fileName);
if (success) {
deletedCoun... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | e0ff04748a03a1e7cfa793d94c1f07cf8453270a | github |
XHXYT/Pixark | entry/src/main/ets/components/BannerView.ets | arkts | clear | 删除全部数据 | public clear(): void {
this.empty()
this.refresh()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public clear(): void {
this.empty()
this.refresh()
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/components/BannerView.ets#L103-L106 | c85240df38dd0a3e4b64d91aa6aeff8e0cbeff2e | github |
fbinba3955/Flymby | common/src/main/ets/video/AvManager.ets | arkts | setAvSessionListener | 设置播控中心监听器 | setAvSessionListener(listener: AvSessionListener) {
this.mAvSessionListener = listener;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setAvSessionListener 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 AvSessionListene... | setAvSessionListener(listener: AvSessionListener) {
this.mAvSessionListener = listener;
} | https://github.com/fbinba3955/Flymby | e0b6101ee1f71183a61b43d52ef6f3ee7cb08a8d | github |
openharmony/distributedhardware_distributed_hardware_fwk | application/entry/src/main/ets/utils/TipsJumpUtils.ets | arkts | jumpAppByUri | Jump to Tips APP by uri
@param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext
@param uri: uri format:hwtips://?funNum=xxx&type=xxx | private static jumpAppByUri(context: startAbleContext, uri: string) {
hilog.info(DOMAIN_ID, TAG, 'try jump to tips app');
let want: Want = {
bundleName: APP_BUNDLE_NAME,
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri
};
context.startAbility(want... | 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 jumpAppByUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left... | private static jumpAppByUri(context: startAbleContext, uri: string) {
hilog.info(DOMAIN_ID, TAG, 'try jump to tips app');
let want: Want = {
bundleName: APP_BUNDLE_NAME,
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri
};
context.startAbility(want... | https://gitee.com/openharmony/distributedhardware_distributed_hardware_fwk.git | b947f4fa2e24468c92dc9d3c29180e8fdafb2dd0 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets | arkts | isInBoundsX | Checks if the provided entry object is in bounds for drawing considering the current animation phase.
@param e
@param set
@return | protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean {
if (e == null)
return false;
let entryIndex = dataSet.getEntryIndexByEntry(e);
if (e == null || entryIndex >= dataSet.getEntryCount() * (this.mAnimator ? this.mAnimator.getPhaseX() : 1)) {
... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left isInBoundsX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean {
if (e == null)
return false;
let entryIndex = dataSet.getEntryIndexByEntry(e);
if (e == null || entryIndex >= dataSet.getEntryCount() * (this.mAnimator ? this.mAnimator.getPhaseX() : 1)) {
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fa7ed681f8e7216af510ad6926371a27ec60848a | gitee |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Game24Logic.ets | arkts | getAllSolutions | 获取所有可能的解法
@param numbers 4个数字
@returns 所有可能的解法表达式数组 | static getAllSolutions(numbers: number[]): string[] {
const solutions: string[] = [];
Game24Logic.findSolutionsRecursive(numbers, solutions, []);
// 去重
const uniqueSolutions: string[] = [];
const solutionSet = new Set(solutions);
solutionSet.forEach(solution => uniqueSolutions.push(solution));... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllSolutions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_exp... | static getAllSolutions(numbers: number[]): string[] {
const solutions: string[] = [];
Game24Logic.findSolutionsRecursive(numbers, solutions, []);
// 去重
const uniqueSolutions: string[] = [];
const solutionSet = new Set(solutions);
solutionSet.forEach(solution => uniqueSolutions.push(solution));... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | c4b7de18c43eeb5f43d7da0a069895b3574461f9 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_complement/bitwise_complement_ulong.ets | arkts | main | ---
desc: check bitwise complement of unsigned long integer
--- | function main(): void {
const v: ulong = {{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: ulong = {{v.value}}
assert ~(v) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8e0d8f787d17d0207f50b726c66c8f230d597f65 | gitee |
Cool_foolisher1/ArkTSRepository | RandomNumberSimulator/entry/src/main/ets/common/utils/PreferenceUtils.ets | arkts | getInstance | 单例模式
@returns 保证整个应用只有一个PreferenceUtils实例 | private static getInstance(): PreferenceUtils {
if (!PreferenceUtils.INSTANCE) {
PreferenceUtils.INSTANCE = new PreferenceUtils()
}
return PreferenceUtils.INSTANCE
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | private static getInstance(): PreferenceUtils {
if (!PreferenceUtils.INSTANCE) {
PreferenceUtils.INSTANCE = new PreferenceUtils()
}
return PreferenceUtils.INSTANCE
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | f24fd510ad3b203b2f430142e65a46e807f8132b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getCurrentThemeConfigSync | 获取当前主题配置(同步) | public getCurrentThemeConfigSync(): ThemeConfig {
return this.getThemeConfigSync();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentThemeConfigSync 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#L... | public getCurrentThemeConfigSync(): ThemeConfig {
return this.getThemeConfigSync();
} | https://github.com/DaLongZhuaZi/manxia | 35ba5088a622144de0ce6c303d4f06436452a7b1 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | some | / === with element lambda functions ===
Checks that at least one element of Uint32Array satisfies the passed function
@param fn check function
@returns true if some element satisfies fn | public some(fn: (element: number, index: int, array: Uint32Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (fn(this.at(i), i, this)) {
return true
}
}
return false
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some 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#Righ... | public some(fn: (element: number, index: int, array: Uint32Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (fn(this.at(i), i, this)) {
return true
}
}
return false
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8f3f71532554c1e63024c3b39fe2d65e974b2635 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Parameter.ets | arkts | equals | Compares whether the current parameter object is equal to another object.
@param { Any } oth Another object used for comparison.
@returns { boolean } Returns true if the objects are equal, otherwise returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(oth: Any): boolean {
return oth instanceof TypeAPIParameter &&
this.paramType!.equals((oth as TypeAPIParameter).paramType!) &&
this.name == (oth as TypeAPIParameter).name &&
this.attributes == (oth as TypeAPIParameter).attributes
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left oth AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Any AST#id... | public equals(oth: Any): boolean {
return oth instanceof TypeAPIParameter &&
this.paramType!.equals((oth as TypeAPIParameter).paramType!) &&
this.name == (oth as TypeAPIParameter).name &&
this.attributes == (oth as TypeAPIParameter).attributes
} | https://gitcode.com/iop123123/arkts-static-skills | 1d17f335e612d466316f28273e614b321fed1441 | gitcode |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/http/AIStreamClient.ets | arkts | sendOnce | 非流式 AI 请求(用于 slug 生成等) | static async sendOnce(
endpoint: string,
apiKey: string,
model: string,
messages: ChatMessage[]
): Promise<string> {
const messagesArr: ChatMessagePayload[] = []
for (let i = 0; i < messages.length; i++) {
const msg = messages[i]
const item: ChatMessagePayload = {
role: m... | 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 sendOnce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left endpoint AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async sendOnce(
endpoint: string,
apiKey: string,
model: string,
messages: ChatMessage[]
): Promise<string> {
const messagesArr: ChatMessagePayload[] = []
for (let i = 0; i < messages.length; i++) {
const msg = messages[i]
const item: ChatMessagePayload = {
role: m... | https://github.com/encorexin/WordPressCMS | c8ecd29ac946461f902e74e20923c303d90ed265 | github |
FinalScave/SweetLine | platform/OHOS/demo/src/main/ets/pages/ResourceUtils.ets | arkts | readRawTextFile | Read a text file from the rawfile directory | static async readRawTextFile(context: Context | undefined, fileName: string): Promise<string> {
try {
if (context == undefined) {
return '';
}
const resourceMgr: resourceManager.ResourceManager = context.resourceManager;
const fileData = await resourceMgr.getRawFileContent(fileName... | 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 readRawTextFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left ... | static async readRawTextFile(context: Context | undefined, fileName: string): Promise<string> {
try {
if (context == undefined) {
return '';
}
const resourceMgr: resourceManager.ResourceManager = context.resourceManager;
const fileData = await resourceMgr.getRawFileContent(fileName... | https://github.com/FinalScave/SweetLine | 3354cb5d34978c40ba2b59f42b66568b54790702 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Image/AvifDecoder.ets | arkts | loadNativeDecoder | 加载Native AVIF解码器 | function loadNativeDecoder(): NativeAvifDecoder | null {
checkNativeModule();
return nativeDecoder;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left loadNativeDecoder 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#union_typ... | function loadNativeDecoder(): NativeAvifDecoder | null {
checkNativeModule();
return nativeDecoder;
} | https://github.com/DaLongZhuaZi/manxia | 53d5c8754ee96bb55a458e8eedfa05a8ac4a0c06 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getComicChapters | 获取漫画章节列表 | public async getComicChapters(comicId: string): Promise<ChapterInfo[]> {
try {
logger.info(TAG, `🔍 [数据库QUERY] 表名=chapter, 查询条件: comicId=${comicId}, 排序: chapterNumber ASC`);
const records = await this.databaseManager.querySql(
`SELECT id, comicId, externalId, title, chapterNumber AS cha... | 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 getComicChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#Left... | public async getComicChapters(comicId: string): Promise<ChapterInfo[]> {
try {
logger.info(TAG, `🔍 [数据库QUERY] 表名=chapter, 查询条件: comicId=${comicId}, 排序: chapterNumber ASC`);
const records = await this.databaseManager.querySql(
`SELECT id, comicId, externalId, title, chapterNumber AS cha... | https://github.com/DaLongZhuaZi/manxia | 91e60e95f961b14c2386fba0cb2bd13f16ecf154 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/components/TouchPointerView.ets | arkts | startDrag | Start drag operation | startDrag(): void {
if (this.instance === 0) return;
this.isDragging = true;
LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,
PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1);
if (this.listener) {
this.listener.onDragStart(this.pointerX, this.p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startDrag 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#Le... | startDrag(): void {
if (this.instance === 0) return;
this.isDragging = true;
LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,
PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1);
if (this.listener) {
this.listener.onDragStart(this.pointerX, this.p... | https://github.com/tangwengang-del/freerdp-harmonyos | 3b99fc0e24fa75d7eb94f9064b202112ce00db95 | github |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/library/src/main/ets/HttpProxyCacheServer.ets | arkts | getProxyUrl | Returns url that wrap original url and should be used for client (MediaPlayer, ExoPlayer, etc).
<p>
If parameter {@code allowCachedFileUri} is {@code true} and file for this url is fully cached
(it means method {@link #isCached(String)} returns {@code true}) then file:// uri to cached file will be returned.
@param url ... | public async getProxyUrl(url: string, allowCachedFileUri: boolean = true): Promise<string> {
let self = this;
if (allowCachedFileUri && self.isCached(url)) {
let cacheFile = self.getCacheFile(url);
self.touchFileSafely(cacheFile);
return cacheFile;
}
// 以下代码是为了确保服务器准备好了 不加这里的逻辑 很可能服务... | 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 getProxyUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#... | public async getProxyUrl(url: string, allowCachedFileUri: boolean = true): Promise<string> {
let self = this;
if (allowCachedFileUri && self.isCached(url)) {
let cacheFile = self.getCacheFile(url);
self.touchFileSafely(cacheFile);
return cacheFile;
}
// 以下代码是为了确保服务器准备好了 不加这里的逻辑 很可能服务... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | ed643a5081115515ca3c66144b74511fba4fef3d | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/FamilyPackService.ets | arkts | currentBlob | Synchronous read; bootstrapper calls this after `init`. | currentBlob(): FamilyPacksBlob | null {
return this.memoryBlob;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left currentBlob AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifier#Left FamilyPacksBlob AST#ide... | currentBlob(): FamilyPacksBlob | null {
return this.memoryBlob;
} | https://github.com/terryma2024/happyword | 6c6ba352e2543f16dfc5cfbefa369659987f815f | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | playWrong | 播放答错音效 | static playWrong(): void {
AudioManager.getInstance().playSound(SoundType.ANSWER_WRONG);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left playWrong 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_s... | static playWrong(): void {
AudioManager.getInstance().playSound(SoundType.ANSWER_WRONG);
} | https://github.com/the-wwyang/kids-learning-app | 3b5ebbcd95073bd222876db629cfd54f8580ad96 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/todo/components/TodoCardLlist.ets | arkts | build | 渲染待办卡片,并把手势事件透传给页面层。 | build() {
if (this.state.visibleTodoCards.length === 0) {
Column({ space: 12 }) {
Text("还没有待办事项")
.fontSize(16)
.fontColor(this.app.theme.palette.textSecondary)
Text("点击右下角按钮,创建待办事项")
.fontSize(14)
.fontColor(this.app.theme.palette.textTertiary)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left i... | build() {
if (this.state.visibleTodoCards.length === 0) {
Column({ space: 12 }) {
Text("还没有待办事项")
.fontSize(16)
.fontColor(this.app.theme.palette.textSecondary)
Text("点击右下角按钮,创建待办事项")
.fontSize(14)
.fontColor(this.app.theme.palette.textTertiary)
... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/todo/components/TodoCardLlist.ets#L369-L399 | 9f0fd64ab1a74f84a5d4fbdf0376539fa3186d36 | github |
LYM15/FireflyCompanion | entry/src/main/ets/view/MinePage.ets | arkts | showLogoutConfirm | 显示退出登录确认对话框 | showLogoutConfirm() {
this.showLogoutDialog = true;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showLogoutConfirm 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#... | showLogoutConfirm() {
this.showLogoutDialog = true;
} | https://github.com/LYM15/FireflyCompanion | dbf16e6a32709a26f1dc0a8730aa41be0b75b633 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | addParameter | Appends parameter to `this` type
@param param parameter to add
@returns this | public addParameter(param: ParameterCreator): LambdaTypeCreator throws {
this.checkNotCreated()
param.frozen.freeze()
if (param.name != null && param.name != '' + this.params.length()) {
throw new TypeAPICreateException("can't have such lambda parameter name")
}
t... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Pa... | public addParameter(param: ParameterCreator): LambdaTypeCreator throws {
this.checkNotCreated()
param.frozen.freeze()
if (param.name != null && param.name != '' + this.params.length()) {
throw new TypeAPICreateException("can't have such lambda parameter name")
}
t... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 14465d02e6edabcd83c9395573e70a0548f14615 | gitee |
Zhiyilang074811/enterprise-ai-assistant | harmony_app/entry/src/main/ets/models/Message.ets | arkts | createUserMessage | 创建用户消息 | static createUserMessage(content: string): Message {
return new Message(`user_${Date.now()}`, MessageType.USER, content);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createUserMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static createUserMessage(content: string): Message {
return new Message(`user_${Date.now()}`, MessageType.USER, content);
} | https://github.com/Zhiyilang074811/enterprise-ai-assistant | 0fde17c08f4a9e4e9b3483332e33dfa7c19d9aeb | github |
openharmony/arkui_ace_engine | advanced_ui_component/multinavigation/source/multinavigation.ets | arkts | isColumn | Check if is column
@returns true if is column | static isColumn(): boolean {
let isColumn: boolean = false;
try {
isColumn = display.isFoldable() && (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED ||
display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_HALF_FOLDED);
} catch (e) {
hilog.error(0x0000, TAG, '... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isColumn 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#bool... | static isColumn(): boolean {
let isColumn: boolean = false;
try {
isColumn = display.isFoldable() && (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED ||
display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_HALF_FOLDED);
} catch (e) {
hilog.error(0x0000, TAG, '... | https://gitee.com/openharmony/arkui_ace_engine.git | 77b3e01e55c2a3fab7b01da10305e4b7c9d58861 | gitee |
CLMC2025/Vignette | entry/src/main/ets/utils/Logger.ets | arkts | enableDebugMode | 启用调试模式 | static enableDebugMode(): void {
DEFAULT_CONFIG.productionMode = false;
DEFAULT_CONFIG.minLevel = LogLevel.VERBOSE;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left enableDebugMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | static enableDebugMode(): void {
DEFAULT_CONFIG.productionMode = false;
DEFAULT_CONFIG.minLevel = LogLevel.VERBOSE;
} | https://github.com/CLMC2025/Vignette | d8b54a322733d79ad360f5a7a1c3b20baba3968c | github |
openharmony-tpc/mp4parser | library/src/main/ets/mp4parser/utils/FileUtils.ets | arkts | reFileName | 文件重命名
@param fileOldPath
@param fileNewPath
@param callBack | static reFileName(fileOldPath: string, fileNewPath: string, callBack: IFileCallBack) {
fileio.rename(fileOldPath, fileNewPath).then(() => {
callBack.callBackResult(0)
}).catch(()=> {
callBack.callBackResult(1)
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left reFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileOldPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | static reFileName(fileOldPath: string, fileNewPath: string, callBack: IFileCallBack) {
fileio.rename(fileOldPath, fileNewPath).then(() => {
callBack.callBackResult(0)
}).catch(()=> {
callBack.callBackResult(1)
});
} | https://gitee.com/openharmony-tpc/mp4parser.git | aecd68477f45e25b056adcfe78ee45dab11445bc | gitee |
RoooyHe/toona-ohos | toona/src/main/ets/services/DeviceManager.ets | arkts | deleteDevices | 修复批量删除方法 | async deleteDevices(deviceIds: string[], authData?: DeviceAuthData): Promise<void> {
try {
await this.ensureHttpClient().deleteDevices(deviceIds, authData);
} catch (error) {
// ✅ 修复:显式断言为 Error 类型
throw error as Error;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteDevices AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceIds AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async deleteDevices(deviceIds: string[], authData?: DeviceAuthData): Promise<void> {
try {
await this.ensureHttpClient().deleteDevices(deviceIds, authData);
} catch (error) {
// ✅ 修复:显式断言为 Error 类型
throw error as Error;
}
} | https://github.com/RoooyHe/toona-ohos | 67010e665e0e02294bd0818047367ac3a07aecd6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ShareLinkDialogComponent.ets | arkts | showShareOptions | ── 对话框控制 ── | showShareOptions(): void {
if (!this.content) {
return;
}
this.appLink = this.buildDeepLink();
this.webLink = this.buildWebLink();
if (!this.appLink && !this.webLink) {
this.getUIContext().getPromptAction().showToast({ message: '无法生成分享链接', duration: 1500 });
return;
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showShareOptions 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... | showShareOptions(): void {
if (!this.content) {
return;
}
this.appLink = this.buildDeepLink();
this.webLink = this.buildWebLink();
if (!this.appLink && !this.webLink) {
this.getUIContext().getPromptAction().showToast({ message: '无法生成分享链接', duration: 1500 });
return;
}
... | https://github.com/DaLongZhuaZi/manxia | 5ea2e10f0e6c252befac520334e5063eb121419c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | generateAesKey | 生成随机 AES 密钥(16字节) | static generateAesKey(): ArrayBuffer {
const random = cryptoFramework.createRandom();
const dataBlob = random.generateRandomSync(16);
// dataBlob.data 是 Uint8Array,需要返回其底层的 ArrayBuffer
// 使用 slice() 创建一个新的 ArrayBuffer 副本以确保数据完整性
const uint8Array = new Uint8Array(dataBlob.data);
return uint8Arr... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateAesKey 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 ArrayBu... | static generateAesKey(): ArrayBuffer {
const random = cryptoFramework.createRandom();
const dataBlob = random.generateRandomSync(16);
// dataBlob.data 是 Uint8Array,需要返回其底层的 ArrayBuffer
// 使用 slice() 创建一个新的 ArrayBuffer 副本以确保数据完整性
const uint8Array = new Uint8Array(dataBlob.data);
return uint8Arr... | https://github.com/AlkaidLab/moonlight-harmony | d3f2694ed8540dae18e23edb03d655141d96a459 | github |
iwae/HarmonyOS-Inno | bridge/agent/AgentKitManager.ets | arkts | show | 显示 AgentKit
@param title 标题
@param queryText 查询文本(可选)
@param customOptions 自定义选项(可选) | show(title: string, queryText?: string, customOptions?: Partial<AgentKitShowOptions>): void {
if (!canIUse("SystemCapability.AI.Agent.AgentKit")) {
hilog.warn(0x0001, 'AgentKitManager', 'AgentKit capability not supported');
return;
}
// 如果传入了 agentId,则使用传入的,否则使用配置的默认值
const finalAgentId =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left show AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig... | show(title: string, queryText?: string, customOptions?: Partial<AgentKitShowOptions>): void {
if (!canIUse("SystemCapability.AI.Agent.AgentKit")) {
hilog.warn(0x0001, 'AgentKitManager', 'AgentKit capability not supported');
return;
}
// 如果传入了 agentId,则使用传入的,否则使用配置的默认值
const finalAgentId =... | https://github.com/iwae/HarmonyOS-Inno | 5ea88ec90a108bfc37cb4d2dbabe57bc36ad773d | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/service/ChartService.ets | arkts | downsampleLTTB | 数据降采样(LTTB算法 - Largest-Triangle-Three-Buckets)
保留数据视觉特征,减少数据点数量 | public downsampleLTTB(
data: { x: number; y: number }[],
threshold: number
): { x: number; y: number }[] {
if (!data || data.length <= threshold) {
return data;
}
const result: { x: number; y: number }[] = [];
const dataLength = data.length;
// 始终保留第一个点
result.push(da... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left downsampleLTTB 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_express... | public downsampleLTTB(
data: { x: number; y: number }[],
threshold: number
): { x: number; y: number }[] {
if (!data || data.length <= threshold) {
return data;
}
const result: { x: number; y: number }[] = [];
const dataLength = data.length;
// 始终保留第一个点
result.push(da... | https://github.com/LJ666-ui/harmony-health-care | e614512c10658337e1b6c3ffce422712c41631ce | github |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/utils/UrlUtils.ets | arkts | getUrl | 获取上传下载地址 | async getUrl(context: common.UIAbilityContext): Promise<string> {
let preference = await preferences.getPreferences(context, STORE_NAME);
let url = await preference.get(URL_KEY, '') as string;
logger.info(TAG, `getUrl,url= ${url}`);
return url;
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getUrl AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async getUrl(context: common.UIAbilityContext): Promise<string> {
let preference = await preferences.getPreferences(context, STORE_NAME);
let url = await preference.get(URL_KEY, '') as string;
logger.info(TAG, `getUrl,url= ${url}`);
return url;
} | https://github.com/openharmony/applications_app_samples | 1f2616e6875952ed00a482daa658d704faf1cc64 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | animateY | Animates values along the Y axis, in a linear fashion.
@param durationMillis animation duration | public animateY(durationMillis: number) {
this.animateY(durationMillis, Easing.Linear);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animateY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durationMillis AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public animateY(durationMillis: number) {
this.animateY(durationMillis, Easing.Linear);
} | https://gitee.com/openharmony/developtools_profiler.git | e45efb6d24344eea9de4592f69cc89d5ca9ee79d | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrCodeGenerator.ets | arkts | writeFormatInfo | Write format info | writeFormatInfo(ecLevel: ECLevel, maskPattern: number): void {
const info = FORMAT_INFO[ecLevel][maskPattern];
// Horizontal (row 8)
for (let i = 0; i < 8; i++) {
const col = i < 6 ? i : i + 1;
this.modules[8][col] = ((info >> (14 - i)) & 1) === 1;
}
for (let i = 8; i < 15; i++) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeFormatInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ecLevel AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ECLevel AST#identifier#Right AST#,#Le... | writeFormatInfo(ecLevel: ECLevel, maskPattern: number): void {
const info = FORMAT_INFO[ecLevel][maskPattern];
// Horizontal (row 8)
for (let i = 0; i < 8; i++) {
const col = i < 6 ? i : i + 1;
this.modules[8][col] = ((info >> (14 - i)) & 1) === 1;
}
for (let i = 8; i < 15; i++) {
... | https://github.com/AlkaidLab/moonlight-harmony | 271161200bb823e7c3beb81c3bea34c2b854053a | github |
YANGZX22/Voot | entry/src/main/ets/services/PipSubtitleManager.ets | arkts | updateSubtitle | Update subtitle text | updateSubtitle(text: string): void {
this.nodeController.updateText(text);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateSubtitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ... | updateSubtitle(text: string): void {
this.nodeController.updateText(text);
} | https://github.com/YANGZX22/Voot | 9c019e459e9c867df1b5e175cdf13a8036a5537d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isBinDigit | isBinDigit() checks whether the char represents a binary digit.
@param { char } value a char to check.
@returns { boolean }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isBinDigit(value: char): boolean {
return value == c'0' || value == c'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 {
return value == c'0' || value == c'1'
} | https://gitcode.com/iop123123/arkts-static-skills | df0f021c147989c3cf01434c108648b3900f66ef | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineBridge.ets | arkts | loadThemeConfig | MARK: - Theme Configuration
Loads theme configuration. | loadThemeConfig(themeConfigJson: string): boolean {
return setThemeConfig(themeConfigJson);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadThemeConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left themeConfigJson AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Lef... | loadThemeConfig(themeConfigJson: string): boolean {
return setThemeConfig(themeConfigJson);
} | https://github.com/AGenUI/AGenUI | 07dccf17752e4ecc35450978437ed88dc8542e66 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | arrayToList | Created because Arrays.asList(...) does not support modification.
@param array
@return | private arrayToList(array: T[]): JArrayList<T> {
let list = new JArrayList<T>();
for (let i = 0; i < array.length; i++) {
let data: T = array[i];
list.add(data);
}
return list;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left arrayToList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left array AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier... | private arrayToList(array: T[]): JArrayList<T> {
let list = new JArrayList<T>();
for (let i = 0; i < array.length; i++) {
let data: T = array[i];
list.add(data);
}
return list;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f162a6458f49898f5ebd696494346ecfd828e848 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | getRelatedValue | 获取关联数据原始值
@param propertyName 关联属性名
@returns 关联数据值或 null | getRelatedValue(propertyName: string): RelatedDataValue | null {
const value = this.relatedData.get(propertyName)
return value ? value : null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getRelatedValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | getRelatedValue(propertyName: string): RelatedDataValue | null {
const value = this.relatedData.get(propertyName)
return value ? value : null
} | https://github.com/offlinecat-dev/OCNetORM | 822007c3144caafc6760f8fd9d28b12319f32a28 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test23_original_index.ets | arkts | testNestedTryCatch | --- Nested try-catch-finally --- | function testNestedTryCatch(): string {
let result: string = '';
try {
result = result + 'A';
try {
result = result + 'B';
throw new Error('inner');
} catch (e) {
result = result + 'C';
} finally {
result = result + 'D';
}
result = result + 'E';
} catch (e) {
re... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedTryCatch AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefin... | function testNestedTryCatch(): string {
let result: string = '';
try {
result = result + 'A';
try {
result = result + 'B';
throw new Error('inner');
} catch (e) {
result = result + 'C';
} finally {
result = result + 'D';
}
result = result + 'E';
} catch (e) {
re... | https://github.com/miaochiahao/ark-ghidra | 5dd92a5bbbfc8566bc05c437ac917ac41a1328a7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets | arkts | has | Checks if a key is in the Map
@param key the key to find in the Map
@returns true if the value is in the Map | override has(key: K): boolean {
const bucketIdx = this.getBucketIndex(key)
let bucket = this.getBucketByIdx(bucketIdx)
while (isLegalAt(bucket)) {
if (Map.sameValueZero(getKeyAt<K>(this.data, bucket), key)) {
return true
}
bucket = this.ge... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden... | override has(key: K): boolean {
const bucketIdx = this.getBucketIndex(key)
let bucket = this.getBucketByIdx(bucketIdx)
while (isLegalAt(bucket)) {
if (Map.sameValueZero(getKeyAt<K>(this.data, bucket), key)) {
return true
}
bucket = this.ge... | https://gitcode.com/iop123123/arkts-static-skills | b5daec75045f2a757d6b296bd928168e141f0706 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/FTPStorage.ets | arkts | write | 写入文件内容 | public async write(path: string, content: ArrayBuffer): Promise<void> {
const config = this.config;
try {
const fullPath = this.getFullPath(path);
const tempDir = CommonUtils.getContext().cacheDir;
const tempFilePath = tempDir + '/temp_upload_' + Date.now() + '.tmp';
try {
con... | 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 write AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right... | public async write(path: string, content: ArrayBuffer): Promise<void> {
const config = this.config;
try {
const fullPath = this.getFullPath(path);
const tempDir = CommonUtils.getContext().cacheDir;
const tempFilePath = tempDir + '/temp_upload_' + Date.now() + '.tmp';
try {
con... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPStorage.ets#L176-L207 | 296987eaee1b037efb40a146095d17c3ee1837ba | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toDecimalPlaces | Return a new Decimal whose value is the value of this Decimal.
@returns { Decimal } the Decimal type | public toDecimalPlaces(): Decimal {
return new Decimal(this);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toDecimalPlaces 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 Decima... | public toDecimalPlaces(): Decimal {
return new Decimal(this);
} | https://gitcode.com/iop123123/arkts-static-skills | 18e0436499988f6eedb51ad66f578d65fc36fa7c | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | setDayNightMode | Sets the day/night mode | static setDayNightMode(mode: string): void {
if (mode !== 'light' && mode !== 'dark') {
hilog.error(0x0000, 'AGenUI', 'setDayNightMode: invalid mode \'%{public}s\', expected \'light\' or \'dark\'', mode);
return;
}
AGenUIEngineBridge.getInstance().setDayNightMode(mode);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDayNightMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static setDayNightMode(mode: string): void {
if (mode !== 'light' && mode !== 'dark') {
hilog.error(0x0000, 'AGenUI', 'setDayNightMode: invalid mode \'%{public}s\', expected \'light\' or \'dark\'', mode);
return;
}
AGenUIEngineBridge.getInstance().setDayNightMode(mode);
} | https://github.com/AGenUI/AGenUI | 9d84872db606c77c9ffabb0e00fc081252aadd0e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/ShareExtAbility/ShareExtAbility.ets | arkts | normalizeFileUri | 标准化文件URI | private normalizeFileUri(uri: string): string {
try {
// 如果URI已经是file://格式,直接返回
if (uri.startsWith('file://')) {
return uri;
}
// 如果URI是content://格式,尝试转换
if (uri.startsWith('content://')) {
logger.info(TAG, `转换content URI: ${uri}`);
// HarmonyOS可以直接使用co... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeFileUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private normalizeFileUri(uri: string): string {
try {
// 如果URI已经是file://格式,直接返回
if (uri.startsWith('file://')) {
return uri;
}
// 如果URI是content://格式,尝试转换
if (uri.startsWith('content://')) {
logger.info(TAG, `转换content URI: ${uri}`);
// HarmonyOS可以直接使用co... | https://github.com/DaLongZhuaZi/manxia | 4e9747cf1a0c3cca19c5272aceea8ff1a4bd943c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncCondVarBasedMutex.ets | arkts | wait | Atomically releases the held OS mutex, suspends the current coroutine,
and then re-acquires the mutex after wakeup.
@param { Object } mutex The OS mutex object that must be locked before calling wait().
@returns { Promise<void> } A promise that resolves after the coroutine is resumed,
and after the mutex is re-acquired... | public async wait(mutex: Object): Promise<void> {
++this.waiters_;
ConcurrencyHelpers.mutexUnlock(mutex);
await this.waitersList_.suspend();
ConcurrencyHelpers.mutexLock(mutex);
} | 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 wait AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mutex AST#identifier#Right AST#:#Left : AST#:#Right... | public async wait(mutex: Object): Promise<void> {
++this.waiters_;
ConcurrencyHelpers.mutexUnlock(mutex);
await this.waitersList_.suspend();
ConcurrencyHelpers.mutexLock(mutex);
} | https://gitcode.com/iop123123/arkts-static-skills | 40551cc88b3575355be34f03e052b538097e3b91 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitSfixed32 | 访问 sfixed32 字段
Wire type: 5 (32-bit) | visitSfixed32(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 5).sfixed32(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitSfixed32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ... | visitSfixed32(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 5).sfixed32(value)
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 307f293957e96c3fae3f7d4c61d7b99df17879b2 | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseProperty.ets | arkts | setViewSize | Sets the view size. | setViewSize(width: number, height: number): void {
this.viewWidth = width;
this.viewHeight = height;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setViewSize 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 AST#identifier#Right AST#,#Left , AS... | setViewSize(width: number, height: number): void {
this.viewWidth = width;
this.viewHeight = height;
} | https://github.com/AGenUI/AGenUI | 30bde9126f201baa33112f8df0fe2da35091aaa8 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/data/SecureStorage.ets | arkts | saveWebDavConfig | ---- WebDAV ----
The full config (URL, username, password) is serialised together so the
three values can never drift out of sync. An invalid/partial JSON blob
(corrupted, schema-changed) is treated as "not configured" — same path
as a fresh install. | static async saveWebDavConfig(config: WebDavConfig): Promise<void> {
const payload: string = JSON.stringify(config);
await SecureStorage.put(ALIAS_WEBDAV, payload);
} | 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 saveWebDavConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left ... | static async saveWebDavConfig(config: WebDavConfig): Promise<void> {
const payload: string = JSON.stringify(config);
await SecureStorage.put(ALIAS_WEBDAV, payload);
} | https://github.com/Vincent-Leon/zotero-harmony | 5e6610dddd6a12bbc9e17c70457d074d571083bb | github |
arkui-x/samples | CodeLab/Cases/feature/customview/src/main/ets/view/CustomView.ets | arkts | getTransitionX | 获取颜色条偏移量 | getTransitionX(index: number) {
let theNumber: number = 0;
for (let i = this.loopDefault; i <= index; i++) {
const title = this.titleArray[i];
const titleLength = title.length * this.titleLengthRadix;
if (i === index) {
theNumber += titleLength / this.titleLengthHalf - this.colorBarH... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTransitionX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Rig... | getTransitionX(index: number) {
let theNumber: number = 0;
for (let i = this.loopDefault; i <= index; i++) {
const title = this.titleArray[i];
const titleLength = title.length * this.titleLengthRadix;
if (i === index) {
theNumber += titleLength / this.titleLengthHalf - this.colorBarH... | https://gitcode.com/arkui-x/samples | e66e4a7a7b921dbb39fa6617ec6416fd1f54bb2a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TaskExecutor.ets | arkts | executeParallel | 并行执行步骤 | private async executeParallel(task: TaskDefinition, context: TaskContext): Promise<void> {
const promises = task.steps.map(async (step, index) => {
// 检查条件
if (step.condition && !this.evaluateCondition(step.condition, context)) {
logger.debug(TAG, `跳过步骤 ${step.id}: 条件不满足`);
return;
... | 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 executeParallel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left ... | private async executeParallel(task: TaskDefinition, context: TaskContext): Promise<void> {
const promises = task.steps.map(async (step, index) => {
// 检查条件
if (step.condition && !this.evaluateCondition(step.condition, context)) {
logger.debug(TAG, `跳过步骤 ${step.id}: 条件不满足`);
return;
... | https://github.com/DaLongZhuaZi/manxia | e372743f5885d6b9b0e17befa45ae2627e0590e5 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_byte.ets | arkts | main | ---
desc: check postfix increment for byte operand
--- | function main(): void {
let value: byte = {{v.value}}
let result: byte = value++
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: byte = {{v.value}}
let result: byte = value++
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2b6dac3c05f7bd929a8b12dde49ea8d28f98e8e1 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | updatePerformanceStatistics | 更新性能统计信息 | private updatePerformanceStatistics(metrics: PerformanceMetrics): void {
const stats = this.statistics.performanceStatistics;
if (metrics.memoryUsage && metrics.memoryUsage > stats.peakMemoryUsage) {
stats.peakMemoryUsage = metrics.memoryUsage;
}
if (metrics.cpuUsage) {
stats.ave... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updatePerformanceStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metrics AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | private updatePerformanceStatistics(metrics: PerformanceMetrics): void {
const stats = this.statistics.performanceStatistics;
if (metrics.memoryUsage && metrics.memoryUsage > stats.peakMemoryUsage) {
stats.peakMemoryUsage = metrics.memoryUsage;
}
if (metrics.cpuUsage) {
stats.ave... | https://github.com/DaLongZhuaZi/manxia | d10c3f2012f5a448a133c2aa64031d3da2aa02dc | github |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/view/SmsLoginPage.ets | arkts | build | 构建短信登录页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.SmsLoginContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.SmsLoginContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | c05e0519c92d70b62743fb58270a23fd7f7f4f5b | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | test_5param | 多参数组合
测试 5 param | function test_5param() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
instance.overloadFunc(
(1).toByte(), (1).toShort(), (1).toInt(), 1.1f, (1.123).toDouble());
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_5param AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declara... | function test_5param() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
instance.overloadFunc(
(1).toByte(), (1).toShort(), (1).toInt(), 1.1f, (1.123).toDouble());
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 4ab9f42caa07684c89d0e87e40c2d6231cb13526 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/SwitchProController.ets | arkts | isJoyCon | 是否是 Joy-Con | private isJoyCon(): boolean {
const pid = this.device.productId;
return pid === SwitchPro.JOYCON_LEFT_PID ||
pid === SwitchPro.JOYCON_RIGHT_PID ||
pid === SwitchPro.JOYCON_PAIR_PID;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isJoyCon 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#b... | private isJoyCon(): boolean {
const pid = this.device.productId;
return pid === SwitchPro.JOYCON_LEFT_PID ||
pid === SwitchPro.JOYCON_RIGHT_PID ||
pid === SwitchPro.JOYCON_PAIR_PID;
} | https://github.com/AlkaidLab/moonlight-harmony | 07e63b8662a3c306a9ce36f5bdcdfe257ec4f912 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | getTrackRecords | 获取内容的所有跟踪记录 | public async getTrackRecords(contentId: string): Promise<TrackRecord[]> {
try {
const sql = 'SELECT * FROM track_record WHERE contentId = ?';
const results = await this.dbManager.querySql(sql, [contentId]);
return this.parseTrackRecords(results);
} catch (error) {
logger.error(TAG, `❌ ... | 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 getTrackRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async getTrackRecords(contentId: string): Promise<TrackRecord[]> {
try {
const sql = 'SELECT * FROM track_record WHERE contentId = ?';
const results = await this.dbManager.querySql(sql, [contentId]);
return this.parseTrackRecords(results);
} catch (error) {
logger.error(TAG, `❌ ... | https://github.com/DaLongZhuaZi/manxia | 27bd679f3c284b208bf1f83f5081610c96727045 | github |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/pages/HomePage.ets | arkts | courseColor | 课程图标背景色:按课程名哈希到一组协调的多彩色,稳定不闪烁、深浅色下白字均可读。 | function courseColor(seed: string): string {
const palette: string[] = [
'#3B6FB0', '#2E8B82', '#4C8C3F', '#B5852E', '#C2693B',
'#B0473F', '#7B5EA8', '#A8497F', '#3A7CA5', '#5E7A2E'
];
let h = 0;
for (let i = 0; i < seed.length; i++) {
h = (h * 31 + seed.charCodeAt(i)) % 1000000;
}
return palett... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left courseColor AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left seed AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function courseColor(seed: string): string {
const palette: string[] = [
'#3B6FB0', '#2E8B82', '#4C8C3F', '#B5852E', '#C2693B',
'#B0473F', '#7B5EA8', '#A8497F', '#3A7CA5', '#5E7A2E'
];
let h = 0;
for (let i = 0; i < seed.length; i++) {
h = (h * 31 + seed.charCodeAt(i)) % 1000000;
}
return palett... | https://github.com/picklerick422/zju-learning-assistant-OH | 15cc285d52234ce4329aeec20d2d26a88dd422b5 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets | arkts | add | Adds a value to the HashSet
@param value the value to add to the HashSet
@returns true if the value was added, false otherwise | add(value: T): boolean {
this.buckets.set(value, value);
return 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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST... | add(value: T): boolean {
this.buckets.set(value, value);
return true;
} | https://gitcode.com/iop123123/arkts-static-skills | debe875800ce431ce4b49e978e6df70dea48f07b | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/CasLoginService.ets | arkts | encodeFormData | 编码表单数据 | private encodeFormData(data: Record<string, string>): string {
const parts: string[] = [];
for (const key of Object.keys(data)) {
parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
return parts.join('&');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left encodeFormData 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#instantiation_... | private encodeFormData(data: Record<string, string>): string {
const parts: string[] = [];
for (const key of Object.keys(data)) {
parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
return parts.join('&');
} | https://github.com/PollenWang6/HiXD | 2a4939bb9d4dc44f7a140989af8f1a3699867e30 | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setMaximumLines | ���������ʾ����
@param pairs map<K,V> ����nullȡ����������
K = (BaseDanmaku.TYPE_SCROLL_RL|BaseDanmaku.TYPE_SCROLL_LR|BaseDanmaku.TYPE_FIX_TOP|BaseDanmaku.TYPE_FIX_BOTTOM)
V = �������
@return | public setMaximumLines(pairs: Map<number, number>): DanmakuContext {
this.mIsMaxLinesLimited = (pairs != null);
if (pairs == null) {
this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_MAXIMUN_LINES_FILTER, primary: false });
} else {
this.setFilterData(DanmakuFilters.TAG_MAXIMUN_L... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaximumLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left pairs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right A... | public setMaximumLines(pairs: Map<number, number>): DanmakuContext {
this.mIsMaxLinesLimited = (pairs != null);
if (pairs == null) {
this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_MAXIMUN_LINES_FILTER, primary: false });
} else {
this.setFilterData(DanmakuFilters.TAG_MAXIMUN_L... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 9c2f894d43f9d9de093d13b08e3bd64b564010f8 | gitee |
HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | entry/src/main/ets/pages/Index.ets | arkts | onError | 错误回调,错误码通过本方法返回
返回错误码1002200002,开始识别失败,重复启动startListening方法时触发
更多错误码请参考错误码参考 | onError(sessionId: string, errorCode: number, errorMessage: string) {
console.error(TAG, `onError, sessionId: ${sessionId} errorCode: ${errorCode} errorMessage: ${errorMessage}`);
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Le... | onError(sessionId: string, errorCode: number, errorMessage: string) {
console.error(TAG, `onError, sessionId: ${sessionId} errorCode: ${errorCode} errorMessage: ${errorMessage}`);
}, | https://gitcode.com/HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | 6b23aecd95f4fc0dae0fdd882d51118a33fe6c09 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an Uint32Array with respect to buf.
@param { ArrayLike<Number> | ArrayBuffer } buf - data initializer
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLengthInt = (buf as ArrayBuffer).getByteLength()
if (this.byteLengthInt % Uint32Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength sh... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Lef... | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLengthInt = (buf as ArrayBuffer).getByteLength()
if (this.byteLengthInt % Uint32Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength sh... | https://gitcode.com/iop123123/arkts-static-skills | 3ab4eede8e6e73b869006aa9e588ec68e9fc261b | gitcode |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/NoticeBar.ets | arkts | build | 向左滚动值 | build(){
Stack(){
//音量图标
Row(){
Image($rawfile("NoticeBar_volume.png"))
.width("60%")
.height("50%")
.margin(10)
}
.height("100%")
.width("10%")
.backgroundColor("#FFFBE8")
.zIndex(10)
.position({x: 0})
//滚动文本
Row()... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build(){
Stack(){
//音量图标
Row(){
Image($rawfile("NoticeBar_volume.png"))
.width("60%")
.height("50%")
.margin(10)
}
.height("100%")
.width("10%")
.backgroundColor("#FFFBE8")
.zIndex(10)
.position({x: 0})
//滚动文本
Row()... | https://gitee.com/openharmony-sig/ohos_easyui.git | ac66bb408ba20b94a12dce18e330d92f412b328e | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets | arkts | forEach | Executes a provided function once per each value in the LightWeightSet object, in insertion order
@param callbackfn to apply; key is always same as value | forEach(callbackFn: LightWeightSetForEachCb<T>): void {
this.buckets.forEach((value: T, key: T): void => {
callbackFn(value, key, this);
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackFn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left LightWei... | forEach(callbackFn: LightWeightSetForEachCb<T>): void {
this.buckets.forEach((value: T, key: T): void => {
callbackFn(value, key, this);
});
} | https://gitcode.com/iop123123/arkts-static-skills | 896b39b7d5291e45f98020290621c54edd19f07f | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets | arkts | constructor | Construct a TreeSet
@param comparator: the comparator of the TreeSet | constructor(comparator?: TreeSetComparator<T>) {
this.treeMap = new TreeMap<T, T>(comparator);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comparator AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_... | constructor(comparator?: TreeSetComparator<T>) {
this.treeMap = new TreeMap<T, T>(comparator);
} | https://gitcode.com/iop123123/arkts-static-skills | ee914e61e53e69e50fac8b8650bde62ddec5357a | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | getLastGesture | Returns the last gesture that has been performed on the chart.
@return | public getLastGesture(): ChartGesture {
return this.mLastGesture;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLastGesture 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 ChartGe... | public getLastGesture(): ChartGesture {
return this.mLastGesture;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5ab9af714f1ee6b9515f31db47f3bc0ad817f2cc | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/StreamMenuManager.ets | arkts | showToast | 显示 Toast 提示 | private showToast(message: string): void {
try {
ToastQueue.show({
message: message,
duration: 1500
});
} catch (e) {
console.warn('showToast failed:', e);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | private showToast(message: string): void {
try {
ToastQueue.show({
message: message,
duration: 1500
});
} catch (e) {
console.warn('showToast failed:', e);
}
} | https://github.com/AlkaidLab/moonlight-harmony | 15ea77de89ec8b26b987df2a23c932343b51ec71 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | getBackground | 获取菜单项背景
@returns 背景颜色 | public getBackground(): ColorType {
return this.background;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBackground 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 ColorTyp... | public getBackground(): ColorType {
return this.background;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | f28d8f14251c81afb2a67deedf90faae7d34d7d2 | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | setupPlayerCallbacks | 设置播放器回调 | private setupPlayerCallbacks(): void {
if (!this.avPlayer) return;
this.avPlayer.on('stateChange', (state: string) => {
console.info(`AVPlayer state changed to: ${state}`);
this.updateState(state);
// 监听播放完成事件
if (state === 'completed') {
console.info('[PlayerService] P... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupPlayerCallbacks 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 setupPlayerCallbacks(): void {
if (!this.avPlayer) return;
this.avPlayer.on('stateChange', (state: string) => {
console.info(`AVPlayer state changed to: ${state}`);
this.updateState(state);
// 监听播放完成事件
if (state === 'completed') {
console.info('[PlayerService] P... | https://github.com/pangpang20/antennaPodHM | 44adfb6f68dcaceac805eb3d6aedda4dd8238a3e | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/navigation/titlebar/common/TitleBarUtils.ets | arkts | getCommonStyleOpts | Generates the standard scroll and blur effect style configuration.
@param isTransparentMode - If true, configures transparent menus and back icons (used in Emphasized pages).
@returns Style configuration object for titleBar. | static getCommonStyleOpts(isTransparentMode: boolean = false): TitleBarStyleOptions {
// Explicitly build the base content style to avoid ArkTS 'arkts-no-spread' error
let originalContentStyle: HdsTitleBarContentStyle = {
titleStyle: {
mainTitleColor: $r('sys.color.font_primary'),
subTit... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCommonStyleOpts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isTransparentMode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | static getCommonStyleOpts(isTransparentMode: boolean = false): TitleBarStyleOptions {
// Explicitly build the base content style to avoid ArkTS 'arkts-no-spread' error
let originalContentStyle: HdsTitleBarContentStyle = {
titleStyle: {
mainTitleColor: $r('sys.color.font_primary'),
subTit... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 9b7fa85b5b8f6a945e271262cb04bdf8d319fdeb | gitcode |
RoooyHe/toona-ohos | toona/src/main/ets/utils/AppLogger.ets | arkts | warn | WARN 级别日志 | warn(msg: string, ...args: object[]): void {
this.logger.warn(this.buildMsg(msg, args));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left warn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right... | warn(msg: string, ...args: object[]): void {
this.logger.warn(this.buildMsg(msg, args));
} | https://github.com/RoooyHe/toona-ohos | 4ff6cce0087647340615d9f294fcfd3635b06a4e | github |
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | entry/src/main/ets/pages/HomePage.ets | arkts | aboutToAppear | Determine whether to show the entry to youth mode settings. | aboutToAppear() {
hilog.info(domainId, logTag, 'HomePage aboutToAppear');
// Call getMinorsProtectionInfoSync to query the youth mode status in the aboutToAppear lifecycle.
this.getMinorsProtectionInfoSync();
// Listen to userLogin events.
this.getUIContext().getHostContext()?.eventHub.on('userLo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
hilog.info(domainId, logTag, 'HomePage aboutToAppear');
// Call getMinorsProtectionInfoSync to query the youth mode status in the aboutToAppear lifecycle.
this.getMinorsProtectionInfoSync();
// Listen to userLogin events.
this.getUIContext().getHostContext()?.eventHub.on('userLo... | https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | 35ebb725e2318cf8deca5d42891bfe24024a7c16 | gitcode |
HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | entry/src/main/ets/pages/AudioCapturer.ets | arkts | init | Initialize
@param audioListener | public async init(dataCallBack: (data: ArrayBuffer) => void) {
if (null != this.mAudioCapturer) {
console.error(TAG, 'AudioCapturerUtil already init');
return;
}
this.mDataCallBack = dataCallBack;
try {
this.mAudioCapturer = await audio.createAudioCapturer(this.audioCapturerOptions)
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left init AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left dataCallBack AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async init(dataCallBack: (data: ArrayBuffer) => void) {
if (null != this.mAudioCapturer) {
console.error(TAG, 'AudioCapturerUtil already init');
return;
}
this.mDataCallBack = dataCallBack;
try {
this.mAudioCapturer = await audio.createAudioCapturer(this.audioCapturerOptions)
... | https://gitcode.com/HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | cd933b0cd1f164665dab492e5db5ae504331d3d6 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getMinAngleForSlices | The minimum angle slices on the chart are rendered with, default is 0f.
@return minimum angle for slices | public getMinAngleForSlices(): number {
return this.mMinAngleForSlices;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMinAngleForSlices 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 numbe... | public getMinAngleForSlices(): number {
return this.mMinAngleForSlices;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 793b00324ea2634faf11e5cf73e61053d98a822a | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/AggregateResult.ets | arkts | getNumber | 获取数值类型的列值
@param key 列名或别名
@returns 数值,不存在或无法转换返回 0 | getNumber(key: string): number {
const value = this.get(key)
if (value === null) {
return 0
}
if (typeof value === 'number') {
return value
}
const num = Number(value)
return isNaN(num) ? 0 : num
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNumber 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#)#... | getNumber(key: string): number {
const value = this.get(key)
if (value === null) {
return 0
}
if (typeof value === 'number') {
return value
}
const num = Number(value)
return isNaN(num) ? 0 : num
} | https://github.com/offlinecat-dev/OCNetORM | 42217082300bd892a2c950ba058484a2ad38f8a5 | github |
Joker-x-dev/HarmonyKit | core/data/src/main/ets/repository/DemoRepository.ets | arkts | updateDemo | 更新 Demo 记录
@param {DemoEntity} entity - 待更新的实体
@returns {Promise<void>} Promise<void> | async updateDemo(entity: DemoEntity): Promise<void> {
return this.demoLocalDataSource.updateItem(entity);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateDemo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entity AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async updateDemo(entity: DemoEntity): Promise<void> {
return this.demoLocalDataSource.updateItem(entity);
} | https://github.com/Joker-x-dev/HarmonyKit | 588a76690c9aed2383bc3a62268855d6e7b55a92 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | send_lyric_row | 7x1 单句歌词广播 // | private send_lyric_row() {} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left send_lyric_row 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#{#Le... | private send_lyric_row() {} | https://github.com/Nekofox-POT/LinMusic | cbcad0468b8ad9b1ea3122fc4f49cb4a82e06a11 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/CategoryRepository.ets | arkts | updateCategory | 更新分类
@param category 分类模型
@returns Promise<boolean> 是否成功 | async updateCategory(category: TaskCategoryData): Promise<boolean> {
try {
const valueBucket = this.toValueBucket(category);
const updatedRows = await this.dao.update(category.id, valueBucket);
if (updatedRows > 0) {
Logger.info(this.LOG_TAG, `Category updated: ${category.id}`);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateCategory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left category AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async updateCategory(category: TaskCategoryData): Promise<boolean> {
try {
const valueBucket = this.toValueBucket(category);
const updatedRows = await this.dao.update(category.id, valueBucket);
if (updatedRows > 0) {
Logger.info(this.LOG_TAG, `Category updated: ${category.id}`);
... | https://github.com/Kira-Yagami-Light/Kira-Projects | e286bbcc9a3c7f058cd2c8a48dd790ebe2ce64e7 | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getSharedComponentId | 获取卡片点击的组件id
@returns | public getSharedComponentId(): string | undefined {
let prePageCardId = ZRouter.getParamByKey(CardUtil.KEY_CLICKED_COMPONENT_ID) as string;
return CardUtil.getPostPageImageId(prePageCardId);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSharedComponentId 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#e... | public getSharedComponentId(): string | undefined {
let prePageCardId = ZRouter.getParamByKey(CardUtil.KEY_CLICKED_COMPONENT_ID) as string;
return CardUtil.getPostPageImageId(prePageCardId);
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L178-L181 | 95b35ed74c01324dd6bc6e5821c7f8e1a8688295 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/TransactionDao.ets | arkts | deleteTransaction | 根据ID删除交易记录
@param transactionId 交易ID
@returns 是否删除成功 | public async deleteTransaction(transactionId: number): Promise<boolean> {
try {
const predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(DBManager.TABLE_TRANSACTIONS);
predicates.equalTo('id', transactionId);
const result: number = await this.rdbStore.delete(predicate... | 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 deleteTransaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left transactionId AST#identifier#Right AST#ERROR#Left AST... | public async deleteTransaction(transactionId: number): Promise<boolean> {
try {
const predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(DBManager.TABLE_TRANSACTIONS);
predicates.equalTo('id', transactionId);
const result: number = await this.rdbStore.delete(predicate... | https://github.com/fuhhhhhhhh/openharmony | 1bf2d97ae09dd80bfd9b1e2935241fc43da0d554 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/AccountKitService.ets | arkts | getAccessToken | 获取长期 Access Token (通过 exchangeAuthCode 换取) | getAccessToken(): string {
return this.credential?.accessToken || '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAccessToken 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#stateme... | getAccessToken(): string {
return this.credential?.accessToken || '';
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | d634bc493224cc99a038066452f9d0690c8f6e6c | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setButtonSpace | 按钮间间距
@param buttonSpace
@returns | setButtonSpace(buttonSpace?: string | number | undefined): Builder {
this.popupOptions.buttonSpace = buttonSpace
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setButtonSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left buttonSpace AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST... | setButtonSpace(buttonSpace?: string | number | undefined): Builder {
this.popupOptions.buttonSpace = buttonSpace
return this
} | https://github.com/wuba/omni-ui | 33e121b5c14bcda08b9ab0c8a89bac84d0fa885e | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | readInt16BE | Reads a signed 16-bit integer from the buffer at the specified offset using big-endian format
@param {int} [offset=0] - Number of bytes to skip before reading
@returns {long} The read value | public readInt16BE(offset: int = 0): long {
let lengthOffset: int = this.length - 2;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= ${leng... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readInt16BE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_express... | public readInt16BE(offset: int = 0): long {
let lengthOffset: int = this.length - 2;
if (offset < 0 || offset > lengthOffset) {
throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` +
`It must be >= 0 and <= ${leng... | https://gitcode.com/iop123123/arkts-static-skills | c6c094f54ce0709681ed2f381ffe3fefa7db3800 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | equals | Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise
@param { Uint8Array | Buffer } otherBuffer - A Buffer or Uint8Array with which to compare buf
@returns { boolean } true or false
@throws { BusinessError } 401 - Parameter error. Possible causes:
1. Mandatory parameters are left unspec... | public equals(otherBuffer: Uint8Array | Buffer): boolean {
return this.compare(otherBuffer) == 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left otherBuffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#... | public equals(otherBuffer: Uint8Array | Buffer): boolean {
return this.compare(otherBuffer) == 0;
} | https://gitcode.com/iop123123/arkts-static-skills | 1cab6b995aaa5b375241ad533abefa19de771725 | gitcode |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/info/AccessibilityInfo.ets | arkts | getButtonInfo | 获取获取聚焦内容,优先通过先通过keyCode获取,如果没有则通过info 获取
@param { string } 默认需要播报的字符.
@param { Boolean } 是否是反函数模式.
@return { string } 转换后的无障碍字符串. | public getButtonInfo(info?: string, isInv?: Boolean): string {
let playStr: string = '';
if (this.keyCode !== null && this.keyCode !== undefined) {
switch (this.keyCode) {
case CalcKeyCode.KEYCODE_INVERSE_MATRIX:
let playInfo = isInv ? ACCESSIBILITY_DESC_INV_ON : ACCESSIBILITY_DESC_INV... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getButtonInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | public getButtonInfo(info?: string, isInv?: Boolean): string {
let playStr: string = '';
if (this.keyCode !== null && this.keyCode !== undefined) {
switch (this.keyCode) {
case CalcKeyCode.KEYCODE_INVERSE_MATRIX:
let playInfo = isInv ? ACCESSIBILITY_DESC_INV_ON : ACCESSIBILITY_DESC_INV... | https://gitee.com/openharmony-sig/applications_calculator.git | 8ffd031503c375114e90708bc6a66a35b70157bd | gitee |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | fixRightInFreeMode | In free mode fix right edge.
@param left
@param crop
@param imageLines
@returns fixedRight. | private fixRightInFreeMode(right: number, crop: RectF, imageLines: Array<LineSegment>): number {
let rightLine = new LineSegment(new Point(right, crop.top), new Point(right, crop.bottom));
let adjacentLines: LineSegment[] = [];
adjacentLines.push(new LineSegment(new Point(crop.left, crop.top), new Point(r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fixRightInFreeMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left right AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private fixRightInFreeMode(right: number, crop: RectF, imageLines: Array<LineSegment>): number {
let rightLine = new LineSegment(new Point(right, crop.top), new Point(right, crop.bottom));
let adjacentLines: LineSegment[] = [];
adjacentLines.push(new LineSegment(new Point(crop.left, crop.top), new Point(r... | https://gitee.com/openharmony/codelabs.git | 93bdfdf6f35d81261b48a3d3b323d105531c3679 | gitee |
1ilI/WebViewJavascriptBridge_harmony | webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets | arkts | jsonToObjArr | json 转 数组 Array<Object>
@param obj 任意类型数据 Object
@returns 数组 Array<Object> | public static jsonToObjArr(obj: Object | undefined | null): Array<Object> {
let result: Array<Object> = new Array();
// 传入的 obj 为空
if (obj === undefined || obj === null) {
return result;
}
// 传入的是 字符串
if (typeof obj === 'string') {
// 尝试用 json 对象接收
try {
let jsonObj:... | 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 jsonToObjArr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#... | public static jsonToObjArr(obj: Object | undefined | null): Array<Object> {
let result: Array<Object> = new Array();
// 传入的 obj 为空
if (obj === undefined || obj === null) {
return result;
}
// 传入的是 字符串
if (typeof obj === 'string') {
// 尝试用 json 对象接收
try {
let jsonObj:... | https://github.com/1ilI/WebViewJavascriptBridge_harmony | 3a878ed3e85e1c4c278495317b3217419d584f10 | github |
HarmonyOS_Samples/BestPracticeSnippets | LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets | arkts | aboutToAppear | Call back when the NodeContainer corresponding to the controller is in Appear. | aboutToAppear(): void {
hilog.info(DOMAIN, TAG, 'aboutToAppear');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
hilog.info(DOMAIN, TAG, 'aboutToAppear');
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | cb1226a91f140a2951b897719453b87974abde0d | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.