nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewAuthManager.ets | arkts | loginWithCookieString | 直接使用用户输入的原始Cookie字符串进行登录(注入并保存) | async loginWithCookieString(sourceId: number, controller: webview.WebviewController | null, rawCookie: string): Promise<void> {
const entries: CookieEntry[] = this.parseDocumentCookieString(rawCookie);
const json: string = this.serializeCookies(entries);
await this.dataManager.updateComicSourceCookies(sou... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginWithCookieString AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AS... | async loginWithCookieString(sourceId: number, controller: webview.WebviewController | null, rawCookie: string): Promise<void> {
const entries: CookieEntry[] = this.parseDocumentCookieString(rawCookie);
const json: string = this.serializeCookies(entries);
await this.dataManager.updateComicSourceCookies(sou... | https://github.com/DaLongZhuaZi/manxia | 481dc040a124f20ed8771c65fdf60dbf6a47affd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/UIContextManager.ets | arkts | getUIContext | 获取UI上下文 | public getUIContext(): UIContext | null {
return this.uiContext;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUIContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AS... | public getUIContext(): UIContext | null {
return this.uiContext;
} | https://github.com/DaLongZhuaZi/manxia | 3b6f91e3d1424f7975f409a938901ff60a05abe1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets | arkts | convertVolumeToMetadata | 将Google Books卷转换为统一元数据格式 | private convertVolumeToMetadata(volume: GoogleBooksVolume): ScrapedMetadata {
const info: GoogleBooksVolumeInfo = volume.volumeInfo;
// 处理封面图片
const coverUrls = this.extractCoverUrls(info.imageLinks);
// 提取ISBN
let isbn: string | undefined;
if (info.industryIdentifiers) {
// 优先... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertVolumeToMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left volume AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | private convertVolumeToMetadata(volume: GoogleBooksVolume): ScrapedMetadata {
const info: GoogleBooksVolumeInfo = volume.volumeInfo;
// 处理封面图片
const coverUrls = this.extractCoverUrls(info.imageLinks);
// 提取ISBN
let isbn: string | undefined;
if (info.industryIdentifiers) {
// 优先... | https://github.com/DaLongZhuaZi/manxia | da69d92c4f0838206af6955a7cbfa4bd14d4ce28 | github |
arkui-x/samples | CodeLab/Cases/feature/gridexchange/src/main/ets/view/GridExchange.ets | arkts | monitoringData | 监听数据变化函数 | monitoringData(): void {
this.isChange = true;
this.GridItemDeletion = new GridItemDeletionCtrl<AppInfo>(this.appInfoList);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left monitoringData 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... | monitoringData(): void {
this.isChange = true;
this.GridItemDeletion = new GridItemDeletionCtrl<AppInfo>(this.appInfoList);
} | https://gitcode.com/arkui-x/samples | 5fdf37af5e5e91a1e73c07e91ea45bd3a0228beb | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/StringBuilder.ets | arkts | toString | Converts the primitive to a string
@param { double } d value to be converted
@returns { String } result of the conversion
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static toString(d: double): String {
return Double.toString(d);
} | 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 toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Righ... | public static toString(d: double): String {
return Double.toString(d);
} | https://gitcode.com/iop123123/arkts-static-skills | 2f9c3567f771bb7065f427d143bb6a3945e474b9 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | minimize | The minimize() attempts to remove information about this locale that would be added by calling maximize().
@return A Intl.Locale instance whose baseName property returns the result of the
Remove Likely Subtags algorithm executed against locale.baseName. | public minimize() : Locale {
let res = new Locale(this)
res.region = undefined
res.script = undefined
res.baseName = res.language
res.tag = res.createTag()
return res
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left minimize 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 Locale AST#id... | public minimize() : Locale {
let res = new Locale(this)
res.region = undefined
res.script = undefined
res.baseName = res.language
res.tag = res.createTag()
return res
} | https://gitcode.com/iop123123/arkts-static-skills | fa4011c803ce1c953e6d582aeca5c38c118cf139 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | updateWebViewSourceCookies | 更新指定图源的 Cookie JSON | async updateWebViewSourceCookies(sourceId: number, cookiesJson: string): Promise<void> {
try {
await this.ensureWebViewSourceConfigRecord(sourceId);
const now: number = Date.now();
const sql: string = `UPDATE webview_source_config SET cookies = ?, updateTime = ? WHERE sourceId = ?`;
await ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateWebViewSourceCookies AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Le... | async updateWebViewSourceCookies(sourceId: number, cookiesJson: string): Promise<void> {
try {
await this.ensureWebViewSourceConfigRecord(sourceId);
const now: number = Date.now();
const sql: string = `UPDATE webview_source_config SET cookies = ?, updateTime = ? WHERE sourceId = ?`;
await ... | https://github.com/DaLongZhuaZi/manxia | e7ba0d42331e83855625097833779fccaea91c6e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/ConsolePanel.ets | arkts | setLogFilter | --- 操作方法 --- | public setLogFilter(filter: LogFilter): void {
this.logFilter = filter;
this.notifyLogUpdate();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLogFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left filter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left L... | public setLogFilter(filter: LogFilter): void {
this.logFilter = filter;
this.notifyLogUpdate();
} | https://github.com/DaLongZhuaZi/manxia | 939a70a80242938356e460e3c4ba3938147c6d23 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/CheatManager.ets | arkts | getOnlineCachePath | 在线缓存文件路径: {cheatsDir}/{gameCode}.{checksum}.xml | private getOnlineCachePath(gameCode: string, checksum: string): string {
return `${this.getCheatsDir()}/${gameCode}.${checksum}.xml`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getOnlineCachePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left gameCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private getOnlineCachePath(gameCode: string, checksum: string): string {
return `${this.getCheatsDir()}/${gameCode}.${checksum}.xml`;
} | https://github.com/richshaw2015/nds | 391d9c796b2f615ab06fb6c639447afc8479fa7a | github |
xufei5789651/HmWan | commons/utils/src/main/ets/common/GlobalContext.ets | arkts | getContext | 获取Context | getContext(key: string): common.UIAbilityContext | undefined {
return this.contexts.get(key);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | getContext(key: string): common.UIAbilityContext | undefined {
return this.contexts.get(key);
} | https://github.com/xufei5789651/HmWan | 9c701cc455c287e91b8a6b92b60a8c39c3c6b717 | github |
erosTeam/NextE | shared/src/main/ets/network/EhApiService.ets | arkts | getUserConfig | Read the EH user config (uconfig.php) for the current site into the editable model. | async getUserConfig(isEx: boolean): Promise<EhProfileSettings> {
const url: string = `${EhConstants.baseUrl(isEx)}/uconfig.php`
const resp: EhTextResponse = await this.fetch(url, isEx, 'generic')
return EhUconfigParser.parse(resp.body)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserConfig AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isEx AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async getUserConfig(isEx: boolean): Promise<EhProfileSettings> {
const url: string = `${EhConstants.baseUrl(isEx)}/uconfig.php`
const resp: EhTextResponse = await this.fetch(url, isEx, 'generic')
return EhUconfigParser.parse(resp.body)
} | https://github.com/erosTeam/NextE | 02e2069c0786f651f216f1e534ad53a44ebc14d6 | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateKeyPress | 按键反馈 — 预设尖锐效果 | static vibrateKeyPress(): void {
VibratorManager.logExecution('vibrateKeyPress');
VibratorManager.vibratePreset(HapticEffect.SHARP, 1, 50, VibrationUsage.TOUCH);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateKeyPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | static vibrateKeyPress(): void {
VibratorManager.logExecution('vibrateKeyPress');
VibratorManager.vibratePreset(HapticEffect.SHARP, 1, 50, VibrationUsage.TOUCH);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | f78142649900e9941364cce46a6698508d85c2cb | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/utils/StorageUtils.ets | arkts | deleteValueSync | 根据key删除值
@param key | deleteValueSync(key: string) {
this.preferences?.deleteSync(key)
this.preferences?.flush((err: BusinessError) => {
if (err) {
console.error(`${this.name} file flush error :${err.message ?? ""}`)
}
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteValueSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Righ... | deleteValueSync(key: string) {
this.preferences?.deleteSync(key)
this.preferences?.flush((err: BusinessError) => {
if (err) {
console.error(`${this.name} file flush error :${err.message ?? ""}`)
}
})
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 009590a287db1b574236c51a63e016533dc98f00 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AnomalyDetectionDAO.ets | arkts | getBySeverity | 根据严重程度获取异常记录 | static async getBySeverity(userId: number, severity: string): Promise<AnomalyRecord[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AnomalyRecord.tableName);
predicates.equalT... | 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 getBySeverity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A... | static async getBySeverity(userId: number, severity: string): Promise<AnomalyRecord[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AnomalyRecord.tableName);
predicates.equalT... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7e2bee2244686f1e1d6b42fb0ebba103a1a43608 | github |
erosTeam/NextE | feature/reader/src/main/ets/viewmodel/ReaderViewModel.ets | arkts | onVerticalScroll | Vertical (continuous) mode: top item drives the counter; load more as the bottom nears the end. | onVerticalScroll(start: number, end: number): void {
this.currentIndex = start
if (!this.exhausted && !this.hasPreviewAt(start)) {
this.prepareTargetPage(start)
} else if (!this.exhausted && end >= this.previewMapUpperBound() - 3) {
this.loadMore()
this.precacheAhead()
} else {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onVerticalScroll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left... | onVerticalScroll(start: number, end: number): void {
this.currentIndex = start
if (!this.exhausted && !this.hasPreviewAt(start)) {
this.prepareTargetPage(start)
} else if (!this.exhausted && end >= this.previewMapUpperBound() - 3) {
this.loadMore()
this.precacheAhead()
} else {
... | https://github.com/erosTeam/NextE | e005e2627b5db829de058fc05ea5553d36eeb977 | github |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/view/PanelMusicHomePage.ets | arkts | aboutToAppear | Calls load on the local view model to populate hero, for-you, and private-song data for the panel. | aboutToAppear() {
this.recommendViewModel.load();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.recommendViewModel.load();
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 10d2ebfc6316cc66736495fed614536e2c8634e3 | gitcode |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | onCameraInputChange | 监听相机输入变化
@param cameraInput - 相机输入对象
@param cameraDevice - 相机设备对象
@returns 无返回值 | onCameraInputChange(cameraInput: camera.CameraInput, cameraDevice: camera.CameraDevice): void {
Logger.info(TAG, `onCameraInputChange is called`);
try {
cameraInput.on('error', cameraDevice, (cameraInputError: BusinessError): void => {
Logger.info(TAG, `onCameraInputChange cameraInput error code... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCameraInputChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraInput AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left camera AST#identif... | onCameraInputChange(cameraInput: camera.CameraInput, cameraDevice: camera.CameraDevice): void {
Logger.info(TAG, `onCameraInputChange is called`);
try {
cameraInput.on('error', cameraDevice, (cameraInputError: BusinessError): void => {
Logger.info(TAG, `onCameraInputChange cameraInput error code... | https://gitee.com/openharmony/multimedia_camera_framework.git | 4d99d34d847c0e78b68189396b5377065d4feca9 | gitee |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | releasePreCreatedNode | 清空所有未关联的预创建组件,释放对应内存
已关联成功的组件,正常显示的组件不受影响 | public releasePreCreatedNode() {
nativeNode.releasePreCreatedNode();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left releasePreCreatedNode 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#... | public releasePreCreatedNode() {
nativeNode.releasePreCreatedNode();
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L67-L69 | ff3b38e7d3fc4e95a28cf1b524fafab08e57b327 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/service/ReimburseService.ets | arkts | getReimburseList | 获取报销列表 | getReimburseList(params: ReimburseQueryParams): Promise<ReimburseInfo[]> {
return new Promise((resolve) => {
setTimeout(() => {
const mockData: ReimburseInfo[] = [
{ id: '1', title: '4月份差旅费报销', amount: 5680.00, applicant: '张三', status: 'PENDING', createTime: '2024-04-28', updateTime: '2024... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getReimburseList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | getReimburseList(params: ReimburseQueryParams): Promise<ReimburseInfo[]> {
return new Promise((resolve) => {
setTimeout(() => {
const mockData: ReimburseInfo[] = [
{ id: '1', title: '4月份差旅费报销', amount: 5680.00, applicant: '张三', status: 'PENDING', createTime: '2024-04-28', updateTime: '2024... | https://github.com/David8Idira/AI-OA | 1c38325adc379a56eb303b3763f4573b7dfd7738 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/settings/MainMenuSettingsSubPage.ets | arkts | isForceUnifiedEnabled | 检查强制统一详情页模式是否启用
默认为 true(强制启用统一详情页) | static isForceUnifiedEnabled(): boolean {
return PageSettingsHelper.settingsManager.getBoolean(PageSettingsHelper.FORCE_UNIFIED_KEY, true);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isForceUnifiedEnabled 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 boo... | static isForceUnifiedEnabled(): boolean {
return PageSettingsHelper.settingsManager.getBoolean(PageSettingsHelper.FORCE_UNIFIED_KEY, true);
} | https://github.com/DaLongZhuaZi/manxia | 2d4e499c359e3eb937efc713dd806bbad5ff1630 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLastIndex | Finds an index of the last element in the BigInt64Array that satisfies the condition
@param { function } fn - condition
@returns { int } - the index of the last element that satisfies fn, -1 otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLastIndex(fn: (val: BigInt, index: int, array: BigInt64Array) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn(new BigInt(val), i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex 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 : ... | public findLastIndex(fn: (val: BigInt, index: int, array: BigInt64Array) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn(new BigInt(val), i, this)) {
return i
}
}
return -1
} | https://gitcode.com/iop123123/arkts-static-skills | b7d47413efc9feee6d5a2d702769477b8955aab7 | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | updateUserProfile | Update user profile information.
同时更新服务器和本地存储 | static async updateUserProfile(updates: Partial<CurrentUser>): Promise<boolean> {
try {
if (!UserManager.dataPreferences) {
Logger.error('UserManager', 'Preferences not initialized');
return false;
}
// Get current user
const currentUser = await UserManager.getCurrentUser(... | 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 updateUserProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left updates AST#identifier#Right AST#:#Lef... | static async updateUserProfile(updates: Partial<CurrentUser>): Promise<boolean> {
try {
if (!UserManager.dataPreferences) {
Logger.error('UserManager', 'Preferences not initialized');
return false;
}
// Get current user
const currentUser = await UserManager.getCurrentUser(... | https://github.com/Harrisonls2004/WaterFlow | ae9ee8fc3e8be918af6558f724ac9211d5850d97 | github |
HarmonyOS_Samples/guide-snippets | ArkData/Udmf/UniformDataTypeDescriptors/entry/src/main/ets/pages/Index.ets | arkts | uniformTypeDescriptorTest | [End import_module]
[Start uniform_type_descriptor_test] | function uniformTypeDescriptorTest() {
try {
// 2.可根据 “.mp3” 文件后缀查询对应UTD数据类型,并查询对应UTD数据类型的具体属性
let fileExtension = '.mp3';
let typeIds1 = uniformTypeDescriptor.getUniformDataTypesByFilenameExtension(fileExtension);
if (typeIds1.length == 0) {
return;
}
let typeObj1 = uniformTypeDescripto... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left uniformTypeDescriptorTest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#t... | function uniformTypeDescriptorTest() {
try {
// 2.可根据 “.mp3” 文件后缀查询对应UTD数据类型,并查询对应UTD数据类型的具体属性
let fileExtension = '.mp3';
let typeIds1 = uniformTypeDescriptor.getUniformDataTypesByFilenameExtension(fileExtension);
if (typeIds1.length == 0) {
return;
}
let typeObj1 = uniformTypeDescripto... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 5c0ccfcf5a4a76fff2507ca6a785f46037956c83 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | remove | Deletes the first specified element found.
@param element - the specified element.
@returns true if the specified element is included, otherwise, false. | public remove(element: T): boolean {
let index: int = this.getIndexOf(element);
if (index != -1) {
this.removeByIndex(index);
return true;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right... | public remove(element: T): boolean {
let index: int = this.getIndexOf(element);
if (index != -1) {
this.removeByIndex(index);
return true;
}
return false;
} | https://gitcode.com/iop123123/arkts-static-skills | aab6d3467b41a95ab82ba00b68800760f3ab90d0 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/infomsg/InfoMsgController.ets | arkts | setConversationCheckAll | Check whether all items are selected. | setConversationCheckAll(type) {
if (!this.isMultipleSelectState) {
return;
}
if (type == common.int.CHECKBOX_SELECT_NONE) {
this.conversationSelectedNumber = common.int.MESSAGE_CODE_ZERO;
this.isConversationCheckAll = false;
} else if (type == comm... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setConversationCheckAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left type AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right... | setConversationCheckAll(type) {
if (!this.isMultipleSelectState) {
return;
}
if (type == common.int.CHECKBOX_SELECT_NONE) {
this.conversationSelectedNumber = common.int.MESSAGE_CODE_ZERO;
this.isConversationCheckAll = false;
} else if (type == comm... | https://gitee.com/openharmony/applications_mms.git | 63133aa9efc9eb9e4422dceef586424cfc6d17b0 | gitee |
openharmony/applications_call | entry/src/main/ets/ServiceAbility/TelephonyApi.ets | arkts | registerCallStateCallback | register call state callback
@param { Function } callBack - inject an Function | public registerCallStateCallback(callBack) {
try {
call.on('callDetailsChange', (data) => {
if (!data) {
LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback')
return;
}
LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback callState: ' + JSON.s... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerCallStateCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callBack AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi... | public registerCallStateCallback(callBack) {
try {
call.on('callDetailsChange', (data) => {
if (!data) {
LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback')
return;
}
LogUtils.i(TAG, prefixLog + 'call.on registerCallStateCallback callState: ' + JSON.s... | https://gitee.com/openharmony/applications_call.git | 753603c27de48f0fbffbbac27f96ec16043da547 | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitBool | 访问 bool 字段
JSON: boolean | visitBool(value: boolean, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitBool 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 boolean AST#identifier#Right AST#,#Left , AST... | visitBool(value: boolean, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 641d81b6d781a34ca9659c2f7453e313cde31282 | gitcode |
iJcher/openharmony-app-znjj | entry/src/main/ets/pages/FirstEnter.ets | arkts | getFirstEnterPreference | 获取用户首选项实例方法 | getFirstEnterPreference(){
let context=getContext(this) as Context
FirstEnterPreference=preferences.getPreferencesSync(context,{name:'FirstEnterPreference'})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getFirstEnterPreference 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_... | getFirstEnterPreference(){
let context=getContext(this) as Context
FirstEnterPreference=preferences.getPreferencesSync(context,{name:'FirstEnterPreference'})
} | https://github.com/iJcher/openharmony-app-znjj | 51753de949580232844dcba39438726eb45bac71 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGManager.ets | arkts | createSVGDeclares | 创建SVG的头部声明 | public createSVGDeclares(): Object{
// 为整个SVG文档添加设置标准SVG声明
let declares = new SVGDeclares();
declares.setXMLVersion('1.0');
declares.setEncoding('utf-8');
declares.setStandalone(true);
this._svgObj = declares.toObj();
return this._svgObj;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createSVGDeclares 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 Obje... | public createSVGDeclares(): Object{
// 为整个SVG文档添加设置标准SVG声明
let declares = new SVGDeclares();
declares.setXMLVersion('1.0');
declares.setEncoding('utf-8');
declares.setStandalone(true);
this._svgObj = declares.toObj();
return this._svgObj;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 13f30e69c4a709c724bcd312d4129fff0132bf97 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | onGyroData | ==================== 核心逻辑 ====================
处理陀螺仪数据 — 映射为右摇杆值
与 Android ControllerHandler.applyGyroToRightStick() 对齐:
- gyroZ (yaw/偏航) → 右摇杆 X
- gyroX (pitch/俯仰) → 右摇杆 Y
- 灵敏度: effectiveSensitivity = 180 / multiplier
- scaledX = -clamp(gz / sensitivity, -1, 1) → 左转为负
- scaledY = clamp(gx / sensitivity, -1, 1) → 抬头为正 | private onGyroData(controllerNumber: number, motionType: number,
gx: number, gy: number, gz: number): void {
if (motionType !== LI_MOTION_TYPE_GYRO) return;
if (!this._enabled || !this.holdActive) {
this.gyroStickX = 0;
this.gyroStickY = 0;
return;
}
const effectiveSensitivity =... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onGyroData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | private onGyroData(controllerNumber: number, motionType: number,
gx: number, gy: number, gz: number): void {
if (motionType !== LI_MOTION_TYPE_GYRO) return;
if (!this._enabled || !this.holdActive) {
this.gyroStickX = 0;
this.gyroStickY = 0;
return;
}
const effectiveSensitivity =... | https://github.com/AlkaidLab/moonlight-harmony | 8d7ca253c59f671fd13b6faef9fb3d728bbe2c4a | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpBackgroundService.ets | arkts | updateNotification | Update notification content | async updateNotification(contentText: string): Promise<void> {
if (!isRunning) {
console.warn(`${TAG}: Service not running, cannot update notification`);
return;
}
await this.showNotification('远程桌面音频连接', contentText);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateNotification AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left contentText AST#identifier... | async updateNotification(contentText: string): Promise<void> {
if (!isRunning) {
console.warn(`${TAG}: Service not running, cannot update notification`);
return;
}
await this.showNotification('远程桌面音频连接', contentText);
} | https://github.com/tangwengang-del/freerdp-harmonyos | e5315a8675414d77868506b2846559849f72734a | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TrackpadGestureHandler.ets | arkts | checkForTap | 检测是否满足轻触条件并发送点击 | private checkForTap(touch: TouchObject, state: FingerState, eventTime: number): void {
if (this.confirmedDrag || this.confirmedMove || this.confirmedScroll) return;
const timeDelta = eventTime - state.startTime;
if (!this.isWithinTapBounds(touch, state) || timeDelta > TAP_TIME_THRESHOLD) {
this.las... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkForTap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left touch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private checkForTap(touch: TouchObject, state: FingerState, eventTime: number): void {
if (this.confirmedDrag || this.confirmedMove || this.confirmedScroll) return;
const timeDelta = eventTime - state.startTime;
if (!this.isWithinTapBounds(touch, state) || timeDelta > TAP_TIME_THRESHOLD) {
this.las... | https://github.com/AlkaidLab/moonlight-harmony | 97b06833b6740c907b34f413909354353fd9bf5f | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | checkFoldIsHalfFolded | Check whether the foldable phone is half-folded.
@return {boolean} Whether the foldable phone is half-folded. | static checkFoldIsHalfFolded(): boolean {
return display.getFoldStatus() === FOLD_STATUS_HALF_FOLDED;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkFoldIsHalfFolded 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 boo... | static checkFoldIsHalfFolded(): boolean {
return display.getFoldStatus() === FOLD_STATUS_HALF_FOLDED;
} | https://gitee.com/openharmony-sig/applications_calculator.git | 9bf01202fefabd937475d95009da19bd6a3d04cf | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | removeLoadListener | 移除加载监听器 | removeLoadListener(listener: WebViewImageLoadListener): void {
const index = this.loadListeners.indexOf(listener);
if (index !== -1) {
this.loadListeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeLoadListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WebViewImageLoadListener AST#iden... | removeLoadListener(listener: WebViewImageLoadListener): void {
const index = this.loadListeners.indexOf(listener);
if (index !== -1) {
this.loadListeners.splice(index, 1);
}
} | https://github.com/DaLongZhuaZi/manxia | 9d31e78ae4e26bb8582fb5b9c4e0e5a92aa89d9e | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/feature/charge/src/main/ets/view/ChargeListView.ets | arkts | handleCheckInstallation | 点击导航图标事件 | handleCheckInstallation(item: ChargeType) {
this.isAppInstalled(item)
if (this.mapList.length === 0) {
toast($r('app.string.visit_store_install_maps_first'))
} else {
this.permissionRequest()
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleCheckInstallation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ChargeType AST#id... | handleCheckInstallation(item: ChargeType) {
this.isAppInstalled(item)
if (this.mapList.length === 0) {
toast($r('app.string.visit_store_install_maps_first'))
} else {
this.permissionRequest()
}
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 04b2e436c9da9b19eb3438faac1e50efe25e44d8 | github |
YANGZX22/Voot | entry/src/main/ets/storage/AsrModelStorage.ets | arkts | saveConfig | 保存 ASR 模型配置 | static async saveConfig(ctx: common.UIAbilityContext, config: AsrModelConfig): Promise<void> {
const prefs = await AsrModelStorage.getPrefs(ctx);
await prefs.put(AsrModelStorage.CONFIG_KEY, JSON.stringify(config));
await prefs.flush();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#R... | static async saveConfig(ctx: common.UIAbilityContext, config: AsrModelConfig): Promise<void> {
const prefs = await AsrModelStorage.getPrefs(ctx);
await prefs.put(AsrModelStorage.CONFIG_KEY, JSON.stringify(config));
await prefs.flush();
} | https://github.com/YANGZX22/Voot | c036d6b7267344f0f420e5fb751dd5e2ac67d7c7 | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/component/preference/utils/PreferenceUtils.ets | arkts | put | 编辑首选项
@param key 键
@param value 值
@returns void | put(key: string, value: preferences.ValueType): void {
if (!this.preferences) {
hilog.error(this.domain, this.tag, `加载Preference失败, Preference尚未初始化!`)
return
}
try {
this.preferences.putSync(key, value)
this.preferences.flushSync()
hilog.debug(this.domain, this.tag, `写入首选项(${... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right ... | put(key: string, value: preferences.ValueType): void {
if (!this.preferences) {
hilog.error(this.domain, this.tag, `加载Preference失败, Preference尚未初始化!`)
return
}
try {
this.preferences.putSync(key, value)
this.preferences.flushSync()
hilog.debug(this.domain, this.tag, `写入首选项(${... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 7d32f93766a94278c4c9f4b73c1881b36e10154b | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | get | Gets the char value wrapped in this CharBox.
@returns { char } The char value wrapped in this CharBox
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get(): char {
return this.value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right... | public get(): char {
return this.value;
} | https://gitcode.com/iop123123/arkts-static-skills | d9a08a53550397522ef3524d08fc4f2f39e88f19 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | checkAndSyncOrientation | 检查并同步屏幕方向
当收到服务器分辨率变化时调用,检查客户端和服务端方向是否一致
@param serverWidth 服务器分辨率宽度
@param serverHeight 服务器分辨率高度
@param clientIsLandscape 客户端当前是否为横屏 | checkAndSyncOrientation(serverWidth: number, serverHeight: number, clientIsLandscape: boolean): void {
// 检查是否启用了屏幕旋转同步
if (!this.displaySettings?.rotableScreen) {
return;
}
const serverIsLandscape = serverWidth > serverHeight;
console.info(`StreamViewModel: checkAndSyncOrientation... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkAndSyncOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left serverWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,... | checkAndSyncOrientation(serverWidth: number, serverHeight: number, clientIsLandscape: boolean): void {
// 检查是否启用了屏幕旋转同步
if (!this.displaySettings?.rotableScreen) {
return;
}
const serverIsLandscape = serverWidth > serverHeight;
console.info(`StreamViewModel: checkAndSyncOrientation... | https://github.com/AlkaidLab/moonlight-harmony | f20e456c63c8c15fbd788c448125a8cfe41813e1 | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets | arkts | clear | Clear data in PreferencesHandler. | public clear() {
if (this.preferences != null) {
this.preferences.clear();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#L... | public clear() {
if (this.preferences != null) {
this.preferences.clear();
}
} | https://gitee.com/harmonyos/codelabs.git | 1b133e446bcaeedd009fd56c3a52e2392bc68ad8 | gitee |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/ui/widget/DanmakuView.ets | arkts | addDanmaku | danmaku.isLive == true的情况下,请在非UI线程中使用此方法,避免可能卡住主线程
@param item | addDanmaku(item: BaseDanmaku): void{
this.delegate.addDanmaku(item)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addDanmaku AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BaseDanmaku AST#identifier#Right AST#)#Left )... | addDanmaku(item: BaseDanmaku): void{
this.delegate.addDanmaku(item)
} | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 7c2ea80249d4838d95aec7211ceb883bbbd97c16 | gitee |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BillManager.ets | arkts | getRecentBills | 查询最近N天的账单(按日期分组)
@param days 天数,默认3天
@returns 按日期分组的账单列表 | static async getRecentBills(days: number = 3): Promise<BillGroup[]> {
const now = new Date();
now.setHours(0, 0, 0, 0);
const startTime = now.getTime() - (days - 1) * 24 * 60 * 60 * 1000;
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.greaterThanOrEqualTo('date', sta... | 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 getRecentBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left days AST#identifier#Right AST#:#Left : AS... | static async getRecentBills(days: number = 3): Promise<BillGroup[]> {
const now = new Date();
now.setHours(0, 0, 0, 0);
const startTime = now.getTime() - (days - 1) * 24 * 60 * 60 * 1000;
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.greaterThanOrEqualTo('date', sta... | https://github.com/ZestBox-18/kitebook-frontend | f9b5556ae9aeac3f401ae5cd1147b56a83877ac4 | github |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageDestroy | 5. 窗口阶段销毁 | onWindowStageDestroy(): void {
// 窗口销毁,释放 UI 资源
// Main window is destroyed, release UI related resources
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | 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 {
// 窗口销毁,释放 UI 资源
// Main window is destroyed, release UI related resources
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | https://github.com/OnceWeWere/Weather_HarmonyOS | d2e393259fe17872b623f9b9c8f795904370ee9c | github |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets | arkts | dealAlarmWithServiceType | Deal with the alarm processing request based on the service type.
@param alarmInfo Alarm information
@param serviceType Alarm service type which could be Start, Stop, or Delay. | async dealAlarmWithServiceType(alarmInfo: AlarmInfo, serviceType: AlarmServiceType,
isCloseButton?: boolean, isSnooze?: boolean): Promise<void> {
if (!alarmInfo || !serviceType) {
LogUtil.error(TAG, 'Execute method dealAlarmWithServiceType failed, params is incorrect.');
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left dealAlarmWithServiceType AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identi... | async dealAlarmWithServiceType(alarmInfo: AlarmInfo, serviceType: AlarmServiceType,
isCloseButton?: boolean, isSnooze?: boolean): Promise<void> {
if (!alarmInfo || !serviceType) {
LogUtil.error(TAG, 'Execute method dealAlarmWithServiceType failed, params is incorrect.');
... | https://gitee.com/openharmony-sig/applications_clock.git | 74c5c26789a3f03aeb884ec643c3a5ffabe05418 | gitee |
xblLab/HarmonyProjectTemplate | commons/lib_common/src/main/ets/utils/AppGalleryUtils.ets | arkts | checkAppUpdate | 是否有更新版本
@param context
@returns | public static checkAppUpdate(context: common.UIAbilityContext): Promise<boolean> {
try {
return updateManager.checkAppUpdate(context)
.then((checkResult: updateManager.CheckUpdateResult) => {
Logger.info(TAG, 'Succeeded in checking Result updateAvailable:' + checkResult.updateAvailable);
... | 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 checkAppUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left ... | public static checkAppUpdate(context: common.UIAbilityContext): Promise<boolean> {
try {
return updateManager.checkAppUpdate(context)
.then((checkResult: updateManager.CheckUpdateResult) => {
Logger.info(TAG, 'Succeeded in checking Result updateAvailable:' + checkResult.updateAvailable);
... | https://github.com/xblLab/HarmonyProjectTemplate | d188f5d99982f32251850a8b58a1385657484f37 | github |
Octo-o-o-o/harmonyos-ai-workspace | samples/templates/web-bridge-h5-shell/BridgeJavaScriptProxy.ets | arkts | emitToJs | ─── 异步出口:Native → Web 单向事件 ────────────────────── | emitToJs(envelope: BridgeEnvelope): void {
const ctrl = this.webController
if (ctrl === null) {
// Web 组件已卸载,丢弃即可(业务层应通过 detach 提前 unsubscribe)
return
}
const literal = jsLiteral(JSON.stringify(envelope))
try {
ctrl.runJavaScript(`window.__handleNative && window.__handleNative(${... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left emitToJs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left envelope AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BridgeEnvelope AST#identifier#Right AST#)#L... | emitToJs(envelope: BridgeEnvelope): void {
const ctrl = this.webController
if (ctrl === null) {
// Web 组件已卸载,丢弃即可(业务层应通过 detach 提前 unsubscribe)
return
}
const literal = jsLiteral(JSON.stringify(envelope))
try {
ctrl.runJavaScript(`window.__handleNative && window.__handleNative(${... | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | a99e65eadde23518c168c9604471efa0b5e6e2d7 | github |
imperson123/- | Harmonyos-Application/entry/src/main/ets/pages/ChatStore.ets | arkts | saveHistory | 保存消息到本地存储 | private saveHistory() {
// 实际应用中应使用数据库或Preferences
AppStorage.Set('chat_history', this.messages);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveHistory 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 ... | private saveHistory() {
// 实际应用中应使用数据库或Preferences
AppStorage.Set('chat_history', this.messages);
} | https://github.com/imperson123/- | 4fc0904f055bf693fa5ad3660a9d524e2f4a6b02 | github |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | registerAVSession | 注册播控中心 | registerAVSession(callback?: AvSessionCallback) {
this.avManager.createAvSession(getContext(this), "flymbyWlPlayer", "video",
this.avManager.createMetadata(
this.param.itemId || '',
this.param.subName || '',
this.param.itemName || '',
this.totalTime,
this.param.coverU... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerAVSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | registerAVSession(callback?: AvSessionCallback) {
this.avManager.createAvSession(getContext(this), "flymbyWlPlayer", "video",
this.avManager.createMetadata(
this.param.itemId || '',
this.param.subName || '',
this.param.itemName || '',
this.totalTime,
this.param.coverU... | https://github.com/fbinba3955/Flymby | 7377f5f96458f05017ca14e7c1610cf498316260 | github |
Blue1-0/wanandroid_harmonyos | entry/src/main/ets/core/DataManager.ets | arkts | fetchBannerList | banner list | fetchBannerList(): ChainableRequest<BannerBean[]> {
return AxiosUtils.get<BannerBean[]>(WanAndroidApi.bannerList)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fetchBannerList 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#instantiation_expression#Left AST#identifier#Left ChainableReq... | fetchBannerList(): ChainableRequest<BannerBean[]> {
return AxiosUtils.get<BannerBean[]>(WanAndroidApi.bannerList)
} | https://github.com/Blue1-0/wanandroid_harmonyos/blob/bb01bf64e40a14c6304363a3290077ea7baaed81/entry/src/main/ets/core/DataManager.ets#L26-L28 | 6a45ce66989ad4aab4ff845b7f7060644cfff4bb | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateBuzz | 连振反馈 — 连续短振序列,适合吸引注意但不打扰 | static vibrateBuzz(): void {
VibratorManager.logExecution('vibrateBuzz');
VibratorManager.vibratePattern([60, 40, 60, 40, 60, 40, 60], 1, VibrationUsage.NOTIFICATION);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateBuzz 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 vibrateBuzz(): void {
VibratorManager.logExecution('vibrateBuzz');
VibratorManager.vibratePattern([60, 40, 60, 40, 60, 40, 60], 1, VibrationUsage.NOTIFICATION);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 9b0af287ee381cda47fdfac1f6250ff47004f4bb | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieDataSet.ets | arkts | isAutomaticallyDisableSliceSpacingEnabled | When enabled, slice spacing will be 0.0 when the smallest value is going to be
smaller than the slice spacing itself.
@return
@Override | public isAutomaticallyDisableSliceSpacingEnabled(): boolean {
return this.mAutomaticallyDisableSliceSpacing;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAutomaticallyDisableSliceSpacingEnabled 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 ... | public isAutomaticallyDisableSliceSpacingEnabled(): boolean {
return this.mAutomaticallyDisableSliceSpacing;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 594fce37a9aedc953eb81d778c2e03809e985655 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | generatePin | 生成配对 PIN 码(使用加密安全的随机数) | private generatePin(): string {
// 使用 CryptoUtil 生成安全随机数
const randomBytes = CryptoUtil.generateRandomBytes(4);
let pin = '';
for (let i = 0; i < 4; i++) {
pin += (randomBytes[i] % 10).toString();
}
return pin;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generatePin 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#... | private generatePin(): string {
// 使用 CryptoUtil 生成安全随机数
const randomBytes = CryptoUtil.generateRandomBytes(4);
let pin = '';
for (let i = 0; i < 4; i++) {
pin += (randomBytes[i] % 10).toString();
}
return pin;
} | https://github.com/AlkaidLab/moonlight-harmony | e00b5d24e7f2cb681c250e30172782321ebcf959 | github |
ZestBox-18/kitebook-frontend | commons/base/src/main/ets/utils/DebounceManager.ets | arkts | execute | 延迟防抖:在指定时间内只执行最后一次触发的操作
@param methodName 方法名称
@param callback 要执行的回调函数
@param delayMs 防抖时间(毫秒) | public execute(methodName: string, callback: DebounceCallback, delayMs: number): void {
// 清除之前的定时器
const existingTimer = DebounceManager.debounceTimers.get(methodName);
if (existingTimer) {
clearTimeout(existingTimer.timerId);
console.info(`[DebounceManager] ${methodName}方法的前一次定时器已被清除`);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left execute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left methodName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Righ... | public execute(methodName: string, callback: DebounceCallback, delayMs: number): void {
// 清除之前的定时器
const existingTimer = DebounceManager.debounceTimers.get(methodName);
if (existingTimer) {
clearTimeout(existingTimer.timerId);
console.info(`[DebounceManager] ${methodName}方法的前一次定时器已被清除`);
... | https://github.com/ZestBox-18/kitebook-frontend | 210ca494e888c1d485ff5ceec2519460ff9c7e9d | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | undefineMacro | Undefine a macro
@param macroName Macro name | public undefineMacro(macroName: string): boolean {
if (this.nativeHandle == 0) {
return false;
}
return lib.HighlightEngine_UndefineMacro(this.nativeHandle, macroName);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left undefineMacro AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left macroName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | public undefineMacro(macroName: string): boolean {
if (this.nativeHandle == 0) {
return false;
}
return lib.HighlightEngine_UndefineMacro(this.nativeHandle, macroName);
} | https://github.com/FinalScave/SweetLine | 8ef65622d1101a6f2d26504513fa838f6c53ee44 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test18_original_index.ets | arkts | isPrime | --- Prime check --- | function isPrime(n: number): boolean {
if (n < 2) {
return false;
}
if (n === 2) {
return true;
}
if (n % 2 === 0) {
return false;
}
let limit: number = Math.sqrt(n);
let i: number = 3;
while (i <= limit) {
if (n % i === 0) {
return false;
}
i = i + 2;
}
return true;
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isPrime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#p... | function isPrime(n: number): boolean {
if (n < 2) {
return false;
}
if (n === 2) {
return true;
}
if (n % 2 === 0) {
return false;
}
let limit: number = Math.sqrt(n);
let i: number = 3;
while (i <= limit) {
if (n % i === 0) {
return false;
}
i = i + 2;
}
return true;
... | https://github.com/miaochiahao/ark-ghidra | f79bc2111e7d5327b8ed5e28ad18de048b4a6ef0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | batchUpdateOnlinePageCacheStatus | 批量更新在线页面的缓存状态 | public async batchUpdateOnlinePageCacheStatus(
updates: Array<PageCacheUpdate>
): Promise<string[]> {
if (updates.length === 0) {
return [];
}
try {
const sql = `UPDATE online_page
SET localPath = ?, fileSize = ?, isDownloaded = 1
WHERE imageUrl = ... | 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 batchUpdateOnlinePageCacheStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left upda... | public async batchUpdateOnlinePageCacheStatus(
updates: Array<PageCacheUpdate>
): Promise<string[]> {
if (updates.length === 0) {
return [];
}
try {
const sql = `UPDATE online_page
SET localPath = ?, fileSize = ?, isDownloaded = 1
WHERE imageUrl = ... | https://github.com/DaLongZhuaZi/manxia | 41857baf544a286181034a2aa6d03afb73e622ff | github |
CPF-ApplicationTPC/openharmony_tpc_samples | bc_ohos/library/src/main/ets/ISO9797Alg3Mac.ets | arkts | desEncrypt | DES 加密(ECB 模式,用于单块加密)
注意:我们已经在 processBlock() 中手动实现了 CBC 逻辑,
这里只需要进行单块 ECB 加密,不能再使用 CBC 模式! | private desEncrypt(data: Uint8Array, key: Uint8Array): Uint8Array {
try {
if (deviceInfo.sdkApiVersion < sdkApiVersion) {
const keyWords: CryptoJS.lib.WordArray = this.bytesToWordArray(key);
const dataWords: CryptoJS.lib.WordArray = this.bytesToWordArray(data);
const encrypted: Cryp... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left desEncrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ui... | private desEncrypt(data: Uint8Array, key: Uint8Array): Uint8Array {
try {
if (deviceInfo.sdkApiVersion < sdkApiVersion) {
const keyWords: CryptoJS.lib.WordArray = this.bytesToWordArray(key);
const dataWords: CryptoJS.lib.WordArray = this.bytesToWordArray(data);
const encrypted: Cryp... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 8c1f927bbce1d1a72b08da511d51042a856aa14b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | toNumChapter | 章节数转数字 | toNumChapter(s: string): string {
if (!s) return '';
// 匹配中文数字并转换
const chineseNums: Record<string, number> = {
'零': 0, '一': 1, '二': 2, '三': 3, '四': 4,
'五': 5, '六': 6, '七': 7, '八': 8, '九': 9,
'十': 10, '百': 100, '千': 1000, '万': 10000
};
// 简单的中文数字转换
let result = s;
co... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toNumChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | toNumChapter(s: string): string {
if (!s) return '';
// 匹配中文数字并转换
const chineseNums: Record<string, number> = {
'零': 0, '一': 1, '二': 2, '三': 3, '四': 4,
'五': 5, '六': 6, '七': 7, '八': 8, '九': 9,
'十': 10, '百': 100, '千': 1000, '万': 10000
};
// 简单的中文数字转换
let result = s;
co... | https://github.com/DaLongZhuaZi/manxia | e4549dd50a9cd836a160df3ba91c774ba35bcd22 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PredicateBuilder.ets | arkts | singleValueToPredicateValue | 将单个 ValueType 转换为 RdbPredicates 支持的值类型
用于非数组类型的条件值 | private static singleValueToPredicateValue(value: ValueType | Array<ValueType> | null): relationalStore.ValueType {
if (value === null) {
return null
}
if (Array.isArray(value)) {
// 如果是数组,返回 null(不应该用于单值条件)
return null
}
if (value === undefined) {
return null
}
if ... | 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 singleValueToPredicateValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Rig... | private static singleValueToPredicateValue(value: ValueType | Array<ValueType> | null): relationalStore.ValueType {
if (value === null) {
return null
}
if (Array.isArray(value)) {
// 如果是数组,返回 null(不应该用于单值条件)
return null
}
if (value === undefined) {
return null
}
if ... | https://github.com/offlinecat-dev/OCNetORM | c2cca6896585c79656d294862fe881a5834d02fb | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | logLines | 按行与长度分割日志,避免单条日志过长被截断
@param {"info" | "error"} level - 日志级别
@param {string[]} lines - 日志行
@returns {void} 无返回值 | function logLines(level: "info" | "error", lines: string[]): void {
const logger: (domain: number, tag: string, format: string, content: string) => void =
level === "error" ? hilog.error : hilog.info;
lines.forEach((line: string) => {
splitLines(line).forEach((segment: string) => {
splitChunks(segment... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left logLines AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left level AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function logLines(level: "info" | "error", lines: string[]): void {
const logger: (domain: number, tag: string, format: string, content: string) => void =
level === "error" ? hilog.error : hilog.info;
lines.forEach((line: string) => {
splitLines(line).forEach((segment: string) => {
splitChunks(segment... | https://github.com/Joker-x-dev/CoolMallArkTS | a8212e3b09541e0bc1698de7a483e9e1d48bae0b | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/CloudSyncService.ets | arkts | uploadToCloud | 上传数据到云端 | private static async uploadToCloud(options: SyncOptions): Promise<number> {
try {
console.log('[CloudSyncService] 开始上传数据到云端');
// 1. 收集本地数据
const dataPackage: CloudDataPackage = await CloudSyncService.collectLocalData(options);
// 2. 可选加密
let payload: string = JSON.stringify(dataPa... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left uploadToCloud AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o... | private static async uploadToCloud(options: SyncOptions): Promise<number> {
try {
console.log('[CloudSyncService] 开始上传数据到云端');
// 1. 收集本地数据
const dataPackage: CloudDataPackage = await CloudSyncService.collectLocalData(options);
// 2. 可选加密
let payload: string = JSON.stringify(dataPa... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | c02bf5e05ff2a8af91a2fa21d1f4499820262889 | github |
openharmony-sig/flutter_audioplayers | packages/audioplayers_ohos/ohos/src/main/ets/components/plugin/player/WrappedPlayer.ets | arkts | seek | seek operations cannot be called until after
the player is ready. | seek(position: number) {
if (this.prepared && this.player?.isLiveStream() != true) {
this.player?.seekTo(position)
this.shouldSeekTo = -1
} else {
this.shouldSeekTo = position
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left seek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left )... | seek(position: number) {
if (this.prepared && this.player?.isLiveStream() != true) {
this.player?.seekTo(position)
this.shouldSeekTo = -1
} else {
this.shouldSeekTo = position
}
} | https://gitee.com/openharmony-sig/flutter_audioplayers.git | aa5a4778a677426838d802ae2792f363bbf16e2c | gitee |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | getState | 获取当前播放状态
@returns AudioState 枚举值,未创建时返回 null
@remarks
可能的状态:
- STATE_NEW: 新建
- STATE_PREPARED: 准备就绪
- STATE_RUNNING: 正在播放
- STATE_PAUSED: 已暂停
- STATE_STOPPED: 已停止
- STATE_RELEASED: 已释放 | public getState(): audio.AudioState | null {
return this.renderer?.state ?? null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#me... | public getState(): audio.AudioState | null {
return this.renderer?.state ?? null;
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L408-L410 | 333988b85ed8beddae6516376fcf77c54ad86cd1 | github |
openharmony/applications_contacts | feature/call/src/main/ets/missedcall/MissedCallNotifier.ets | arkts | getMissedBadgeNumber | get Missed Call BadgeNumber | public async getMissedBadgeNumber() {
if (this.missedBadgeNumber == -1) {
this.missedBadgeNumber = await sharedPreferencesUtils.getFromPreferences(KEY_MISSED_BADGE_NUM, -1) as number;
}
return this.missedBadgeNumber;
} | 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 getMissedBadgeNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public async getMissedBadgeNumber() {
if (this.missedBadgeNumber == -1) {
this.missedBadgeNumber = await sharedPreferencesUtils.getFromPreferences(KEY_MISSED_BADGE_NUM, -1) as number;
}
return this.missedBadgeNumber;
} | https://gitee.com/openharmony/applications_contacts.git | 2375ef17d6ce8e1518ed025105a46f42f9fbac3d | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/SettingsUtil.ets | arkts | clearDoctorAuth | 清除医生认证信息 | async clearDoctorAuth(): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
await this.dataPreferences.delete('doctor_token');
await this.dataPreferences.delete('doctor_info');
await this.dataPreferences.flush();
} catch (e) {
console.error('SettingsUtil... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearDoctorAuth AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left... | async clearDoctorAuth(): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
await this.dataPreferences.delete('doctor_token');
await this.dataPreferences.delete('doctor_info');
await this.dataPreferences.flush();
} catch (e) {
console.error('SettingsUtil... | https://github.com/LJ666-ui/harmony-health-care | 1bb90ee6b90690cdda4d0490075dd7900ccfdbec | github |
PollenWang6/HiXD | entry/src/main/ets/services/AttendanceService.ets | arkts | loginToLearning | SSO 登录到超星学习平台
参照 Flutter checkAndLogin:直接请求 CAS service URL,利用已有 TGC 自动重定向到超星 | async loginToLearning(): Promise<void> {
const casUrl: string = 'https://ids.xidian.edu.cn/authserver/login?service=' +
encodeURIComponent(LOGIN_URL);
console.info(TAG, 'loginToLearning: hitting CAS directly, URL=' + casUrl.substring(0, 100) + '...');
const resp: HttpResponse = await this.http.get(c... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginToLearning AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene... | async loginToLearning(): Promise<void> {
const casUrl: string = 'https://ids.xidian.edu.cn/authserver/login?service=' +
encodeURIComponent(LOGIN_URL);
console.info(TAG, 'loginToLearning: hitting CAS directly, URL=' + casUrl.substring(0, 100) + '...');
const resp: HttpResponse = await this.http.get(c... | https://github.com/PollenWang6/HiXD | bf7066dfad3a2b83a078571cc59a07e6f0c4cc7b | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setDrawTopYLabelEntry | set this to true to enable drawing the top y-label entry. Disabling this can be helpful
when the top y-label and
left x-label interfere with each other. default: true
@param enabled | public setDrawTopYLabelEntry(enabled: boolean): void {
this.mDrawTopYLabelEntry = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawTopYLabelEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | public setDrawTopYLabelEntry(enabled: boolean): void {
this.mDrawTopYLabelEntry = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | b00024fffbc5a750feba1d43c0af2392524fcd91 | gitee |
HarmonyOS_Samples/guide-snippets | ArkTS/ArkTSCompilationToolchain/ArkGuardForSourceCodeObfuscation/CodeObfuscationIssues/entry/src/ohosTest/ets/test/Ability.test.ets | arkts | runTest | 通用的测试函数。 | async function runTest(testCaseName: string, buttonText: string, delayTime: number, description: string,
done: Function) {
hilog.info(DOMAIN, TAG, BUNDLE + `${description}, begin`);
let btnAccept = await driver.findComponent(ON.text(buttonText));
if (btnAccept !== undefined) {
await btnAccept.click();
... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left runTest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left testCaseName AST#identifier#Right AST#typ... | async function runTest(testCaseName: string, buttonText: string, delayTime: number, description: string,
done: Function) {
hilog.info(DOMAIN, TAG, BUNDLE + `${description}, begin`);
let btnAccept = await driver.findComponent(ON.text(buttonText));
if (btnAccept !== undefined) {
await btnAccept.click();
... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 4efe9e38ff4873b1e41c6cf6529fb162210b2bcd | gitcode |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/network-request-template.ets | arkts | buildUrl | ==================== 构建 URL ==================== | private buildUrl(path: string, params?: Record<string, string | number>): string {
let url = `${API_BASE_URL}${path.startsWith('/') ? path : `/${path}`}`;
if (params) {
let query = Object.entries(params)
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v.toString())}`)
.jo... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | private buildUrl(path: string, params?: Record<string, string | number>): string {
let url = `${API_BASE_URL}${path.startsWith('/') ? path : `/${path}`}`;
if (params) {
let query = Object.entries(params)
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v.toString())}`)
.jo... | https://github.com/Goway-Hui/harmonyos-next-dev | 0109d46f1ebdcf40deef854875f809844d76ed75 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/KeyboardMapper.ets | arkts | setListener | Set the key processing listener | setListener(listener: KeyProcessingListener): void {
this.listener = listener;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KeyProcessingListener AST#identifier#Rig... | setListener(listener: KeyProcessingListener): void {
this.listener = listener;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 0be9d9f91b5dbf7df756b98c92235acc0effa080 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Reader.ets | arkts | fixed32 | Read fixed32 little-endian | fixed32(): number { const v = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 4).getUint32(0, true); this.pos += 4; return v >>> 0 } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fixed32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_bloc... | fixed32(): number { const v = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 4).getUint32(0, true); this.pos += 4; return v >>> 0 } | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 9b8aef275d2eaf9e6d5fa61ef036e2d3b9f2a931 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AutomationEngine.ets | arkts | checkVitalSignTrigger | 检查生命体征阈值触发 | private checkVitalSignTrigger(trigger: TriggerCondition, eventData: EventData): boolean {
if (eventData.eventType !== EventType.VITAL_SIGNS_CHANGE) {
return false;
}
return this.evaluateConditionGroup(trigger.condition, eventData.data);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkVitalSignTrigger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left trigger AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private checkVitalSignTrigger(trigger: TriggerCondition, eventData: EventData): boolean {
if (eventData.eventType !== EventType.VITAL_SIGNS_CHANGE) {
return false;
}
return this.evaluateConditionGroup(trigger.condition, eventData.data);
} | https://github.com/LJ666-ui/harmony-health-care | 0b95c3a23b0e6c6f5f212697247d4fe8ae6ea960 | github |
offlinecat-dev/OCNetORM | src/main/ets/core/ScopeRegistry.ets | arkts | getScopeNames | 获取实体的所有作用域名称
@param entityName 实体名称
@returns 作用域名称数组 | getScopeNames(entityName: string): Array<string> {
const entityScopes = this.scopes.get(entityName)
if (entityScopes === undefined) {
return []
}
const names: Array<string> = []
entityScopes.forEach((_, name) => {
names.push(name)
})
return names
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getScopeNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#E... | getScopeNames(entityName: string): Array<string> {
const entityScopes = this.scopes.get(entityName)
if (entityScopes === undefined) {
return []
}
const names: Array<string> = []
entityScopes.forEach((_, name) => {
names.push(name)
})
return names
} | https://github.com/offlinecat-dev/OCNetORM | 6b6bc481be8b7343e315085246786d03ecc720bc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | notifyError | 通知任务错误 | private notifyError(task: UnifiedDownloadTask, error: string): void {
this.lastProgressNotifyAtByTaskId.delete(task.id);
this.recordTaskFlowEvent(
task,
DownloadCacheFlowEventType.CALLBACK_NOTIFIED,
DownloadCacheFlowStage.TASK,
'unified_notify_error',
false,
error,
0
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left U... | private notifyError(task: UnifiedDownloadTask, error: string): void {
this.lastProgressNotifyAtByTaskId.delete(task.id);
this.recordTaskFlowEvent(
task,
DownloadCacheFlowEventType.CALLBACK_NOTIFIED,
DownloadCacheFlowStage.TASK,
'unified_notify_error',
false,
error,
0
... | https://github.com/DaLongZhuaZi/manxia | bf43aa6e22bf90f10a7f23a30058bede3a077988 | github |
wanrenhuifu/JLU | harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/utils/UserStore.ets | arkts | getUserStore | 获取本地仓库 | getUserStore() {
return preferences.getPreferences(getContext(this),{name:'UserStore'})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getUserStore 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 ... | getUserStore() {
return preferences.getPreferences(getContext(this),{name:'UserStore'})
} | https://github.com/wanrenhuifu/JLU | 643d0ea0a6d2888cb74b5fdd6f944418486d6edc | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | expand | Creates the smallest range that includes the current range and a given range.
@param { ScopeHelper } range - A Scope range object
@returns { ScopeHelper } Returns the smallest range that includes the current range and a given range.
Creates the smallest range that includes the current range and a given range.
@param { ... | expand(range: ScopeHelper<T>): ScopeHelper<T> {
let lowerLimit = this._lowerLimit.compareTo(range.getLower()) ? range.getLower() : this._lowerLimit
let upperLimit = this._upperLimit.compareTo(range.getUpper()) ? this._upperLimit : range.getUpper()
return new ScopeHelper<T>(lo... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left expand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left range AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#ide... | expand(range: ScopeHelper<T>): ScopeHelper<T> {
let lowerLimit = this._lowerLimit.compareTo(range.getLower()) ? range.getLower() : this._lowerLimit
let upperLimit = this._upperLimit.compareTo(range.getUpper()) ? this._upperLimit : range.getUpper()
return new ScopeHelper<T>(lo... | https://gitcode.com/iop123123/arkts-static-skills | 4b068ec48518039eea203675592c395f97923886 | gitcode |
fbinba3955/Flymby | smartxplayer/src/main/ets/helper/SXSessionHelper.ets | arkts | resumeLivePosition | 用户disable直播流时的seek | private async resumeLivePosition() {
if (!this.session) {
await this.createSession()
}
let position = this.player.getPosition()
if (position < 0) {
// position小于0会被avSessionPlayer认定为直播流
return
}
this.playbackState.position = {
elapsedTime: position,
updateTime: s... | 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 resumeLivePosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async resumeLivePosition() {
if (!this.session) {
await this.createSession()
}
let position = this.player.getPosition()
if (position < 0) {
// position小于0会被avSessionPlayer认定为直播流
return
}
this.playbackState.position = {
elapsedTime: position,
updateTime: s... | https://github.com/fbinba3955/Flymby | 9ac6d1e90a858375fabdb9e25e19f0ed8f4c6026 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | of | -----
of
@param {Any} o value
@returns {Type}
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(o: Any): Type {
const td = TypeAPI.getTypeDescriptor(o)
const contextClass = o == undefined ? Class.ofCaller() : Class.of(o as object)
const contextLinker = contextClass == undefined ? getBootRuntimeLinker() : contextClass.getLinker()
return Type.resolve(td, contextL... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#... | public static of(o: Any): Type {
const td = TypeAPI.getTypeDescriptor(o)
const contextClass = o == undefined ? Class.ofCaller() : Class.of(o as object)
const contextLinker = contextClass == undefined ? getBootRuntimeLinker() : contextClass.getLinker()
return Type.resolve(td, contextL... | https://gitcode.com/iop123123/arkts-static-skills | c697a90dc422957157bdde8b68686a57baa05571 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | display | Displays the DataFrame to the console
@returns {void} | public display(): void {
const rows = this.render();
for (const row of rows) {
console.log(row);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left display 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 ... | public display(): void {
const rows = this.render();
for (const row of rows) {
console.log(row);
}
} | https://gitcode.com/iop123123/arkts-static-skills | 7d12b414d655460329185b4e32961e9a173dbe1a | gitcode |
arkui-x/samples | CodeLab/Cases/feature/bottompanelslide/src/main/ets/model/DataSource.ets | arkts | addData | 改变单个数据
@param {number} index - 索引值
@param {VideoDataType} data - 修改后的值 | public addData(index: number, data: VideoDataType): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | public addData(index: number, data: VideoDataType): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://gitcode.com/arkui-x/samples | f104c9632f6df9b040076074fee29478e35d6a39 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Writer.ets | arkts | bool | Write boolean (varint) | bool(v: boolean): Writer { return this.uint32(v ? 1 : 0) } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left bool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) AST#)#Right ... | bool(v: boolean): Writer { return this.uint32(v ? 1 : 0) } | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | e3018d0fbd232ca7c2fb16311807a35bf1dd85bb | gitcode |
erosTeam/NextE | feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets | arkts | loadMoreFavorites | Favorites page paging (favorite-type profiles): page+from forward, nextGid fallback. Ported from
the favorites VM — favorites.php pages by page number + last-visible gid, not a pure gid cursor. | private async loadMoreFavorites(): Promise<void> {
DiagnosticLogger.info('home-list-anchor', 'fav_more_enter', this.debugState())
const page: number = this.favNextPage
const from: string = page >= 0 ? this.lastVisibleGid() : ''
const cursor: string = page >= 0 ? from : this.nextGid
if (cursor.leng... | 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 loadMoreFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async loadMoreFavorites(): Promise<void> {
DiagnosticLogger.info('home-list-anchor', 'fav_more_enter', this.debugState())
const page: number = this.favNextPage
const from: string = page >= 0 ? this.lastVisibleGid() : ''
const cursor: string = page >= 0 ? from : this.nextGid
if (cursor.leng... | https://github.com/erosTeam/NextE | 9064adbebf3c8e581fb356a744689503f19f2423 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets | arkts | aboutToAppear | 页面出现前加载列表
@returns {void} 无返回值 | aboutToAppear(): void {
void this.refreshList();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
void this.refreshList();
} | https://github.com/Joker-x-dev/HarmonyKit | 95331aa8b811e34e57ce0944423f47f7df4c9ae1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/UniversalDialog.ets | arkts | showWithContext | 使用页面 UIContext 的 PromptAction 显示系统 ActionMenu 作为选择对话框。
该实现确保挂载在有效的页面上下文中,规避自定义弹窗在未完成渲染批次时的挂载失败。 | public static showWithContext(uiContext: UIContext, options: UniversalDialogOptions): void {
try {
const prompt = uiContext.getPromptAction();
if (!prompt) {
logger.error(TAG, 'PromptAction 获取失败,无法显示系统选择对话框');
return;
}
if (!options.buttons || options.buttons.length === 0) ... | 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 showWithContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Le... | public static showWithContext(uiContext: UIContext, options: UniversalDialogOptions): void {
try {
const prompt = uiContext.getPromptAction();
if (!prompt) {
logger.error(TAG, 'PromptAction 获取失败,无法显示系统选择对话框');
return;
}
if (!options.buttons || options.buttons.length === 0) ... | https://github.com/DaLongZhuaZi/manxia | e4ac4c39d4a6753594c0aecec106b3abac69aed8 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | writeUIntBE | Writes an unsigned integer to the buffer at the specified offset using big-endian format
@param {long} value - Value to write
@param {int} offset - Number of bytes to skip before writing
@param {int} byteLength - Number of bytes to write (maximum 6)
@returns {int} Offset plus the number of bytes written
@throws {Error}... | public writeUIntBE(value: long, offset: int, byteLength: int): int {
Buffer.checkByteLengthConstraint(byteLength);
this.checkWriteUInt(value, offset, byteLength);
const view = this.getDataView();
let remaining = value;
for (let i = byteLength - 1; i >=... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeUIntBE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier... | public writeUIntBE(value: long, offset: int, byteLength: int): int {
Buffer.checkByteLengthConstraint(byteLength);
this.checkWriteUInt(value, offset, byteLength);
const view = this.getDataView();
let remaining = value;
for (let i = byteLength - 1; i >=... | https://gitcode.com/iop123123/arkts-static-skills | e7c2263128b11db65c6b33a477755f9661a4fd17 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/common/OfflineResourceManager.ets | arkts | submitToCache | 保存数据到内存和磁盘中
@param url 资源请求url
@param data url对应的响应数据 | submitToCache(url: string, data: ResponseDataType) {
let key = transferUrlToKey(url);
this.memoryCacheManager.submitToMemory(key, data);
this.diskCacheManager.submitToDisk(key, data);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left submitToCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ... | submitToCache(url: string, data: ResponseDataType) {
let key = transferUrlToKey(url);
this.memoryCacheManager.submitToMemory(key, data);
this.diskCacheManager.submitToDisk(key, data);
} | https://gitcode.com/arkui-x/samples | ca7c79163b2941e12e2d754d10d0a756ba0e69f1 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test44_original_index.ets | arkts | isPowerOfTwo | --- Power of two check --- | function isPowerOfTwo(n: number): boolean {
if (n <= 0) {
return false;
}
return (n & (n - 1)) === 0;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isPowerOfTwo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function isPowerOfTwo(n: number): boolean {
if (n <= 0) {
return false;
}
return (n & (n - 1)) === 0;
} | https://github.com/miaochiahao/ark-ghidra | 99f05009fe6424e25dc076e35ac9c513fe73451f | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoadResult.ets | arkts | constructor | 构造函数
@param relationName 关联名称 | constructor(relationName: string = '') {
this.relationName = relationName
this.success = false
this.errorMessage = ''
this.loadedCount = 0
this.duration = 0
} | 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 relationName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identi... | constructor(relationName: string = '') {
this.relationName = relationName
this.success = false
this.errorMessage = ''
this.loadedCount = 0
this.duration = 0
} | https://github.com/offlinecat-dev/OCNetORM | 32d657be551243b3407d7ff50d6bad09cdf53b03 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/AppTypeUtil.ets | arkts | isPhoneApp | Check is phone app type.
@returns | static isPhoneApp(): boolean {
const type = AppTypeUtil.getAppType();
return type === AppType.PHONE;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isPhoneApp 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#bo... | static isPhoneApp(): boolean {
const type = AppTypeUtil.getAppType();
return type === AppType.PHONE;
} | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 095fce43c9bf71bd1e0c4e1c658aca7d2adfaa50 | gitcode |
erosTeam/NextE | feature/gallery/src/main/ets/viewmodel/GalleryDetailViewModel.ets | arkts | seed | Seed the header from the list row for instant paint. | seed(gallery: EhGallery): void {
this.gallery = gallery
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left seed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left gallery AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EhGallery AST#identifier#Right AST#)#Left ) AST#... | seed(gallery: EhGallery): void {
this.gallery = gallery
} | https://github.com/erosTeam/NextE | fbbb5b21ec306d64a29717e930e7df6a48d23cce | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | notifyDeviceRemoved | 通知设备已移除 | protected notifyDeviceRemoved(): void {
if (this.listener) {
this.listener.deviceRemoved(this);
}
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left notifyDeviceRemoved 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#Rig... | protected notifyDeviceRemoved(): void {
if (this.listener) {
this.listener.deviceRemoved(this);
}
} | https://github.com/AlkaidLab/moonlight-harmony | c1c1681197ab5ad284b05bd86b60a35cfaf921ae | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getCurrentMonthDays | 用于生成当前月份的所有天数的数组
@param year 年
@param month 月
@returns 返回所有天数 | static getCurrentMonthDays(year: number, month: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_MONTH = TimeUtils.getLastDayOfMonth(year, month);
for (let i = 1; i <= LAST_DAY_OF_MONTH; i++) {
DAYS.push(i);
}
return DAYS;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentMonthDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static getCurrentMonthDays(year: number, month: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_MONTH = TimeUtils.getLastDayOfMonth(year, month);
for (let i = 1; i <= LAST_DAY_OF_MONTH; i++) {
DAYS.push(i);
}
return DAYS;
} | https://gitcode.com/arkui-x/samples | efb5e6664f1565e49515f1ef48f49da040b8135d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PageCurlEffectV2.ets | arkts | onExternalProgressChange | 外部进度变化时更新渲染
注意:这是热路径,避免任何不必要的开销 | onExternalProgressChange(): void {
// 热路径:移除日志输出以提高性能
if (this.externalProgress >= 0 && this.isReady) {
// 只在首次或 PixelMap 真正变化时更新 Bitmap(移到外部控制)
if (!this.checkAndUpdateBitmaps()) {
return;
}
this.curlProgress = this.externalProgress;
this.renderCurlEffect();
this.o... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onExternalProgressChange 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_e... | onExternalProgressChange(): void {
// 热路径:移除日志输出以提高性能
if (this.externalProgress >= 0 && this.isReady) {
// 只在首次或 PixelMap 真正变化时更新 Bitmap(移到外部控制)
if (!this.checkAndUpdateBitmaps()) {
return;
}
this.curlProgress = this.externalProgress;
this.renderCurlEffect();
this.o... | https://github.com/DaLongZhuaZi/manxia | 0506c38879d3cad0c46177e3b3e32e1e605652bc | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarDataSet.ets | arkts | getEntryCountStacks | returns the overall entry count, including counting each stack-value
individually
@return | public getEntryCountStacks(): number {
return this.mEntryCountStacks;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEntryCountStacks 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... | public getEntryCountStacks(): number {
return this.mEntryCountStacks;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | df8ef87d0089d3d0c834032a4bf073602a5bae7f | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/model/DigitPanelModel.ets | arkts | constructor | constructor | private constructor() {
this.init();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor 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 ... | private constructor() {
this.init();
} | https://gitee.com/openharmony-sig/applications_calculator.git | 32f5dcef9de68a3204a484d94949e7a34efba9a1 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/EntityMetadata.ets | arkts | addIndex | 添加索引元数据(按名称或签名去重)
@param index 索引元数据 | addIndex(index: IndexMetadata): void {
const signature = index.getSignature()
for (let i = 0; i < this.indexes.length; i++) {
const existing = this.indexes[i]
if (existing.name === index.name || existing.getSignature() === signature) {
return
}
}
this.indexes.push(index)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IndexMetadata AST#identifier#Right AST#)#Left ... | addIndex(index: IndexMetadata): void {
const signature = index.getSignature()
for (let i = 0; i < this.indexes.length; i++) {
const existing = this.indexes[i]
if (existing.name === index.name || existing.getSignature() === signature) {
return
}
}
this.indexes.push(index)
} | https://github.com/offlinecat-dev/OCNetORM | 3f2de0e9e19ca28bc4b54927f08adfbb8b109d19 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | toReversed | Creates a reversed copy
@returns { Int32Array } - a reversed copy
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toReversed(): Int32Array {
let newArray = new Int32Array(this.lengthInt);
if (this.lengthInt > 0) {
Int32Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed 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 Int32Array ... | public toReversed(): Int32Array {
let newArray = new Int32Array(this.lengthInt);
if (this.lengthInt > 0) {
Int32Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | https://gitcode.com/iop123123/arkts-static-skills | 8daa0960abd539fb0a0d11961d3165ecbf386533 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_than/greater_than_short.ets | arkts | main | ---
desc: check greater operation for two short integers
--- | function main(): void {
const a: short = {{v.left}}
const b: short = {{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: short = {{v.left}}
const b: short = {{v.right}}
assert (a > b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 784cb5dfc5aca98ba34637d0da6ec9f292117781 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getMangaCachePath | 获取漫画缓存目录路径
路径: suwayomi/chapters/{mangaTitle}/ | public getMangaCachePath(mangaTitle: string): string {
if (!DownloadDirManager.isReady()) {
throw new Error('Download目录未初始化');
}
const sanitizedTitle = this.sanitizeName(mangaTitle);
return DownloadDirManager.ensureDirectory(`suwayomi/chapters/${sanitizedTitle}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMangaCachePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | public getMangaCachePath(mangaTitle: string): string {
if (!DownloadDirManager.isReady()) {
throw new Error('Download目录未初始化');
}
const sanitizedTitle = this.sanitizeName(mangaTitle);
return DownloadDirManager.ensureDirectory(`suwayomi/chapters/${sanitizedTitle}`);
} | https://github.com/DaLongZhuaZi/manxia | a4065764cce300b792f8b19e62cb445e41019d36 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | getFormSize | returns the size in vp of the legend forms
@return | public getFormSize(): number {
return this.mFormSize;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFormSize 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#num... | public getFormSize(): number {
return this.mFormSize;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d4c1605b63040d0ef7438f155e7d1861da61d4f3 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.