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 |
|---|---|---|---|---|---|---|---|---|---|---|
Bistu-OSSDT-2024/16-ArkNotes | memo/entry/src/main/ets/pages/Index.ets | arkts | build | 当前选择的壁纸的索引
两种内置的壁纸的路径 | build() {
Stack() {
// 背景图片
//Image($r('app.media.backgroundimage'))
Image(this.backgroundImages[this.backgroundImageIndex]) // 使用当前选择的壁纸
.width('100%')
.height('100%')
.objectFit(ImageFit.Fill)
// 主体页面
Column() {
// 标题栏
CustomTitle({
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack() {
// 背景图片
//Image($r('app.media.backgroundimage'))
Image(this.backgroundImages[this.backgroundImageIndex]) // 使用当前选择的壁纸
.width('100%')
.height('100%')
.objectFit(ImageFit.Fill)
// 主体页面
Column() {
// 标题栏
CustomTitle({
... | https://github.com/Bistu-OSSDT-2024/16-ArkNotes | f199413d1d8b6a870f86cb758675677258ab7fd1 | github |
openharmony/applications_mms | entry/src/main/ets/service/CallService.ets | arkts | call | Calling
@param telephone
@callback callback | call(telephone, callback) {
if (telephone == null || telephone == common.string.EMPTY_STR) {
HiLog.i(TAG, 'telephone is null');
return;
}
let result: LooseObject = {};
call.dial(telephone).then((value) => {
result.code = common.int.SUCCESS;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left call AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left telephone AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Right AST#arg... | call(telephone, callback) {
if (telephone == null || telephone == common.string.EMPTY_STR) {
HiLog.i(TAG, 'telephone is null');
return;
}
let result: LooseObject = {};
call.dial(telephone).then((value) => {
result.code = common.int.SUCCESS;
... | https://gitee.com/openharmony/applications_mms.git | 0cd8b02d0aab0a513cb3835915efc61ceaf93f27 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/SettingsService.ets | arkts | isDarkMode | @deprecated 使用 getThemeMode 代替
获取深色模式状态 | public async isDarkMode(): Promise<boolean> {
const mode = await this.getThemeMode();
return mode === ThemeMode.DARK;
} | 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 isDarkMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public async isDarkMode(): Promise<boolean> {
const mode = await this.getThemeMode();
return mode === ThemeMode.DARK;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L159-L162 | bd26eac847e5df95a31851e32465581657cd4edf | github |
openharmony/codelabs | Data/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets | arkts | bottomTextStyle | Bottom text common style. | @Extend(Text) function bottomTextStyle (fontWeight: number, textAttribute: number, fontSize: Resource, fontColor: Resource) {
.fontWeight(fontWeight)
.letterSpacing(textAttribute)
.fontSize(fontSize)
.fontColor(fontColor)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text) function bottomTextStyle (fontWeight: number, textAttribute: number, fontSize: Resource, fontColor: Resource) {
.fontWeight(fontWeight)
.letterSpacing(textAttribute)
.fontSize(fontSize)
.fontColor(fontColor)
} | https://gitee.com/openharmony/codelabs.git | cf73d75ca664cb94cc36e328aa2302c044d831b7 | gitee |
PollenWang6/HiXD | entry/src/main/ets/services/ClassService.ets | arkts | appPost | 业务 POST 请求 | private async appPost(path: string, body: Record<string, string>): Promise<HttpResponse> {
const url = 'https://ehall.xidian.edu.cn' + path;
const cookies = this.http.getCookiesForDomain('ehall.xidian.edu.cn');
const hasCas: boolean = cookies.indexOf('MOD_AUTH_CAS') >= 0;
const hasJsession: boolean = ... | 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 appPost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#... | private async appPost(path: string, body: Record<string, string>): Promise<HttpResponse> {
const url = 'https://ehall.xidian.edu.cn' + path;
const cookies = this.http.getCookiesForDomain('ehall.xidian.edu.cn');
const hasCas: boolean = cookies.indexOf('MOD_AUTH_CAS') >= 0;
const hasJsession: boolean = ... | https://github.com/PollenWang6/HiXD | afd59c80fe2dd9fc69f30174367bdbe6f4a35b68 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/08.reference_types/06.array_types/array_type.ets | arkts | main | ---
desc: An array is an object which contains elements of a similar data type
params: {{item.array}}
--- | function main(): void {
let x: {{item.type}}[] = {{item.array}}; | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let x: {{item.type}}[] = {{item.array}}; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 62c14b1666b1ef6d83de53341dc429061ea2a810 | gitee |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/common/utils/DateUtil.ets | arkts | formatDate | 核心:格式化日期为 YYYY-MM-DD 字符串
修复了补0逻辑,确保是 2023-01-05 而不是 2023-1-5 | static formatDate(date: number | Date): string {
if (!date) {
return '';
} // 安全保护
let d = new Date(date);
let year = d.getFullYear();
let month = d.getMonth() + 1;
let day = d.getDate();
let monthStr = month < 10 ? '0' + month : '' + month;
let dayStr = day < 10 ? '0' + day : ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Lef... | static formatDate(date: number | Date): string {
if (!date) {
return '';
} // 安全保护
let d = new Date(date);
let year = d.getFullYear();
let month = d.getMonth() + 1;
let day = d.getDate();
let monthStr = month < 10 ? '0' + month : '' + month;
let dayStr = day < 10 ? '0' + day : ... | https://gitcode.com/openharmony/codelabs | 2955af44b024d4b0e3c1d8c7484953adacf0d5e5 | gitcode |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/response/Response.ets | arkts | success | Create a synthetic successful response with null body. | static success<T>(body: T | null = null): Response<T> {
return new Response<T>(200, 'OK', body, {});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left success AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right... | static success<T>(body: T | null = null): Response<T> {
return new Response<T>(200, 'OK', body, {});
} | https://github.com/killetom/ktretrofit | 22c4fe9a67c3868b4c1bf05e4b2079575ce181f3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getEbookFontSize | 获取电子书字号 | public static getEbookFontSize(): number {
return FontAwareHelper.globalState.ebookFontSize;
} | 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 getEbookFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public static getEbookFontSize(): number {
return FontAwareHelper.globalState.ebookFontSize;
} | https://github.com/DaLongZhuaZi/manxia | 3d864ef60ce53ee01c8e80611335138a8af92dcb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelInitializer.ets | arkts | loadSavedSources | 从数据库加载已保存的书源 | private async loadSavedSources(): Promise<void> {
try {
const dataManager = getNovelDataManager();
const sourceManager = getNovelSourceManager();
const savedSources = await dataManager.getAllSources();
for (const source of savedSources) {
// 直接加载到内存,不再持久化(已经在数据库中)
so... | 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 loadSavedSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private async loadSavedSources(): Promise<void> {
try {
const dataManager = getNovelDataManager();
const sourceManager = getNovelSourceManager();
const savedSources = await dataManager.getAllSources();
for (const source of savedSources) {
// 直接加载到内存,不再持久化(已经在数据库中)
so... | https://github.com/DaLongZhuaZi/manxia | 97baea1fb4ec81af00fc75b03d03b8172aaec7c0 | github |
Delsin-Yu/JustPDF | entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets | arkts | panByDeltaVp | 使用 vp 增量平移(用于水平滑动翻页时与 pageTurnOffsetVp 单位一致) | panByDeltaVp(deltaVp: Vector2, uiContext: UIContext): void {
this.viewPan = Vec2(this.viewPan.x + deltaVp.x, this.viewPan.y + deltaVp.y);
this.clampViewPan(uiContext);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left panByDeltaVp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deltaVp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Vector2 AST#identifier#Right AST#,#Left ... | panByDeltaVp(deltaVp: Vector2, uiContext: UIContext): void {
this.viewPan = Vec2(this.viewPan.x + deltaVp.x, this.viewPan.y + deltaVp.y);
this.clampViewPan(uiContext);
} | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets#L453-L456 | fb7985b9cc35c3ca6b5e1f0656453e89d867f4e9 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | setEscMenuEnabled | 设置 ESC 菜单功能是否启用 | setEscMenuEnabled(enabled: boolean): void {
this.escMenuEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setEscMenuEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#... | setEscMenuEnabled(enabled: boolean): void {
this.escMenuEnabled = enabled;
} | https://github.com/AlkaidLab/moonlight-harmony | c86411d06b3ded8a793f693f3963b454b057bfcf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | diff | 计算两个时间戳之间的差值
@param start - 开始时间戳
@param end - 结束时间戳(默认为当前时间)
@returns 时间差(毫秒) | static diff(start: number, end: number = Date.now()): number {
return end - start;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left diff AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | static diff(start: number, end: number = Date.now()): number {
return end - start;
} | https://github.com/DaLongZhuaZi/manxia | 438d0869796cc4fdb2a49bdbd96b53fbb75dd987 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | listVMSharedFiles | 列出 VM 共享目录内容 | public async listVMSharedFiles(vmName: string): Promise<string[]> {
try {
const sharedPath = this.getVMSharedPath(vmName);
const files: string[] = [];
const dir = fs.opendirSync(sharedPath);
let dirent = dir.readSync();
while (dirent) {
files.push(dirent.name);
... | 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 listVMSharedFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left... | public async listVMSharedFiles(vmName: string): Promise<string[]> {
try {
const sharedPath = this.getVMSharedPath(vmName);
const files: string[] = [];
const dir = fs.opendirSync(sharedPath);
let dirent = dir.readSync();
while (dirent) {
files.push(dirent.name);
... | https://github.com/AetheriumSimulator/qemu-hmos | 7cc729f7943f50d3cbc1dcf3c69aa1442f4ce75e | github |
HarmonyOS_Samples/push-kit-sample-code-clientdemo-arkts | entry/src/main/ets/abilities/TestAbility.ets | arkts | onNewWant | When the app is in the background, click pop-up to invoke | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
const value = want.parameters?.['testKey'];
hilog.info(0x0000, 'testTag', 'Succeeded in getting message data, value is %{public}s', value??'default value');
this.localStorage.setOrCreate('want', want)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R... | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
const value = want.parameters?.['testKey'];
hilog.info(0x0000, 'testTag', 'Succeeded in getting message data, value is %{public}s', value??'default value');
this.localStorage.setOrCreate('want', want)
} | https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-clientdemo-arkts | b4cac3c36dc86a2f768eb9707854c8d161f76b47 | gitcode |
xblLab/HarmonyProjectTemplate | features/course/src/main/ets/viewmodels/Calendar.ets | arkts | getFutureDatesCountInCurrentMonth | 获取当前月的未来日期数量(用于统计等用途)
@param calendar 日历数据
@returns 当前月中未来日期的数量 | static getFutureDatesCountInCurrentMonth(calendar: CalendarItem[]): number {
return calendar.filter(item => item.isCurrentMonth && !item.isPastDate && !item.isToday).length;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFutureDatesCountInCurrentMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left calendar AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ... | static getFutureDatesCountInCurrentMonth(calendar: CalendarItem[]): number {
return calendar.filter(item => item.isCurrentMonth && !item.isPastDate && !item.isToday).length;
} | https://github.com/xblLab/HarmonyProjectTemplate | 78c5c2c080ef16e249072a1bf9565d4f6726b33e | github |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | 2. 窗口阶段创建(关键:这里加载 UI) | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
// 窗口已创建,加载主页面
windowStage.loadContent('pages/StartPage', (err) => {
// 页面加载回调:加载成功或失败的处理
if (... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
// 窗口已创建,加载主页面
windowStage.loadContent('pages/StartPage', (err) => {
// 页面加载回调:加载成功或失败的处理
if (... | https://github.com/OnceWeWere/Weather_HarmonyOS | ec828fa28a69f68c320006519d32e047d51576ac | github |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/GestureUtils.ets | arkts | updateGestureState | 更新手势状态
@param state - 当前手势状态
@param currentX - 当前X坐标
@param currentY - 当前Y坐标
@returns 更新后的手势状态 | static updateGestureState(
state: GestureState,
currentX: number,
currentY: number
): GestureState {
return {
startX: state.startX,
startY: state.startY,
currentX: currentX,
currentY: currentY,
deltaX: currentX - state.startX,
deltaY: currentY - state.startY,
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left updateGestureState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static updateGestureState(
state: GestureState,
currentX: number,
currentY: number
): GestureState {
return {
startX: state.startX,
startY: state.startY,
currentX: currentX,
currentY: currentY,
deltaX: currentX - state.startX,
deltaY: currentY - state.startY,
... | https://github.com/kumaleap/ArkSwipeDeck | ac948849ef68fe6ec0617ff2bde06c4b6c3c723c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_long.ets | arkts | main | ---
desc: check not equal operation for two long integer operands
--- | function main(): void {
const a: long = {{v.left}}
const b: long = {{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: long = {{v.left}}
const b: long = {{v.right}}
assert (a != b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 385bfb77864995f850523a7a71dc209d1921b5ea | gitee |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/database/Config.ets | arkts | getConfigVersion | 获取配置版本号 | getConfigVersion(): number {
return initConfig.version
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfigVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#state... | getConfigVersion(): number {
return initConfig.version
} | https://github.com/ZestBox-18/kitebook-frontend | 61f638baa74f964b571961ce4ddce3e88bce6bac | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getLyrics | 获取歌词
@param id 音频 item id
@returns LyricDto JSON 或 undefined | public getLyrics(id: string): Promise<object | undefined> {
return this.requireApi().getLyrics(id)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLyrics 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 string A... | public getLyrics(id: string): Promise<object | undefined> {
return this.requireApi().getLyrics(id)
} | https://github.com/OHPG/FinMusic | d457b27200410dbf45cbc7ec277c9ebd381318b0 | github |
HarmonyOS_Samples/component-collection | entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets | arkts | build | Line width | build() {
Column() {
TitleBar({ title: $r('app.string.System_icon') })
Stack() {
// Brightness condition component
Stack() {
Slider({
value: this.sliderValue,
style: SliderStyle.InSet,
direction: Axis.Vertical,
reverse: true
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
TitleBar({ title: $r('app.string.System_icon') })
Stack() {
// Brightness condition component
Stack() {
Slider({
value: this.sliderValue,
style: SliderStyle.InSet,
direction: Axis.Vertical,
reverse: true
... | https://gitcode.com/HarmonyOS_Samples/component-collection | 2da63d3d88365016234ee9d66dcafef621604df2 | gitcode |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | dispose | 释放窗口监听
@returns {void} 无返回值 | dispose(): void {
if (!this.windowClass) {
return;
}
if (this.avoidAreaChangeHandler) {
this.windowClass.off("avoidAreaChange", this.avoidAreaChangeHandler);
}
if (this.windowSizeChangeHandler) {
this.windowClass.off("windowSizeChange", this.windowSizeChangeHandler);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dispose 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... | dispose(): void {
if (!this.windowClass) {
return;
}
if (this.avoidAreaChangeHandler) {
this.windowClass.off("avoidAreaChange", this.avoidAreaChangeHandler);
}
if (this.windowSizeChangeHandler) {
this.windowClass.off("windowSizeChange", this.windowSizeChangeHandler);
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | b3679a6412adbbdc99ecc1d832927b3f2f182855 | github |
arkui-x/samples | CodeLab/Cases/common/utils/src/main/ets/utils/NWebUtils.ets | arkts | getNWebEx | 重新获取NodeController | function getNWebEx(url:string, context:UIContext) : NWebNodeController | null {
createNWeb(url, context);
return getNWeb(url);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getNWebEx AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function getNWebEx(url:string, context:UIContext) : NWebNodeController | null {
createNWeb(url, context);
return getNWeb(url);
} | https://gitcode.com/arkui-x/samples | 3b827169db356306d0b94b681d97cfda94cda6d7 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | mergeStreamUsage | 把单块解析出的 usage 合并进本轮累积值:按字段取 max。
这样能统一处理 OpenAI(一次性)、Google(每块累计)、Anthropic(input 在 start / output 在 delta 累计)三种形态。 | private mergeStreamUsage(usage: UsageInfo): void {
const current = this.streamUsage
if (current === null) {
this.streamUsage = {
prompt_tokens: usage.prompt_tokens > 0 ? usage.prompt_tokens : 0,
completion_tokens: usage.completion_tokens > 0 ? usage.completion_tokens : 0,
total_t... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeStreamUsage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left usage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private mergeStreamUsage(usage: UsageInfo): void {
const current = this.streamUsage
if (current === null) {
this.streamUsage = {
prompt_tokens: usage.prompt_tokens > 0 ? usage.prompt_tokens : 0,
completion_tokens: usage.completion_tokens > 0 ? usage.completion_tokens : 0,
total_t... | https://github.com/LongLiveY96/chatcube | d9608a4039736f2809d0cbc19592dc7cf7e50ead | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | registerCallbacks | 注册动画回调 | public registerCallbacks(animationId: string, callbacks: AnimationCallbacks): void {
this.animationCallbacks.set(animationId, callbacks);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animationId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | public registerCallbacks(animationId: string, callbacks: AnimationCallbacks): void {
this.animationCallbacks.set(animationId, callbacks);
} | https://github.com/DaLongZhuaZi/manxia | af92893568c378653c5abc09b4bb40d8d30e1b6f | github |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets | arkts | findSimilarLearnedWord | Find if there's a similar learned word (for typo detection) | private findSimilarLearnedWord(m: LangModel, word: string): string | null {
const threshold = Math.min(2, Math.floor(word.length * 0.3)); // Max 2 char difference or 30% of word length
let bestMatch: string | null = null;
let bestDistance = threshold + 1;
// Check against all learned words (words in... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findSimilarLearnedWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left m AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private findSimilarLearnedWord(m: LangModel, word: string): string | null {
const threshold = Math.min(2, Math.floor(word.length * 0.3)); // Max 2 char difference or 30% of word length
let bestMatch: string | null = null;
let bestDistance = threshold + 1;
// Check against all learned words (words in... | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L105-L123 | fa99ad4da75c6c35b3270746f289491861624094 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | restoreMangaFromBackup | 从备份根目录/manga恢复漫画(新格式) | private async restoreMangaFromBackup(mangaSource: string): Promise<void> {
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (!downloadDirPath) {
logger.warn(TAG, 'Download目录未配置,跳过漫画恢复');
return;
}
const downloadMangaTarget = `${downloadDirPath}/manga`;
... | 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 restoreMangaFromBackup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaSource AST#identifier#Right AST#ERROR#Le... | private async restoreMangaFromBackup(mangaSource: string): Promise<void> {
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (!downloadDirPath) {
logger.warn(TAG, 'Download目录未配置,跳过漫画恢复');
return;
}
const downloadMangaTarget = `${downloadDirPath}/manga`;
... | https://github.com/DaLongZhuaZi/manxia | e9329d572ae06d883d08e91d33dce729d342e522 | github |
openharmony/xts_tools | sample/AppSampleD/entry/src/main/ets/pages/Index.ets | arkts | loginVerification | 底部选择索引
登录验证 | loginVerification(): boolean {
// 验证是否登录
if (AppStorage.get("userInfo") == null || AppStorage.get("userInfo") == undefined) {
return false;
}
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loginVerification 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#s... | loginVerification(): boolean {
// 验证是否登录
if (AppStorage.get("userInfo") == null || AppStorage.get("userInfo") == undefined) {
return false;
}
return true;
} | https://gitee.com/openharmony/xts_tools.git | 0735379bf289783b2c68322771b91bbb6728ae84 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Char.ets | arkts | isHexDigit | isBinDigit() checks whether the char represents a hexadecimal digit.
@param value a char to check.
@returns true if the char is a hexadecimal digit. | public static isHexDigit(value: char): boolean {
let isDigit = (c'0' <= value) && (value <= c'9')
let isChar = ((c'a' <= value) && (value <= c'f'))
|| ((c'A' <= value) && (value <= c'F'))
return isDigit || isChar
} | 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 isHexDigit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static isHexDigit(value: char): boolean {
let isDigit = (c'0' <= value) && (value <= c'9')
let isChar = ((c'a' <= value) && (value <= c'f'))
|| ((c'A' <= value) && (value <= c'F'))
return isDigit || isChar
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | aa2bcc574166be41ff4a9bcd7d85b0362816424e | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/service/AiService.ets | arkts | getChatSessions | 获取聊天会话列表 | async getChatSessions(): Promise<ApiResponse<{ sessions: ChatSession[] }>> {
return this.client.get<{ sessions: ChatSession[] }>(API_ENDPOINTS.AI_CHAT_SESSIONS)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getChatSessions AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene... | async getChatSessions(): Promise<ApiResponse<{ sessions: ChatSession[] }>> {
return this.client.get<{ sessions: ChatSession[] }>(API_ENDPOINTS.AI_CHAT_SESSIONS)
} | https://github.com/David8Idira/AI-OA | f9f936035c1e2b2f1f2985157524b5935f281311 | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/ReminderSettingsPage.ets | arkts | formatReminderTime | 格式化提醒时间信息 | formatReminderTime(reminder: ReminderSettings): string {
if (reminder.mode === 'interval') {
// 检查必要字段是否存在
if (!reminder.intervalMinutes) {
return '间隔时间未设置';
}
const hours = Math.floor(reminder.intervalMinutes / 60);
const minutes = reminder.intervalMinutes % 60;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatReminderTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reminder AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReminderSettings AST#identifier#R... | formatReminderTime(reminder: ReminderSettings): string {
if (reminder.mode === 'interval') {
// 检查必要字段是否存在
if (!reminder.intervalMinutes) {
return '间隔时间未设置';
}
const hours = Math.floor(reminder.intervalMinutes / 60);
const minutes = reminder.intervalMinutes % 60;
... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 05b4d2c0725fbda9e3d9f8fd35f88537bc8f1f7e | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/pages/Index.ets | arkts | refreshData | 刷新数据的核心方法 | refreshData() {
this.isLoading = true;
// 并行查询:所有习惯 + 今日打卡记录ID + 今日打卡次数Map
Promise.all([
HabitRepository.queryAll(),
RecordRepository.getTodayCompletedIds(),
RecordRepository.getTodayCompletedNums()
]).then((results: Object[]) => {
// 强制类型转换,解决编译报错
let allHabits = result... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshData 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 A... | refreshData() {
this.isLoading = true;
// 并行查询:所有习惯 + 今日打卡记录ID + 今日打卡次数Map
Promise.all([
HabitRepository.queryAll(),
RecordRepository.getTodayCompletedIds(),
RecordRepository.getTodayCompletedNums()
]).then((results: Object[]) => {
// 强制类型转换,解决编译报错
let allHabits = result... | https://gitcode.com/openharmony/codelabs | 4c3af5f242a32b57f0eed5e3ccfa4e86e2b694e4 | gitcode |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | multiply | Multiplication operator | multiply(operand: number): Offset {
return new Offset(this.dx * operand, this.dy * operand);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left multiply AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operand AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Right... | multiply(operand: number): Offset {
return new Offset(this.dx * operand, this.dy * operand);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L128-L130 | e71b6c656b3cbc4d584f750d653dd6e857adb286 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates an Uint8ClampedArray with respect to data, byteOffset and length.
@param buf data initializer
@param byteOffset byte offset from begin of the buf
@param length size of elements of type number in newly created Uint8ClampedArray | public constructor(buf: ArrayBuffer, byteOffset: number, length: number) {
this(buf, byteOffset as int, length as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array... | public constructor(buf: ArrayBuffer, byteOffset: number, length: number) {
this(buf, byteOffset as int, length as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7552f627d9e82eccbf9f9cc8f71bef3115a63071 | gitee |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/component/CommentItem.ets | arkts | build | 构建评论 Item
@returns {void} 无返回值 | build(): void {
RowStartTop({
widthValue: P100,
paddingValue: $r("app.float.space_padding_medium"),
onTap: this.onTap ? (_: ClickEvent): void => this.handleTap() : undefined
}) {
Avatar({
src: this.comment.avatarUrl ?? "",
avatarSize: 32
});
SpaceHorizontal... | 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 {
RowStartTop({
widthValue: P100,
paddingValue: $r("app.float.space_padding_medium"),
onTap: this.onTap ? (_: ClickEvent): void => this.handleTap() : undefined
}) {
Avatar({
src: this.comment.avatarUrl ?? "",
avatarSize: 32
});
SpaceHorizontal... | https://github.com/Joker-x-dev/CoolMallArkTS | 75b5eb9825b1d253281c5e5032c50a42219b7b21 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/AppShell.ets | arkts | build | 渲染应用壳层和 overlay 容器。 | build() {
Stack() {
this.buildBaseContent()
if (this.app.nav.hasOverlayRoute) {
Navigation(this.app.nav) {}
.mode(NavigationMode.Stack)
.hideNavBar(true)
.navDestination(this.buildDestination)
.backgroundColor(this.app.theme.palette.transparent)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack() {
this.buildBaseContent()
if (this.app.nav.hasOverlayRoute) {
Navigation(this.app.nav) {}
.mode(NavigationMode.Stack)
.hideNavBar(true)
.navDestination(this.buildDestination)
.backgroundColor(this.app.theme.palette.transparent)
... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppShell.ets#L129-L146 | 7a24cee4c7845dfc811d1aa79325a053db1f75d0 | github |
openharmony/arkui_advanced_ui_component | customappbar/source/custom_app_bar_forpc.ets | arkts | onMaximizeButtonClick | 点击放大按钮 | onMaximizeButtonClick(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMaximizeButtonClick 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_expr... | onMaximizeButtonClick(): void {
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | cacc268f5874c3d7ff52741c9c06f0a75caf3e55 | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets | arkts | getChineseInitial | 获取中文字符的拼音首字母 | private getChineseInitial(char: string): string {
// 常见中文姓氏拼音首字母映射表
const pinyinMap: Record<string, string> = {
'张': 'Z',
'王': 'W',
'李': 'L',
'赵': 'Z',
'刘': 'L',
'陈': 'C',
'杨': 'Y',
'黄': 'H',
'周': 'Z',
'吴': 'W',
'徐': 'X',
'孙': 'S',
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getChineseInitial AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left char AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private getChineseInitial(char: string): string {
// 常见中文姓氏拼音首字母映射表
const pinyinMap: Record<string, string> = {
'张': 'Z',
'王': 'W',
'李': 'L',
'赵': 'Z',
'刘': 'L',
'陈': 'C',
'杨': 'Y',
'黄': 'H',
'周': 'Z',
'吴': 'W',
'徐': 'X',
'孙': 'S',
... | https://gitcode.com/openharmony/codelabs | 5960a00b5fe7d5e02dbbd645399c06bedbf04c24 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/LegendRenderer.ets | arkts | getLabelPaint | Returns the Paint object used for drawing the Legend labels.
@return | public getLabelPaint(): Paint {
return this.mLegendLabelPaint;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabelPaint 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 Paint AS... | public getLabelPaint(): Paint {
return this.mLegendLabelPaint;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a16aad2fa38b9520349d05e906b7fda694f8a29a | gitee |
openharmony/applications_mms | entry/src/main/ets/pages/settings/settingsController.ets | arkts | maliciousWeb | Malicious website selection | maliciousWeb(e) {
HiLog.i(TAG, 'maliciousWeb, checked = ' + e.checked);
let messageCode = common.route.MESSAGE_CODE_UPDATE_MALICIOUS_WEBSITE_IDENTIFICATION_VALUE;
let actionData: LooseObject = {};
this.maliciousWebSwitch = e.checked;
if (this.maliciousWebSwitch) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left maliciousWeb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left e AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expressio... | maliciousWeb(e) {
HiLog.i(TAG, 'maliciousWeb, checked = ' + e.checked);
let messageCode = common.route.MESSAGE_CODE_UPDATE_MALICIOUS_WEBSITE_IDENTIFICATION_VALUE;
let actionData: LooseObject = {};
this.maliciousWebSwitch = e.checked;
if (this.maliciousWebSwitch) {
... | https://gitee.com/openharmony/applications_mms.git | 034342ff961e91186f212e801e48066e1f8e01f9 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportNovelLibraryFavoritesOnly | 导出小说库(旧方法,仅收藏)
@deprecated 使用 exportNovelLibrary 代替 | private async exportNovelLibraryFavoritesOnly(): Promise<NovelBackupItem[]> {
try {
const novels = await this.novelDataManager.getFavoriteBooks();
const backupItems: NovelBackupItem[] = novels.map((novel: NovelBook): NovelBackupItem => ({
id: novel.id,
sourceId: novel.sourceId,
... | 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 exportNovelLibraryFavoritesOnly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_ex... | private async exportNovelLibraryFavoritesOnly(): Promise<NovelBackupItem[]> {
try {
const novels = await this.novelDataManager.getFavoriteBooks();
const backupItems: NovelBackupItem[] = novels.map((novel: NovelBook): NovelBackupItem => ({
id: novel.id,
sourceId: novel.sourceId,
... | https://github.com/DaLongZhuaZi/manxia | b5e9aa024bd1850d59c008a959c607c34b9d04d6 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarChartModel.ets | arkts | getBarBounds | The passed outputRect will be assigned the values of the bounding box of the specified Entry in the specified DataSet.
The rect will be assigned Float.MIN_VALUE in all locations if the Entry could not be found in the charts data.
@param e
@return | public getBarBounds(e: BarEntry, outputRect: MyRect): void {
if (!this.mData) {
return;
}
let bounds: MyRect = outputRect;
let set: IBarDataSet | null = this.mData.getDataSetForEntry(e);
if (!set) {
bounds.set(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBarBounds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BarEnt... | public getBarBounds(e: BarEntry, outputRect: MyRect): void {
if (!this.mData) {
return;
}
let bounds: MyRect = outputRect;
let set: IBarDataSet | null = this.mData.getDataSetForEntry(e);
if (!set) {
bounds.set(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE);
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | dc71929d099b3c5c06eba9b22fdb4c49bb7083b0 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | updateGroups | Parses raw group keys and values to groups | protected updateGroups(): void {
throw new Error("not overridden")
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left updateGroups 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#... | protected updateGroups(): void {
throw new Error("not overridden")
} | https://gitcode.com/iop123123/arkts-static-skills | 454c6257d5b3a06d39087fa2cd5ac8161b553db4 | gitcode |
anhao0226/harmony-music-player | entry/src/main/ets/common/utils/AudioShareData.ets | arkts | toMap | key-value | toMap(): Record<string, any> {
const result: Record<string, any> = {};
result['AUDIO_ID'] = this._audioId;
result['PLAY_INDEX'] = this._playIndex;
result['PLAYLIST'] = this._playlist;
result['AUDIO_PROGRESS'] = this._progress;
result['PLAY_MODE'] = this._playMode;
return result;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toMap 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#sequence_expression#Left A... | toMap(): Record<string, any> {
const result: Record<string, any> = {};
result['AUDIO_ID'] = this._audioId;
result['PLAY_INDEX'] = this._playIndex;
result['PLAYLIST'] = this._playlist;
result['AUDIO_PROGRESS'] = this._progress;
result['PLAY_MODE'] = this._playMode;
return result;
} | https://github.com/anhao0226/harmony-music-player | 90204ed3b77c19aa484bf03df54fb314a59f9053 | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/AchievementService.ets | arkts | getAllAchievements | 获取所有成就(包含解锁状态和进度) | async getAllAchievements(): Promise<Achievement[]> {
const allAchievements = AchievementConfig.getAllAchievements();
const unlockedMap = await this.getUnlockedAchievementsMap();
// 计算每个成就的进度和状态,并检查是否需要解锁
for (const achievement of allAchievements) {
const unlockedInfo = unlockedMap.get(achieveme... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllAchievements AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g... | async getAllAchievements(): Promise<Achievement[]> {
const allAchievements = AchievementConfig.getAllAchievements();
const unlockedMap = await this.getUnlockedAchievementsMap();
// 计算每个成就的进度和状态,并检查是否需要解锁
for (const achievement of allAchievements) {
const unlockedInfo = unlockedMap.get(achieveme... | https://gitcode.com/openharmony/codelabs | faa2f40f1a3fa3ddfd2c4e943050780ca2fe03fe | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | test | Executes a search for a match between a regular expression and specified string
@param { String } str the string against which to match the regular expression.
@returns { boolean } If the string has matches, returns true; otherwise returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public test(str: String): boolean {
if (str.length < this.lastIndex) {
this.lastIndex = 0
return false
}
if (!this.globalOrSticky_ || (this.lastIndex < 0)) {
this.lastIndex = 0
}
return this.testImpl(this.pattern_, str, this.pattern_.length... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left test AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | public test(str: String): boolean {
if (str.length < this.lastIndex) {
this.lastIndex = 0
return false
}
if (!this.globalOrSticky_ || (this.lastIndex < 0)) {
this.lastIndex = 0
}
return this.testImpl(this.pattern_, str, this.pattern_.length... | https://gitcode.com/iop123123/arkts-static-skills | 2e13855ec9329fe5cccb827bfa778186a84799af | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/SdkApiUtil.ets | arkts | isSdkApiAtMost | @param maxSdkApi Upper bound (inclusive). Compare to {@link SdkConstants} in app code.
@returns True when the device API level is at most maxSdkApi. | public static isSdkApiAtMost(maxSdkApi: number): boolean {
return deviceInfo.sdkApiVersion <= maxSdkApi;
} | 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 isSdkApiAtMost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxSdkApi AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public static isSdkApiAtMost(maxSdkApi: number): boolean {
return deviceInfo.sdkApiVersion <= maxSdkApi;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | e66a8eab923612b3c672137d3fadc2433ee573e8 | gitcode |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/utils/AlarmCardUtil.ets | arkts | notifyAlarmCardTimeUpdate | notify AlarmCard Time Update when clock modify
-大于等于24小时:“n天后响铃”
-大于等于30分钟,小于24小时:“n小时内响铃” (向上取整,例:4h32min显示5小时内响铃)
- 大于等于10分钟,小于30分钟:“30分钟内响铃”
-小于10分钟:“即将响铃”
@returns | public static async notifyAlarmCardTimeUpdate(): Promise<void> {
let ringTimeInMs: number = await TimeUtil.getNextAlarmTime();
const isFiring = await AlarmStateManager.isFiring();
LogUtil.info(TAG, `notifyAlarmCardTimeUpdate ringTimeInMs:${ringTimeInMs}, isFiring=${isFiring}`);
if (isFiring) {
r... | 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 notifyAlarmCardTimeUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AS... | public static async notifyAlarmCardTimeUpdate(): Promise<void> {
let ringTimeInMs: number = await TimeUtil.getNextAlarmTime();
const isFiring = await AlarmStateManager.isFiring();
LogUtil.info(TAG, `notifyAlarmCardTimeUpdate ringTimeInMs:${ringTimeInMs}, isFiring=${isFiring}`);
if (isFiring) {
r... | https://gitee.com/openharmony-sig/applications_clock.git | b9784d0b9f4de0a49da14a14e9dca2389076ba67 | gitee |
xiebyapps/ClipLink | entry/src/main/ets/services/ConfigService.ets | arkts | saveConfig | Save configuration to preferences | async saveConfig(config: AppConfig): Promise<void> {
try {
if (!this.preferences) {
this.preferences = await dataPreferences.getPreferences(
this.getAbilityContext(),
this.PREFS_NAME
);
}
await this.preferences.put(this.KEY_SERVER_TYPE, config.server.type);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveConfig AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async saveConfig(config: AppConfig): Promise<void> {
try {
if (!this.preferences) {
this.preferences = await dataPreferences.getPreferences(
this.getAbilityContext(),
this.PREFS_NAME
);
}
await this.preferences.put(this.KEY_SERVER_TYPE, config.server.type);
... | https://github.com/xiebyapps/ClipLink | 60376c0d68564584055556c89c6e549c58cdae97 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | constructor | 构造函数
@param entityName 实体名称
@throws EntityNotRegisteredError 如果实体未注册 | constructor(entityName: string, executionScope: RepositoryExecutionScope | null = null) {
this.entityName = entityName
this.executionScope = executionScope ?? new RepositoryExecutionScope()
const metadata = MetadataStorage.getInstance().getEntityMetadata(entityName)
if (metadata === null) {
thro... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST... | constructor(entityName: string, executionScope: RepositoryExecutionScope | null = null) {
this.entityName = entityName
this.executionScope = executionScope ?? new RepositoryExecutionScope()
const metadata = MetadataStorage.getInstance().getEntityMetadata(entityName)
if (metadata === null) {
thro... | https://github.com/offlinecat-dev/OCNetORM | 5846406b183e9aa9dd7112d2161f8aeadeb4f7a0 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicSearchService.ets | arkts | formatDuration | 格式化时长 | private formatDuration(ms: number): string {
if (!ms || ms <= 0) return '00:00'
const seconds = Math.floor(ms / 1000)
const minutes = Math.floor(seconds / 60)
const remainingSeconds = seconds % 60
return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private formatDuration(ms: number): string {
if (!ms || ms <= 0) return '00:00'
const seconds = Math.floor(ms / 1000)
const minutes = Math.floor(seconds / 60)
const remainingSeconds = seconds % 60
return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`
} | https://github.com/cpdd5201314/harmonyOS-music-app | a3e4773990c493b2c3e90ad170c3c0f4a98080f5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | openNovelDetail | 打开小说详情页 | private openNovelDetail(novel: NovelBook): void {
const pageType = PageSettingsHelper.getNovelDetailPageType();
const rawCoverPath = this.getNovelCoverPath(novel);
const displayCoverPath = this.getNovelDisplayCoverPath(novel);
const cachedCoverPath = rawCoverPath.length > 0
&& !this.isNetworkUrl... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openNovelDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left novel AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private openNovelDetail(novel: NovelBook): void {
const pageType = PageSettingsHelper.getNovelDetailPageType();
const rawCoverPath = this.getNovelCoverPath(novel);
const displayCoverPath = this.getNovelDisplayCoverPath(novel);
const cachedCoverPath = rawCoverPath.length > 0
&& !this.isNetworkUrl... | https://github.com/DaLongZhuaZi/manxia | b36878405ce7e929dfdb121a09d7e9da88610ad5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | keys | Returns an list of keys in Uint16Array
@returns { IterableIterator<int> } - iterator over keys
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public keys(): IterableIterator<int> {
return new Uint16ArrayIteratorKeys(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys 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 keys(): IterableIterator<int> {
return new Uint16ArrayIteratorKeys(this)
} | https://gitcode.com/iop123123/arkts-static-skills | 2642bf475370bbab056a1063230ed962970f5847 | gitcode |
openharmony/applications_mms | entry/src/main/ets/utils/MmsPreferences.ets | arkts | getValueOfMaliciousWebSwitch | Obtains the value of the malicious URL identification switch. | public getValueOfMaliciousWebSwitch(): string {
return <string> this.getValueFromMap(common.string.KEY_OF_MALICIOUS_WEB_SWITCH, common.bool.FALSE);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueOfMaliciousWebSwitch 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#Le... | public getValueOfMaliciousWebSwitch(): string {
return <string> this.getValueFromMap(common.string.KEY_OF_MALICIOUS_WEB_SWITCH, common.bool.FALSE);
} | https://gitee.com/openharmony/applications_mms.git | 87f5f0f752fe03bd5956719b4bff96fe6850038a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | getGridColumns | 获取网格列数 | public static getGridColumns(): number {
return ResponsiveLayoutHelper.getLayoutParams().gridColumns;
} | 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 getGridColumns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getGridColumns(): number {
return ResponsiveLayoutHelper.getLayoutParams().gridColumns;
} | https://github.com/DaLongZhuaZi/manxia | 7c40b1ef9697b4b69d7a3085c2a59c1ac69c86c5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ComicConverter.ets | arkts | convertComicInfoToManga | 将ComicInfo转换为Manga对象(同步版本,使用默认设置)
@deprecated 请使用 convertComicInfoToMangaAsync 以加载完整的阅读设置和进度 | public static convertComicInfoToManga(comic: ComicInfo): Manga {
logger.warn(TAG, `使用同步转换方法,将返回默认设置。建议使用 convertComicInfoToMangaAsync 以加载完整数据`);
// 根据封面路径判断图片来源类型(网络/本地/rawfile)
const detectImageSourceType = (path: string): ImageSourceType => {
const src: string = path;
if (src.indexOf('h... | 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 convertComicInfoToManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comic AST#identifier#Right AST#... | public static convertComicInfoToManga(comic: ComicInfo): Manga {
logger.warn(TAG, `使用同步转换方法,将返回默认设置。建议使用 convertComicInfoToMangaAsync 以加载完整数据`);
// 根据封面路径判断图片来源类型(网络/本地/rawfile)
const detectImageSourceType = (path: string): ImageSourceType => {
const src: string = path;
if (src.indexOf('h... | https://github.com/DaLongZhuaZi/manxia | 796195495e1fcbb0afb83b1d680cc6c52dc806eb | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onNewWant | ✅ 生命周期:应用已在后台运行 (被通知唤起)
必须添加这个方法,否则后台运行时点击通知没反应 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.logger.info('Ability onNewWant');
// 处理热启动时的跳转参数
this.handleNotificationJump(want);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R... | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.logger.info('Ability onNewWant');
// 处理热启动时的跳转参数
this.handleNotificationJump(want);
} | https://gitcode.com/openharmony/codelabs | 165d56e59cea7fe4024ead03ddda9d84b8780419 | gitcode |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/ThemeManager.ets | arkts | addThemeChangeListener | 添加主题变化监听器
@param listener 监听器函数 | addThemeChangeListener(listener: (theme: ThemeType, colors: ThemeColors) => void): void {
this.themeChangeListeners.push(listener);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left addThemeChangeListener 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#ident... | addThemeChangeListener(listener: (theme: ThemeType, colors: ThemeColors) => void): void {
this.themeChangeListeners.push(listener);
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 8fa1778da74538ff1b85a783aa7a7e02035aa252 | github |
Kira-Yagami-Light/Kira-Projects | XuanyinMusic/entry/src/main/ets/utils/AVSessionManager.ets | arkts | init | 初始化媒体会话 | static async init(context: Context) {
AVSessionManager.session = await AvSession.createAVSession(context, 'bgPlay', 'audio');
AVSessionManager.controller = await AVSessionManager.session.getController();
AVSessionManager.registerEvent();
} | 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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig... | static async init(context: Context) {
AVSessionManager.session = await AvSession.createAVSession(context, 'bgPlay', 'audio');
AVSessionManager.controller = await AVSessionManager.session.getController();
AVSessionManager.registerEvent();
} | https://github.com/Kira-Yagami-Light/Kira-Projects | aa562979c5c090dd4d8338779d81baa1b712f3ad | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/services/NotificationService.ets | arkts | publishCalendarReminder | 发布日历提醒
@param context 上下文
@param eventId 事件ID (用于通知去重和参数传递)
@param title 标题
@param content 内容
@param triggerTime 触发时间戳 | static async publishCalendarReminder(context: common.UIAbilityContext, eventId: number, title: string,
content: string, triggerTime: number): Promise<number> {
const now = new Date().getTime();
// 1. 时间校验 (修复:给予 1 分钟的宽限期,防止毫秒级延迟导致校验失败)
if (triggerTime < now - 60000) {
logger.warn(`Time passed. ... | 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 publishCalendarReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST... | static async publishCalendarReminder(context: common.UIAbilityContext, eventId: number, title: string,
content: string, triggerTime: number): Promise<number> {
const now = new Date().getTime();
// 1. 时间校验 (修复:给予 1 分钟的宽限期,防止毫秒级延迟导致校验失败)
if (triggerTime < now - 60000) {
logger.warn(`Time passed. ... | https://gitcode.com/openharmony/codelabs | f13012aedeff0039c22fc5aa3d799a4f3027cc56 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets | arkts | executeRetryStrategy | 执行重试策略 | private async executeRetryStrategy(failureType: StartupFailureType): Promise<RecoveryResult> {
logger.info('StartupRecovery', '🔄 执行重试策略');
try {
// 等待一段时间后重试
await new Promise<void>(resolve => setTimeout(resolve, 1000));
// 根据失败类型执行相应的重试逻辑
switch (failureType) {
de... | 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 executeRetryStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left failureType AST#identifier#Right... | private async executeRetryStrategy(failureType: StartupFailureType): Promise<RecoveryResult> {
logger.info('StartupRecovery', '🔄 执行重试策略');
try {
// 等待一段时间后重试
await new Promise<void>(resolve => setTimeout(resolve, 1000));
// 根据失败类型执行相应的重试逻辑
switch (failureType) {
de... | https://github.com/DaLongZhuaZi/manxia | f2e891c96b22ff24227f299e367f39b133d8c43d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/RhinoSandboxComponent.ets | arkts | onReady | 等待沙箱就绪 | onReady(callback: () => void): void {
const executor = getRhinoWasmExecutor();
if (executor.isSandboxReady()) {
callback();
} else {
this.readyCallbacks.push(callback);
}
} | AST#program#Left AST#ERROR#Left AST#identifier#Left onReady AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#... | onReady(callback: () => void): void {
const executor = getRhinoWasmExecutor();
if (executor.isSandboxReady()) {
callback();
} else {
this.readyCallbacks.push(callback);
}
} | https://github.com/DaLongZhuaZi/manxia | b3aa9e1efafbd16b5e222f7e19ffeaea844b2aa5 | github |
harmonyos/codelabs | HarmonyOS_NEXT/PixelConversion/entry/src/main/ets/viewmodel/IntroductionViewModel.ets | arkts | getIntroductionList | Get introduction list data on the left.
@return {Array<IntroductionItem>} introductionItems | getIntroductionList() {
let introductionItems = INTRODUCE_LIST;
return introductionItems;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIntroductionList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bloc... | getIntroductionList() {
let introductionItems = INTRODUCE_LIST;
return introductionItems;
} | https://gitee.com/harmonyos/codelabs.git | b4638828282046665a0d952a04b35d3fa42a7fea | gitee |
cpdd5201314/harmonyOS-music-app | common/mediaCommon/src/main/ets/utils/SongManager.ets | arkts | addSong | 添加新歌曲 | public addSong(song: Music): void {
this.songs.push(song);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addSong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Music AS... | public addSong(song: Music): void {
this.songs.push(song);
} | https://github.com/cpdd5201314/harmonyOS-music-app | c6cb5d42cfc59b357b89cb0c7554d367f6415d17 | github |
xinthink/ohos-axios | entry/src/main/ets/pages/Index.ets | arkts | settingRemoteValidation | 设置 RemoteValidation | settingRemoteValidation(){
this.clear()
this.showUrl = this.clientCert_hasPsw
this.startTime = new Date().getTime();
axios<InfoModel, AxiosResponse<InfoModel>, null>({
url: this.clientCert_oneWayAuth,
method: 'get',
remoteValidation: 'skip',
connectTimeout: this.connectTimeout... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left settingRemoteValidation 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_... | settingRemoteValidation(){
this.clear()
this.showUrl = this.clientCert_hasPsw
this.startTime = new Date().getTime();
axios<InfoModel, AxiosResponse<InfoModel>, null>({
url: this.clientCert_oneWayAuth,
method: 'get',
remoteValidation: 'skip',
connectTimeout: this.connectTimeout... | https://github.com/xinthink/ohos-axios | 3e01db2b3ac60cde6902a77820f18db575f1920c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | randomUUID | 生成UUID | randomUUID(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left randomUUID AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_b... | randomUUID(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
} | https://github.com/DaLongZhuaZi/manxia | f798f2678b39b920920114396a72744e3fc8e920 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | tanh | Return a new Decimal whose value is the hyperbolic tangent of `n`, rounded to `precision`
significant digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal} A value in radians.
@returns { Decimal } the Decimal type | static tanh(n: Value): Decimal {
return new Decimal(n).tanh();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left tanh AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | static tanh(n: Value): Decimal {
return new Decimal(n).tanh();
} | https://gitcode.com/iop123123/arkts-static-skills | 3fc71512b58d085f28bb2cb4e8a5a4c365a4cbfa | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/ComputerViewModel.ets | arkts | notifyDataChange | 通知单个数据变化 | private notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
});
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyDataChange 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#... | private notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
});
} | https://github.com/AlkaidLab/moonlight-harmony | 9553d4cc67837f49c5ce9f61fbd77e2e1fc72818 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | valueOf | The `valueOf()` method returns the primitive value of a `Date` object.
@returns { long } return the primitive value of a `Date` object
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public valueOf(): long {
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left long AST#ident... | public valueOf(): long {
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | 3d1bd6fb4a77532d57b2b818facb6661f4158498 | gitcode |
wuba/omni-ui | omni_component/src/main/ets/theme/OmniThemeUtil.ets | arkts | colorWithOpacity | Adjusts the opacity of a given color.
@param color - The color value (number or string).
@param opacity - The opacity level (0 to 1).
@returns A color with the specified opacity applied. | static colorWithOpacity(color: OmniResourceColor, opacity: number): OmniResourceColor {
if (typeof color === "number") {
// Handle numeric color (ARGB format)
const alpha = Math.round(opacity * 255); // Convert opacity to 0-255 range
const rgb = color & 0x00ffffff; // Extract the RGB part
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left colorWithOpacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static colorWithOpacity(color: OmniResourceColor, opacity: number): OmniResourceColor {
if (typeof color === "number") {
// Handle numeric color (ARGB format)
const alpha = Math.round(opacity * 255); // Convert opacity to 0-255 range
const rgb = color & 0x00ffffff; // Extract the RGB part
... | https://github.com/wuba/omni-ui | fff39c59088ae8e87f8674e2eb833c5862b88032 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | requireUserId | ---- internals ---- | private requireUserId(): number {
if (this.userId === undefined) {
throw new ZoteroApiError(
0,
'ZoteroClient: userID unknown — call verifyKey() first or pass it to the constructor',
);
}
return this.userId;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left requireUserId 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 AS... | private requireUserId(): number {
if (this.userId === undefined) {
throw new ZoteroApiError(
0,
'ZoteroClient: userID unknown — call verifyKey() first or pass it to the constructor',
);
}
return this.userId;
} | https://github.com/Vincent-Leon/zotero-harmony | c5cfc3e2b6e5bfb8182f373c2cff40de6a9e76f6 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/OneDriveManager.ets | arkts | isCacheFull | 检查缓存是否超过限制 | public isCacheFull(): boolean {
return this.getCacheSize() >= this.config.maxCacheSize;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isCacheFull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | public isCacheFull(): boolean {
return this.getCacheSize() >= this.config.maxCacheSize;
} | https://github.com/AetheriumSimulator/qemu-hmos | bed19e6efadde861879eca33f4c21c32bb93f755 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | setAllBits | Sets all of bits in a bit vector to a particular element.
@param { int } element - Element to be set (0 means 0, else means 1). | public setAllBits(element: int): void {
if (element === 0) {
for (let i = 0; i < this.getUsedCapacity(); i++) {
this.buffer[i] = 0;
}
} else {
for (let i = 0; i < this.getUsedCapacity(); i++) {
this.b... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAllBits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier... | public setAllBits(element: int): void {
if (element === 0) {
for (let i = 0; i < this.getUsedCapacity(); i++) {
this.buffer[i] = 0;
}
} else {
for (let i = 0; i < this.getUsedCapacity(); i++) {
this.b... | https://gitcode.com/iop123123/arkts-static-skills | a047f2cc64fbc617e6a42eff7d331514f58c8228 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | getDbBucketFromAlarm | 将前台使用的闹钟对象,转换为新增修改数据库的入参对象
isIntentMode 意图框架调用此方法的标识 意图框架的alarmTime为时间戳
@param alarmInfo 前台定义的闹钟对象
@return 新增、修改数据的入参对象 | getDbBucketFromAlarm(alarmInfo: AlarmInfo, isIntentMode?: boolean): rdb.ValuesBucket {
LogUtil.info(TAG, 'before getDbBucketFromAlarm alarm is : ' + JSON.stringify(alarmInfo) + isIntentMode)
if (!isIntentMode) {
return {
'TITLE': alarmInfo.title,
'HOUR': alarmInfo.hour,
'MINUTE':... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getDbBucketFromAlarm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | getDbBucketFromAlarm(alarmInfo: AlarmInfo, isIntentMode?: boolean): rdb.ValuesBucket {
LogUtil.info(TAG, 'before getDbBucketFromAlarm alarm is : ' + JSON.stringify(alarmInfo) + isIntentMode)
if (!isIntentMode) {
return {
'TITLE': alarmInfo.title,
'HOUR': alarmInfo.hour,
'MINUTE':... | https://gitee.com/openharmony-sig/applications_clock.git | 7535c4a54d6b158caf9cf687dfa17d49b7a7e436 | gitee |
huaiminqin/TankWar-Master-with-Many-Tasks | game/src/main/ets/mission/MissionFactory.ets | arkts | createMixedMission | 创建混合任务 - 多个目标 | static createMixedMission(level: number): Mission {
const mission = new Mission(
`综合作战 ${level}`,
'完成多个战术目标'
);
// 消灭部分敌人
mission.addObjective({
type: MissionType.DESTROY_ALL_ENEMIES,
description: '消灭 10 辆敌方坦克',
progress: 0,
target: 10,
status: MissionSta... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createMixedMission 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#L... | static createMixedMission(level: number): Mission {
const mission = new Mission(
`综合作战 ${level}`,
'完成多个战术目标'
);
// 消灭部分敌人
mission.addObjective({
type: MissionType.DESTROY_ALL_ENEMIES,
description: '消灭 10 辆敌方坦克',
progress: 0,
target: 10,
status: MissionSta... | https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks | 55c4187b24c2d1e90fd44735f3afb1b81dc56f33 | github |
openharmony-sig/ohos_video_trimmer | entry/src/main/ets/pages/FileUtils.ets | arkts | clearFile | 清空已有文件数据 | clearFile(path: string): number {
return fs.openSync(path, fs.OpenMode.TRUNC).fd
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | clearFile(path: string): number {
return fs.openSync(path, fs.OpenMode.TRUNC).fd
} | https://gitee.com/openharmony-sig/ohos_video_trimmer.git | 55827fea3d1fd91663a5755b8fd16ac40c20e298 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | extractSubjectPublicKeyInfo | 从 X.509 证书 DER 中提取 SubjectPublicKeyInfo
TBSCertificate ::= SEQUENCE {
version [0] EXPLICIT INTEGER DEFAULT v1,
serialNumber INTEGER,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo <-- 我们要的
} | private static extractSubjectPublicKeyInfo(certDer: Uint8Array): Uint8Array | null {
try {
let pos = 0;
// 外层 SEQUENCE (Certificate)
pos = CryptoUtil.skipAsn1Tag(certDer, pos, 0x30);
if (pos < 0) return null;
pos = CryptoUtil.skipAsn1Length(certDer, pos);
if (pos < 0) return n... | 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 extractSubjectPublicKeyInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left certDer AST#identifier#R... | private static extractSubjectPublicKeyInfo(certDer: Uint8Array): Uint8Array | null {
try {
let pos = 0;
// 外层 SEQUENCE (Certificate)
pos = CryptoUtil.skipAsn1Tag(certDer, pos, 0x30);
if (pos < 0) return null;
pos = CryptoUtil.skipAsn1Length(certDer, pos);
if (pos < 0) return n... | https://github.com/AlkaidLab/moonlight-harmony | 8fe7f35fc3f68651507fad77b2687accb60d8360 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | toSafeNumber | 安全的数字转换
@param value - 要转换的值
@param defaultValue - 默认值
@returns 数字值 | static toSafeNumber(value: Object, defaultValue: number = 0): number {
if (TypeGuards.isNumber(value)) {
return value as number;
}
return defaultValue;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toSafeNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ob... | static toSafeNumber(value: Object, defaultValue: number = 0): number {
if (TypeGuards.isNumber(value)) {
return value as number;
}
return defaultValue;
} | https://github.com/DaLongZhuaZi/manxia | 6bd43c529b2c208a3aa62afc8c543e7ae3726ca0 | github |
openharmony/update_update_app | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getOtaStatus | 取升级状态
@return resolve 状态/reject 错误信息 | async getOtaStatus(): Promise<UpgradeData<OtaStatus>> {
return new Promise((resolve, reject) => {
this.updateManager.getOtaStatus().then((result: UpgradeData<OtaStatus>) => {
if (result?.callResult === UpgradeCallResult.OK) {
this.refreshState(result?.data);
}
resolve(resul... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOtaStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async getOtaStatus(): Promise<UpgradeData<OtaStatus>> {
return new Promise((resolve, reject) => {
this.updateManager.getOtaStatus().then((result: UpgradeData<OtaStatus>) => {
if (result?.callResult === UpgradeCallResult.OK) {
this.refreshState(result?.data);
}
resolve(resul... | https://gitee.com/openharmony/update_update_app.git | a137f6fb4745907fd5546313cf20502248e6ed65 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | toLocaleString | Converts BigInt64Array to a string with respect to locale
@param locales
@param options
@returns string representation | public toLocaleString(locales: Object, options: Object): string {
throw new Error("BigInt64Array.toLocaleString: not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object, options: Object): string {
throw new Error("BigInt64Array.toLocaleString: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8909eec10c0240bf1bd8b7dc9e9fff886ddc5b99 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | clearLogHistory | 清空日志历史(用于测试) | clearLogHistory(): void {
this.logHistory = []
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearLogHistory 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... | clearLogHistory(): void {
this.logHistory = []
} | https://github.com/offlinecat-dev/OCNetORM | 2a8a1f2cf6f4d189e88a1761f3a3122b062425bb | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnWaterFallViewModel.ets | arkts | initGapData | 初始化自定义间距数据 | private initGapData(): void {
const items: Object[] = [];
for (let i = 0; i < 16; i++) {
const height = 90 + Math.floor(Math.random() * 110);
const color = this.colors[(i + 6) % this.colors.length];
items.push(new WaterFallDemoItem(i, height, color, `Gap-${i + 1}`));
}
this.gapDataSo... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initGapData 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... | private initGapData(): void {
const items: Object[] = [];
for (let i = 0; i < 16; i++) {
const height = 90 + Math.floor(Math.random() * 110);
const color = this.colors[(i + 6) % this.colors.length];
items.push(new WaterFallDemoItem(i, height, color, `Gap-${i + 1}`));
}
this.gapDataSo... | https://github.com/codelably/tuniao-ui | 57370f7f00cf58ea44033e9e7b702ac1abb70c60 | github |
dingzhilin1990/zhilinclaw | src/events/EventBus.ets | arkts | publishSync | 同步发布事件(不等待处理器完成)
@param event 事件名称
@param data 事件数据 | public publishSync(event: string, data?: any): void {
const subs = this.subscribers.get(event);
if (!subs) return;
subs.forEach(subscription => {
try {
subscription.handler(data);
} catch (error) {
console.error(`[EventBus] 事件处理器错误 [${event}]:`, error);
}
});
//... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left publishSync 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 str... | public publishSync(event: string, data?: any): void {
const subs = this.subscribers.get(event);
if (!subs) return;
subs.forEach(subscription => {
try {
subscription.handler(data);
} catch (error) {
console.error(`[EventBus] 事件处理器错误 [${event}]:`, error);
}
});
//... | https://github.com/dingzhilin1990/zhilinclaw | 4ff6e666c1f237bfc05278d11cf33b3c5d7f8ec0 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | loadSettings | 从设置加载配置 | loadSettings(settings: GyroAssistSettings): void {
this._sensitivityMultiplier = settings.sensitivity;
this._invertX = settings.invertX;
this._invertY = settings.invertY;
this._activationKey = settings.activationKey;
this.holdActive = this._activationKey === GYRO_ACTIVATION_ALWAYS;
if (!this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left settings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GyroAssistSettings AST#identifier#Right... | loadSettings(settings: GyroAssistSettings): void {
this._sensitivityMultiplier = settings.sensitivity;
this._invertX = settings.invertX;
this._invertY = settings.invertY;
this._activationKey = settings.activationKey;
this.holdActive = this._activationKey === GYRO_ACTIVATION_ALWAYS;
if (!this.... | https://github.com/AlkaidLab/moonlight-harmony | dc4015edd0b684259fa5cb61009fe52d226cc9f8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | hasUrlProperty | 属性检查方法(使用instanceof和as替代is类型守卫) | private hasUrlProperty(action: Action): boolean {
return Object.keys(action).includes('url');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasUrlProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private hasUrlProperty(action: Action): boolean {
return Object.keys(action).includes('url');
} | https://github.com/DaLongZhuaZi/manxia | 140de70e95a89ee632aee966593bbc8b5908bbf2 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | shouldPreserveReasoningContentForToolMessages | 判断 assistant 历史消息是否需要原样回传 reasoning_content 字段。
名字保留为 ForToolMessages 是历史原因,实际覆盖所有 assistant 消息(tool_call / 纯文本 / multimodal)。
命中的 strategy 即使 reasoning_content 为空串也必须保留字段:
DeepSeek-V4 thinking 模式下,丢字段会触发 HTTP 400 invalid_request_error。 | private shouldPreserveReasoningContentForToolMessages(strategy: ReasoningRequestStrategy): boolean {
return strategy === ReasoningRequestStrategy.OPENAI_COMPAT_REASONING_EFFORT ||
strategy === ReasoningRequestStrategy.DEEPSEEK_THINKING ||
strategy === ReasoningRequestStrategy.MIMO_THINKING ||
st... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldPreserveReasoningContentForToolMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left strategy AST#identifier#Right AST#:#Left : AST#:#Right... | private shouldPreserveReasoningContentForToolMessages(strategy: ReasoningRequestStrategy): boolean {
return strategy === ReasoningRequestStrategy.OPENAI_COMPAT_REASONING_EFFORT ||
strategy === ReasoningRequestStrategy.DEEPSEEK_THINKING ||
strategy === ReasoningRequestStrategy.MIMO_THINKING ||
st... | https://github.com/LongLiveY96/chatcube | cbac2a4b5bff27f5d32d1a432bb038ea421b17d9 | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | handleConfigurationUpdated | Wired into `LifecycleObserver`'s `environment.onConfigurationUpdated`
when `trackOrientationChanges` is on. HMOS's config-update channel is
the platform-correct trigger for rotation events.
`Configuration.direction` is the canonical orientation field:
DIRECTION_VERTICAL (0) → portrait
DIRECTION_HORIZONTAL (1) → lands... | private handleConfigurationUpdated(config: SystemConfig): void {
const dir: number | undefined = config.direction;
if (dir === undefined) return;
let mode: string = '';
if (dir === ConfigurationConstant.Direction.DIRECTION_VERTICAL) mode = 'portrait';
else if (dir === ConfigurationConstant.Directi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleConfigurationUpdated 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#... | private handleConfigurationUpdated(config: SystemConfig): void {
const dir: number | undefined = config.direction;
if (dir === undefined) return;
let mode: string = '';
if (dir === ConfigurationConstant.Direction.DIRECTION_VERTICAL) mode = 'portrait';
else if (dir === ConfigurationConstant.Directi... | https://github.com/Countly/countly-sdk-hos | 0eb88331633dba55568f25e6dcf230c8539a848d | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/HelperUtil.ets | arkts | md5 | md5
@param text
@returns | static async md5(text: string): Promise<string> {
let md5 = cryptoFramework.createMd("MD5")
await md5.update({
data: new util.TextEncoder().encodeInto(text)
})
let result = await md5.digest()
return HelperUtil.uint8ArrayToHexString(result.data)
} | 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 md5 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right A... | static async md5(text: string): Promise<string> {
let md5 = cryptoFramework.createMd("MD5")
await md5.update({
data: new util.TextEncoder().encodeInto(text)
})
let result = await md5.digest()
return HelperUtil.uint8ArrayToHexString(result.data)
} | https://github.com/yangyongzhen/hmmovie | 8db8f0cc391a68d74fb60740b6df1533d7163283 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | getFileNameWithoutExtension | 获取不含扩展名的文件名
@param filePath 文件路径
@returns 不含扩展名的文件名 | private getFileNameWithoutExtension(filePath: string): string {
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
const lastDot = fileName.lastIndexOf('.');
return lastDot > 0 ? fileName.substring(0, lastDot) : fileName;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileNameWithoutExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left s... | private getFileNameWithoutExtension(filePath: string): string {
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
const lastDot = fileName.lastIndexOf('.');
return lastDot > 0 ? fileName.substring(0, lastDot) : fileName;
} | https://github.com/DaLongZhuaZi/manxia | 331cfdae5f858bbbd032deacbc39e2635b68a223 | github |
openharmony/arkui_advanced_ui_component | atomicserviceweb/source/atomicserviceweb.ets | arkts | isNeedReport | 判断是否需要打点
@param apiNameAlias 接口别名
@return 是否需要打点 | public isNeedReport(apiName: string): boolean {
return NEED_REPORTED_API_LIST.includes(apiName);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isNeedReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left apiName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | public isNeedReport(apiName: string): boolean {
return NEED_REPORTED_API_LIST.includes(apiName);
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 40c819c7c74ad30c724e5e4ba7bd623949831e5f | gitee |
openharmony/codelabs | Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets | arkts | getLastThreeDaysValue | Get the steps value of the last three days.
@param {Array<ChartPoint>} results. | async getLastThreeDaysValue(rdbStore: DataRdb.RdbStore) {
let results: Array<ChartPoint> = new Array<ChartPoint>();
let index = CommonConstants.THE_FIRST_THREE_DAYS;
while (index > 0) {
let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_SENSOR);
predicates.... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getLastThreeDaysValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST#type_annotatio... | async getLastThreeDaysValue(rdbStore: DataRdb.RdbStore) {
let results: Array<ChartPoint> = new Array<ChartPoint>();
let index = CommonConstants.THE_FIRST_THREE_DAYS;
while (index > 0) {
let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_SENSOR);
predicates.... | https://gitee.com/openharmony/codelabs.git | 5deb76127c6068024ec40006f9ef7255bedfbf45 | gitee |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/smart_home/app/entry/src/main/ets/filemanager/pages/intelligentscenario.ets | arkts | getValue | 获取光照、温度、湿度值 | getValue() {
light.ReadLightIntensity(1).then(); // 读取光强传感器数据,引脚为1
this.getLightIntensity = light.GetLightIntensity();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS... | getValue() {
light.ReadLightIntensity(1).then(); // 读取光强传感器数据,引脚为1
this.getLightIntensity = light.GetLightIntensity();
} | https://gitee.com/openharmony/vendor_unionman.git | a67d3684ac65c0e6233bb9b55d720d4168edeb1f | gitee |
openharmony-sig/ohos_byte_global_viewpool | byte_global_viewpool/src/main/ets/schedule/ScheduleService.ets | arkts | executeTaskForce | @description 强制执行任务
@param {()=>void} callback
@param {number} delayTime 延迟时间(ms) | public static executeTaskForce(callback: ()=>void, delayTime: number) {
setTimeout(callback, delayTime) // 使用setTimeout插入正常任务队列执行
} | 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 executeTaskForce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left c... | public static executeTaskForce(callback: ()=>void, delayTime: number) {
setTimeout(callback, delayTime) // 使用setTimeout插入正常任务队列执行
} | https://gitee.com/openharmony-sig/ohos_byte_global_viewpool.git | 5e8bfdf87bbf31dab658311659eb28c828f5ef9e | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | getCustomYAxisLabels | get Y-axis custom labels
@param axis Reference coordinate axis | public getCustomYAxisLabels(axis: AxisDependency): number[] {
let customYAxisLabels: number[] | undefined = [];
if (axis == AxisDependency.LEFT) {
customYAxisLabels = this.mAxisLeft?.getCustomYAxisLabels();
}
if (axis == AxisDependency.RIGHT) {
customYAxisLabels = this.mAxisRight?.getCusto... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCustomYAxisLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left axis AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public getCustomYAxisLabels(axis: AxisDependency): number[] {
let customYAxisLabels: number[] | undefined = [];
if (axis == AxisDependency.LEFT) {
customYAxisLabels = this.mAxisLeft?.getCustomYAxisLabels();
}
if (axis == AxisDependency.RIGHT) {
customYAxisLabels = this.mAxisRight?.getCusto... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c18129608c6566a0f9762bff7ef0ea62f5a66554 | gitee |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Privacy/Note/NoteFormPage.ets | arkts | shareNote | 华为系统级别分享 systemShare
1. 华为分享没有开源,只能在 HarmonyOS 文档中查看,在 OpenHarmony 文档中没有。
2. 华为分享需要通过真机测试,模拟器不支持分享(模拟器会闪退)。
分享笔记 | shareNote() {
try {
if (canIUse('SystemCapability.Collaboration.SystemShare')) {
// 1. 构建分享数据
const shareData = new systemShare.SharedData({
utd: uniformTypeDescriptor.UniformDataType.PLAIN_TEXT, // 指定分享的数据类型
title: this.title,
content: this.content
})
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left shareNote 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 AST... | shareNote() {
try {
if (canIUse('SystemCapability.Collaboration.SystemShare')) {
// 1. 构建分享数据
const shareData = new systemShare.SharedData({
utd: uniformTypeDescriptor.UniformDataType.PLAIN_TEXT, // 指定分享的数据类型
title: this.title,
content: this.content
})
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 7e8401a0ecdf1e6d5ae9590de9152c94b9c1d9ad | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/AssistantService.ets | arkts | getAllAssistants | ============================================================================
查询(内存优先,必要时 ensure)
============================================================================ | async getAllAssistants(): Promise<Assistant[]> {
await this.store.ensureAssistantsInitialized()
return this.store.getAssistants()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllAssistants AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen... | async getAllAssistants(): Promise<Assistant[]> {
await this.store.ensureAssistantsInitialized()
return this.store.getAssistants()
} | https://github.com/LongLiveY96/chatcube | 3584b08fcfce45b771fc40872cccaa6efb9b301c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/BarLineChartTouchListener.ets | arkts | performZoom | Performs the all operations necessary for pinch and axis zoom.
@param event | private performZoom(isTouchEvent: boolean, event: TouchEvent | GestureEvent) {
let gestureFingersCount: number = 1;
if (isTouchEvent) {
event = event as TouchEvent;
gestureFingersCount = event.touches.length;
} else {
event = event as GestureEvent;
gestureFingersCount = event.finge... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left performZoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#... | private performZoom(isTouchEvent: boolean, event: TouchEvent | GestureEvent) {
let gestureFingersCount: number = 1;
if (isTouchEvent) {
event = event as TouchEvent;
gestureFingersCount = event.touches.length;
} else {
event = event as GestureEvent;
gestureFingersCount = event.finge... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 24569c3b6876b46c677281a2f8809a5bbfa4f821 | gitee |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets | arkts | connectSocketAndOnClose | TCP或TLS连接 服务端或对端 | connectSocketAndOnClose(): void {
this.socketController?.connectSocket(oppositeAddress, oppositePort, (data: string) => {
this.receiveMessage(data);
})
// 连接同时订阅关闭连接回调
this.socketController?.onClose(() => {
CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left connectSocketAndOnClose 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#stat... | connectSocketAndOnClose(): void {
this.socketController?.connectSocket(oppositeAddress, oppositePort, (data: string) => {
this.receiveMessage(data);
})
// 连接同时订阅关闭连接回调
this.socketController?.onClose(() => {
CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback);
... | https://github.com/openharmony/applications_app_samples | 3679c9bf0196be4dc46a362fbfb44d7f5d33d655 | github |
HarmonyOS_Samples/guide-snippets | Ability/InsightIntentConfigDevelopment/entry/src/main/ets/insightintents/PlayMusicExecutor.ets | arkts | onExecuteInUIAbilityForegroundMode | 由于意图配置中'executeMode'配置了'foreground'前台模式执行,故需要实现该接口 | async onExecuteInUIAbilityForegroundMode(intentName: string, params: Record<string, Object>,
windowStage: window.WindowStage): Promise<insightIntent.ExecuteResult> {
// 实现播放逻辑
// [StartExclude playmusic_executor]
hilog.info(DOMAIN, 'testTag', '[PlayMusicExecutor] onExecuteInUIAbilityForegroundMode run... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onExecuteInUIAbilityForegroundMode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left intentName AST#identifier#Right AST... | async onExecuteInUIAbilityForegroundMode(intentName: string, params: Record<string, Object>,
windowStage: window.WindowStage): Promise<insightIntent.ExecuteResult> {
// 实现播放逻辑
// [StartExclude playmusic_executor]
hilog.info(DOMAIN, 'testTag', '[PlayMusicExecutor] onExecuteInUIAbilityForegroundMode run... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 7d0c280bc6a55d730a53b75accc32e7c5413d415 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.