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 |
|---|---|---|---|---|---|---|---|---|---|---|
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test42_original_index.ets | arkts | testReverseSort | --- Array reverse sort --- | function testReverseSort(): string {
let nums: number[] = [3, 1, 4, 1, 5, 9, 2, 6];
nums.sort((a: number, b: number): number => {
return b - a;
});
return String(nums[0]) + ',' + String(nums[3]) + ',' + String(nums[7]);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testReverseSort 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_... | function testReverseSort(): string {
let nums: number[] = [3, 1, 4, 1, 5, 9, 2, 6];
nums.sort((a: number, b: number): number => {
return b - a;
});
return String(nums[0]) + ',' + String(nums[3]) + ',' + String(nums[7]);
} | https://github.com/miaochiahao/ark-ghidra | 1bf748425cdd8a058a8aa9c91ab8b900dfbce939 | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repolist/repolist.ets | arkts | onPageShow | 页面show的生命周期 | onPageShow() {
//判断是否已初始化
if (this.repoListViewModel.isInit === false) {
this.repoListViewModel.initRepos()
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
//判断是否已初始化
if (this.repoListViewModel.isInit === false) {
this.repoListViewModel.initRepos()
}
} | https://gitee.com/openharmony-sig/online_event.git | bf73de0fecdd383f68f6e2ad5a668f03342206ed | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | evalJSAsync | 执行JavaScript代码(异步版本) | async evalJSAsync(code: string): Promise<string> {
const jsEngine = getLegadoJsEngine();
const context: JsContext = {
result: this.content,
baseUrl: this.baseUrl,
src: this.content,
variables: this.getVariablesObject(),
jsLib: this.jsLib
};
const result = await jsEng... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left evalJSAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async evalJSAsync(code: string): Promise<string> {
const jsEngine = getLegadoJsEngine();
const context: JsContext = {
result: this.content,
baseUrl: this.baseUrl,
src: this.content,
variables: this.getVariablesObject(),
jsLib: this.jsLib
};
const result = await jsEng... | https://github.com/DaLongZhuaZi/manxia | e5946f0bebcb2c9c9e4463a9783fbe9080fe707b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets | arkts | getWebViewInstance | 获取WebView实例 | getWebViewInstance(sourceId: string): webview.WebviewController | null {
try {
let instanceInfo: WebViewInstanceInfo | undefined = this.webViewInstances.get(sourceId);
if (!instanceInfo) {
// 创建新实例
const newInstanceInfo = this.createWebViewInstance(sourceId);
if (!newIns... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getWebViewInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | getWebViewInstance(sourceId: string): webview.WebviewController | null {
try {
let instanceInfo: WebViewInstanceInfo | undefined = this.webViewInstances.get(sourceId);
if (!instanceInfo) {
// 创建新实例
const newInstanceInfo = this.createWebViewInstance(sourceId);
if (!newIns... | https://github.com/DaLongZhuaZi/manxia | 76b144e9d96d77646e6f4daf04ac8db396c2858b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets | arkts | getUnionConstituentTypes | Get all constituent types of a union class.
@returns { FixedArray<Class> | undefined } a fixed array of constituent types,
or undefined if this is not a union class.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getUnionConstituentTypes(): FixedArray<Class> | undefined {
if (!this.isUnion()) {
return undefined
}
return this.getUnionConstituentTypesInternal()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUnionConstituentTypes 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_expres... | public getUnionConstituentTypes(): FixedArray<Class> | undefined {
if (!this.isUnion()) {
return undefined
}
return this.getUnionConstituentTypesInternal()
} | https://gitcode.com/iop123123/arkts-static-skills | edc9411c05a9c6db31f6aefef83d73de83cc5d32 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | toLocaleTimeString | Gets a string with a language-sensitive representation of the time portion of the date.
@returns a language-sensitive representation of the time portion of the date. | public toLocaleTimeString(): String {
return Date.getLocaleString("%EX", "", this.ms, false);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleTimeString 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 Str... | public toLocaleTimeString(): String {
return Date.getLocaleString("%EX", "", this.ms, false);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c2372bdd47c88e523f39913ce3ea5b5beb3ec595 | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/LoginStateManager.ets | arkts | addListener | 注册状态变化监听 | addListener(listener: (state: LoginState) => void): void {
this.listeners.add(listener);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left addListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener 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(listener: (state: LoginState) => void): void {
this.listeners.add(listener);
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 8c821e538de788ca1ffbd6b3a094f9777c33588a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | arrayBuffer | Returns a promise that fulfills with an <ArrayBuffer> containing a copy of the Blob data.
@returns {Promise} | arrayBuffer(): Promise<ArrayBuffer> {
return Promise.resolve(ArrayBuffer.from(this.arrBuffer as ArrayBuffer))
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left arrayBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left ... | arrayBuffer(): Promise<ArrayBuffer> {
return Promise.resolve(ArrayBuffer.from(this.arrBuffer as ArrayBuffer))
} | https://gitcode.com/iop123123/arkts-static-skills | 5aae625737ecba92b5a428d0eefb07d55560ef3b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildPopularActions | 构建热门漫画获取操作序列 | buildPopularActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'popular');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少热门漫画工作流配置'
);
}
return this.processActions(workflow, {});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildPopularActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfig A... | buildPopularActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'popular');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少热门漫画工作流配置'
);
}
return this.processActions(workflow, {});
} | https://github.com/DaLongZhuaZi/manxia | a7fa1f1498277fb91ee5f3b8d5657f9a52ea64c2 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpBackgroundService.ets | arkts | scheduleRestart | Schedule service restart (called when service is unexpectedly terminated) | async scheduleRestart(): Promise<void> {
if (isNormalStop) {
console.info(`${TAG}: Normal stop, no restart needed`);
return;
}
const now = Date.now();
// Reset counter if cooldown period passed (5 minutes)
if (now - lastRestartTime > 5 * 60 * 1000) {
restartCount = 0;
con... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left scheduleRestart AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left... | async scheduleRestart(): Promise<void> {
if (isNormalStop) {
console.info(`${TAG}: Normal stop, no restart needed`);
return;
}
const now = Date.now();
// Reset counter if cooldown period passed (5 minutes)
if (now - lastRestartTime > 5 * 60 * 1000) {
restartCount = 0;
con... | https://github.com/tangwengang-del/freerdp-harmonyos | 6a96f90fe9a829c7ba37e47c45f675d16db927dc | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/ResourceUtil.ets | arkts | isEmptyObj | 检查对象是否为空
@param obj Object
@returns 如果对象为空或没有属性,则返回true否则返回false | private static isEmptyObj(obj: Object): boolean {
if (obj === null || typeof obj !== 'object') {
return true
}
return Object.keys(obj).length === 0
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isEmptyObj AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST... | private static isEmptyObj(obj: Object): boolean {
if (obj === null || typeof obj !== 'object') {
return true
}
return Object.keys(obj).length === 0
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 187ee500edea281f72a6d462d760d1911f612127 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/ListDemo2.ets | arkts | myFooter | 分组列表的每个组的 footer | @Builder function myFooter(num: number) {
Text(`共 ${num} 条数据`)
.fontSize(16)
.backgroundColor(Color.Green)
.fontColor(Color.White)
.width("100%")
.padding(10)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left myFooter AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required... | @Builder function myFooter(num: number) {
Text(`共 ${num} 条数据`)
.fontSize(16)
.backgroundColor(Color.Green)
.fontColor(Color.White)
.width("100%")
.padding(10)
} | https://github.com/webabcd/HarmonyDemo | 5360daae9c91f266b4fd68186998bdf867a62e03 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/equal/equal_byte.ets | arkts | main | ---
desc: check equality of two bytes
--- | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a == b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a == b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a9a12956eab50ccac313f15671cbbe331f41e57f | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitRepeatedString | 访问 repeated string 字段 | visitRepeatedString(value: string[], fieldNumber: number): void {
for (const item of value) {
this.visitString(item, fieldNumber)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedString 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#subscript_expression#Left AST#identifier#Left strin... | visitRepeatedString(value: string[], fieldNumber: number): void {
for (const item of value) {
this.visitString(item, fieldNumber)
}
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | e7724d4b5d878e07064d534b6b12becfba7358ad | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Array.ets | arkts | test_sortCopy | note: used for tests, {@link test_sortAllOn} | function test_sortCopy(arr: boolean[]): boolean[] {
let c = new boolean[arr.length]
for (let i = 0; i < arr.length; i++) {
c[i] = arr[i]
}
return c
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_sortCopy AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function test_sortCopy(arr: boolean[]): boolean[] {
let c = new boolean[arr.length]
for (let i = 0; i < arr.length; i++) {
c[i] = arr[i]
}
return c
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 87e3746300849993e9b6a91726c715e16a753521 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/json.ets | arkts | stringify | Converts booleans array to JSON format
@param d: boolean[] - booleans array to be converted to a JSON as an Array of Boolean literals
@returns String - JSON representation of booleans array | public static stringify(d: boolean[]): String {
let s = new StringBuilder("[")
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
if (d[i]) {
s.append("true,")
} else {
s.append("false,")
}
}
... | 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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: boolean[]): String {
let s = new StringBuilder("[")
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
if (d[i]) {
s.append("true,")
} else {
s.append("false,")
}
}
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7e764a0c418f1d546bda61549b37220c56c520f6 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/LogUtil.ets | arkts | setHilog | 日志打印方式
@param isHilog,true-hilog、false-console | public static setHilog(isHilog: boolean) {
LogUtil.isHilog = isHilog;
} | 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 setHilog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isHilog AST#identifier#Right AST#:#Left : AST#... | public static setHilog(isHilog: boolean) {
LogUtil.isHilog = isHilog;
} | https://github.com/tdcare/tdwebrtc | 325e56fcad832d84e28c57ccfa55882c1a6208b2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SyncPrimitives.ets | arkts | lock | Method gives exclusive access to critical section is case of successful mutex lock.
Otherwise, blocks current coroutine until other coroutine will unlock the mutex. | public lock(): void {
Mutex.lock(this);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left lock AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public lock(): void {
Mutex.lock(this);
} | https://gitcode.com/iop123123/arkts-static-skills | 0b1ad762db6a625650ff59809c27766637816ed8 | gitcode |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | blockGuestDanmaku | �����Ƿ������ο͵�Ļ
@param block true����false������
@return | public blockGuestDanmaku(block: boolean): DanmakuContext {
if (this.mBlockGuestDanmaku != block) {
this.mBlockGuestDanmaku = block;
if (block) {
this.setFilterData(DanmakuFilters.TAG_GUEST_FILTER, block);
} else {
this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_GU... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left blockGuestDanmaku AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left block AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public blockGuestDanmaku(block: boolean): DanmakuContext {
if (this.mBlockGuestDanmaku != block) {
this.mBlockGuestDanmaku = block;
if (block) {
this.setFilterData(DanmakuFilters.TAG_GUEST_FILTER, block);
} else {
this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_GU... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | bc3c42daf3adcb218c18257e0b507a8cdee70839 | gitee |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/component/UserAgreement.ets | arkts | build | 构建用户协议区域
@returns {void} 无返回值 | build(): void {
ColumnStart({ widthValue: P100 }) {
Text() {
Span(this.prefix)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_tertiary"));
Span($r("app.string.user_agreement"))
.fontSize($r("app.float.body_medium"))
.fontColor($r... | 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 {
ColumnStart({ widthValue: P100 }) {
Text() {
Span(this.prefix)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_tertiary"));
Span($r("app.string.user_agreement"))
.fontSize($r("app.float.body_medium"))
.fontColor($r... | https://github.com/Joker-x-dev/CoolMallArkTS | 44562c336f41d9ebaff7123470061e7cfad4f34d | github |
2763981847/Clock-Alarm | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | 窗口阶段创建时调用。
@param windowStage 创建的窗口阶段 | async onWindowStageCreate(windowStage: window.WindowStage) {
// AlarmClock 窗口已创建,为该能力设置主页面
let globalDisplay: display.Display = display.getDefaultDisplaySync();
// 在全局上下文中设置全局对象实例
GlobalContext.getContext().setObject('globalDisplay', globalDisplay);
let preference = GlobalContext.getContext().getO... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left windowStage AST#identifier#Right AST#type_annotati... | async onWindowStageCreate(windowStage: window.WindowStage) {
// AlarmClock 窗口已创建,为该能力设置主页面
let globalDisplay: display.Display = display.getDefaultDisplaySync();
// 在全局上下文中设置全局对象实例
GlobalContext.getContext().setObject('globalDisplay', globalDisplay);
let preference = GlobalContext.getContext().getO... | https://github.com/2763981847/Clock-Alarm | b6bb11f1b83df808866d641a8e6b1f4bc277c09a | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/download/FileTypes.ets | arkts | mime | 扩展名 → MIME 类型(系统"打开方式"匹配用)。 | static mime(ext: string): string {
const e: string = ext.toLowerCase();
if (e === 'pdf') return 'application/pdf';
if (e === 'epub') return 'application/epub+zip';
if (e === 'mobi') return 'application/x-mobipocket-ebook';
if (e === 'azw' || e === 'azw3') return 'application/vnd.amazon.ebook';
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left mime AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | static mime(ext: string): string {
const e: string = ext.toLowerCase();
if (e === 'pdf') return 'application/pdf';
if (e === 'epub') return 'application/epub+zip';
if (e === 'mobi') return 'application/x-mobipocket-ebook';
if (e === 'azw' || e === 'azw3') return 'application/vnd.amazon.ebook';
... | https://github.com/LZZLHY/hlib | d1b05474c19da8e3fbfcd818c752a5e3e4396f3e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/FTP/FTPNativeClient.ets | arkts | initialize | 初始化客户端 | async initialize(): Promise<boolean> {
checkNativeModule();
if (!nativeModule) {
logger.error(TAG, 'Native模块未加载');
return false;
}
try {
const protocol = this.config.useSFTP === true ? 'sftp' : (this.config.useFTPS ? 'ftps' : 'ftp');
logger.info(TAG, `初始化FTP客户端: ${protoco... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | async initialize(): Promise<boolean> {
checkNativeModule();
if (!nativeModule) {
logger.error(TAG, 'Native模块未加载');
return false;
}
try {
const protocol = this.config.useSFTP === true ? 'sftp' : (this.config.useFTPS ? 'ftps' : 'ftp');
logger.info(TAG, `初始化FTP客户端: ${protoco... | https://github.com/DaLongZhuaZi/manxia | d4fa3f067ddd02bc17f50ad07b0a30bcda51ef0f | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Row.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
RowSpaceAroundBottom() { Text("A"); Text("B"); Text("C"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | 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 {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | https://github.com/Joker-x-dev/CoolMallArkTS | 1d3b6984bc0016b5b117f9c14d9d57a8aac72b63 | github |
openharmony/codelabs | ETSUI/Foodbook/entry/src/main/ets/pages/set up.ets | arkts | clearCacheAction | 执行清除操作 | clearCacheAction() {
this.showRunImage = true
setTimeout(() => {
this.showRunImage = false
promptAction.showToast({
message: '清除成功!',
duration: 2000
})
this.cacheSize = '0B'
}, 3500)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearCacheAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | clearCacheAction() {
this.showRunImage = true
setTimeout(() => {
this.showRunImage = false
promptAction.showToast({
message: '清除成功!',
duration: 2000
})
this.cacheSize = '0B'
}, 3500)
} | https://gitcode.com/openharmony/codelabs | f448ccd8698264639c4dedb41c2d708877437ad6 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Copies all elements of arr to the current BigUint64Array starting from insertPos.
@param arr array to copy data from
@param insertPos start index where data from arr will be inserted
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
public | /* public */ internal set(arr: BigInt[], insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: BigInt[]): size of arr is greater than BigUint64Array.length")
}
for (let i = 0; i < arr.length; ++i) {
... | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#id... | /* public */ internal set(arr: BigInt[], insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: BigInt[]): size of arr is greater than BigUint64Array.length")
}
for (let i = 0; i < arr.length; ++i) {
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b8914b52d030011614fef8b73215c978100d0ede | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | getById | 根据ID查询训练记录 | static async getById(recordId: number): Promise<SmartCategoryTraining | null> {
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SmartCategoryTraining.tableName);
predicates.equalTo('record_id', recordId).and().equalTo('is_deleted', 0);
... | 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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | static async getById(recordId: number): Promise<SmartCategoryTraining | null> {
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SmartCategoryTraining.tableName);
predicates.equalTo('record_id', recordId).and().equalTo('is_deleted', 0);
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 10ceaaf88b69852cc5b5e55189cf453b721d0d49 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | cleanupDistantCompletedForWebtoon | 条漫模式:清理远离可见区域的已完成项 | cleanupDistantCompletedForWebtoon(): void {
if (this.visiblePages.size === 0) {
return;
}
const keepRange = this.config.webtoonPreloadRange + 5;
const toRemove: number[] = [];
this.completed.forEach(pageIndex => {
// 检查是否在任何可见页面的范围内
let isInRange = false;
this.visiblePage... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanupDistantCompletedForWebtoon 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#{#Left { A... | cleanupDistantCompletedForWebtoon(): void {
if (this.visiblePages.size === 0) {
return;
}
const keepRange = this.config.webtoonPreloadRange + 5;
const toRemove: number[] = [];
this.completed.forEach(pageIndex => {
// 检查是否在任何可见页面的范围内
let isInRange = false;
this.visiblePage... | https://github.com/DaLongZhuaZi/manxia | b6b7ff76f1d67b67b6b52a2101eb909a6521f5cd | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/NotificationService.ets | arkts | markAsRead | 标记通知已读 | async markAsRead(notificationId: string): Promise<boolean> {
try {
const response = await HttpUtil.post(`/notifications/${notificationId}/read`);
if (response.success) {
const notification = this.notifications.get(notificationId);
if (notification) {
notification.statu... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left markAsRead AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left notificationId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async markAsRead(notificationId: string): Promise<boolean> {
try {
const response = await HttpUtil.post(`/notifications/${notificationId}/read`);
if (response.success) {
const notification = this.notifications.get(notificationId);
if (notification) {
notification.statu... | https://github.com/LJ666-ui/harmony-health-care | 998c16530c92292aba7edd65662550e342486531 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | increaseStackLength | Increases the length of the element stack by creating a new `XmlNode` object with default empty values for
`name`, `prefix`, and `namespace_`, and pushing it onto the `elementStack`. | private increaseStackLength(): void {
let node: XmlNode = {
name: '',
prefix: '',
namespace_: ''
}
this.elementStack.push(node);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left increaseStackLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | private increaseStackLength(): void {
let node: XmlNode = {
name: '',
prefix: '',
namespace_: ''
}
this.elementStack.push(node);
} | https://gitcode.com/iop123123/arkts-static-skills | ee253bdd8506c25a02ee653c2f3c3de047eef59e | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationListController.ets | arkts | clickToInfoMessages | The notification page is displayed. | clickToInfoMessages(hasAggregate, hasInfoMsg, isSearchStatus) {
if (this.resetTouch()) {
return;
}
if (this.isMultipleSelectState) {
return;
}
router.push({
uri: 'pages/infomsg/InfoMsg'
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickToInfoMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hasAggregate AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left hasInfoMsg AST#identifier#Right AST#,#Left ,... | clickToInfoMessages(hasAggregate, hasInfoMsg, isSearchStatus) {
if (this.resetTouch()) {
return;
}
if (this.isMultipleSelectState) {
return;
}
router.push({
uri: 'pages/infomsg/InfoMsg'
})
} | https://gitee.com/openharmony/applications_mms.git | e61b15338e6f740c2c7cd3418d2de5d95286151f | gitee |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/entity/Auth.ets | arkts | isExpired | 检查访问令牌是否过期
@returns {boolean} 是否过期 | isExpired(): boolean {
const currentTime: number = Date.now();
const expirationTime: number = this.createdAt + this.expire * 1000;
return currentTime >= expirationTime;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isExpired AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | isExpired(): boolean {
const currentTime: number = Date.now();
const expirationTime: number = this.createdAt + this.expire * 1000;
return currentTime >= expirationTime;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 0182537476f9e52f220701d3046304a50ab1881c | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/GlobalExtAbility/GlobalDialogModel.ets | arkts | permissionCheck | 判断是否拥有控制全局开关的权限
return boolean | public permissionCheck(): boolean {
try {
let flag = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
let bundleInfo = bundleManager.getBundleInfoForSelfSync(flag);
let atManager = abilityAccessCtrl.createAtManager();
let status =
atManager.verifyAccessTokenSync(bundleInf... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left permissionCheck 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 A... | public permissionCheck(): boolean {
try {
let flag = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
let bundleInfo = bundleManager.getBundleInfoForSelfSync(flag);
let atManager = abilityAccessCtrl.createAtManager();
let status =
atManager.verifyAccessTokenSync(bundleInf... | https://gitee.com/openharmony/applications_permission_manager.git | e46e5f91fb003a884a3d4b7bb9778c1b2232df5e | gitee |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messageinput/components/ClassicInputBar.ets | arkts | aboutToAppear | 4 columns x 2 rows | aboutToAppear() {
// Check initial input content
this.checkInputContent();
// Subscribe to blank area click event to dismiss keyboard
EventBus.getInstance().on('onBlankAreaClick', (eventData: emitter.EventData) => {
console.log('[ClassicInputBar] 📨 Received onBlankAreaClick event');
... | 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() {
// Check initial input content
this.checkInputContent();
// Subscribe to blank area click event to dismiss keyboard
EventBus.getInstance().on('onBlankAreaClick', (eventData: emitter.EventData) => {
console.log('[ClassicInputBar] 📨 Received onBlankAreaClick event');
... | https://github.com/Tencent-RTC/TUIKit_Harmony | f1ab39ffd37c972600d4063ffff0ac3edccf5359 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | includes | Determines whether Int16Array includes a certain element, returning true or false as appropriate
@param { short } searchElement - The element to search for
@param { int } fromIndex - The position in this array at which to begin searching for searchElement
@returns { boolean } - true if searchElement is in Int16Array, f... | public includes(searchElement: short, fromIndex: int): boolean {
return this.indexOf(searchElement.toInt(), fromIndex) != -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left short AST#iden... | public includes(searchElement: short, fromIndex: int): boolean {
return this.indexOf(searchElement.toInt(), fromIndex) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | e8d04d89dbc3d1079b25cc4ab8895e5928df9345 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/view/ImageAnimate.ets | arkts | getOffSetX | Get the image offset.
@param index
@returns offset | getOffSetX(index: number) {
let offsetIndex = this.getImgCoefficients(index);
let tempOffset = Math.abs(offsetIndex);
let offsetX = 0;
if (tempOffset === 1) {
offsetX = -Const.IMAGE_X_OFFSET_MAX * offsetIndex;
} else if (tempOffset === Const.HALF_COUNT) {
offsetX = -Const.IMAGE_x_OFFSE... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getOffSetX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A... | getOffSetX(index: number) {
let offsetIndex = this.getImgCoefficients(index);
let tempOffset = Math.abs(offsetIndex);
let offsetX = 0;
if (tempOffset === 1) {
offsetX = -Const.IMAGE_X_OFFSET_MAX * offsetIndex;
} else if (tempOffset === Const.HALF_COUNT) {
offsetX = -Const.IMAGE_x_OFFSE... | https://gitee.com/harmonyos/codelabs.git | 171b4c87ba894badd2c315ced8641880ce38b6cd | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/components/SwipeMenuListItem.ets | arkts | onIndexChanged | 监听index变化 - 重新创建菜单以确保菜单项正确更新 | onIndexChanged() {
logger.debug(`SwipeMenuListItem-${this.index} index changed, recreating menu`);
this.createMenu();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onIndexChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | onIndexChanged() {
logger.debug(`SwipeMenuListItem-${this.index} index changed, recreating menu`);
this.createMenu();
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 79052881308e43253b5aec30b621e42bd3ff2a58 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | createApproval | 创建审批(保存草稿)
@param params 创建参数 | async createApproval(params: CreateApprovalParams): Promise<ApiResponse<{ approvalId: string }>> {
return this.client.post<{ approvalId: string }>('/api/v1/approval/approvals', params)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createApproval AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async createApproval(params: CreateApprovalParams): Promise<ApiResponse<{ approvalId: string }>> {
return this.client.post<{ approvalId: string }>('/api/v1/approval/approvals', params)
} | https://github.com/David8Idira/AI-OA | e837d0f8ce3a476e5f58d42b74a760d078866efa | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/DownloadManager.ets | arkts | createOnlineMangaDownloadTaskWithFetcher | 创建在线漫画下载任务(延迟获取图片列表)
适用于在图源详情页下载时,还没有获取到章节图片数据的情况 | public async createOnlineMangaDownloadTaskWithFetcher(
mangaId: string,
mangaTitle: string,
chapterId: string,
chapterTitle: string,
sourceId: number,
pageListFetcher: PageListFetcher,
downloadCacheFlowId: string = ''
): Promise<string> {
const startedAt: number = Date.now();
try... | 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 createOnlineMangaDownloadTaskWithFetcher AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right A... | public async createOnlineMangaDownloadTaskWithFetcher(
mangaId: string,
mangaTitle: string,
chapterId: string,
chapterTitle: string,
sourceId: number,
pageListFetcher: PageListFetcher,
downloadCacheFlowId: string = ''
): Promise<string> {
const startedAt: number = Date.now();
try... | https://github.com/DaLongZhuaZi/manxia | 376bf1221712b01ec2b0add8629fdf61e1d36289 | github |
ZestBox-18/kitebook-frontend | commons/base/src/main/ets/entities/AccountBean.ets | arkts | isLiability | 判断当前账户是否为负债账户。 | isLiability(): boolean {
return this.type === AccountTypeEnum.LIABILITY;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLiability AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isLiability(): boolean {
return this.type === AccountTypeEnum.LIABILITY;
} | https://github.com/ZestBox-18/kitebook-frontend | b370d3ee417bb916e479d0a09cd2cc6ca8f3da23 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/EBookSettingsPage.ets | arkts | isDarkBackground | 判断背景色是否为深色 | function isDarkBackground(bgColor: string): boolean {
const hex = bgColor.replace('#', '');
const r = parseInt(hex.substring(0, 2), 16);
const g = parseInt(hex.substring(2, 4), 16);
const b = parseInt(hex.substring(4, 6), 16);
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
return luminance < 0... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isDarkBackground AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bgColor AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | function isDarkBackground(bgColor: string): boolean {
const hex = bgColor.replace('#', '');
const r = parseInt(hex.substring(0, 2), 16);
const g = parseInt(hex.substring(2, 4), 16);
const b = parseInt(hex.substring(4, 6), 16);
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
return luminance < 0... | https://github.com/DaLongZhuaZi/manxia | 80aa7c6e694398992072c5f1b0819d47b4bdebfc | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/pages/History/WatchHistoryPage.ets | arkts | showClearConfirmDialog | 显示清空确认弹窗 | showClearConfirmDialog() {
AlertDialog.show({
title: '清空观看历史',
message: '确定要清空所有观看历史吗?此操作无法撤销。',
primaryButton: {
value: '取消',
action: () => {}
},
secondaryButton: {
value: '清空',
fontColor: this.getThemeColors().errorColor,
action: () => {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showClearConfirmDialog 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_b... | showClearConfirmDialog() {
AlertDialog.show({
title: '清空观看历史',
message: '确定要清空所有观看历史吗?此操作无法撤销。',
primaryButton: {
value: '取消',
action: () => {}
},
secondaryButton: {
value: '清空',
fontColor: this.getThemeColors().errorColor,
action: () => {
... | https://github.com/SMAT-Lab/PhantomRendering | 572eca82001500a83c3d85299b70df0b00b8e892 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/DataStorageManager.ets | arkts | getNumber | 读取数字数据
@param storeName 存储文件名
@param key 键名
@param defaultValue 默认值
@returns 读取的值或默认值 | async getNumber(storeName: string, key: string, defaultValue: number = 0): Promise<number> {
try {
const prefs = await this.getPreferences(storeName);
const value = await prefs.get(key, defaultValue);
return value as number;
} catch (error) {
console.error(`[DataStorageManager] Failed ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNumber AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left storeName AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async getNumber(storeName: string, key: string, defaultValue: number = 0): Promise<number> {
try {
const prefs = await this.getPreferences(storeName);
const value = await prefs.get(key, defaultValue);
return value as number;
} catch (error) {
console.error(`[DataStorageManager] Failed ... | https://github.com/the-wwyang/kids-learning-app | 03485fa1af640cf8e843ee882f4479d2c4933347 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/LineParser.ets | arkts | filterBlankLines | 过滤空白行
@param lines 行数组
@returns 过滤掉仅包含空白字符的行(trim 后长度为 0) | static filterBlankLines(lines: string[]): string[] {
return lines.filter(line => line.trim().length > 0);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left filterBlankLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lines AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expr... | static filterBlankLines(lines: string[]): string[] {
return lines.filter(line => line.trim().length > 0);
} | https://github.com/XJTUWYD/ArkDiff | 2dff3b1ff56cdfd11d9617a533a7be9d9996931d | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/viewmodel/BaseHomeViewModel.ets | arkts | sendEvent | 发送事件
@param eventParam BaseHomeEventParam
@returns boolean | void | public sendEvent<P>(eventParam: BaseHomeEventParam<P>): boolean | void {
const eventType: BaseHomeEventTypeEnum = eventParam.type
if (eventType === BaseHomeEventTypeEnum.HANDLE_SCROLL_OFFSET) {
return this.handleListOffset(eventParam.param as OffsetParam)
} else if (eventType === BaseHomeEventTypeEn... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#binary_expression#Left AST#identifier#Left sendEvent AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left P AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig... | public sendEvent<P>(eventParam: BaseHomeEventParam<P>): boolean | void {
const eventType: BaseHomeEventTypeEnum = eventParam.type
if (eventType === BaseHomeEventTypeEnum.HANDLE_SCROLL_OFFSET) {
return this.handleListOffset(eventParam.param as OffsetParam)
} else if (eventType === BaseHomeEventTypeEn... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 719e7f9ab5ed699df7b786ca48216b1c9a87681b | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/NotificationDAO.ets | arkts | clearAll | 清空用户所有通知 | static async clearAll(userId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `DELETE FROM notifications WHERE user_id = ?`;
await store.executeSql(sql, [userId]);
} | 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 clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#... | static async clearAll(userId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `DELETE FROM notifications WHERE user_id = ?`;
await store.executeSql(sql, [userId]);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5d646f30973c20695dad107a65b5a1f568c65241 | github |
openharmony/applications_filepicker | entry/src/main/ets/pages/component/TreeItem.ets | arkts | needExpandPath | 是否需要展开目录,如果最近保存的目录不为空,需要展开到最近保存的目录
@returns true:需要展开目录 | needExpandPath(): boolean {
if (!this.canExpandPath() || this.isClickExpand) {
return false;
}
return FileUtil.hasSubFolder(this.loadPath, this.fileItem.currentDir);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left needExpandPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stat... | needExpandPath(): boolean {
if (!this.canExpandPath() || this.isClickExpand) {
return false;
}
return FileUtil.hasSubFolder(this.loadPath, this.fileItem.currentDir);
} | https://gitee.com/openharmony/applications_filepicker.git | 23190455e98ffa8554a760f2d0e266baf8a76b40 | gitee |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioDecoderManager.ets | arkts | decodeFromUrl | 从网络 URL 异步解码音频至下载目录
@param {string} url - 音频资源 URL
@param {string} outputFileName - 输出的目标文件名 (PCM)
@param {Function} [onProgress] - 可选的进度回调函数
@returns {Promise<boolean>} | public async decodeFromUrl(
url: string,
outputFileName: string,
onProgress?: (p: DecodeAudioProgress) => void
): Promise<boolean> {
if (!this.context) {
hilog.error(DOMAIN, TAG, 'decodeFromUrl: Context or DownloadDir not ready');
return false;
}
try {
const outputPath = n... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left decodeFromUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L... | public async decodeFromUrl(
url: string,
outputFileName: string,
onProgress?: (p: DecodeAudioProgress) => void
): Promise<boolean> {
if (!this.context) {
hilog.error(DOMAIN, TAG, 'decodeFromUrl: Context or DownloadDir not ready');
return false;
}
try {
const outputPath = n... | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioDecoderManager.ets#L244-L263 | 3422dc1f6c0314fd2a0ccaf186aaf1ae3d707d14 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | formatMessage | 格式化日志消息
@param level - 日志级别
@param tag - 日志标签
@param message - 日志消息
@returns 格式化后的日志消息 | private formatMessage(level: LogLevel, tag: string, message: string): string {
// [新增] 定义您需要的全局日志前缀
const globalPrefix = '[NGF] ';
const levelSymbol = LOG_LEVEL_SYMBOLS.get(level) || '❓ 未知';
const chineseTag = TAG_MAPPING[tag] || tag;
const timestamp = this.enableTimestamp ? this.getTimestamp() + ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private formatMessage(level: LogLevel, tag: string, message: string): string {
// [新增] 定义您需要的全局日志前缀
const globalPrefix = '[NGF] ';
const levelSymbol = LOG_LEVEL_SYMBOLS.get(level) || '❓ 未知';
const chineseTag = TAG_MAPPING[tag] || tag;
const timestamp = this.enableTimestamp ? this.getTimestamp() + ... | https://github.com/DaLongZhuaZi/manxia | cbd607452d52dfe18eb69fd8bfe9d75c3987b047 | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/RdbManager.ets | arkts | getSongById | 根据 ID 查询单首歌曲详情 | async getSongById(songId: string): Promise<SongItemType | null> {
if (!this.rdbStore) return null;
let predicates = new relationalStore.RdbPredicates(this.tableNameSong);
predicates.equalTo('id', songId);
const resultSet = await this.rdbStore.query(predicates);
const songs = this.parseSongResult... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getSongById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left songId AST#identifier#Right AST#t... | async getSongById(songId: string): Promise<SongItemType | null> {
if (!this.rdbStore) return null;
let predicates = new relationalStore.RdbPredicates(this.tableNameSong);
predicates.equalTo('id', songId);
const resultSet = await this.rdbStore.query(predicates);
const songs = this.parseSongResult... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L490-L500 | b82e714c6963445cc8dde515b00061232f37a11a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | getWorkflowNames | 获取工作流名称列表 | private getWorkflowNames(workflows: Workflow): string[] {
const names: string[] = [];
if (this.getWorkflowByType(workflows, WorkflowType.INITIALIZE)) names.push('initialize');
if (this.getWorkflowByType(workflows, WorkflowType.LOGIN)) names.push('login');
if (this.getWorkflowByType(workflows, Workflow... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getWorkflowNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left workflows AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Workflo... | private getWorkflowNames(workflows: Workflow): string[] {
const names: string[] = [];
if (this.getWorkflowByType(workflows, WorkflowType.INITIALIZE)) names.push('initialize');
if (this.getWorkflowByType(workflows, WorkflowType.LOGIN)) names.push('login');
if (this.getWorkflowByType(workflows, Workflow... | https://github.com/DaLongZhuaZi/manxia | 2c2d14a4d0c7c9647fd610175de2ce36811a05c6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentSet.ets | arkts | delete | Removes a value from the ConcurrentSet.
@param { T } val the value to remove
@returns { boolean } true if the delete operation is success, otherwise false. | public delete(val: T): boolean {
return this.elements.delete(val);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left val AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left T AST#ty... | public delete(val: T): boolean {
return this.elements.delete(val);
} | https://gitcode.com/iop123123/arkts-static-skills | 1b538b2315972e4924672285ffd3349fe1d59d60 | gitcode |
zmuxuny/ai-guardian-star | entry/src/main/ets/pages/MqttManager.ets | arkts | startDeviceCheck | 启动设备在线检测定时器(每5秒检查一次) | private startDeviceCheck(): void {
this.stopDeviceCheck();
this.deviceCheckTimer = setInterval(() => {
if (!this.isConnected) {
this.deviceOnline = false;
return;
}
// 如果在DEVICE_TIMEOUT_MS内收到过设备消息,视为在线
const elapsed = Date.now() - this.lastDeviceActivity;
this.dev... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startDeviceCheck 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#ex... | private startDeviceCheck(): void {
this.stopDeviceCheck();
this.deviceCheckTimer = setInterval(() => {
if (!this.isConnected) {
this.deviceOnline = false;
return;
}
// 如果在DEVICE_TIMEOUT_MS内收到过设备消息,视为在线
const elapsed = Date.now() - this.lastDeviceActivity;
this.dev... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/pages/MqttManager.ets#L195-L206 | bbd22f782bd5c4c912bdd87d2291c3ec5ceebfab | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/models/WordEntry.ets | arkts | isValid | Structural validation of a single entry. Kept here (not in the repository)
so both the parser and future dynamic content sources can reuse it. | isValid(): boolean {
if (this.id.length === 0) {
return false;
}
if (this.word.length === 0) {
return false;
}
if (this.meaningZh.length === 0) {
return false;
}
if (this.category.length === 0) {
return false;
}
if (!Number.isFinite(this.difficulty) || this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b... | isValid(): boolean {
if (this.id.length === 0) {
return false;
}
if (this.word.length === 0) {
return false;
}
if (this.meaningZh.length === 0) {
return false;
}
if (this.category.length === 0) {
return false;
}
if (!Number.isFinite(this.difficulty) || this.... | https://github.com/terryma2024/happyword | 94ecd1a681f11e0646729c9ecf105543af1bc2fc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | tryAsArray | Attempts to get an array value from an object by key.
Returns undefined if the key is not found or if the value is not an array.
@param {string} key - The key to look up
@returns {Array<JsonElement>} The array value if found, undefined otherwise | tryAsArray(): Array<JsonElement> | undefined {
return this.jsonType == JsonType.JsonArray
? this.maybeArrayValues
: undefined
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left tryAsArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:... | tryAsArray(): Array<JsonElement> | undefined {
return this.jsonType == JsonType.JsonArray
? this.maybeArrayValues
: undefined
} | https://gitcode.com/iop123123/arkts-static-skills | e99fd854ee2937da9f45ea92bef17cf1537dfd6e | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | aggregateByTag | 按标签聚合账单统计
@param userId 用户ID
@param startDate 开始日期
@param endDate 结束日期
@returns 标签统计结果 | static async aggregateByTag(
userId: number,
startDate: string,
endDate: string
): Promise<TagAggregation[]> {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
t.tag_id,
t.name AS tag_name,
t.color,
COUNT(DISTINCT bt.bill_id) AS bill_c... | 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 aggregateByTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ... | static async aggregateByTag(
userId: number,
startDate: string,
endDate: string
): Promise<TagAggregation[]> {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
t.tag_id,
t.name AS tag_name,
t.color,
COUNT(DISTINCT bt.bill_id) AS bill_c... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 509d77a264b5f5965d1d7caeb737b9260fb09d93 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/store/AppStore.ets | arkts | subscribe | 订阅状态变化 | public subscribe(listener: (state: AppState) => void): () => void {
this.listeners.push(listener);
// 返回取消订阅函数
return () => {
const index = this.listeners.indexOf(listener);
if (index > -1) {
this.listeners.splice(index, 1);
}
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left subscribe AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | public subscribe(listener: (state: AppState) => void): () => void {
this.listeners.push(listener);
// 返回取消订阅函数
return () => {
const index = this.listeners.indexOf(listener);
if (index > -1) {
this.listeners.splice(index, 1);
}
};
} | https://github.com/LJ666-ui/harmony-health-care | f91b9ba01037a9918185fc3f70b942e78b5ac3ec | github |
openharmony-sig/okdownload | entry/src/main/ets/pages/model/resModel.ets | arkts | constructor | 资源链接
status: string; //下载状态 | constructor(id: number, name: string, progress: number, priority: number, url: string) {
this.id = id;
this.name = name;
this.progress = progress;
this.priority = priority;
this.url = url;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST... | constructor(id: number, name: string, progress: number, priority: number, url: string) {
this.id = id;
this.name = name;
this.progress = progress;
this.priority = priority;
this.url = url;
} | https://gitee.com/openharmony-sig/okdownload.git | 8f31e7d962464b90694875bdbad9ef5b53cc433a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets | arkts | initializeUserManual | 初始化使用手册(首次运行时添加到书库) | public async initializeUserManual(): Promise<void> {
try {
// 确保已初始化
if (!this.isInitialized) {
await this.initialize();
}
const ebookDataManager = EBookDataManager.getInstance();
// Delete old user manual versions if they exist
const oldManualIds = getLegacyUserManua... | 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 initializeUserManual AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public async initializeUserManual(): Promise<void> {
try {
// 确保已初始化
if (!this.isInitialized) {
await this.initialize();
}
const ebookDataManager = EBookDataManager.getInstance();
// Delete old user manual versions if they exist
const oldManualIds = getLegacyUserManua... | https://github.com/DaLongZhuaZi/manxia | 58c97290e9b9a7bb4c8b01253a3c628726ae5fb1 | github |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | common/sample_common/src/main/ets/model/CommonEventManager.ets | arkts | subscribeCB | Callback for common event subscription. | private subscribeCB(error: BusinessError, data: commonEventManager.CommonEventData): void {
if (error) {
Logger.error(TAG, `Failed to subscribeCB. Code: ${error.code}`);
} else {
Logger.info(TAG, `Start to subscribeCB. Event: ${data.event}.`);
switch (data.event) {
case commonEventMa... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left subscribeCB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private subscribeCB(error: BusinessError, data: commonEventManager.CommonEventData): void {
if (error) {
Logger.error(TAG, `Failed to subscribeCB. Code: ${error.code}`);
} else {
Logger.info(TAG, `Start to subscribeCB. Event: ${data.event}.`);
switch (data.event) {
case commonEventMa... | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | d4ede63e739df6284ba7ac54860fca5af890f886 | gitcode |
LZZLHY/hlib | entry/src/main/ets/utils/AppRouter.ets | arkts | pushBookDetail | 跳转书籍详情。集中构造 BookDetailParams,避免各页/各 Tab 重复同一段映射逻辑
(此前在 HomeTab / SearchTab / FavoritesTab / BookDetailPage / SimilarBooksPage 各写一遍)。 | static pushBookDetail(book: Book): void {
const param: BookDetailParams = {
bookId: String(book.id),
hashId: book.hash !== undefined ? book.hash : '',
title: book.title,
cover: book.cover !== undefined ? book.cover : '',
};
AppRouter.push(Routes.BOOK_DETAIL, param);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left pushBookDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left book AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left B... | static pushBookDetail(book: Book): void {
const param: BookDetailParams = {
bookId: String(book.id),
hashId: book.hash !== undefined ? book.hash : '',
title: book.title,
cover: book.cover !== undefined ? book.cover : '',
};
AppRouter.push(Routes.BOOK_DETAIL, param);
} | https://github.com/LZZLHY/hlib | cc20ee366f2d7873be030cad1ae8bdbc55cd68fe | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | getMangaCardSize | 获取漫画卡片尺寸 | public static getMangaCardSize(): MangaCardSize {
const breakpoint = ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint();
switch (breakpoint) {
case Breakpoint.XS:
return new MangaCardSize(100, 140);
case Breakpoint.SM:
return new MangaCardSize(110, 154);
case Br... | 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 getMangaCardSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public static getMangaCardSize(): MangaCardSize {
const breakpoint = ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint();
switch (breakpoint) {
case Breakpoint.XS:
return new MangaCardSize(100, 140);
case Breakpoint.SM:
return new MangaCardSize(110, 154);
case Br... | https://github.com/DaLongZhuaZi/manxia | 48261170157c29d66890bf24b093b96f851088ea | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | calcAngles | calculates the needed angles for the chart slices | private calcAngles(): void {
if (!this.mData) {
return;
}
let entryCount: number = this.mData.getEntryCount();
if (this.mDrawAngles.length != entryCount) {
this.mDrawAngles = new Array<number>(entryCount) //new float[entryCount];
} else {
for (let i: number = 0; i < entryCount;... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calcAngles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressi... | private calcAngles(): void {
if (!this.mData) {
return;
}
let entryCount: number = this.mData.getEntryCount();
if (this.mDrawAngles.length != entryCount) {
this.mDrawAngles = new Array<number>(entryCount) //new float[entryCount];
} else {
for (let i: number = 0; i < entryCount;... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 607a92fded59f4b752f2d6cc559e3afdcad9c92a | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleContent.ets | arkts | onContentLoadTimedOut | Called by the overlay when its WebView reports a fatal load error or timeout. | public onContentLoadTimedOut(): void {
this.config.logger.w('[ModuleContent] content load timed out, closing overlay');
this.onContentClosedByUser(ContentStatus.CLOSED, { 'reason': 'timeout' });
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onContentLoadTimedOut 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#... | public onContentLoadTimedOut(): void {
this.config.logger.w('[ModuleContent] content load timed out, closing overlay');
this.onContentClosedByUser(ContentStatus.CLOSED, { 'reason': 'timeout' });
} | https://github.com/Countly/countly-sdk-hos | e86f2c13240858ad153619e31c3ea37b0a3816e9 | github |
huaiminqin/TankWar-Master-with-Many-Tasks | util/src/mock/DataService.ets | arkts | fetchListData | 真实逻辑:调用后端接口获取列表数据(依赖网络) | static async fetchListData(page: number, size: number): Promise<string[]> {
// 真实场景:axios.get('/api/list') 等网络请求
return new Promise((resolve) => {
setTimeout(() => {
// 真实接口返回的模拟数据(实际由后端返回)
// const data = Array.from({ length: size }, (_, i) => `真实数据-Page${page}-Item${i+1}`);
let... | 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 fetchListData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST... | static async fetchListData(page: number, size: number): Promise<string[]> {
// 真实场景:axios.get('/api/list') 等网络请求
return new Promise((resolve) => {
setTimeout(() => {
// 真实接口返回的模拟数据(实际由后端返回)
// const data = Array.from({ length: size }, (_, i) => `真实数据-Page${page}-Item${i+1}`);
let... | https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks | 04fb08e946e89f33a60742399b203c969a265a9a | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/utils/lunar.ets | arkts | getDayInChinese | 获取农历日期的中文名称
@returns 日期中文名称(如"初一"、"十五") | getDayInChinese(): string {
return LUNAR_DAY_NAMES[this.lunarDay - 1];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDayInChinese AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem... | getDayInChinese(): string {
return LUNAR_DAY_NAMES[this.lunarDay - 1];
} | https://github.com/codelably/tuniao-ui | 45164a5c69e5d951fe8ff4673ab31c6d3cd91276 | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/services/MusicShareService.ets | arkts | shareSong | 分享单首歌曲 | async shareSong(song: SongItemType): Promise<void> {
if (!this.context) {
console.error("MusicShareService: Context is null");
return;
}
try {
// **重要:为了确保 _buildSharedRecord 中 fs.accessSync 不会因 this.context 导致的潜在问题而失败,
// 并且保持 shareSong 内部对文件存在的明确控制,这里仍然保留文件存在的检查。
// 如果 _bu... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left shareSong AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left song AST#identifier#Right AST#type_... | async shareSong(song: SongItemType): Promise<void> {
if (!this.context) {
console.error("MusicShareService: Context is null");
return;
}
try {
// **重要:为了确保 _buildSharedRecord 中 fs.accessSync 不会因 this.context 导致的潜在问题而失败,
// 并且保持 shareSong 内部对文件存在的明确控制,这里仍然保留文件存在的检查。
// 如果 _bu... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/services/MusicShareService.ets#L171-L209 | b144a65693a8dbe1b7e98aa72807be547addd6aa | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/local/LocalFileStorage.ets | arkts | doWrite | 写入文件内容
@param path 文件路径
@param content 文件内容
@returns Promise<void> | public async doWrite(path: string, content: ArrayBuffer): Promise<void> {
try {
// 打开文件(如果不存在则创建)
const file = await fs.open(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
// 写入内容
await fs.write(file.fd, content);
// 关闭文件
await fs.close(file.fd);
return Promise.resol... | 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 doWrite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Rig... | public async doWrite(path: string, content: ArrayBuffer): Promise<void> {
try {
// 打开文件(如果不存在则创建)
const file = await fs.open(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
// 写入内容
await fs.write(file.fd, content);
// 关闭文件
await fs.close(file.fd);
return Promise.resol... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L113-L126 | 48d85fe49141c0983a460c73e3cc0c7ee3ae7cfa | github |
CLMC2025/Vignette | entry/src/main/ets/model/AnimationModel.ets | arkts | springBouncy | 创建弹跳的弹簧动画 | static springBouncy(direction: AnimationDirection = AnimationDirection.CENTER): AnimationConfig {
return AnimationConfig.spring(direction, 200, 8, 1);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left springBouncy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left direction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_exp... | static springBouncy(direction: AnimationDirection = AnimationDirection.CENTER): AnimationConfig {
return AnimationConfig.spring(direction, 200, 8, 1);
} | https://github.com/CLMC2025/Vignette | 925e5da7f0693d7a673cd7d5e47623b2753159fd | github |
zmuxuny/ai-guardian-star | entry/src/main/ets/common/ThemeManager.ets | arkts | updateSystemUI | 更新系统 UI(状态栏) | private async updateSystemUI() {
try {
if (!this.context) {
console.log(`[Theme]:Context 未初始化,跳过系统UI更新`);
return;
}
const mainWindow = await window.getLastWindow(this.context);
if (mainWindow) {
// 设置状态栏内容颜色(深色模式用白色文字,浅色模式用黑色文字)
await mainWindow.setWindowSy... | 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 updateSystemUI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async updateSystemUI() {
try {
if (!this.context) {
console.log(`[Theme]:Context 未初始化,跳过系统UI更新`);
return;
}
const mainWindow = await window.getLastWindow(this.context);
if (mainWindow) {
// 设置状态栏内容颜色(深色模式用白色文字,浅色模式用黑色文字)
await mainWindow.setWindowSy... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/ThemeManager.ets#L151-L169 | 801ba56909af1e98c47898a0347c350a35721b5a | github |
XHXYT/Pixark | entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets | arkts | deleteByIds | 根据多个ID批量删除历史记录 (主键批量删除,性能最优)
@param ids 记录ID数组
@returns 删除的记录数量 | async deleteByIds(ids: (number | null)[]): Promise<number> {
logger.debug('deleteByIds ids = ' + JSON.stringify(ids))
// 过滤掉 null 并转为字符串数组,适配 in 查询
const validIds = ids.filter(id => id !== null).map(String);
if (validIds.length === 0) return 0;
return this.deleteItem(this.getPredicates().in('id', ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteByIds AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ids AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async deleteByIds(ids: (number | null)[]): Promise<number> {
logger.debug('deleteByIds ids = ' + JSON.stringify(ids))
// 过滤掉 null 并转为字符串数组,适配 in 查询
const validIds = ids.filter(id => id !== null).map(String);
if (validIds.length === 0) return 0;
return this.deleteItem(this.getPredicates().in('id', ... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L109-L115 | ede2fd0948f63da8a4c643ef12ae4e4f3254448d | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/SnoozeManager.ets | arkts | deleteSnoozedAlarmId | Delete the nap data
@param alarmId alarm id | async deleteSnoozedAlarmId(alarmId: string): Promise<void> {
const snoozeIdsArray = await this.getSnoozedAlarmId();
const newSnoozeIdsArray = snoozeIdsArray.filter(id => alarmId !== id);
const preferences = await this.getPreferences();
await preferences.put(SNOOZE_ID, newSnoozeIdsArray.join(SNOOZE_SEP... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteSnoozedAlarmId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmId AST#identifier#Right AST#type_annotation#Left AST#... | async deleteSnoozedAlarmId(alarmId: string): Promise<void> {
const snoozeIdsArray = await this.getSnoozedAlarmId();
const newSnoozeIdsArray = snoozeIdsArray.filter(id => alarmId !== id);
const preferences = await this.getPreferences();
await preferences.put(SNOOZE_ID, newSnoozeIdsArray.join(SNOOZE_SEP... | https://gitee.com/openharmony-sig/applications_clock.git | c2c607a43e60819aaa8cd03f189139dc1a870e57 | gitee |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets | arkts | readFoldPosture | 读取折叠状态,更新 cachedFoldPosture
注意:display.getDisplayFoldStatus() 不在标准 API 类型定义中,
折叠状态改由 onConfigurationUpdate 回调注入,此处保持 Unknown。 | private readFoldPosture(): void {
// getDisplayFoldStatus() 不在标准 display 类型上,CI 构建不通过。
// 折叠状态由外部通过 updateFoldPosture() 注入。
this.cachedFoldPosture = FoldPosture.Unknown
hilog.info(DOMAIN, TAG, `FoldPosture: Unknown (deferred to external injection)`)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left readFoldPosture 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#exp... | private readFoldPosture(): void {
// getDisplayFoldStatus() 不在标准 display 类型上,CI 构建不通过。
// 折叠状态由外部通过 updateFoldPosture() 注入。
this.cachedFoldPosture = FoldPosture.Unknown
hilog.info(DOMAIN, TAG, `FoldPosture: Unknown (deferred to external injection)`)
} | https://github.com/Xiwei753/xiezuoruanjian | fcb60269b2c45af63f4c0d1b9aa88b44fdf71a53 | github |
dingzhilin1990/zhilinclaw | src/events/EventBus.ets | arkts | subscribe | 订阅事件
@param event 事件名称
@param handler 事件处理器
@returns 订阅 ID,用于取消订阅 | public subscribe(event: string, handler: EventHandler): string {
if (!this.subscribers.has(event)) {
this.subscribers.set(event, []);
}
const id = `sub_${++this.subscriptionCounter}`;
const subscription: Subscription = {
id,
handler,
once: false
};
this.subscribers.ge... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subscribe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | public subscribe(event: string, handler: EventHandler): string {
if (!this.subscribers.has(event)) {
this.subscribers.set(event, []);
}
const id = `sub_${++this.subscriptionCounter}`;
const subscription: Subscription = {
id,
handler,
once: false
};
this.subscribers.ge... | https://github.com/dingzhilin1990/zhilinclaw | 7a592b8ce435059a30d1880c69c6183e797777a1 | github |
openharmony-sig/smartperf | device/device_ui/entry/src/main/ets/common/ui/detail/chart/utils/Utils.ets | arkts | calcTextSize | public static float getLineSpacing(Paint paint, Paint.FontMetrics fontMetrics){
paint.getFontMetrics(fontMetrics);
return fontMetrics.ascent - fontMetrics.top + fontMetrics.bottom;
}
/**
* Returns a recyclable FSize instance.
* calculates the approximate size of a text, depending on a demo text
* avoid repeated calls (... | public static calcTextSize(paint: Paint, demoText: string): FSize{
var fsize: FSize = new FSize(paint.getTextSize() * demoText.length, paint.getTextSize());
return fsize;
} | 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 calcTextSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left paint AST#identifier#Right AST#:#Left : AS... | public static calcTextSize(paint: Paint, demoText: string): FSize{
var fsize: FSize = new FSize(paint.getTextSize() * demoText.length, paint.getTextSize());
return fsize;
} | https://gitee.com/openharmony-sig/smartperf.git | 296ef440d7013d7599629fb29ee1a443788c8544 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | hide | 隐藏面板(关闭所有标签) | hide(): void {
this.tabs = [];
this.activeTabId = '';
this.mode = PanelMode.HIDDEN;
this.notifyCallback();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS... | hide(): void {
this.tabs = [];
this.activeTabId = '';
this.mode = PanelMode.HIDDEN;
this.notifyCallback();
} | https://github.com/DaLongZhuaZi/manxia | 7e27283d254826eebebef85d12cbfa00f3bbc462 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets | arkts | resourceExists | 检查资源是否存在
@param context 上下文对象
@param resId 资源ID
@returns Promise<boolean> 资源是否存在 | public static async resourceExists(context: common.UIAbilityContext, resId: number): Promise<boolean> {
try {
await context.resourceManager.getStringValue(resId);
return true;
} catch (error) {
logger.debug(`Resource ${resId} does not exist`);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left resourceExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left con... | public static async resourceExists(context: common.UIAbilityContext, resId: number): Promise<boolean> {
try {
await context.resourceManager.getStringValue(resId);
return true;
} catch (error) {
logger.debug(`Resource ${resId} does not exist`);
return false;
}
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 0f83bd43834e69f05de4c6e26ca365a8b23f93b2 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/Rect.ets | arkts | exactCenterY | @return the exact vertical center of the rectangle as a float. | public exactCenterY(): number {
return (this.top + this.bottom) * 0.5;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left exactCenterY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | public exactCenterY(): number {
return (this.top + this.bottom) * 0.5;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1d596908cbc2ebf55985d05ec622b37184ab3b66 | gitee |
openharmony/applications_mms | entry/src/main/ets/pages/transmitmsg/transmitMsgController.ets | arkts | jumpToContactForResult | Go to Contacts app | async jumpToContactForResult(actionData, callback) {
let str = commonService.commonContactParam(actionData);
let data = await globalThis.mmsContext.startAbilityForResult(str);
this.dialogMsg.data = data;
if (data.resultCode == 0 && JSON.parse(data.want.parameters.contactObjects).leng... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left jumpToContactForResult AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#,#Left... | async jumpToContactForResult(actionData, callback) {
let str = commonService.commonContactParam(actionData);
let data = await globalThis.mmsContext.startAbilityForResult(str);
this.dialogMsg.data = data;
if (data.resultCode == 0 && JSON.parse(data.want.parameters.contactObjects).leng... | https://gitee.com/openharmony/applications_mms.git | c44c1f4f30c76f19ae98b973832067f7a45a0e8e | gitee |
openharmony/arkui_ace_engine | advanced_ui_component/treeviewv2/source/treeviewv2.ets | arkts | onNodeModify | Node modify event registration and processing.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 26 | public onNodeModify(callback: OnChangedCallback): void {
this.nodeModifyEvents.push(callback);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onNodeModify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public onNodeModify(callback: OnChangedCallback): void {
this.nodeModifyEvents.push(callback);
} | https://gitcode.com/openharmony/arkui_ace_engine | 6e95fea28f3e138d2eb76d3ebb05cea61a676b82 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Workflow/WorkflowCapabilities.ets | arkts | startSessionManagement | 启动会话管理 | async startSessionManagement(
context: WorkflowContext,
refreshCallback: () => Promise<void>
): Promise<void> {
const capability = context.capabilities.get('sessionManagement');
if (!capability) {
return;
}
const config = capability as SessionRefreshConfig;
await this.sessionManag... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startSessionManagement 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 AS... | async startSessionManagement(
context: WorkflowContext,
refreshCallback: () => Promise<void>
): Promise<void> {
const capability = context.capabilities.get('sessionManagement');
if (!capability) {
return;
}
const config = capability as SessionRefreshConfig;
await this.sessionManag... | https://github.com/DaLongZhuaZi/manxia | 0397773a837c838c37a4c39f39054d967e639d9e | github |
openharmony-sig/fluttertpc_video_compress | ohos/src/main/ets/dev/fluttercommunity/video_compress/VideoCompress.ets | arkts | toArrayBuffer | PixelMap 转ArrayBuffer | toArrayBuffer(pixel: PixelMap) {
let buf = new ArrayBuffer(pixel.getPixelBytesNumber())
pixel.readPixelsToBuffer(buf)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toArrayBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pixel AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PixelMap AST#identifier#Ri... | toArrayBuffer(pixel: PixelMap) {
let buf = new ArrayBuffer(pixel.getPixelBytesNumber())
pixel.readPixelsToBuffer(buf)
} | https://gitee.com/openharmony-sig/fluttertpc_video_compress.git | 6af9d127f6a774e735b4ef4a85fb81fdbfce90e3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportNovelSourcesToFiles | 导出书源为单独JSON文件到legadoextensions目录 | private async exportNovelSourcesToFiles(tempDir: string, novelSources: NovelSourceBackup[]): Promise<void> {
const legadoDir = `${tempDir}/legadoextensions`;
if (!SafeFileUtils.accessSync(legadoDir)) {
SafeFileUtils.mkdirSyncStrict(legadoDir, true);
}
let exportedCount = 0;
const failur... | 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 exportNovelSourcesToFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tempDir AST#identifier#Right AST#ERROR#Lef... | private async exportNovelSourcesToFiles(tempDir: string, novelSources: NovelSourceBackup[]): Promise<void> {
const legadoDir = `${tempDir}/legadoextensions`;
if (!SafeFileUtils.accessSync(legadoDir)) {
SafeFileUtils.mkdirSyncStrict(legadoDir, true);
}
let exportedCount = 0;
const failur... | https://github.com/DaLongZhuaZi/manxia | 9c0e420b7c0329cc296badc9ae2e4224c096f3c9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setTime | Sets the number of milliseconds since the epoch,
which is defined as the midnight at the beginning of January 1, 1970, UTC.
@param { long } value new ms
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setTime(value: long): long {
this.ms = value;
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#Rig... | public setTime(value: long): long {
this.ms = value;
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | 9e00353626de734117ea1f6ecad490d4e681ee81 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | updateComicBasicInfo | 更新漫画基础信息
@param comicId 漫画ID
@param basicInfo 基础信息对象
注意:comic_info表的时间字段是updateTime(INTEGER),不是updatedAt | public async updateComicBasicInfo(comicId: string, basicInfo: ComicBasicInfoUpdate): Promise<void> {
try {
logger.info(TAG, `更新漫画基础信息: ${comicId}`);
// 直接使用SQL更新,避免UpdateRecordData类型转换问题
// comic_info表字段:id, sourceId, externalId, title, author, description, coverUrl, coverLocalPath,
... | 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 updateComicBasicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#... | public async updateComicBasicInfo(comicId: string, basicInfo: ComicBasicInfoUpdate): Promise<void> {
try {
logger.info(TAG, `更新漫画基础信息: ${comicId}`);
// 直接使用SQL更新,避免UpdateRecordData类型转换问题
// comic_info表字段:id, sourceId, externalId, title, author, description, coverUrl, coverLocalPath,
... | https://github.com/DaLongZhuaZi/manxia | a3b971ea9e58eb9dcde4d291768ca9092d33f157 | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets | arkts | enableBluetooth | 开启蓝牙功能 | enableBluetooth(): void {
Log.showInfo(TAG, `enableBluetooth`);
try {
this.onBTStateChange();
access.enableBluetooth();
} catch (err) {
Log.showError(TAG, `enableBluetooth: err = ${err}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left enableBluetooth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl... | enableBluetooth(): void {
Log.showInfo(TAG, `enableBluetooth`);
try {
this.onBTStateChange();
access.enableBluetooth();
} catch (err) {
Log.showError(TAG, `enableBluetooth: err = ${err}`);
}
} | https://gitcode.com/arkui-x/samples | 6247d25d065bb23f2e76aa401be5b51711ad66a4 | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/GuidePage.ets | arkts | isEverywhereCancelable | 获取当前引导页是否支持点击任意位置切换下一页或移除
@returns 是否支持点击任意位置切换下一页或移除 | public isEverywhereCancelable(): boolean {
return this.everywhereCancelable;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEverywhereCancelable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left bo... | public isEverywhereCancelable(): boolean {
return this.everywhereCancelable;
} | https://github.com/wuba/omni-ui | a7dcf24c3566011cd14aa08427ee8892a18a6fdc | github |
offlinecat-dev/OCNetORM | src/main/ets/database/DatabaseManager.ets | arkts | isHealthy | 检查连接是否健康
@returns 是否健康 | isHealthy(): boolean {
return this.healthy
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isHealthy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | isHealthy(): boolean {
return this.healthy
} | https://github.com/offlinecat-dev/OCNetORM | 1fa5f8601efa1725ef9aa56d3fa7120c1a6ba8d2 | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/features/learning/src/main/ets/model/LearningModel.ets | arkts | init | init list data and load learning path from servers. | init(): void {
this.loadLearningPathData();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS... | init(): void {
this.loadLearningPathData();
} | https://gitcode.com/HarmonyOS_Samples/hmosworld | 7608eb161d39be54334aea38df8a79a64360d253 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/BookmarkBase.ets | arkts | fromJson | Create a bookmark from JSON object | static fromJson(json: object): BookmarkBase {
const bookmark = new BookmarkBase();
const data = json as Record<string, Object>;
// Copy basic properties
if (data['id'] !== undefined) bookmark.id = data['id'] as number;
if (data['label'] !== undefined) bookmark.label = data['label'] as string;... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left object ... | static fromJson(json: object): BookmarkBase {
const bookmark = new BookmarkBase();
const data = json as Record<string, Object>;
// Copy basic properties
if (data['id'] !== undefined) bookmark.id = data['id'] as number;
if (data['label'] !== undefined) bookmark.label = data['label'] as string;... | https://github.com/tangwengang-del/freerdp-harmonyos | c02dd033865837bc399edded99ca076d9e1c8748 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | getAVPlayerState | 获取当前avplayer状态
@returns {media.AVPlayerState | undefined} | getAVPlayerState(): media.AVPlayerState | undefined {
if (!this.avPlayer) {
logger.error('avPlayer no create.');
return;
}
return this.avPlayer.state;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAVPlayerState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#... | getAVPlayerState(): media.AVPlayerState | undefined {
if (!this.avPlayer) {
logger.error('avPlayer no create.');
return;
}
return this.avPlayer.state;
} | https://gitcode.com/arkui-x/samples | 8b5af22a590de2bff35a07311614d5c1186c48a7 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setDrawRoundedSlices | Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabled
and if the slices are not drawn under the hole.
@param enabled draw curved ends of slices | public setDrawRoundedSlices(enabled: boolean): void {
this.mDrawRoundedSlices = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawRoundedSlices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public setDrawRoundedSlices(enabled: boolean): void {
this.mDrawRoundedSlices = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 3d5bf4afd6b391c494dd9d8a60b8237c20110320 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test31_original_index.ets | arkts | testNumberParsing | --- Number parsing edge cases --- | function testNumberParsing(): string {
let a: number = parseInt('ff', 16);
let b: number = parseInt('1010', 2);
let c: number = parseFloat('3.14');
let d: number = Number('0');
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNumberParsing AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testNumberParsing(): string {
let a: number = parseInt('ff', 16);
let b: number = parseInt('1010', 2);
let c: number = parseFloat('3.14');
let d: number = Number('0');
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | https://github.com/miaochiahao/ark-ghidra | 4d8632a07fed8101609b7e9b567157f8a8d99ae4 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/utils/EventBus.ets | arkts | getEventId | Get or create event ID for event name | private static getEventId(eventName: string): number {
if (!EventBus.eventIdMap.has(eventName)) {
EventBus.eventIdMap.set(eventName, EventBus.nextEventId++);
}
return EventBus.eventIdMap.get(eventName)!;
} | 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 getEventId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left... | private static getEventId(eventName: string): number {
if (!EventBus.eventIdMap.has(eventName)) {
EventBus.eventIdMap.set(eventName, EventBus.nextEventId++);
}
return EventBus.eventIdMap.get(eventName)!;
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 45132709d7681bf29f91ca18505dd51656857132 | github |
jiwangyihao/FlameChase | entry/src/main/ets/utils/DesignSystem.ets | arkts | getColor | Get color from resources with light variation based on HSL color model.
@param resourceStr Color resource from app, e.g., 'app.color.my_color'.
@param variation Lightness value (0-1000), where 0 is white and 1000 is black.
@returns Color with applied light variation. | getColor(
darkHint: NumberObject, resourceStr: string, variation: number = 600,
alpha: number = 1
): string | Resource {
if (this.context === undefined) {
throw new Error('DesignSystem context is not registered. Call register() first.');
}
if (variation < 0 || variation > 1000) {
th... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left darkHint AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left N... | getColor(
darkHint: NumberObject, resourceStr: string, variation: number = 600,
alpha: number = 1
): string | Resource {
if (this.context === undefined) {
throw new Error('DesignSystem context is not registered. Call register() first.');
}
if (variation < 0 || variation > 1000) {
th... | https://github.com/jiwangyihao/FlameChase | 559756b515afcf479b0473363efe561741b2a028 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/AudioHaptic/entry/src/main/ets/pages/AudioHaptic.ets | arkts | aboutToAppear | 需更改为目标振动资源的Uri | aboutToAppear(): void {
console.log(`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 {
console.log(`aboutToAppear`)
} | https://github.com/openharmony/applications_app_samples | 84d924cf772666f6eccac24a8cca0b01c2c54f69 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginatedResult.ets | arkts | isFirstPage | 检查当前页是否为第一页
@returns 是否为第一页 | isFirstPage(): boolean {
return this.page === 1
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isFirstPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isFirstPage(): boolean {
return this.page === 1
} | https://github.com/offlinecat-dev/OCNetORM | 04200deeeb8e87f1ee2a1f9d0e41334ec4626097 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AutomationEngine.ets | arkts | checkRules | 检查规则触发条件 | public async checkRules(eventData: EventData): Promise<RuleExecutionResult[]> {
const results: RuleExecutionResult[] = [];
console.log(`AutomationEngine: Checking rules for event ${eventData.eventType}`);
// 遍历所有启用的规则
for (const rule of this.rules.values()) {
if (!rule.isEnabled) {
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 checkRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventData AST#identifier#Right AST#:#Left : A... | public async checkRules(eventData: EventData): Promise<RuleExecutionResult[]> {
const results: RuleExecutionResult[] = [];
console.log(`AutomationEngine: Checking rules for event ${eventData.eventType}`);
// 遍历所有启用的规则
for (const rule of this.rules.values()) {
if (!rule.isEnabled) {
con... | https://github.com/LJ666-ui/harmony-health-care | edb746ae24e582391745474026be2963ed4557d1 | github |
bhengubv/aether-protocol | arkts/src/main/ets/incentive/MeshTipService.ets | arkts | settleMeshTip | The payload parameter is part of the interface contract; a bare node
intentionally settles nothing, so it is accepted and ignored. | async settleMeshTip(payload: TipPacketPayload): Promise<void> {
// intentionally no-op — a bare node carries the tip signal but never moves value.
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left settleMeshTip AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left payload AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async settleMeshTip(payload: TipPacketPayload): Promise<void> {
// intentionally no-op — a bare node carries the tip signal but never moves value.
} | https://github.com/bhengubv/aether-protocol | 70308fc23fdddeac3c445298388e21b792249b4b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | setOriginalSensorCallback | 设置原始传感器回调(用于 motion event 直通)
当体感助手活跃时,传感器数据同时发给助手和此回调 | setOriginalSensorCallback(callback: SensorDataCallback | null): void {
this.originalSensorCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOriginalSensorCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left... | setOriginalSensorCallback(callback: SensorDataCallback | null): void {
this.originalSensorCallback = callback;
} | https://github.com/AlkaidLab/moonlight-harmony | 5d7f7c958d0b09d043eec33cd20330deae8a672c | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.