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 |
|---|---|---|---|---|---|---|---|---|---|---|
ibestservices/ibest-ui | library/src/main/ets/components/form/index.ets | arkts | validateField | 验证单个表单 | validateField(prop: string, callBack?: (valid: boolean, field?: IBestFieldValidateInfo) => void): Promise<IBestFieldValidateResult>{
return new Promise((resolve) => {
const item = this.formItems.find((item: IBestFieldItem) => item.prop === prop)
if (item) {
item.validate().then((res: IBestFieldValidateInfo... | AST#program#Left AST#ERROR#Left AST#identifier#Left validateField AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prop AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#binary_expression#Left AST#ca... | validateField(prop: string, callBack?: (valid: boolean, field?: IBestFieldValidateInfo) => void): Promise<IBestFieldValidateResult>{
return new Promise((resolve) => {
const item = this.formItems.find((item: IBestFieldItem) => item.prop === prop)
if (item) {
item.validate().then((res: IBestFieldValidateInfo... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/form/index.ets#L143-L159 | fadbe050f7c20bbf317acb5abbec32885f4a9a09 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AlertManager.ets | arkts | deleteAlert | 删除指定告警 | public deleteAlert(alertId: string): boolean {
const index = this.alerts.findIndex(a => a.alertId === alertId);
if (index > -1) {
this.alerts.splice(index, 1);
this.notifySubscribers();
console.log(`AlertManager: Alert deleted - ${alertId}`);
return true;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteAlert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left alertId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | public deleteAlert(alertId: string): boolean {
const index = this.alerts.findIndex(a => a.alertId === alertId);
if (index > -1) {
this.alerts.splice(index, 1);
this.notifySubscribers();
console.log(`AlertManager: Alert deleted - ${alertId}`);
return true;
}
return false;
} | https://github.com/LJ666-ui/harmony-health-care | f331eb8bf470aa6d06d30a4cb0ba094c17a9f97a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | downloadMangaChapters | 批量下载漫画章节 | public async downloadMangaChapters(
mangaId: string,
mangaTitle: string,
sourceId: number,
chapters: MangaChapterDownloadItem[]
): Promise<MangaBatchDownloadResult> {
const batchStartedAt: number = Date.now();
const batchFlowId: string = this.ensureDownloadCacheFlow(
'',
Download... | 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 downloadMangaChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:... | public async downloadMangaChapters(
mangaId: string,
mangaTitle: string,
sourceId: number,
chapters: MangaChapterDownloadItem[]
): Promise<MangaBatchDownloadResult> {
const batchStartedAt: number = Date.now();
const batchFlowId: string = this.ensureDownloadCacheFlow(
'',
Download... | https://github.com/DaLongZhuaZi/manxia | ffffa287683454f02d5a6d56dba4d6e4f8a971d1 | github |
honjow/Next2V | shared/src/main/ets/utils/AppPrompt.ets | arkts | surfaceSystemMaterial | Menus / popups / context menus that are non-resident and pop at an arbitrary anchor position. The
immersive-material guidance recommends THICK for this class so their short option labels stay legible
over whatever content sits behind them. | static surfaceSystemMaterial(): uiMaterial.Material | undefined {
if (!deviceInfo.apiAvailable('26.0.0')) {
return undefined
}
return ImmersiveMaterialSettings.systemMaterial(
connectImmersiveMaterialSettings().level,
uiMaterial.ImmersiveStyle.THICK,
false,
)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left surfaceSystemMaterial AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expressio... | static surfaceSystemMaterial(): uiMaterial.Material | undefined {
if (!deviceInfo.apiAvailable('26.0.0')) {
return undefined
}
return ImmersiveMaterialSettings.systemMaterial(
connectImmersiveMaterialSettings().level,
uiMaterial.ImmersiveStyle.THICK,
false,
)
} | https://github.com/honjow/Next2V | 0b5247902e960a04e814751b2e3406408ccf41a3 | github |
openharmony/codelabs | ETSUI/SimpleCalculator/entry/src/main/ets/model/CalculateModel.ets | arkts | inputSymbol | Input Symbols.
@param value Input Operators. | inputSymbol(value: string) {
if (CheckEmptyUtil.isEmpty(value)) {
return;
}
let len = this.expressions.length;
switch (value) {
case Symbol.CLEAN:
this.expressions = [];
this.context.calValue = '';
break;
case Symbol.DEL:
this.inputDelete(len);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left inputSymbol 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 string AST#identifier#Right ... | inputSymbol(value: string) {
if (CheckEmptyUtil.isEmpty(value)) {
return;
}
let len = this.expressions.length;
switch (value) {
case Symbol.CLEAN:
this.expressions = [];
this.context.calValue = '';
break;
case Symbol.DEL:
this.inputDelete(len);
... | https://gitee.com/openharmony/codelabs.git | 94a77b39960e4c15628ed6f8cc9e8b79fc4fe735 | gitee |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/component/GoodsDetailBottomBar.ets | arkts | build | 构建商品详情底部操作栏
@returns {void} 无返回值 | build(): void {
Column() {
RowSpaceBetweenCenter({
widthValue: P100,
paddingValue: {
top: $r("app.float.space_vertical_small"),
bottom: this.safeAreaEnabled && this.windowSafeAreaState.bottomInset > 0
? 0
: $r("app.float.space_vertical_small")
... | 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 {
Column() {
RowSpaceBetweenCenter({
widthValue: P100,
paddingValue: {
top: $r("app.float.space_vertical_small"),
bottom: this.safeAreaEnabled && this.windowSafeAreaState.bottomInset > 0
? 0
: $r("app.float.space_vertical_small")
... | https://github.com/Joker-x-dev/CoolMallArkTS | 4a23c8838f4a51d65cf089d16e389cb2773c568a | github |
openharmony/applications_filepicker | audiopicker/src/main/ets/localresource/LocalResourceManager.ets | arkts | terminateSelfWithResult | 用户选择文件后,返回结果URI列表并赋予临时权限 | public terminateSelfWithResult(localAudioFile: Array<LocalAudioFile>): Promise<Array<string>> {
//赋予权限就放在audiopicker模块,直接调系统接口
return new Promise(async (resolve) => {
let uriList: string[] = []
for(let item of localAudioFile) {
try {
await fileShare.grantUriPermission(item.uri, C... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left terminateSelfWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left localAudioFile AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public terminateSelfWithResult(localAudioFile: Array<LocalAudioFile>): Promise<Array<string>> {
//赋予权限就放在audiopicker模块,直接调系统接口
return new Promise(async (resolve) => {
let uriList: string[] = []
for(let item of localAudioFile) {
try {
await fileShare.grantUriPermission(item.uri, C... | https://gitee.com/openharmony/applications_filepicker.git | 2563b1f6c824f41e9db4e3f8445a1d61b6ded5fc | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsBackupService.ets | arkts | isAutoBackupEnabled | 是否已启用自动备份 | static async isAutoBackupEnabled(): Promise<boolean> {
const uri = await PreferencesUtil.get<string>(AUTO_BACKUP_URI_KEY, '');
return uri.length > 0;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left isAutoBackupEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | static async isAutoBackupEnabled(): Promise<boolean> {
const uri = await PreferencesUtil.get<string>(AUTO_BACKUP_URI_KEY, '');
return uri.length > 0;
} | https://github.com/AlkaidLab/moonlight-harmony | 98677cc38d93c605c67b4ef686d5c568e478e0ad | github |
openharmony/multimedia_camera_framework | frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/modeSwitchPage.ets | arkts | onChangeIsModeBol | // 暂停后点击停止 需要将暂停回复默认 | onChangeIsModeBol() {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onChangeIsModeBol 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#... | onChangeIsModeBol() {
} | https://gitee.com/openharmony/multimedia_camera_framework.git | 67bc831fee83c1033c47d7e2795aa85820ec571e | gitee |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V21.ets | arkts | getVersion | getter | protected getVersion(): number {
return VCardConfig.VERSION_21;
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getVersion 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... | protected getVersion(): number {
return VCardConfig.VERSION_21;
} | https://gitee.com/openharmony-tpc/VCard.git | 2e26ca4c18288e354ee7e0a5f92b8cc9d0f5a916 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/OneDriveManager.ets | arkts | getRDPDrivePath | 获取 RDP 会话中访问 OneDrive 缓存的路径
当使用 RDP 驱动器重定向时,在 VM 中的路径 | public getRDPDrivePath(): string {
// 在 RDP 会话中,重定向的驱动器会显示为 \\tsclient\onedrive
return '\\\\tsclient\\onedrive';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRDPDrivePath 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... | public getRDPDrivePath(): string {
// 在 RDP 会话中,重定向的驱动器会显示为 \\tsclient\onedrive
return '\\\\tsclient\\onedrive';
} | https://github.com/AetheriumSimulator/qemu-hmos | 6e19328d6f97bcd28f928e627f87a84b3afef86e | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/AnalyticsService.ets | arkts | captureError | 捕获一条错误(环形截断,仅保留最近 MAX_ERRORS 条) | static captureError(scope: string, message: string): void {
AnalyticsService.init();
// 截断超长 message,避免异常对象撑爆存储
const safe = message.length > 300 ? message.substring(0, 300) : message;
AnalyticsService.errors.unshift({ scope, message: safe, time: Date.now() });
if (AnalyticsService.errors.length >... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left captureError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scope AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static captureError(scope: string, message: string): void {
AnalyticsService.init();
// 截断超长 message,避免异常对象撑爆存储
const safe = message.length > 300 ? message.substring(0, 300) : message;
AnalyticsService.errors.unshift({ scope, message: safe, time: Date.now() });
if (AnalyticsService.errors.length >... | https://github.com/XJTUWYD/ArkDiff | 1e73b88685cbce41fc9f41acbd88cd2cebc08ae5 | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/DateUtil.ets | arkts | formateDateForNoteTitle | 获取笔记标题的格式化时间
@param date note modified time | formateDateForNoteTitle(date: Date): string {
let nowDate = new Date()
let diffMin = Math.floor((nowDate.getTime() - date.getTime()) / 1000 / 60)
if (diffMin < 0) {
LogUtil.info(TAG, "DateUtils, formateDateForNoteTitle : date is error")
return this.formateDateForNoteContent(date)
}
le... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formateDateForNoteTitle 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#identifier#Left Date AST#identifier#Right AST#)#... | formateDateForNoteTitle(date: Date): string {
let nowDate = new Date()
let diffMin = Math.floor((nowDate.getTime() - date.getTime()) / 1000 / 60)
if (diffMin < 0) {
LogUtil.info(TAG, "DateUtils, formateDateForNoteTitle : date is error")
return this.formateDateForNoteContent(date)
}
le... | https://gitee.com/openharmony/applications_notes.git | 88b6a5c9bc2299a38bc23e906d7720f8f6c7a558 | gitee |
iwae/HarmonyOS-Inno | bridge/OHBridge.ets | arkts | createShareData | 创建分享数据对象(包含兼容性处理和文件路径提取)
Create share data object (with compatibility handling and file path extraction)
@param configOrPath - JSON配置字符串 或 图片文件路径(兼容旧版)| JSON config string or image path (backward compatible)
@returns ShareDataResult | function createShareData(configOrPath: string): ShareDataResult {
let config: ShareConfig;
let imagePath: string | null = null;
// 尝试解析为JSON配置 | Try to parse as JSON config
try {
config = JSON.parse(configOrPath) as ShareConfig;
console.log('使用JSON配置 | Using JSON config:', config);
imagePath = conf... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createShareData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left configOrPath AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | function createShareData(configOrPath: string): ShareDataResult {
let config: ShareConfig;
let imagePath: string | null = null;
// 尝试解析为JSON配置 | Try to parse as JSON config
try {
config = JSON.parse(configOrPath) as ShareConfig;
console.log('使用JSON配置 | Using JSON config:', config);
imagePath = conf... | https://github.com/iwae/HarmonyOS-Inno | 8239adf6f01504a3d2368bb48014c673f143ef27 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | box | Creates a new IntBox instance with the specified initial value.
@param { int } value - The initial int value to be wrapped
@returns { IntBox } A new IntBox instance containing the specified int value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static box(value: int): IntBox {
return new IntBox(value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left box AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right ... | public static box(value: int): IntBox {
return new IntBox(value);
} | https://gitcode.com/iop123123/arkts-static-skills | ad40406aeaef453455f54aa5a164859072e209ee | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | getThemeTransitionAnimation | 获取主题过渡动画配置 | public static getThemeTransitionAnimation(duration: number = 300): AnimateParam {
return {
duration: duration,
curve: Curve.EaseInOut,
iterations: 1,
playMode: PlayMode.Normal
};
} | 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 getThemeTransitionAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Rig... | public static getThemeTransitionAnimation(duration: number = 300): AnimateParam {
return {
duration: duration,
curve: Curve.EaseInOut,
iterations: 1,
playMode: PlayMode.Normal
};
} | https://github.com/DaLongZhuaZi/manxia | 22ead65135bf54e9778a78eeb66fd4b827dcfaaa | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets | arkts | setExitAnimate | 设置进场动画参数(比如动画时间,播放速度等)
@param param
@returns | public setExitAnimate(param: AnimateParam) {
this._options.setExitAnimateParam(param)
this._options.update(this._callback)
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setExitAnimate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public setExitAnimate(param: AnimateParam) {
this._options.setExitAnimateParam(param)
this._options.update(this._callback)
return this
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets#L47-L51 | 537c705571a602d7a818d6aee17bf57f11a10b9b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | parseTrackRecords | 解析数据库查询结果为TrackRecord数组 | private parseTrackRecords(results: DatabaseRecord[]): TrackRecord[] {
if (!results || results.length === 0) {
return [];
}
const records: TrackRecord[] = [];
for (let i = 0; i < results.length; i++) {
const row: TrackRecordDatabaseRecord = results[i] as TrackRecordDatabaseRecord;
co... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseTrackRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscrip... | private parseTrackRecords(results: DatabaseRecord[]): TrackRecord[] {
if (!results || results.length === 0) {
return [];
}
const records: TrackRecord[] = [];
for (let i = 0; i < results.length; i++) {
const row: TrackRecordDatabaseRecord = results[i] as TrackRecordDatabaseRecord;
co... | https://github.com/DaLongZhuaZi/manxia | 65c6b72086ffab7275a3e7ab1fb4b1085caf98ab | github |
HarmonyOS_Samples/BestPracticeSnippets | ClickResponseOptimization/entry/src/main/ets/pages/CityListPage.ets | arkts | computeTask | [Start compute_task] | @Concurrent
function computeTask(): string[] {
let array: string[] = []
// AppConstant.CITYS 为需要加载的数据
for (let t of AppConstant.CITYS) {
array.push(t.trim())
}
let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" });
array.sort((a, b) => collator.compare(a, b))
return arr... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left computeTask AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#... | @Concurrent
function computeTask(): string[] {
let array: string[] = []
// AppConstant.CITYS 为需要加载的数据
for (let t of AppConstant.CITYS) {
array.push(t.trim())
}
let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" });
array.sort((a, b) => collator.compare(a, b))
return arr... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 69543e80f988e287020fb866de57ccdfd27ecd84 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | importUnknownWords | 导入未知词汇数据 | importUnknownWords(json: string): boolean {
try {
const data = JSON.parse(json) as ExportedUnknownWord[];
for (const item of data) {
const info = new UnknownWordInfo(
item.word,
item.context,
item.frequency,
item.priority
);
info.timesta... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left importUnknownWords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Lef... | importUnknownWords(json: string): boolean {
try {
const data = JSON.parse(json) as ExportedUnknownWord[];
for (const item of data) {
const info = new UnknownWordInfo(
item.word,
item.context,
item.frequency,
item.priority
);
info.timesta... | https://github.com/CLMC2025/Vignette | f92fabc46d19093827bf4d09b48286a025d1bd4e | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/TimerManager.ets | arkts | getPreferences | 用于持久化计时器数据的轻量级存储对象
获取操作内部存储的对象
@return 操作内部存储的对象 | async getPreferences(): Promise<Preferences> {
if (this.preferences) {
return this.preferences;
}
this.preferences = await preferencesUtil.getPreferences((GlobalContext.getContext()
.getObject('clockContext') as Context), ALARM_CLOCK_TIMER_STORE);
return this.preferences as Preferences;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPreferences AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ... | async getPreferences(): Promise<Preferences> {
if (this.preferences) {
return this.preferences;
}
this.preferences = await preferencesUtil.getPreferences((GlobalContext.getContext()
.getObject('clockContext') as Context), ALARM_CLOCK_TIMER_STORE);
return this.preferences as Preferences;
... | https://gitee.com/openharmony-sig/applications_clock.git | bb306cd90452f010b55cd84df6858bdc4445e8ef | gitee |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/CominLog/PlayerManager.ets | arkts | playSpecifyMusic | 播放指定音乐
@param index 序号 | playSpecifyMusic(seekTo, index: number) {
this.currentMusicIndex = index
this.play(seekTo)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playSpecifyMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seekTo AST#identifier#Right AST#,#Left , AST#,#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left ... | playSpecifyMusic(seekTo, index: number) {
this.currentMusicIndex = index
this.play(seekTo)
} | https://gitee.com/openharmony-sig/online_event.git | 28e9388ce86ab802df99123f70de9560045a4936 | gitee |
Gramony/Gramony | features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets | arkts | pinnedChats | ArkTS doesn't support generator so we cannot merge the iterators into one | pinnedChats(): IterableIterator<Chat> {
return this.pinnedChatsMap.values();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pinnedChats 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#call_expression#Left... | pinnedChats(): IterableIterator<Chat> {
return this.pinnedChatsMap.values();
} | https://github.com/Gramony/Gramony | 1f418703709289a86b0db56f888f890af9ee96f7 | github |
openharmony-sig/aki | example/ohos/18_napi_call_function_exception/entry/src/main/ets/pages/Index.ets | arkts | mightThrowAnError | 使用自定义异常 | function mightThrowAnError(): void {
throw new MyCustomError('Cannot read property length of undefined');
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mightThrowAnError AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function mightThrowAnError(): void {
throw new MyCustomError('Cannot read property length of undefined');
} | https://gitee.com/openharmony-sig/aki.git | 5e701f6d3a596bc7f59c00ec919ce3cf31037a45 | gitee |
OHPG/FinSdk | jellyfin/src/main/ets/api/SessionApi.ets | arkts | postFullCapabilities | postFullCapabilities
@summary Updates capabilities for a device.
@param {SessionApiPostFullCapabilitiesRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof SessionApi | public async postFullCapabilities(requestParameters: SessionApiPostFullCapabilitiesRequest): Promise<void> {
let params: Record<string, string | undefined> = {
"id": requestParameters.id
}
return this.apiClient.post({path: "/Sessions/Capabilities/Full", parameters: params, data: requestParameters.cl... | 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 postFullCapabilities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Ri... | public async postFullCapabilities(requestParameters: SessionApiPostFullCapabilitiesRequest): Promise<void> {
let params: Record<string, string | undefined> = {
"id": requestParameters.id
}
return this.apiClient.post({path: "/Sessions/Capabilities/Full", parameters: params, data: requestParameters.cl... | https://github.com/OHPG/FinSdk | b03e649e694912c7968b04b579878425593cab0d | github |
arkui-x/samples | CodeLab/Cases/feature/componentstack/src/main/ets/view/ComponentStack.ets | arkts | build | 快截图标区域3 左右之间间隔 | build() {
if (this.isChange) {
Row() {
IconList3({ marginSpace: this.marginSpace })
}
.backgroundColor($r('app.color.component_stack_product_background'))
.width('100%')
.height($r("app.integer.component_stack_icon_list_height3"))
.opacity(this.opacity1)
// TODO: ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left i... | build() {
if (this.isChange) {
Row() {
IconList3({ marginSpace: this.marginSpace })
}
.backgroundColor($r('app.color.component_stack_product_background'))
.width('100%')
.height($r("app.integer.component_stack_icon_list_height3"))
.opacity(this.opacity1)
// TODO: ... | https://gitcode.com/arkui-x/samples | ebeb6e6265c1f80aa9c26ad52255c3541973b65a | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/CleanerManager.ets | arkts | getVideoList | 获取视频列表 | async getVideoList() {
// 获取所有图片/视频
const photoAssets = await this.getAssets() as photoAccessHelper.PhotoAsset[]
// 过滤出视频 PhotoType 为 VIDEO
return photoAssets.filter(item => {
try {
if (canIUse('SystemCapability.FileManagement.PhotoAccessHelper.Core')) {
return item.photoType =... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getVideoList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#R... | async getVideoList() {
// 获取所有图片/视频
const photoAssets = await this.getAssets() as photoAccessHelper.PhotoAsset[]
// 过滤出视频 PhotoType 为 VIDEO
return photoAssets.filter(item => {
try {
if (canIUse('SystemCapability.FileManagement.PhotoAccessHelper.Core')) {
return item.photoType =... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | aa3f8938cb2b6e40d1f3f98884e9144e6128d742 | gitcode |
erosTeam/NextE | shared/src/main/ets/network/EhApiPhpService.ets | arkts | parseTagVote | The resulting vote for `tagKey` parsed from a taggallery tagpane: <a id="ta_<key>" class="tup|tdn|">
(spaces in the key become underscores in the id). Falls back to the prior vote if the tag is not in
the pane (never the SENT value — that turned a withdraw into a phantom downvote). | private static parseTagVote(tagpane: string, tagKey: string, fallback: number): number {
if (tagpane.length === 0) {
return fallback
}
const at: number = tagpane.indexOf(`id="ta_${tagKey.split(' ').join('_')}"`)
if (at < 0) {
return fallback
}
const m: RegExpMatchArray | null = tag... | 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 parseTagVote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tagpane AST#identifier#Right AST#ERROR#Left AST#:#Left... | private static parseTagVote(tagpane: string, tagKey: string, fallback: number): number {
if (tagpane.length === 0) {
return fallback
}
const at: number = tagpane.indexOf(`id="ta_${tagKey.split(' ').join('_')}"`)
if (at < 0) {
return fallback
}
const m: RegExpMatchArray | null = tag... | https://github.com/erosTeam/NextE | 842570bafd7e7897addb1a958eb8eb1105cb5ca0 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test2_original_index.ets | arkts | testSpreadArray | === Spread Operator === | function testSpreadArray(): number {
let a: number[] = [1, 2, 3];
let b: number[] = [...a, 4, 5];
let total: number = 0;
for (const item of b) {
total += item;
}
return total;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSpreadArray AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_... | function testSpreadArray(): number {
let a: number[] = [1, 2, 3];
let b: number[] = [...a, 4, 5];
let total: number = 0;
for (const item of b) {
total += item;
}
return total;
} | https://github.com/miaochiahao/ark-ghidra | 161b30803bc36ba96f35db8520e96cd232815707 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets | arkts | getAbnormalRecords | 获取考勤异常记录
@param params 查询参数 | async getAbnormalRecords(params?: { startDate?: string; endDate?: string; page?: number; pageSize?: number }): Promise<ApiResponse<{ records: any[]; total: number }>> {
return this.client.get<{ records: any[]; total: number }>('/api/v1/attendance/abnormal', params as Record<string, any>)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAbnormalRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#typ... | async getAbnormalRecords(params?: { startDate?: string; endDate?: string; page?: number; pageSize?: number }): Promise<ApiResponse<{ records: any[]; total: number }>> {
return this.client.get<{ records: any[]; total: number }>('/api/v1/attendance/abnormal', params as Record<string, any>)
} | https://github.com/David8Idira/AI-OA | 34a42673a50cc7af3e8a678413533b3880e60f60 | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Game24Logic.ets | arkts | createDeck | 生成一副完整的扑克牌(不包括大小王)
@returns 扑克牌数组 | static createDeck(): Card[] {
const deck: Card[] = [];
// 四种花色
const suits = [Suit.HEART, Suit.DIAMOND, Suit.CLUB, Suit.SPADE];
// 每种花色13张牌 (A, 2-10, J, Q, K)
for (let suit of suits) {
for (let rank = 1; rank <= 13; rank++) {
deck.push(new Card(suit, rank));
}
}
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDeck 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_... | static createDeck(): Card[] {
const deck: Card[] = [];
// 四种花色
const suits = [Suit.HEART, Suit.DIAMOND, Suit.CLUB, Suit.SPADE];
// 每种花色13张牌 (A, 2-10, J, Q, K)
for (let suit of suits) {
for (let rank = 1; rank <= 13; rank++) {
deck.push(new Card(suit, rank));
}
}
... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 01cb6c47d8522a82499b351d4e31a1da3a55afa4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringByRegex | ==================== 正则解析 ====================
通过正则获取字符串
支持: 单个正则, &&组合正则, ||组合正则 | private getStringByRegex(pattern: string): string {
// 处理规则分割符
const splitResult = this.splitRuleStr(pattern);
if (splitResult.rules.length > 1) {
return this.getRegexStringWithSplitRules(splitResult.rules, splitResult.splitType);
}
return this.getStringByRegexSingle(pattern);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringByRegex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pattern AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | private getStringByRegex(pattern: string): string {
// 处理规则分割符
const splitResult = this.splitRuleStr(pattern);
if (splitResult.rules.length > 1) {
return this.getRegexStringWithSplitRules(splitResult.rules, splitResult.splitType);
}
return this.getStringByRegexSingle(pattern);
} | https://github.com/DaLongZhuaZi/manxia | e430c0740283971aa183e39a835349a52534ee22 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | getSystemFonts | 获取系统字体列表 | getSystemFonts(): SystemFont[] {
return SYSTEM_FONTS.slice();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getSystemFonts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left... | getSystemFonts(): SystemFont[] {
return SYSTEM_FONTS.slice();
} | https://github.com/DaLongZhuaZi/manxia | 6dcc6cabb8e195c6f7972a0dd578185e5b0da03a | github |
harmonyos/codelabs | ElectronicAlbum/entry/src/main/ets/common/utils/Logger.ets | arkts | constructor | constructor.
@param prefix Identifies the log tag.
@param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF
@param args Indicates the log parameters. | constructor(prefix: string = '', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#L... | constructor(prefix: string = '', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | https://gitee.com/harmonyos/codelabs.git | 5f4a302d70bd25a02845885bfffece17028e83a3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets | arkts | saveRuleToDb | 保存单个规则到数据库 | private async saveRuleToDb(rule: DictRule): Promise<void> {
try {
const dataManager = getNovelDataManager();
const store = dataManager.getStore();
await store.executeSql('DELETE FROM novel_dict_rule WHERE id = ?', [rule.id]);
const sql = `INSERT INTO novel_dict_rule
... | 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 saveRuleToDb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : A... | private async saveRuleToDb(rule: DictRule): Promise<void> {
try {
const dataManager = getNovelDataManager();
const store = dataManager.getStore();
await store.executeSql('DELETE FROM novel_dict_rule WHERE id = ?', [rule.id]);
const sql = `INSERT INTO novel_dict_rule
... | https://github.com/DaLongZhuaZi/manxia | 2438096790360223636e04829a1386ee13bfe141 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets | arkts | cleanupOrphanedMappings | 清理孤立的书架映射记录
删除那些在映射中存在但实际内容已不存在的记录
@param validMangaIds 有效的漫画ID列表
@param validEbookIds 有效的电子书ID列表
@param validNovelIds 有效的小说ID列表
@returns 清理的记录数 | async cleanupOrphanedMappings(
validMangaIds: string[],
validEbookIds: string[],
validNovelIds: string[]
): Promise<number> {
const keysToDelete: string[] = [];
this.itemCategoryMap.forEach((item, key) => {
let isValid = false;
switch (item.contentType) {
case Con... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cleanupOrphanedMappings AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left validMangaIds AST#identifier#Right AST#type_annotation#... | async cleanupOrphanedMappings(
validMangaIds: string[],
validEbookIds: string[],
validNovelIds: string[]
): Promise<number> {
const keysToDelete: string[] = [];
this.itemCategoryMap.forEach((item, key) => {
let isValid = false;
switch (item.contentType) {
case Con... | https://github.com/DaLongZhuaZi/manxia | ad6a76eeff1481ec4d384371c05641a00496d5c6 | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/features/discover/src/main/ets/model/DiscoverModel.ets | arkts | getSearchHistory | get search history | getSearchHistory(): void {
this.preferenceManager.getValue<string[]>('searchHistory').then(res => {
this.searchHistory = res ?? [];
Logger.error(TAG, 'Get search History success.');
}).catch((err: BusinessError) => Logger.error(TAG, 'Get search History Failed. Cause: ' + err));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | getSearchHistory(): void {
this.preferenceManager.getValue<string[]>('searchHistory').then(res => {
this.searchHistory = res ?? [];
Logger.error(TAG, 'Get search History success.');
}).catch((err: BusinessError) => Logger.error(TAG, 'Get search History Failed. Cause: ' + err));
} | https://gitcode.com/HarmonyOS_Samples/hmosworld | 4e3ab3aee274f6d52e18f881209b7ccd6e1faeb7 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | every | Checks that all elements of Int16Array satisfy the passed function
@param fn check function
@returns true if all elements satisfy fn | public every(fn: (element: short, index: int, array: Int16Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Rig... | public every(fn: (element: short, index: int, array: Int16Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a5856d2ab4b5216b0e9d5bf6626de09e6713eb47 | gitee |
openharmony/codelabs | ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/common/utils/Logger.ets | arkts | showToast | 通用轻提示 | showToast(message: string) {
prompt.showToast({
message: message,
duration: 2000
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Le... | showToast(message: string) {
prompt.showToast({
message: message,
duration: 2000
});
} | https://gitcode.com/openharmony/codelabs | 2837f4098ebc337162528a2097c7494a388ca01a | gitcode |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets | arkts | tapPackSyncAndWaitForToast | Tap the 🔄 同步词包 button and wait for `PackManagerSyncToast` to
surface, which is the user-visible signal that both `ensureLatest`
promises have settled (regardless of updated/cached/cleared status).
Returns the raw toast text so callers can correlate against the
`formatPackSyncToast` matrix when needed. | async function tapPackSyncAndWaitForToast(driver: Driver): Promise<string> {
try {
let syncBtn: Component | null = null;
for (let attempt: number = 0; attempt < 8; attempt++) {
syncBtn = await driver.findComponent(ON.id('PackManagerSyncButton'));
if (syncBtn !== null) {
break;
}
... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left tapPackSyncAndWaitForToast AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#... | async function tapPackSyncAndWaitForToast(driver: Driver): Promise<string> {
try {
let syncBtn: Component | null = null;
for (let attempt: number = 0; attempt < 8; attempt++) {
syncBtn = await driver.findComponent(ON.id('PackManagerSyncButton'));
if (syncBtn !== null) {
break;
}
... | https://github.com/terryma2024/happyword | 1d8e84b84e55a460b6efd4e3257a8827a87b296d | github |
arkui-x/samples | CodeLab/Cases/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets | arkts | toArray | 获取注册标题集合
@returns: 包含所有注册标题的数组 | public toArray(): string[] {
if (this.keys.length > 0) {
return this.keys;
}
let array: string[] = [];
let keys: IterableIterator<string> = this.tabsInfo.keys()
for (let keysElement of keys) {
array.push(keysElement);
}
return array;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toArray 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_sta... | public toArray(): string[] {
if (this.keys.length > 0) {
return this.keys;
}
let array: string[] = [];
let keys: IterableIterator<string> = this.tabsInfo.keys()
for (let keysElement of keys) {
array.push(keysElement);
}
return array;
} | https://gitcode.com/arkui-x/samples | a452597ad2659b7a77cca49cdce548b71916d4c4 | gitcode |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets | arkts | addAddress | 新增地址
@param {Address} params - 地址信息
@returns {Promise<NetworkResponse<{ id: number }>>} 新增结果 | async addAddress(params: Address): Promise<NetworkResponse<Id>> {
const resp: AxiosResponse<NetworkResponse<Id>> =
await NetworkClient.http.post("user/address/add", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addAddress AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async addAddress(params: Address): Promise<NetworkResponse<Id>> {
const resp: AxiosResponse<NetworkResponse<Id>> =
await NetworkClient.http.post("user/address/add", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | f9a6188a241f7677c129e63d4bd4506cec7104c0 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets | arkts | clear_timer_interval | 清除轮询定时器 // | private clear_timer_interval() {
if (this.timer_interval !== -1) {
clearInterval(this.timer_interval)
this.timer_interval = -1
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left clear_timer_interval 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 AS... | private clear_timer_interval() {
if (this.timer_interval !== -1) {
clearInterval(this.timer_interval)
this.timer_interval = -1
}
} | https://github.com/Nekofox-POT/LinMusic | 2d0a9a6a309d0ee6fca57aac56c0f4c588af3084 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_api10/app/i2c_app/entry/src/main/ets/pages/second.ets | arkts | startWork | 开启定时器 | startWork() {
this.intervalID = setInterval(() => {
this.getValue();
}, 500)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startWork 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... | startWork() {
this.intervalID = setInterval(() => {
this.getValue();
}, 500)
} | https://gitee.com/openharmony/vendor_unionman.git | 0f3b76697140727af266eba68db502c6487cf439 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets | arkts | isInitialized | 检查是否已初始化 | public isInitialized(): boolean {
return this.initialized;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST... | public isInitialized(): boolean {
return this.initialized;
} | https://github.com/DaLongZhuaZi/manxia | 61ada0d08b9a29c5b86dde1a87c1b3b58ce5994b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | filter | creates a new Int8Array from current Int8Array based on a condition fn
@param fn the condition to apply for each element
@returns a new Int8Array with elements from current Int8Array that satisfy condition fn | public filter(fn: (val: byte) => boolean): Int8Array {
let newF: (val: byte, index: int, array: Int8Array) => boolean =
(val: byte, index: int, array: Int8Array): boolean => { return fn(val) }
return this.filter(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: byte) => boolean): Int8Array {
let newF: (val: byte, index: int, array: Int8Array) => boolean =
(val: byte, index: int, array: Int8Array): boolean => { return fn(val) }
return this.filter(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5d37efc14d4d63962a95a8c8fdf4937dc7cc5580 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | copyWithin | Makes a copy of internal elements to targetPos from startPos to endPos.
See rules of parameters normalization on
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin | MDN}
@param { int } target - insert index to place copied elements
@param { int } start - start inde... | public copyWithin(target: int, start: int, end?: int): Uint16Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let count... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public copyWithin(target: int, start: int, end?: int): Uint16Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let count... | https://gitcode.com/iop123123/arkts-static-skills | db3101fdb424a88d12d389ba18db6709838763df | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unsigned_right_shift/unsigned_right_shift_int.ets | arkts | main | ---
desc: check unsigned right shift operation for integer
--- | function main(): void {
const a: int = {{v.left}}
const b: int = {{v.right}}
assert (a >>> b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: int = {{v.left}}
const b: int = {{v.right}}
assert (a >>> b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | af785513237c0ae7f640aaa7e9357c5209e00d60 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | compareTo | Lexicographical comparison between this String and another one.
The result is less than 0 if this string sorts before the other,
0 if they are equal, and greater than 0 otherwise.
@param other String to compare with
@throws NullPointerException if to param is null
@returns the comparison result | public override compareTo(other: String): int {
let to: String = other as String;
let len: int = min(this.length(), to.length()) as int;
for (let i: int = 0; i < len; i++) {
let lhsCh: Char = new Char(this.charAt(i));
let rhsCh: Char = new Char(to.charAt(i));
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST... | public override compareTo(other: String): int {
let to: String = other as String;
let len: int = min(this.length(), to.length()) as int;
for (let i: int = 0; i < len; i++) {
let lhsCh: Char = new Char(this.charAt(i));
let rhsCh: Char = new Char(to.charAt(i));
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | eab4e7228208d1186651d3a5c5c3e65e78653fdd | gitee |
HarmonyOS_Samples/BestPracticeSnippets | ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets | arkts | colorTransform | [End WorkerPort] | function colorTransform(rgbValue: number): number {
return Number((rgbValue / 255).toFixed(2));
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left colorTransform AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rgbValue AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function colorTransform(rgbValue: number): number {
return Number((rgbValue / 255).toFixed(2));
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 2c2c125db2b231d135548d3857e6ab138c69b9cb | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/LogUtil.ets | arkts | getObjectToJson | 对象转JSON字符串 | public static getObjectToJson(obj: object, line: boolean = true): string {
try {
let jsonStr = JSON.stringify(obj, null, 2);
if (line) {
jsonStr = jsonStr.replace(/\n/g, '\n│\t');
if (jsonStr.endsWith('\t]')) {
jsonStr = jsonStr.replace(/..$/, ' ]');
} else if (jsonS... | 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 getObjectToJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : A... | public static getObjectToJson(obj: object, line: boolean = true): string {
try {
let jsonStr = JSON.stringify(obj, null, 2);
if (line) {
jsonStr = jsonStr.replace(/\n/g, '\n│\t');
if (jsonStr.endsWith('\t]')) {
jsonStr = jsonStr.replace(/..$/, ' ]');
} else if (jsonS... | https://github.com/tdcare/tdwebrtc | 3e9064d3c57c6747eca04ed2b4fd7ee728abcb54 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/ui/SystemBarDemo.ets | arkts | enterFullScreen | 进入全屏(沉浸式效果)
沉浸式效果就是顶部的系统状态栏和底部的系统导航栏会叠放在主界面之上 | enterFullScreen() {
this.windowClass.setWindowLayoutFullScreen(true).then(() => {
this.message = '进入全屏成功';
}).catch((err: BusinessError) => {
this.message =`进入全屏失败, errCode:${err.code}, errMessage:${err.message}`;
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left enterFullScreen 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#Le... | enterFullScreen() {
this.windowClass.setWindowLayoutFullScreen(true).then(() => {
this.message = '进入全屏成功';
}).catch((err: BusinessError) => {
this.message =`进入全屏失败, errCode:${err.code}, errMessage:${err.message}`;
});
} | https://github.com/webabcd/HarmonyDemo | 432103ee3ea96d158bd923927431261a83892fb7 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/Point.ets | arkts | constructor | Constructor.
@param x
@param y | constructor(x: number, y: number) {
this.x = x;
this.y = y;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#... | constructor(x: number, y: number) {
this.x = x;
this.y = y;
} | https://gitee.com/openharmony/codelabs.git | 3a78f5ceb702b76a5bd5e57bf79424c95f5e22a8 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVErrorAnalyzer.ets | arkts | getAllServerGuides | 获取所有服务器配置指南 | static getAllServerGuides(): WebDAVServerGuide[] {
return WEBDAV_SERVER_GUIDES;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllServerGuides 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 Web... | static getAllServerGuides(): WebDAVServerGuide[] {
return WEBDAV_SERVER_GUIDES;
} | https://github.com/DaLongZhuaZi/manxia | a2dff8d276a73bde85a9992b20dbcde02951974a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BuiltinArraySort.ets | arkts | heapSortDown | Build max heap with root in startIndex given its children are roots of valid heaps | function heapSortDown(arr: FixedArray<byte>, idxFromStart: int, startIndex: int, endIndex: int): void {
let heapRoot = startIndex + idxFromStart
let arrIndex = heapRoot
let childIndex = startIndex + idxFromStart * 2 + 1
const tmp = arr[arrIndex]
// Walk heap to bottom and pull max child up on each l... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left heapSortDown AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function heapSortDown(arr: FixedArray<byte>, idxFromStart: int, startIndex: int, endIndex: int): void {
let heapRoot = startIndex + idxFromStart
let arrIndex = heapRoot
let childIndex = startIndex + idxFromStart * 2 + 1
const tmp = arr[arrIndex]
// Walk heap to bottom and pull max child up on each l... | https://gitcode.com/iop123123/arkts-static-skills | 831ac5719772c699b3e358ddbc9a17a989f1d6c6 | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/OmniFilterComponentRegistry.ets | arkts | hasRightSlideType | 检查是否存在某个右滑类型的组件 | hasRightSlideType(type: string): boolean {
return this.rightSlideTypeBuilderPool.has(type);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasRightSlideType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left... | hasRightSlideType(type: string): boolean {
return this.rightSlideTypeBuilderPool.has(type);
} | https://github.com/wuba/omni-ui | a4eb8a0c70a2aabd46783a0211636c4fba4e3345 | github |
erosTeam/NextE | shared/src/main/ets/network/EhError.ets | arkts | ehTextOf | Read EH's scraped sentence off a caught value ('' when absent / not an EhError). | static ehTextOf(err: Object): string {
const e = err as EhError
return e !== null && e !== undefined && e.isEhError === true ? e.ehText : ''
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left ehTextOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object A... | static ehTextOf(err: Object): string {
const e = err as EhError
return e !== null && e !== undefined && e.isEhError === true ? e.ehText : ''
} | https://github.com/erosTeam/NextE | 651835306903bf46df5d41c94bb19549cff5d762 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosEngineHost.ets | arkts | pauseRendering | Pause the engine render loop ahead of a navigation that will destroy
the XComponent surface (CocosBattlePage calls this before replaceUrl).
Idempotent; the page's organic onPageHide that follows is a no-op for
visibility and only re-relays the JSPAGE event. | pauseRendering(): void {
this.pageActive = false;
this.updateVisibility();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pauseRendering 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_blo... | pauseRendering(): void {
this.pageActive = false;
this.updateVisibility();
} | https://github.com/terryma2024/happyword | faf24c3815b37388fc1746f256063779d723ea2f | github |
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | entry/src/main/ets/pages/PersonalInfoPage.ets | arkts | updateSilentLoginMap | Update persistently stored data silentLoginMap. | updateSilentLoginMap(unionID: string) {
const userInfo: UserInfo = {
avatar: this.avatar,
nickName: this.nickName,
quickLoginAnonymousPhone: storage.get('quickLoginAnonymousPhone') as string,
isSilentLogin: this.isSilentLogin
}
this.silentLoginMap.set(unionID, userInfo);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateSilentLoginMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left unionID AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig... | updateSilentLoginMap(unionID: string) {
const userInfo: UserInfo = {
avatar: this.avatar,
nickName: this.nickName,
quickLoginAnonymousPhone: storage.get('quickLoginAnonymousPhone') as string,
isSilentLogin: this.isSilentLogin
}
this.silentLoginMap.set(unionID, userInfo);
} | https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | 670a89bdc4c3f848c80e1fe77327c0568ebd756c | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | syncState | Synchronizes the component UI state to the data model.
@param componentId Component ID
@param change State change payload | syncState(componentId: string, change: object): void {
const changeJson = JSON.stringify(change);
this.surfaceManager?.syncState(this.surfaceId, componentId, changeJson);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#... | syncState(componentId: string, change: object): void {
const changeJson = JSON.stringify(change);
this.surfaceManager?.syncState(this.surfaceId, componentId, changeJson);
} | https://github.com/AGenUI/AGenUI | 855a1a59187cf0097bde7babad28897d27b9417d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/MdnsDiscovery.ets | arkts | getDiscoveredComputers | 获取已发现的计算机列表 | getDiscoveredComputers(): DiscoveredComputer[] {
return Array.from(this.discoveredComputers.values());
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getDiscoveredComputers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AS... | getDiscoveredComputers(): DiscoveredComputer[] {
return Array.from(this.discoveredComputers.values());
} | https://github.com/AlkaidLab/moonlight-harmony | 089ce44bf33a18cc9b2a92d11e708cc57ddad9ea | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | isRegExp | Check whether the entered value is of type regexp.
@param { Object } value - A regular expression object value
@returns { boolean } Returns true if the value is a regular expression object. | isRegExp(value: Object): boolean {
return value instanceof RegExp;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRegExp 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 Object AST#identifier#Right AST#)#Left ) AST#)... | isRegExp(value: Object): boolean {
return value instanceof RegExp;
} | https://gitcode.com/iop123123/arkts-static-skills | 6f4ad33970bfe0045d4428218b27d1f05aec67a3 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/component/GoodsShippingServiceCard.ets | arkts | build | 构建发货与服务卡片
@returns {void} 无返回值 | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin... | https://github.com/Joker-x-dev/CoolMallArkTS | 54898f1d76e04a4e31cb7ad8e9dda65a98630051 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | splitLines | 按换行符拆分字符串
@param {string} value - 原始字符串
@returns {string[]} 拆分后的行 | function splitLines(value: string): string[] {
if (!value) {
return [""];
}
return value.split("\n");
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left splitLines AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function splitLines(value: string): string[] {
if (!value) {
return [""];
}
return value.split("\n");
} | https://github.com/Joker-x-dev/CoolMallArkTS | 037fd7786c50390a965b633abe619e5f6dda1318 | github |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/pages/TimeZoneUtil.ets | arkts | getCityDisplayName | 获取某时区城市在locale下的本地化显示 | static getCityDisplayName(cityID: string, locale: string): string {
return i18n.TimeZone.getCityDisplayName(cityID, locale);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCityDisplayName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cityID AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static getCityDisplayName(cityID: string, locale: string): string {
return i18n.TimeZone.getCityDisplayName(cityID, locale);
} | https://gitee.com/openharmony-sig/applications_clock.git | 8b4863cd15f324964361db71ab62b2c987d3bbde | gitee |
openharmony-sig/ohos_highlightguide | library/src/main/ets/highlightguide/model/GuidePage.ets | arkts | setHighLightIndicator | 设置当前引导页的引导层
@param indicator 引导层插槽,对应@Builder注解修饰的布局
@returns 引导层布局 | public setHighLightIndicator(indicator: Function | null): GuidePage {
this.highLightIndicator = indicator;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighLightIndicator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left indicator AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binar... | public setHighLightIndicator(indicator: Function | null): GuidePage {
this.highLightIndicator = indicator;
return this;
} | https://gitee.com/openharmony-sig/ohos_highlightguide.git | ea400b24bfa289c91e9c2d0a0e5a22526387d631 | gitee |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/calculator/AdvancedSunshineCalculator.ets | arkts | getSolarDeclination | 计算太阳赤纬(弧度) | private getSolarDeclination(dayOfYear: number): number {
return 0.409 * Math.sin(2 * Math.PI * (dayOfYear - 81) / 365);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSolarDeclination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dayOfYear AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | private getSolarDeclination(dayOfYear: number): number {
return 0.409 * Math.sin(2 * Math.PI * (dayOfYear - 81) / 365);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | d0867904dc1c15a010316ed3ac14a275d421dbd2 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/data/ItemRepository.ets | arkts | listItemsInCollection | Items in a specific collection — uses the JSON-encoded collections list
stored on each item row (see itemToBucket). For 100-item caches this is
fine; for large libraries we'd normalise into a join table. Inherits
sort from listTopItems. | async listItemsInCollection(
collectionKey: string,
sort?: SortOrder,
tag?: string,
): Promise<ZoteroItem[]> {
const all = await this.listTopItems(sort, tag);
const filtered: ZoteroItem[] = [];
for (const item of all) {
const cols = item.data.collections;
if (cols !== undefined &... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left listItemsInCollection AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left collectionKey AST#identifier#Right AST#type_annotation#Le... | async listItemsInCollection(
collectionKey: string,
sort?: SortOrder,
tag?: string,
): Promise<ZoteroItem[]> {
const all = await this.listTopItems(sort, tag);
const filtered: ZoteroItem[] = [];
for (const item of all) {
const cols = item.data.collections;
if (cols !== undefined &... | https://github.com/Vincent-Leon/zotero-harmony | c8281c177ee3ea96361aa69a890e8ca2bd3087a9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current Int32Array using range [begin, end)
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/sliceFromTo}
@param { int } [begin] - start index to be taken into slice
@param { int } [end] - last index to be taken into slice
@returns { Int32Array } - a ... | public slice(begin?: int, end?: int): Int32Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#... | public slice(begin?: int, end?: int): Int32Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | 5fb33e18a69eb68b57e7406a48ea80cfe6011620 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/InvisibleWebViewComponent.ets | arkts | unregisterWebView | 注销WebView实例 | unregisterWebView(sourceId: string): void {
this.webViewMap.delete(sourceId);
logger.info(TAG, `注销WebView实例: ${sourceId}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | unregisterWebView(sourceId: string): void {
this.webViewMap.delete(sourceId);
logger.info(TAG, `注销WebView实例: ${sourceId}`);
} | https://github.com/DaLongZhuaZi/manxia | 3b3c5516245e214656e9454403b76c05163e1a87 | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/model/HouseSunshineModel.ets | arkts | formatMinutesToHours | 格式化时间为小时显示 | formatMinutesToHours(minutes: number): string {
return (minutes / 60).toFixed(3);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatMinutesToHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minutes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left )... | formatMinutesToHours(minutes: number): string {
return (minutes / 60).toFixed(3);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 339e67dac4ab19cdc1bf64cd1e3920f9fb2a5258 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/SystemResourceDemoPage.ets | arkts | onPageShow | 修复SystemResourceDemoPage.ets中的getContext过时用法 | onPageShow() {
// [修复] 使用 onPageShow 替代 aboutToAppear
try {
const stack = AppStorage.get<NavPathStack>('GlobalNavStack');
if (stack) {
this.pathStack = stack;
} else {
logger.error('SystemResourceDemoPage', '无法从 AppStorage 获取 GlobalNavStack!');
}
} catch (err) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
// [修复] 使用 onPageShow 替代 aboutToAppear
try {
const stack = AppStorage.get<NavPathStack>('GlobalNavStack');
if (stack) {
this.pathStack = stack;
} else {
logger.error('SystemResourceDemoPage', '无法从 AppStorage 获取 GlobalNavStack!');
}
} catch (err) {
... | https://github.com/DaLongZhuaZi/manxia | 73f155aa3e5fa3e437bf34925c14882c0bef2aaa | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/ComputerViewModel.ets | arkts | updateCachedCounts | 更新缓存的统计值(触发 @Observed 响应式更新) | private updateCachedCounts(): void {
this.computerCount = this.computers.length;
this.onlineCount = this.computers.filter(c => c.isOnline).length;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateCachedCounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private updateCachedCounts(): void {
this.computerCount = this.computers.length;
this.onlineCount = this.computers.filter(c => c.isOnline).length;
} | https://github.com/AlkaidLab/moonlight-harmony | 985bf013b49e0c5091908315ae40f9b557d73b50 | github |
openharmony/applications_systemui | features/airplanecomponent/src/main/ets/default/pages/airplaneComponent.ets | arkts | mClickEvent | when flyModelStatus == true, so airplane is opening,
use variable mWifiOriginalStatus to record WLAN current status
use system interface to WLAN current status: WifiInfo.isWifiActive()
when flyModelStatus == false ,so airplane is closed
get variable mWifiOriginalStatus
if variable mWifiOriginalStatus == true, set WLAN ... | mClickEvent() {
this.flyModelStatus =!this.flyModelStatus;
Log.showDebug(TAG, `flyModelStatus:${this.flyModelStatus}`);
if (this.flyModelStatus == true) {
this.mWifiOriginalStatus = wifi.isWifiActive();
Log.showInfo(TAG, `airplane status is opening, WLAN Original Status :${this.mWifiOriginalSt... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left mClickEvent 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... | mClickEvent() {
this.flyModelStatus =!this.flyModelStatus;
Log.showDebug(TAG, `flyModelStatus:${this.flyModelStatus}`);
if (this.flyModelStatus == true) {
this.mWifiOriginalStatus = wifi.isWifiActive();
Log.showInfo(TAG, `airplane status is opening, WLAN Original Status :${this.mWifiOriginalSt... | https://gitee.com/openharmony/applications_systemui.git | 627eb74b91d1f55763bb9f52aacbbb3d9aed57e2 | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/view/SizePage.ets | arkts | build | 构建尺寸展示页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "尺寸",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.SizeContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "尺寸",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.SizeContent();
}
} | https://github.com/codelably/tuniao-ui | e93bf22e0d1fd5c57452b8c96ff344e357da76e8 | github |
LZZLHY/hlib | entry/src/main/ets/storage/ErrorReportStore.ets | arkts | init | 启动时调用一次,把磁盘数据加载到内存缓存。失败容错。 | static async init(): Promise<void> {
try {
const list: ErrorReport[] = await PreferencesStore.getObject<ErrorReport[]>(
'settings', KEY_REPORTS, [],
);
ErrorReportStore.cache = Array.isArray(list) ? list : [];
ErrorReportStore.loaded = true;
} catch {
ErrorReportStore.cac... | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | static async init(): Promise<void> {
try {
const list: ErrorReport[] = await PreferencesStore.getObject<ErrorReport[]>(
'settings', KEY_REPORTS, [],
);
ErrorReportStore.cache = Array.isArray(list) ? list : [];
ErrorReportStore.loaded = true;
} catch {
ErrorReportStore.cac... | https://github.com/LZZLHY/hlib | 23e58238d49b4fb9cc83ddc0d7cbc1057ffdb7c5 | github |
openharmony/codelabs | ETSUI/SwiperArkTS/entry/src/main/ets/view/all/PictureSort.ets | arkts | textStyle | text style.
@param fontSize Font size.
@param fontWeight Font weight. | @Extend(Text)
function textStyle(fontSize: Resource, fontWeight: number) {
.fontSize(fontSize)
.fontWeight(fontWeight)
.fontColor($r('app.color.font_black'))
} | 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 textStyle(fontSize: Resource, fontWeight: number) {
.fontSize(fontSize)
.fontWeight(fontWeight)
.fontColor($r('app.color.font_black'))
} | https://gitee.com/openharmony/codelabs.git | db85c0d295c0c573c974bde67fe841283f886bd1 | gitee |
CLMC2025/Vignette | entry/src/main/ets/utils/Logger.ets | arkts | performance | 性能日志(记录耗时) | performance(label: string, startTime: number): void {
if (!this.shouldLog(LogLevel.INFO)) return;
const elapsed = Date.now() - startTime;
console.info(this.formatMessage('P', `${label}: ${elapsed}ms`));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left performance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS... | performance(label: string, startTime: number): void {
if (!this.shouldLog(LogLevel.INFO)) return;
const elapsed = Date.now() - startTime;
console.info(this.formatMessage('P', `${label}: ${elapsed}ms`));
} | https://github.com/CLMC2025/Vignette | 8e762fe5ddcb0de0079d8019e38577c71513755f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Assigns val as element on insertPos.
@param { int } insertPos - index to change
@param { BigInt } val - value to set
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(insertPos: int, val: BigInt): void {
this.$_set(insertPos, val)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | public set(insertPos: int, val: BigInt): void {
this.$_set(insertPos, val)
} | https://gitcode.com/iop123123/arkts-static-skills | 56ec14648b3595371b6bdfd1e1d6dde39f548bbf | gitcode |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | seekTo | 跳转到指定播放位置
@param positionMs - 目标位置(毫秒)
@returns Promise<void> 跳转完成后 resolve
@remarks
- 支持任意位置跳转(包括往前跳转)
- 支持本地文件和 URL 流式播放
- 跳转精度目标:< 50ms
@throws
- 解码器未初始化
- 目标位置无效 | public async seekTo(positionMs: number): Promise<void> {
if (!this.decoder) {
throw new Error('Decoder not initialized');
}
if (positionMs < 0) {
throw new Error('positionMs must be >= 0');
}
const wasPlaying = this.isPlaying_;
// 1. 暂停 AudioRenderer(但不暂停解码器,因为 seek 需要解码线程运行)
... | 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 seekTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left positionMs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public async seekTo(positionMs: number): Promise<void> {
if (!this.decoder) {
throw new Error('Decoder not initialized');
}
if (positionMs < 0) {
throw new Error('positionMs must be >= 0');
}
const wasPlaying = this.isPlaying_;
// 1. 暂停 AudioRenderer(但不暂停解码器,因为 seek 需要解码线程运行)
... | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L292-L332 | fc86efc14569770b31042f639cbe32f5d4f250de | github |
codelably/HCompass | core/spatialization/src/main/ets/util/MaterialUtil.ets | arkts | getMaterialModifier | 为通用组件 Modifier 应用材质效果
@param options 修饰器配置
@returns 已应用样式的 CommonModifier | public static getMaterialModifier(options: MaterialModifierOptions): CommonModifier {
if (options.backgroundColor) {
options.modifier.backgroundColor(options.backgroundColor);
}
if (options.backgroundBlurStyle) {
options.modifier.backgroundBlurStyle(options.backgroundBlurStyle);
}
retu... | 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 getMaterialModifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#... | public static getMaterialModifier(options: MaterialModifierOptions): CommonModifier {
if (options.backgroundColor) {
options.modifier.backgroundColor(options.backgroundColor);
}
if (options.backgroundBlurStyle) {
options.modifier.backgroundBlurStyle(options.backgroundBlurStyle);
}
retu... | https://github.com/codelably/HCompass | 0311ae59e3885231c2d2adbcd18b68e870f8b92c | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/SunAngleHelper.ets | arkts | dayLengthHours | 计算一天的日照时长(小时) | static dayLengthHours(latitude: number, dayOfYear: number): number {
const latRad = latitude * SunAngleHelper.DEGREE_TO_RADIAN;
const declination = SunAngleHelper.solarDeclination(dayOfYear);
const decRad = declination * SunAngleHelper.DEGREE_TO_RADIAN;
const cosH = -Math.tan(latRad) * Math.tan(d... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left dayLengthHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left latitude AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | static dayLengthHours(latitude: number, dayOfYear: number): number {
const latRad = latitude * SunAngleHelper.DEGREE_TO_RADIAN;
const declination = SunAngleHelper.solarDeclination(dayOfYear);
const decRad = declination * SunAngleHelper.DEGREE_TO_RADIAN;
const cosH = -Math.tan(latRad) * Math.tan(d... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 680432ee7dd4fe875db483752f1ad2de55c3af45 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/BaseMapper.ets | arkts | updateById | 根据主键更新
@param obj 实体类,id不可以为空
@returns sql执行结果:改变数量 | async updateById(obj: T, db?: Connection): Promise<relationalStore.ValueType> {
let isClose: boolean = true
if (db === undefined) {
db = await this.getConnection()
} else {
isClose = false
}
const sqlData = this.sqlUtils.updateById(obj)
let res = await db.execDML(sqlData.sql, sqlDa... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left obj AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async updateById(obj: T, db?: Connection): Promise<relationalStore.ValueType> {
let isClose: boolean = true
if (db === undefined) {
db = await this.getConnection()
} else {
isClose = false
}
const sqlData = this.sqlUtils.updateById(obj)
let res = await db.execDML(sqlData.sql, sqlDa... | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L337-L350 | 7b865f09f131547b1bbbe2f2a16e2bcff33af793 | github |
HarmonyCandies/extended_text | extended_text/src/main/ets/Utils.ets | arkts | value | The integer stored in this Accumulator. | get value(): number {
return this._value;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left value 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#E... | get value(): number {
return this._value;
} | https://github.com/HarmonyCandies/extended_text | 40d1e11fe983a65109c951e7c55e638a32fcc0a9 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/common/utils/Logger.ets | arkts | error | Error 日志 | static error(tag: string, message: string): void {
if (Logger.currentLevel <= LogLevel.ERROR) {
hilog.error(DOMAIN, `${TAG}:${tag}`, message)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | static error(tag: string, message: string): void {
if (Logger.currentLevel <= LogLevel.ERROR) {
hilog.error(DOMAIN, `${TAG}:${tag}`, message)
}
} | https://gitcode.com/openharmony/codelabs | 744c21fbc42771f0aedd9b78502e9bb51aafb3f7 | gitcode |
midori52000/ArkPilot | Agent/entry/src/main/ets/skills/SkillsBackendService.ets | arkts | importFromZip | 从 ZIP 文件导入 Skill | async importFromZip(zipPath: string): Promise<InstalledSkill[]> {
const tempDir = `${this.codexHome}/.tmp_zip_import_${Date.now()}`;
fileIo.mkdirSync(tempDir, true);
try {
await this.extractZip(zipPath, tempDir);
this.flattenGitHubZipRoot(tempDir);
// 找到包含 SKILL.md 的目录
const skil... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importFromZip AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left zipPath AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async importFromZip(zipPath: string): Promise<InstalledSkill[]> {
const tempDir = `${this.codexHome}/.tmp_zip_import_${Date.now()}`;
fileIo.mkdirSync(tempDir, true);
try {
await this.extractZip(zipPath, tempDir);
this.flattenGitHubZipRoot(tempDir);
// 找到包含 SKILL.md 的目录
const skil... | https://github.com/midori52000/ArkPilot | 5c9b46d2d823c12b15ba66be35b77543c5f137b1 | github |
codelably/HCompass | entry/src/main/ets/entryability/AppInterceptors.ets | arkts | buildRequestUrl | 拼接请求地址 | private buildRequestUrl(config: InternalAxiosRequestConfig): string {
const baseUrl: string = config.baseURL ?? "";
const url: string = config.url ?? "";
if (url.startsWith("http://") || url.startsWith("https://")) {
return url;
}
// 处理 baseURL 与 url 的拼接,避免双斜杠
if (baseUrl.endsWith("/") &... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildRequestUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private buildRequestUrl(config: InternalAxiosRequestConfig): string {
const baseUrl: string = config.baseURL ?? "";
const url: string = config.url ?? "";
if (url.startsWith("http://") || url.startsWith("https://")) {
return url;
}
// 处理 baseURL 与 url 的拼接,避免双斜杠
if (baseUrl.endsWith("/") &... | https://github.com/codelably/HCompass | 2ab4dcc564e2f27ecbc46f6e93d86557c92c84e9 | github |
openharmony/applications_mms | entry/src/main/ets/pages/infomsg/InfoMsgController.ets | arkts | searchConversationHeadClick | Searching for a session avatar | searchConversationHeadClick(index) {
this.headClickedListener(this.searchResultList.sessionList[index]);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchConversationHeadClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#... | searchConversationHeadClick(index) {
this.headClickedListener(this.searchResultList.sessionList[index]);
} | https://gitee.com/openharmony/applications_mms.git | 7840cae70db2a7790e3e248ffc2d3b84b18d4c33 | gitee |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets | arkts | reset | 重置播放器
@returns {Promise<void>} | async reset(): Promise<void> {
await this.avplayerModel.resetAVPlayer();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reset 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_type#L... | async reset(): Promise<void> {
await this.avplayerModel.resetAVPlayer();
} | https://gitcode.com/arkui-x/samples | 2d3f00e863f085a6046c2352ea446188a90aa824 | gitcode |
2763981847/Clock-Alarm | entry/src/main/ets/viewmodel/WorldClockViewModel.ets | arkts | addCity | 添加城市到城市列表中。
@param city 要添加的城市 | public addCity(city: CityItem) {
this.cities.push(city)
this.setCitiesToDatabase()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addCity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left city AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CityItem... | public addCity(city: CityItem) {
this.cities.push(city)
this.setCitiesToDatabase()
} | https://github.com/2763981847/Clock-Alarm | 52787081e8656578fdf54758986972640c2fbb59 | github |
heeh02/superconnect | harmony/entry/src/main/ets/session/Session.ets | arkts | dispose | Remove the rotation listener — call on disconnect so the subscription doesn't dangle. | dispose(): void {
if (this.capsTimer >= 0) { clearTimeout(this.capsTimer); this.capsTimer = -1; }
try { display.off('change', this.onDisplayChange); } catch (e) { /* best-effort */ }
} | 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.capsTimer >= 0) { clearTimeout(this.capsTimer); this.capsTimer = -1; }
try { display.off('change', this.onDisplayChange); } catch (e) { /* best-effort */ }
} | https://github.com/heeh02/superconnect | cfcda52fae114ca7ef9c8de639f299663778815a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | initializeMetrics | 初始化性能指标 | private initializeMetrics(): PerformanceMetrics {
return {
frameRate: {
current: 0,
average: 0,
min: Number.MAX_VALUE,
max: 0,
history: []
},
frameTime: {
current: 0,
average: 0,
min: Number.MAX_VALUE,
max: 0,
histor... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializeMetrics 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 P... | private initializeMetrics(): PerformanceMetrics {
return {
frameRate: {
current: 0,
average: 0,
min: Number.MAX_VALUE,
max: 0,
history: []
},
frameTime: {
current: 0,
average: 0,
min: Number.MAX_VALUE,
max: 0,
histor... | https://github.com/DaLongZhuaZi/manxia | c866dc62b704dded52debc399f3641d39fe898ea | github |
HarmonyOS_Samples/MusicHome | products/tv/src/main/ets/tvability/TvAbility.ets | arkts | onWindowStageDestroy | Logs window stage destroy. | onWindowStageDestroy(): void {
Logger.info('TvAbility: Ability onWindowStageDestroy');
try {
MediaService.getInstance().release();
} catch (error) {
Logger.error(`MediaService release ${JSON.stringify(error)}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy 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#stateme... | onWindowStageDestroy(): void {
Logger.info('TvAbility: Ability onWindowStageDestroy');
try {
MediaService.getInstance().release();
} catch (error) {
Logger.error(`MediaService release ${JSON.stringify(error)}`);
}
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 96e2ebc90c335f0c6f0c23acb786f94975b1ffee | gitcode |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/BudgetOverviewCardComponent.ets | arkts | build | 构建预算概览卡片外壳并注入预算内容。 | build() {
HomeSwiperCardShellComponent({
themeState: this.themeState,
compactLayout: this.compactLayout,
opacityValue: this.opacityValue,
scaleValue: this.scaleValue,
rotateValue: this.rotateValue,
zIndexValue: this.zIndexValue,
heightValue: 236,
leftPadding: this.c... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
HomeSwiperCardShellComponent({
themeState: this.themeState,
compactLayout: this.compactLayout,
opacityValue: this.opacityValue,
scaleValue: this.scaleValue,
rotateValue: this.rotateValue,
zIndexValue: this.zIndexValue,
heightValue: 236,
leftPadding: this.c... | https://github.com/ZestBox-18/kitebook-frontend | 2b9764b597f77f1c40e0a162d207ae8c852faece | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | onControllerAttached | Requests | onControllerAttached() {
// Slim UA
if (this.inSlim) {
const ua4s = userAgent4Slim();
if (ua4s) {
try {
this.controller?.setCustomUserAgent(ua4s);
} catch (e) {
meow(`setCustomUserAgent failed: ${e}`, 'meowTabInfo][onControllerAttached', meowLevel.ERROR);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onControllerAttached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | onControllerAttached() {
// Slim UA
if (this.inSlim) {
const ua4s = userAgent4Slim();
if (ua4s) {
try {
this.controller?.setCustomUserAgent(ua4s);
} catch (e) {
meow(`setCustomUserAgent failed: ${e}`, 'meowTabInfo][onControllerAttached', meowLevel.ERROR);
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 6953fc86afcdb286321526538a4b47bee2163287 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskHelper.ets | arkts | getOwnerCount | 当前持有后台资格的业务数量 | static getOwnerCount(): number {
return BackgroundTaskHelper.activeOwners.size;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOwnerCount 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#n... | static getOwnerCount(): number {
return BackgroundTaskHelper.activeOwners.size;
} | https://github.com/DaLongZhuaZi/manxia | 70138abacbc2a683b2d407a114867f6d7fc261c2 | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeViewV2.ets | arkts | delayUpdateParentChildNum | delay update all parentnodes childNum | function delayUpdateParentChildNum(isAdd: boolean, count: int,
nodeIdNodeItemMap: Map<number, NodeItem>, updateNodeIdList: Array<number>): void {
let taskId: int = 0;
taskId = setTimeout(() => {
updateNodeIdList.forEach((parentNodeId) => {
updateParentChildNumHandler(parentNodeId, nodeIdNodeItemMap, isA... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left delayUpdateParentChildNum AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isAdd AST#identifier#Right AST#type_annotation#Left AST#:#Le... | function delayUpdateParentChildNum(isAdd: boolean, count: int,
nodeIdNodeItemMap: Map<number, NodeItem>, updateNodeIdList: Array<number>): void {
let taskId: int = 0;
taskId = setTimeout(() => {
updateNodeIdList.forEach((parentNodeId) => {
updateParentChildNumHandler(parentNodeId, nodeIdNodeItemMap, isA... | https://gitcode.com/openharmony/arkui_ace_engine | f342e5505bf6ce958bc20d92e98f29557eeaeec3 | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component/multinavigation/source/multinavigation.ets | arkts | isStraightProduct | Check if is straight product
@returns true if is straight product | public static isStraightProduct(): boolean {
return DeviceHelper.isPhone() && !DeviceHelper.isFold();
} | 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 isStraightProduct AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public static isStraightProduct(): boolean {
return DeviceHelper.isPhone() && !DeviceHelper.isFold();
} | https://gitee.com/openharmony/arkui_ace_engine.git | 2a8eeb0d01aad78dfe5007248fad5f853bed4acf | gitee |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/IncomeExpenseCardComponent.ets | arkts | CardContent | 构建收支概览卡片主体内容。 | private CardContent() {
Column() {
Row() {
Row() {
this.CardHeader($r('sys.symbol.arrow_left_arrow_right'), '本月收支')
}
.layoutWeight(1)
HomeVisibilityToggleComponent({
hidden: this.hiddenAmount,
themeState: this.themeState,
onToggle: () ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left CardContent 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#ca... | private CardContent() {
Column() {
Row() {
Row() {
this.CardHeader($r('sys.symbol.arrow_left_arrow_right'), '本月收支')
}
.layoutWeight(1)
HomeVisibilityToggleComponent({
hidden: this.hiddenAmount,
themeState: this.themeState,
onToggle: () ... | https://github.com/ZestBox-18/kitebook-frontend | 84c17776b9242a7fab17761f1e991d053d619f50 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/AIService.ets | arkts | chatStream | 流式调用聊天 API(SSE)。
通过 requestInStream + on('dataReceive') 逐 chunk 接收,
从 choices[0].delta.content 提取增量文本。
@returns HttpRequest 对象,调用方可通过 destroy() 取消请求 | private chatStream(
messages: ChatMessage[],
onChunk: (text: string) => void,
onDone: () => void,
onError: (error: string) => void,
): http.HttpRequest {
const httpRequest = http.createHttp();
let sseBuffer: string = '';
let hasError: boolean = false;
// 注册数据接收事件:逐 chunk 解析 SSE 格式
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left chatStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left messages AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expr... | private chatStream(
messages: ChatMessage[],
onChunk: (text: string) => void,
onDone: () => void,
onError: (error: string) => void,
): http.HttpRequest {
const httpRequest = http.createHttp();
let sseBuffer: string = '';
let hasError: boolean = false;
// 注册数据接收事件:逐 chunk 解析 SSE 格式
... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/AIService.ets#L233-L327 | fe58b9497533bec602dbcabba02ace6afba72433 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.