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 |
|---|---|---|---|---|---|---|---|---|---|---|
Joker-x-dev/CoolMallArkTS | core/result/src/main/ets/RequestHelper.ets | arkts | toast | 配置是否自动 toast 错误
@param {boolean} enable - 是否展示
@returns {RequestHelper<T>} 当前实例 | toast(enable: boolean = true): RequestHelper<T> {
this.useToast = enable;
return this;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left toast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right... | toast(enable: boolean = true): RequestHelper<T> {
this.useToast = enable;
return this;
} | https://github.com/Joker-x-dev/CoolMallArkTS | ecfe3fcdcb1c6a0ce5149b0276edbc96dd5ff539 | github |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets | arkts | unregisterDeviceListCallback | Disabling the listening event. | unregisterDeviceListCallback(): void {
if (this.myDeviceManager === undefined) {
Logger.error('RemoteDeviceModel', 'unregisterDeviceListCallback deviceManager has not initialized');
return;
}
try {
this.myDeviceManager.off('deviceStateChange');
this.myDeviceManager.release();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDeviceListCallback 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... | unregisterDeviceListCallback(): void {
if (this.myDeviceManager === undefined) {
Logger.error('RemoteDeviceModel', 'unregisterDeviceListCallback deviceManager has not initialized');
return;
}
try {
this.myDeviceManager.off('deviceStateChange');
this.myDeviceManager.release();
... | https://gitee.com/openharmony/codelabs.git | 323ad08fa8beaa36f3fbecab4f1d738afb7338f8 | gitee |
the-wwyang/kids-learning-app | src/main/ets/storage/LearningRecordStorageService.ets | arkts | loadSessions | 加载学习会话列表
@returns 会话列表 | static async loadSessions(): Promise<LearningSession[]> {
try {
const hasData = await dataStorage.has(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_SESSIONS
);
if (!hasData) {
console.log('[LearningRecordStorage] No saved sessions');
... | 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 loadSessions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async loadSessions(): Promise<LearningSession[]> {
try {
const hasData = await dataStorage.has(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_SESSIONS
);
if (!hasData) {
console.log('[LearningRecordStorage] No saved sessions');
... | https://github.com/the-wwyang/kids-learning-app | 5b0358f31e772681c4c16322cf3febe539c17cd8 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | resumeApp | 恢复会话
注意:resume 与 launch 使用相同的完整参数列表,只是 verb 不同 | async resumeApp(config: LaunchConfig): Promise<string> {
// 使用与 launch 相同的完整参数列表
const query = this.buildLaunchQuery(config.appId, config, 'resume');
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'resume', query);
console.info(`NvHttp: resumeApp URL: ${url}`);
// 使用客户端证书
const resp... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left resumeApp AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async resumeApp(config: LaunchConfig): Promise<string> {
// 使用与 launch 相同的完整参数列表
const query = this.buildLaunchQuery(config.appId, config, 'resume');
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'resume', query);
console.info(`NvHttp: resumeApp URL: ${url}`);
// 使用客户端证书
const resp... | https://github.com/AlkaidLab/moonlight-harmony | 16fba48eb12abf48c5dbee57849eff8837b3c5af | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets | arkts | getMangaDetail | ==================== 漫画详情缓存 ====================
获取漫画详情缓存 | getMangaDetail(sourceId: number, mangaId: string): MangaInfo | null {
const key = this.generateKey(sourceId, mangaId);
const item = this.mangaDetailCache.get(key);
if (!item) {
logger.debug(TAG, `漫画详情缓存未命中: ${key}`);
return null;
}
if (this.isExpired(item)) {
this.manga... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getMangaDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | getMangaDetail(sourceId: number, mangaId: string): MangaInfo | null {
const key = this.generateKey(sourceId, mangaId);
const item = this.mangaDetailCache.get(key);
if (!item) {
logger.debug(TAG, `漫画详情缓存未命中: ${key}`);
return null;
}
if (this.isExpired(item)) {
this.manga... | https://github.com/DaLongZhuaZi/manxia | f368f8edfbd2f9f08bbdc7f00949af0af0547f30 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | stopAutoCollection | 停止自动收集 | private stopAutoCollection(): void {
if (this.collectTimer !== null) {
clearInterval(this.collectTimer);
this.collectTimer = null;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopAutoCollection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private stopAutoCollection(): void {
if (this.collectTimer !== null) {
clearInterval(this.collectTimer);
this.collectTimer = null;
}
} | https://github.com/DaLongZhuaZi/manxia | 6e45a7ab3584049efc694362e9b25d847b6ed661 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/WindowUtil.ets | arkts | updateStatusBarColor | 更新状态栏颜色
@param isDark boolean | public static updateStatusBarColor(isDark: boolean): void {
try {
WindowUtil.windowClass?.setWindowSystemBarProperties({
// 修改状态栏内容的颜色
statusBarContentColor: isDark ? StatusBarColorTypeEnum.WHITE : StatusBarColorTypeEnum.BLACK
}).then(() => {
Logger.info(TAG, `设置系统栏属性成功`)
... | 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 updateStatusBarColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isDark AST#identifier#Right AST#:#... | public static updateStatusBarColor(isDark: boolean): void {
try {
WindowUtil.windowClass?.setWindowSystemBarProperties({
// 修改状态栏内容的颜色
statusBarContentColor: isDark ? StatusBarColorTypeEnum.WHITE : StatusBarColorTypeEnum.BLACK
}).then(() => {
Logger.info(TAG, `设置系统栏属性成功`)
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 877b0aad5a0e6907f15570f0c5ccb076381ea9bb | gitcode |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/TouchConfig.ets | arkts | strict | 严格配置(难触发滑动) | static strict(): TouchConfig {
let config = new TouchConfig();
config.minSwipeDistance = 30; // 距离
config.minFlingVelocity = 1000; // 速度阈值
config.menuOpenThreshold = 0.8; // 80%打开
return config;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left strict 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 TouchConfig AST... | static strict(): TouchConfig {
let config = new TouchConfig();
config.minSwipeDistance = 30; // 距离
config.minFlingVelocity = 1000; // 速度阈值
config.menuOpenThreshold = 0.8; // 80%打开
return config;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | bf82cb708178b77403e24c26c2ec9f41065fff87 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | lifecycle | 📝 记录应用生命周期事件
@param tag - 日志分类标签
@param event - 生命周期事件名称
@param details - 事件详情 | public lifecycle(tag: string, event: string, details?: string): void {
const detailsText = details ? ` - ${details}` : '';
this.info(tag, `🔄 生命周期事件: ${event}${detailsText}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lifecycle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | public lifecycle(tag: string, event: string, details?: string): void {
const detailsText = details ? ` - ${details}` : '';
this.info(tag, `🔄 生命周期事件: ${event}${detailsText}`);
} | https://github.com/DaLongZhuaZi/manxia | edafe2d7e816c31689b86025b2200f10b5ebe736 | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/AudioManager.ets | arkts | setupEventListeners | 设置事件监听器 | private setupEventListeners(): void {
if (!this.audioPlayer) return;
// 播放状态变化
this.audioPlayer.on('play', () => {
this.playerState = PlayerState.PLAYING;
this.notifyPlayListeners(true);
this.notifyStateChangeListeners(this.playerState);
});
this.audioPlayer.on('pause', () => {... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupEventListeners AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void ... | private setupEventListeners(): void {
if (!this.audioPlayer) return;
// 播放状态变化
this.audioPlayer.on('play', () => {
this.playerState = PlayerState.PLAYING;
this.notifyPlayListeners(true);
this.notifyStateChangeListeners(this.playerState);
});
this.audioPlayer.on('pause', () => {... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | a66347db57de91e3269800b7736f1d479fcf2b02 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | videoCodec | 设置视频编码器 | public videoCodec(codec: string): FFmpegCommandBuilder {
this.vCodec = codec;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left videoCodec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left codec AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | public videoCodec(codec: string): FFmpegCommandBuilder {
this.vCodec = codec;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools | 2077315efc5f2f2e40deb146ba08ec0e156df876 | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | getPrefs | 获取 Preferences 实例(懒加载并复用)
@returns {Promise<preferences.Preferences>} Preferences 实例 | private async getPrefs(): Promise<preferences.Preferences> {
try {
if (!this.prefsInstance) {
this.prefsInstance = await preferences.getPreferences(this.context, this.prefsName);
}
return this.prefsInstance;
} catch (error) {
throw this.wrapError(error, "获取 Preferences 实例失败");
... | 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 getPrefs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | private async getPrefs(): Promise<preferences.Preferences> {
try {
if (!this.prefsInstance) {
this.prefsInstance = await preferences.getPreferences(this.context, this.prefsName);
}
return this.prefsInstance;
} catch (error) {
throw this.wrapError(error, "获取 Preferences 实例失败");
... | https://github.com/Joker-x-dev/CoolMallArkTS | 84bfe1eb0b7fb1edc10056313676d2264a38f70f | github |
honjow/Next2V | feature/detail/src/main/ets/pages/TopicDetailPage.ets | arkts | jumpToFloorIndex | Resolve a floor to its ACTUAL displayed row and scroll there. Under 楼中楼 reordering a nested reply
has no top-level row of its own, so it resolves to the row that contains it (its ancestor) instead of
a chronological 2+floor guess that lands near the end. Falls back to the list end when the floor isn't
in the loaded dat... | private jumpToFloorIndex(floor: number): void {
if (floor <= 0) {
return
}
const source = this.v.replyDataSource
const listIndex = TopicDetailScrollCoordinator.listIndexForFloor(
floor,
source.totalCount(),
(index: number) => source.getData(index),
)
const target = list... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left jumpToFloorIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left floor AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private jumpToFloorIndex(floor: number): void {
if (floor <= 0) {
return
}
const source = this.v.replyDataSource
const listIndex = TopicDetailScrollCoordinator.listIndexForFloor(
floor,
source.totalCount(),
(index: number) => source.getData(index),
)
const target = list... | https://github.com/honjow/Next2V | 698e7b05125879d1c81ca5dc2bd51908cfcb5c62 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | constructor | Constructs a list node with provided element.
@param { T } element the element stored in the node
@syscap SystemCapability.Utils.Lang | public constructor(element: T) {
this.element = element;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#... | public constructor(element: T) {
this.element = element;
} | https://gitcode.com/iop123123/arkts-static-skills | cf598fde7a96715ab1dd8996c9c3aa0860d70dc4 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | from | Creates an Int32Array from array-like argument
@param o array-like object to initialize Int32Array
@returns new Int32Array | public from(o: Object): Int32Array {
throw new Error("Int32Array.from: not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | public from(o: Object): Int32Array {
throw new Error("Int32Array.from: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ea4b1f3f0bc9377419955a98b5ef166a54a1c261 | gitee |
dingzhilin1990/zhilinclaw | src/agents/HanwudiWorkflow.ets | arkts | step2_Planning | 步骤 2: 策略规划 | private async step2_Planning(researchResult: any): Promise<any> {
this.addLog(2, 'Strategist', '制定执行策略', 'started');
const input = researchResult.output || '';
const result = await this.strategist.process(input);
this.addLog(2, 'Strategist', '策略规划完成',
result.success ? 'completed' : 'f... | 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 step2_Planning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left researchResult AST#identifier#Right AST#ERROR#Left AS... | private async step2_Planning(researchResult: any): Promise<any> {
this.addLog(2, 'Strategist', '制定执行策略', 'started');
const input = researchResult.output || '';
const result = await this.strategist.process(input);
this.addLog(2, 'Strategist', '策略规划完成',
result.success ? 'completed' : 'f... | https://github.com/dingzhilin1990/zhilinclaw | f962c4feff3052dd64ce3cff05c4db12587bc19f | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/AnimationUtil.ets | arkts | setAnimation | 设置动画模式
@param mode 动画模式: 'auto'(自动), 'up'(向上), 'bottom'(向下), 'left'(向左), 'right'(向右) | public static setAnimation(mode: string) {
XAnimation.mode = mode
} | 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 setAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST... | public static setAnimation(mode: string) {
XAnimation.mode = mode
} | https://github.com/Yebingiscn/SweetVideo | baaf9c50331395a5b014cc987d97190d599cd79f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets | arkts | extractDomain | 从URL提取域名 | private extractDomain(url: string): string {
try {
// 处理简单的域名格式
if (!url.includes('://')) {
return url.split('/')[0];
}
const match = url.match(/^https?:\/\/([^\/]+)/);
if (match) {
return match[1];
}
return '';
} catch (e) {
return '';
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractDomain 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 ... | private extractDomain(url: string): string {
try {
// 处理简单的域名格式
if (!url.includes('://')) {
return url.split('/')[0];
}
const match = url.match(/^https?:\/\/([^\/]+)/);
if (match) {
return match[1];
}
return '';
} catch (e) {
return '';
... | https://github.com/DaLongZhuaZi/manxia | 2e530be3f2a13ead0dd49bc0d685f7ef8f72e5b5 | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/view/TrainsComponent.ets | arkts | checkTime | Determine if it is within the time period.
@param startTime and endTime.
@returns boolean | checkTime(startTime: string, endTime: string): boolean {
const date = new Date();
const dateStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} `;
const startDate = new Date(dateStr + startTime).getTime();
const endDate = new Date(dateStr + endTime).getTime();
const currentDate =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Ri... | checkTime(startTime: string, endTime: string): boolean {
const date = new Date();
const dateStr = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} `;
const startDate = new Date(dateStr + startTime).getTime();
const endDate = new Date(dateStr + endTime).getTime();
const currentDate =... | https://gitee.com/harmonyos/codelabs.git | 4c900b4800d9371792fa24bb88d3a645a244b289 | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnPickerViewModel.ets | arkts | toggleMultiObj | 切换多列对象数组选择器显示状态 | toggleMultiObj(): void {
this.multiObjOpen = !this.multiObjOpen;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleMultiObj 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... | toggleMultiObj(): void {
this.multiObjOpen = !this.multiObjOpen;
} | https://github.com/codelably/tuniao-ui | c3c5e0b58ba758a4dfcc6c6b945f039c979627a5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | source | Returns a string containing the source text of this regular expression
@return { String } The source of the regular expression.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get source(): String {
return this.source_
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left source 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 String AST#identifier#Ri... | get source(): String {
return this.source_
} | https://gitcode.com/iop123123/arkts-static-skills | 59acde19d8da126a4881a745502e9ef33e649d38 | gitcode |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/CityDataService.ets | arkts | getAllCities | 获取所有城市 | static getAllCities(): CityModel[] {
CityDataService.initCities();
return CityDataService.cities;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllCities 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 CityModel... | static getAllCities(): CityModel[] {
CityDataService.initCities();
return CityDataService.cities;
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | f60a043d0e2b71e6db125a2b9ef33c5a5d853ed0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getOnlineChapterByExternalId | [新增] 根据外部章节ID查询online_chapter表
用于在线漫画章节的查询(支持不同图源的外部ID) | public async getOnlineChapterByExternalId(comicId: string, externalChapterId: string): Promise<OnlineChapterInfo | null> {
try {
logger.info(TAG, `🔍 查询在线章节: comicId=${comicId}, externalId=${externalChapterId}`);
// [性能优化] 只查询实际使用的列,避免 SELECT * 的数据传输开销
const sql = `SELECT id, comicId, externalId... | 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 getOnlineChapterByExternalId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Lef... | public async getOnlineChapterByExternalId(comicId: string, externalChapterId: string): Promise<OnlineChapterInfo | null> {
try {
logger.info(TAG, `🔍 查询在线章节: comicId=${comicId}, externalId=${externalChapterId}`);
// [性能优化] 只查询实际使用的列,避免 SELECT * 的数据传输开销
const sql = `SELECT id, comicId, externalId... | https://github.com/DaLongZhuaZi/manxia | 867521a94bb431824d3abfbcfa01be56d0adf8d0 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/UserProfile.ets | arkts | isSpender | 判断是否为消费型用户 | isSpender(): boolean {
return this.spendingPersonality === SPENDING_SPENDER;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSpender AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | isSpender(): boolean {
return this.spendingPersonality === SPENDING_SPENDER;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9e68640559917c4c3010846b4c0d4772fe7549f9 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/common/utils/Logger.ets | arkts | info | Info 日志 | static info(tag: string, message: string): void {
if (Logger.currentLevel <= LogLevel.INFO) {
hilog.info(DOMAIN, `${TAG}:${tag}`, message)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | static info(tag: string, message: string): void {
if (Logger.currentLevel <= LogLevel.INFO) {
hilog.info(DOMAIN, `${TAG}:${tag}`, message)
}
} | https://gitcode.com/openharmony/codelabs | ecd39f8862513ab4e28be56210189441dad7eff2 | gitcode |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets | arkts | addElements | 添加节点的子节点(不覆盖原有子节点值)
@param elements 子节点 | public addElements(elements: Object): void{
let objKeys: string[] = Object.keys(this._formatResultObj);
let indexOfKey = objKeys.indexOf(SVGAttrConstants.ATTR_KEY_ELEMENTS);
if (indexOfKey === -1) {
this._elements = new Array();
if (isArray(elements)) {
this._elements.concat(elements);... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left elements AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ident... | public addElements(elements: Object): void{
let objKeys: string[] = Object.keys(this._formatResultObj);
let indexOfKey = objKeys.indexOf(SVGAttrConstants.ATTR_KEY_ELEMENTS);
if (indexOfKey === -1) {
this._elements = new Array();
if (isArray(elements)) {
this._elements.concat(elements);... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | e360f784482445d266589a5106bc2edb37029752 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | throwOutOfRangeError | Throws an error when a parameter value is outside allowed range bounds
@param {string} param_name - Name of the parameter that caused the error
@param {double} param_value - The value that is out of range
@param {int} left_bound - Minimum allowed value (inclusive)
@param {int} right_bound - Maximum allowed value (inclu... | private static throwOutOfRangeError(param_name: string, param_value: double, left_bound: int, right_bound: int) {
let message = `The value of "${param_name}" is out of range.`;
message += `It must be >= ${left_bound} and <= ${right_bound}. Received value is: ${param_value}`;
... | 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 throwOutOfRangeError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left param_name AST#identifier#Right AST#ERROR#Left... | private static throwOutOfRangeError(param_name: string, param_value: double, left_bound: int, right_bound: int) {
let message = `The value of "${param_name}" is out of range.`;
message += `It must be >= ${left_bound} and <= ${right_bound}. Received value is: ${param_value}`;
... | https://gitcode.com/iop123123/arkts-static-skills | b4103546c659d3eef924f02f16ca2dd800835dc1 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | setString | Sets a current JsonElement to a string value.
@param {string} value - The string value to set | setString(value: string): void {
this.setUndefined()
this.maybeStringValue = value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#... | setString(value: string): void {
this.setUndefined()
this.maybeStringValue = value
} | https://gitcode.com/iop123123/arkts-static-skills | a5fd8c2d367a75794bc0475e9529c0750934572c | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readUint16 | Reads the next unsigned short.
@param littleEndian If the value is little endian.
@returns The value. | readUint16(littleEndian?: boolean): number {
const value = this.getUint16(this.mByteOffset, littleEndian)
this.mByteOffset += 2
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readUint16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left littleEndian AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#E... | readUint16(littleEndian?: boolean): number {
const value = this.getUint16(this.mByteOffset, littleEndian)
this.mByteOffset += 2
return value
} | https://gitee.com/openharmony-sig/flutter_engine.git | ae5c405379f4315b759820c6b002dd1918ef5798 | gitee |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | getWebpOptimizeDecoding | 获取默认解码是否开启了webp解码优化
@returns 返回true表示开启了优化解码,返回false表示没有开启 | getWebpOptimizeDecoding(): boolean {
return nativeNode.getWebpOptimizeDecoding();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWebpOptimizeDecoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right... | getWebpOptimizeDecoding(): boolean {
return nativeNode.getWebpOptimizeDecoding();
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L394-L396 | 68eb68002aa6df93be82ec0fd7d1f51f595cd391 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/TotpService.ets | arkts | parseSteamSecret | 解析Steam令牌密钥
@param steamSecret Steam令牌密钥(可能是特殊格式)
@returns 标准化的Base32密钥 | public parseSteamSecret(steamSecret: string): string {
// 移除所有空格和连字符
let cleanedSecret = steamSecret.replace(/[\s-]/g, '').toUpperCase();
// 检查是否是Steam特殊格式(以"STE"开头)
if (cleanedSecret.startsWith('STE')) {
// 移除前缀并进行必要的转换
cleanedSecret = cleanedSecret.substring(3);
}
return cleane... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left parseSteamSecret AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left steamSecret AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | public parseSteamSecret(steamSecret: string): string {
// 移除所有空格和连字符
let cleanedSecret = steamSecret.replace(/[\s-]/g, '').toUpperCase();
// 检查是否是Steam特殊格式(以"STE"开头)
if (cleanedSecret.startsWith('STE')) {
// 移除前缀并进行必要的转换
cleanedSecret = cleanedSecret.substring(3);
}
return cleane... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L535-L546 | 45e6a177875f38d3da3bb17a086e1530ba8996b9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an Uint16Array from FixedArray<number>
@param { FixedArray<number> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, Uint16Array.doubleToInt(numbers[i]))
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, Uint16Array.doubleToInt(numbers[i]))
}
} | https://gitcode.com/iop123123/arkts-static-skills | c115f994982303a7d3f72ab6948b6ba701b4f195 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | generateAnimationId | 生成唯一动画ID | public static generateAnimationId(): string {
return `anim_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
} | 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 generateAnimationId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public static generateAnimationId(): string {
return `anim_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
} | https://github.com/DaLongZhuaZi/manxia | 016de2c98cbf38c8d06f33bd01d44b292478e604 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | verifyWithCert | 使用 DER 编码的 X.509 证书验证签名
从证书中提取公钥,然后验证 data 的 RSA-SHA256 签名 | static async verifyWithCert(data: Uint8Array, signature: Uint8Array, certDer: Uint8Array): Promise<boolean> {
try {
// 从 DER 证书中提取 SubjectPublicKeyInfo
const pubKeyDer = CryptoUtil.extractSubjectPublicKeyInfo(certDer);
if (!pubKeyDer) {
console.error('CryptoUtil: 无法从证书中提取公钥');
re... | 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 verifyWithCert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AS... | static async verifyWithCert(data: Uint8Array, signature: Uint8Array, certDer: Uint8Array): Promise<boolean> {
try {
// 从 DER 证书中提取 SubjectPublicKeyInfo
const pubKeyDer = CryptoUtil.extractSubjectPublicKeyInfo(certDer);
if (!pubKeyDer) {
console.error('CryptoUtil: 无法从证书中提取公钥');
re... | https://github.com/AlkaidLab/moonlight-harmony | dccac2b5caf4b7ba37a78422499baaa0347d4c6b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/StreamDownloader.ets | arkts | stopHeartbeat | 停止进度心跳定时器 | private stopHeartbeat(): void {
if (this.heartbeatTimer !== -1) {
clearInterval(this.heartbeatTimer);
this.heartbeatTimer = -1;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopHeartbeat 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#expre... | private stopHeartbeat(): void {
if (this.heartbeatTimer !== -1) {
clearInterval(this.heartbeatTimer);
this.heartbeatTimer = -1;
}
} | https://github.com/DaLongZhuaZi/manxia | e624301d81560f6fdcdcc79822be742ea076794e | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | getByInviteeUserId | 获取用户的邀请 (By User ID) | static async getByInviteeUserId(userId: number): Promise<LedgerInvitation[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(LedgerInvitation.tableName);
predicates.equalTo('invi... | 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 getByInviteeUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef... | static async getByInviteeUserId(userId: number): Promise<LedgerInvitation[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(LedgerInvitation.tableName);
predicates.equalTo('invi... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b0fedddee08d98d3b66bd229d0eb9faa9f865aaa | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | createTunAndStartFilter | Create the tun and start the native DNS filter using routes computed from
the current network. Shared by initial setup and live network-change
reconfiguration. Throws on any failure. | private async createTunAndStartFilter(): Promise<void> {
if (this.vpnConnection === undefined) {
throw new Error('VpnConnection is not available');
}
try {
this.logVpnConfig();
this.writeStatus('creating', false, 'Creating DNS-only VPN and preparing the local filter engine.');
// ... | 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 createTunAndStartFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | private async createTunAndStartFilter(): Promise<void> {
if (this.vpnConnection === undefined) {
throw new Error('VpnConnection is not available');
}
try {
this.logVpnConfig();
this.writeStatus('creating', false, 'Creating DNS-only VPN and preparing the local filter engine.');
// ... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L711-L797 | 26d4ed768754923930144d91668403f6386d13f3 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | removeYAxisCustomLabel | remove Y-axis custom labels
@param axis Reference coordinate axis
@param numbers Deleted labels dataset | public removeYAxisCustomLabel(axis: AxisDependency, numbers: number[]): void {
if (axis == AxisDependency.LEFT) {
this.mAxisLeft?.removeYAxisCustomLabel(numbers);
}
if (axis == AxisDependency.RIGHT) {
this.mAxisRight?.removeYAxisCustomLabel(numbers);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeYAxisCustomLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left axis AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public removeYAxisCustomLabel(axis: AxisDependency, numbers: number[]): void {
if (axis == AxisDependency.LEFT) {
this.mAxisLeft?.removeYAxisCustomLabel(numbers);
}
if (axis == AxisDependency.RIGHT) {
this.mAxisRight?.removeYAxisCustomLabel(numbers);
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5d6b4b5668d679e72d5dc31538f5dd274401a811 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets | arkts | extractOptionalNumberFromObject | 从对象中提取可选数字值
@param obj 对象
@param key 键
@return number | undefined 数字值 | protected extractOptionalNumberFromObject(obj: Record<string, Object>, key: string): number | undefined {
const value = obj[key];
if (value === undefined || value === null) {
return undefined;
}
const num = Number(value);
return isNaN(num) ? undefined : num;
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left extractOptionalNumberFromObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | protected extractOptionalNumberFromObject(obj: Record<string, Object>, key: string): number | undefined {
const value = obj[key];
if (value === undefined || value === null) {
return undefined;
}
const num = Number(value);
return isNaN(num) ? undefined : num;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L342-L349 | fb5fac7fd7179b251b103a440e2e0e6adeedd698 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setShadowX | 阴影X轴,单位:vp
@param shadowX
@returns | setShadowX(shadowX: number): Builder {
this.popupConfig.shadowX = shadowX
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setShadowX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shadowX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig... | setShadowX(shadowX: number): Builder {
this.popupConfig.shadowX = shadowX
return this
} | https://github.com/wuba/omni-ui | 81ee1101313416fe6c62e029fab632323f7e39cb | github |
HarmonyOS_Samples/guide-snippets | ArkData/DataObject/CrossDeviceCollaboration/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets | arkts | createDataObject | 2. 拉起对端Ability后创建分布式数据对象 | createDataObject() {
if (!caller) {
hilog.error(DOMAIN, TAG, 'call remote first');
return;
}
if (dataObject) {
hilog.error(DOMAIN, TAG, 'create dataObject already');
return;
}
// 2.1 创建分布式数据对象实例
let data = new Data('The title', 'The text');
dataObject = distributed... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createDataObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | createDataObject() {
if (!caller) {
hilog.error(DOMAIN, TAG, 'call remote first');
return;
}
if (dataObject) {
hilog.error(DOMAIN, TAG, 'create dataObject already');
return;
}
// 2.1 创建分布式数据对象实例
let data = new Data('The title', 'The text');
dataObject = distributed... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | b8577790befb64b4a1dbfb8b6315403ac6fecad4 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowAppHost.ets | arkts | reportWindowClose | Report window close event. Deletes the windowId from the id main list and focus history list.
@param windowId The window ID. | reportWindowClose(windowId: string) {
const idxInHistory = this.windowFocusHistory.indexOf(windowId);
if (idxInHistory !== -1) {
this.windowFocusHistory.splice(idxInHistory, 1);
}
const idxInList = this.windowIds.indexOf(windowId);
if (idxInList !== -1) {
this.windowIds.splice(idxInLis... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left reportWindowClose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left windowId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right... | reportWindowClose(windowId: string) {
const idxInHistory = this.windowFocusHistory.indexOf(windowId);
if (idxInHistory !== -1) {
this.windowFocusHistory.splice(idxInHistory, 1);
}
const idxInList = this.windowIds.indexOf(windowId);
if (idxInList !== -1) {
this.windowIds.splice(idxInLis... | https://github.com/awaLiny2333/LinysBrowser_NEXT | d74862b7d0a9aba77823e1d0b2d06c241a29b05b | github |
arkui-x/samples | CodeLab/Cases/feature/customkeyboardtoh5/src/main/ets/components/TitleBar.ets | arkts | setInput | 监听inputValue将输入内容映射到h5页面的input中 | setInput() {
this.browser.webController.runJavaScript(`setInput('${this.inputValue}')`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS... | setInput() {
this.browser.webController.runJavaScript(`setInput('${this.inputValue}')`);
} | https://gitcode.com/arkui-x/samples | d29b866bf64342950410a1e4c74a9cab24dba976 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | canRecover | 判断是否可以恢复 | private canRecover(): boolean {
const currentPhaseDetail = this.phases.get(this.currentPhase);
if (!currentPhaseDetail) {
return false;
}
// 如果当前阶段还有重试机会
if (currentPhaseDetail.retryCount < currentPhaseDetail.maxRetries) {
return true;
}
// 如果当前阶段可跳过
if (currentPh... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left canRecover 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... | private canRecover(): boolean {
const currentPhaseDetail = this.phases.get(this.currentPhase);
if (!currentPhaseDetail) {
return false;
}
// 如果当前阶段还有重试机会
if (currentPhaseDetail.retryCount < currentPhaseDetail.maxRetries) {
return true;
}
// 如果当前阶段可跳过
if (currentPh... | https://github.com/DaLongZhuaZi/manxia | 190ecff91057c94e9361b8feee8c10737c4d876b | github |
the-wwyang/kids-learning-app | src/main/ets/common/UserService.ets | arkts | getPhoneUsers | 获取手机号用户映射 | private async getPhoneUsers(): Promise<Map<string, string>> {
if (this.dataPreferences === null) {
return new Map<string, string>();
}
try {
const phoneUsersJson = await this.dataPreferences.get(UserService.PHONE_USERS_KEY, '{}') as string;
const phoneUsersObj: Record<string, string> = J... | 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 getPhoneUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async getPhoneUsers(): Promise<Map<string, string>> {
if (this.dataPreferences === null) {
return new Map<string, string>();
}
try {
const phoneUsersJson = await this.dataPreferences.get(UserService.PHONE_USERS_KEY, '{}') as string;
const phoneUsersObj: Record<string, string> = J... | https://github.com/the-wwyang/kids-learning-app | 0533d10017385eae51a1ee11af2158d06e35207b | github |
arkui-x/samples | CodeLab/Cases/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets | arkts | getMenuTranslateOptions | 获取标题展开时,继续下拉的菜单栏Translate参数
@returns {TranslateOptions} 标题展开后继续下拉的菜单栏Translate参数 | getMenuTranslateOptions(): TranslateOptions {
return { y: Math.max(-this.curOffset, 0) };
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMenuTranslateOptions 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 TranslateOptions AST#identifier#Right ... | getMenuTranslateOptions(): TranslateOptions {
return { y: Math.max(-this.curOffset, 0) };
} | https://gitcode.com/arkui-x/samples | 0bca522ee4648533af8e0e00c460da026f628095 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/KeyboardMapper.ets | arkts | sendWindowsKey | Send Windows key | sendWindowsKey(): void {
if (this.listener) {
this.listener.onKeyEvent(VK_LWIN, true);
this.listener.onKeyEvent(VK_LWIN, false);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendWindowsKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#... | sendWindowsKey(): void {
if (this.listener) {
this.listener.onKeyEvent(VK_LWIN, true);
this.listener.onKeyEvent(VK_LWIN, false);
}
} | https://github.com/tangwengang-del/freerdp-harmonyos | dab02f4002a44b4f0c03bef552927b23a9de9085 | github |
mybricks/comlib-harmony-normal | packages/rt-arkts/comlib/src/main/ets/AiMusic/model/AppMusicMediaPlayer.ets | arkts | setTargetAudio | 设置当前歌曲 | static async setTargetAudio(targetAudio: WorksItemWithLabelsModel, justEditInfo?: boolean) {
// 只修改信息,不触发更换歌曲url,进度等
if (justEditInfo) {
MediaPlayer.targetAudio = targetAudio
return
}
if (MediaPlayer.targetAudio && MediaPlayer.targetAudio.file.id !== targetAudio.file.id) {
MediaPlay... | 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 setTargetAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left targetAudio AST#identifier#Right AST#:#Le... | static async setTargetAudio(targetAudio: WorksItemWithLabelsModel, justEditInfo?: boolean) {
// 只修改信息,不触发更换歌曲url,进度等
if (justEditInfo) {
MediaPlayer.targetAudio = targetAudio
return
}
if (MediaPlayer.targetAudio && MediaPlayer.targetAudio.file.id !== targetAudio.file.id) {
MediaPlay... | https://github.com/mybricks/comlib-harmony-normal | c03405b4b03d672b2e915840879d122d54d63355 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/PairingManager.ets | arkts | extractServerCert | 提取服务器证书
注意:服务器返回的是 PEM 格式证书的十六进制编码 | private extractServerCert(xml: string): Uint8Array | null {
const certHex = XmlUtil.getValue(xml, 'plaincert');
if (!certHex) {
return null;
}
// 十六进制解码得到 PEM 字符串的字节
const pemBytes = CryptoUtil.hexToBytes(certHex);
// 将字节转换为字符串
let pemString = '';
for (let i = 0; i < pe... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractServerCert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xml AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private extractServerCert(xml: string): Uint8Array | null {
const certHex = XmlUtil.getValue(xml, 'plaincert');
if (!certHex) {
return null;
}
// 十六进制解码得到 PEM 字符串的字节
const pemBytes = CryptoUtil.hexToBytes(certHex);
// 将字节转换为字符串
let pemString = '';
for (let i = 0; i < pe... | https://github.com/AlkaidLab/moonlight-harmony | 8010a64ead2e7dde32ab35d125ceef361ce6062a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Enforcement/UnifiedDetailPageEnforcer.ets | arkts | getSceneConfigs | 获取场景配置列表 | private getSceneConfigs(): SceneConfig[] {
const mangaScene: SceneConfig = { name: '漫画', key: PageSettingKeys.MANGA_DETAIL_PAGE_TYPE };
const ebookScene: SceneConfig = { name: '电子书', key: PageSettingKeys.EBOOK_DETAIL_PAGE_TYPE };
const novelScene: SceneConfig = { name: '小说', key: PageSettingKeys.NOVEL_DET... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSceneConfigs 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 Sce... | private getSceneConfigs(): SceneConfig[] {
const mangaScene: SceneConfig = { name: '漫画', key: PageSettingKeys.MANGA_DETAIL_PAGE_TYPE };
const ebookScene: SceneConfig = { name: '电子书', key: PageSettingKeys.EBOOK_DETAIL_PAGE_TYPE };
const novelScene: SceneConfig = { name: '小说', key: PageSettingKeys.NOVEL_DET... | https://github.com/DaLongZhuaZi/manxia | 69ff0f9898c24ff55fd6eb92abf5796603e0f17b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | startAutoCollection | 开始自动收集 | private startAutoCollection(): void {
if (this.collectTimer !== null) {
return;
}
this.collectTimer = setInterval(() => {
this.collectPerformanceData();
}, this.collectInterval);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startAutoCollection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | private startAutoCollection(): void {
if (this.collectTimer !== null) {
return;
}
this.collectTimer = setInterval(() => {
this.collectPerformanceData();
}, this.collectInterval);
} | https://github.com/DaLongZhuaZi/manxia | 23efb3d9a20178f37f1a67291aa817b258e1be95 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/JArrayList.ets | arkts | constructor | 列表中当前的位置 | constructor() {
this.dataSource = [];
this.listSize = 0; // 列表的大小
this.pos = 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.dataSource = [];
this.listSize = 0; // 列表的大小
this.pos = 0; // 列表中当前的位置
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7c60399b5a3f008a788c4c49a77740da13819886 | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/ExportManager.ets | arkts | escapeCsvValue | 转义 CSV 值(处理逗号和引号) | private escapeCsvValue(value: string): string {
if (!value) return '';
// 如果包含逗号、换行或引号,需要用引号包裹并转义引号
if (value.includes(',') || value.includes('\n') || value.includes('"')) {
return `"${value.replace(/"/g, '""')}"`;
}
return value;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeCsvValue 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#Le... | private escapeCsvValue(value: string): string {
if (!value) return '';
// 如果包含逗号、换行或引号,需要用引号包裹并转义引号
if (value.includes(',') || value.includes('\n') || value.includes('"')) {
return `"${value.replace(/"/g, '""')}"`;
}
return value;
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | b06c2551947d23777bbe5f7ad600b67c862da58f | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Guard/Outdoor/GuardNightPage.ets | arkts | build | -------------- ↑ WebSocket 服务 ↑ -------------- | build() {
Column() {
Column() {
if (this.isShowMap) {
MapComponent({ mapOptions: this.mapOption, mapCallback: this.callback })
.width('100%')
.height('100%')
}
}
.layoutWeight(1)
Column() {
Row() {
Row() {
Tex... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Column() {
if (this.isShowMap) {
MapComponent({ mapOptions: this.mapOption, mapCallback: this.callback })
.width('100%')
.height('100%')
}
}
.layoutWeight(1)
Column() {
Row() {
Row() {
Tex... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | e6ed64bda7cca5c8c4a44eb1590262b8faebe072 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | getAll | 查询用户所有未删除标签
@param userId 用户ID
@returns 标签数组 | static async getAll(userId: number): Promise<Tag[]> {
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FROM tags WHERE user_id = ? AND is_deleted = 0 ORDER BY tag_id ASC`;
const tags: Tag[] = [];
let resultSet: relationalStore.ResultSet | null = null;
try {
resultSet = awai... | 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 getAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Ri... | static async getAll(userId: number): Promise<Tag[]> {
const store = DatabaseManager.getDatabase();
const sql = `SELECT * FROM tags WHERE user_id = ? AND is_deleted = 0 ORDER BY tag_id ASC`;
const tags: Tag[] = [];
let resultSet: relationalStore.ResultSet | null = null;
try {
resultSet = awai... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | fdb93718b93abfc2b92f38ba43e4a3a5c7dacf28 | github |
fa223797/Harmonyos-notebook | entry/src/main/ets/pages/Page06_AddTask.ets | arkts | TagContainer | 添加标签容器和文本样式 | @Extend(Column) function TagContainer(bgColor: string) {
.width(60)
.height(30)
.backgroundColor(bgColor)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Column AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | @Extend(Column) function TagContainer(bgColor: string) {
.width(60)
.height(30)
.backgroundColor(bgColor)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
} | https://github.com/fa223797/Harmonyos-notebook | 22414e6328b3c3e2a36847ee89d8f15aff4106bb | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/info/AccessibilityInfo.ets | arkts | getStrByResource | 将Resource转换为字符串
@param { Resource } 资源.
@return { string } 转换后的字符串. | public static getStrByResource(resource: Resource): string {
let playStr: string = '';
let context = GlobalContext.getContext().getObject('resourceManager') as resmgr.ResourceManager;
if (context !== undefined) {
try {
playStr = context.getStringSync(resource.id);
return playStr;
} cat... | 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 getStrByResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Le... | public static getStrByResource(resource: Resource): string {
let playStr: string = '';
let context = GlobalContext.getContext().getObject('resourceManager') as resmgr.ResourceManager;
if (context !== undefined) {
try {
playStr = context.getStringSync(resource.id);
return playStr;
} cat... | https://gitee.com/openharmony-sig/applications_calculator.git | c07992bb220ae2e8a90c792fb2c21ea12f7c9e75 | gitee |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/utils/TranslationTextParser.ets | arkts | getAtUserNames | Get @ user names from message's atUserList
Note: Currently returns userIDs as fallback. In production, should call UserStore to get display names. | public static async getAtUserNames(messageInfo?: MessageInfo): Promise<string[] | null> {
if (!messageInfo || !messageInfo.atUserList || messageInfo.atUserList.length === 0) {
return null;
}
const atUserIDs = messageInfo.atUserList;
// Separate @All from regular users
const regularUserIDs:... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getAtUserNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mes... | public static async getAtUserNames(messageInfo?: MessageInfo): Promise<string[] | null> {
if (!messageInfo || !messageInfo.atUserList || messageInfo.atUserList.length === 0) {
return null;
}
const atUserIDs = messageInfo.atUserList;
// Separate @All from regular users
const regularUserIDs:... | https://github.com/Tencent-RTC/TUIKit_Harmony | ab58d09f10d2807472ce4963ad6c344aa237d065 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ImageRestorationEngine.ets | arkts | executePreprocessing | ==================== 私有方法 ====================
执行预处理 | private async executePreprocessing(
imageUri: string,
params?: ProcessingParams
): Promise<PreprocessResult> {
const startTime = Date.now();
const imageData = await this.preprocessor.process(imageUri, params?.preprocessing);
const quality = await this.preprocessor.assessQuality(imageData);
c... | 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 executePreprocessing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imageUri AST#identifier#Right AST#ERROR#Left AS... | private async executePreprocessing(
imageUri: string,
params?: ProcessingParams
): Promise<PreprocessResult> {
const startTime = Date.now();
const imageData = await this.preprocessor.process(imageUri, params?.preprocessing);
const quality = await this.preprocessor.assessQuality(imageData);
c... | https://github.com/LJ666-ui/harmony-health-care | c6ba776fed36993e16400a35b9b7fc2238a1a841 | github |
apap6628114/nga_oh | entry/src/main/ets/parser/nga/html-thread/PostArgScanner.ets | arkts | extractUserInfo | 提取 commonui.userInfo.setAll(...) 调用中的用户信息对象。
@param html NGA 帖子页 HTML
@returns 用户信息对象;未找到或解析失败时返回空对象 | function extractUserInfo(html: string): Record<string, Object> {
const idx: number = html.indexOf(SETALL_MARKER);
if (idx < 0) {
return {};
}
const jsonStr: string = extractBalancedBraces(html, idx + SETALL_MARKER.length);
if (!jsonStr) {
return {};
}
try {
const cleaned: string = preprocessJs... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractUserInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function extractUserInfo(html: string): Record<string, Object> {
const idx: number = html.indexOf(SETALL_MARKER);
if (idx < 0) {
return {};
}
const jsonStr: string = extractBalancedBraces(html, idx + SETALL_MARKER.length);
if (!jsonStr) {
return {};
}
try {
const cleaned: string = preprocessJs... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/nga/html-thread/PostArgScanner.ets#L159-L178 | 02941828b01ea2eb0b0915662998ec2218ed47d0 | github |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/model/Light.ets | arkts | turnOn | 实现抽象方法:开灯逻辑
开机时显示当前亮度,符合灯光的使用场景 | async turnOn(): Promise<void> {
try {
await delay(100); // 模拟灯光启动延迟
this.brightness = 50; // 初始化亮度
this.status = 'on';
logAction(`${this.getInfo()} 已开启,当前亮度:${this.brightness}%`);
} catch(error) {
console.error(`error: ${(error as Error).message}`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left turnOn AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#... | async turnOn(): Promise<void> {
try {
await delay(100); // 模拟灯光启动延迟
this.brightness = 50; // 初始化亮度
this.status = 'on';
logAction(`${this.getInfo()} 已开启,当前亮度:${this.brightness}%`);
} catch(error) {
console.error(`error: ${(error as Error).message}`);
}
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | 04837b95351efe762c69c33ed8cf51a29cbf43e2 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/common/UserService.ets | arkts | loginByPhone | 手机号登录/注册 | public async loginByPhone(phone: string, code: string): Promise<LoginResult> {
if (!this.isValidPhone(phone)) {
return new LoginResult(false, '请输入正确的手机号');
}
if (code.length !== 6) {
return new LoginResult(false, '请输入6位验证码');
}
// 验证验证码
const isCodeValid = await this.verifyCode(p... | 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 loginByPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AST... | public async loginByPhone(phone: string, code: string): Promise<LoginResult> {
if (!this.isValidPhone(phone)) {
return new LoginResult(false, '请输入正确的手机号');
}
if (code.length !== 6) {
return new LoginResult(false, '请输入6位验证码');
}
// 验证验证码
const isCodeValid = await this.verifyCode(p... | https://github.com/the-wwyang/kids-learning-app | 68225d34cb236b4d5d876ae3498471b41be3c862 | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateError | 错误反馈 — 三次振动 | static vibrateError(): void {
VibratorManager.logExecution('vibrateError');
VibratorManager.vibratePreset(HapticEffect.SHARP, 3, 100, VibrationUsage.PHYSICAL_FEEDBACK);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateError 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#expressio... | static vibrateError(): void {
VibratorManager.logExecution('vibrateError');
VibratorManager.vibratePreset(HapticEffect.SHARP, 3, 100, VibrationUsage.PHYSICAL_FEEDBACK);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 3b66f35678a32f202388ec6bdf7e840919c39035 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets | arkts | decrement | 计数减一
@returns {void} 无返回值 | decrement(): void {
this.counterState.decrement();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decrement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le... | decrement(): void {
this.counterState.decrement();
} | https://github.com/Joker-x-dev/HarmonyKit | 5133059cf8064d1fbcf530df7841c8ac58e0cde9 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/CartRepository.ets | arkts | getAllCarts | 获取购物车中所有商品
@returns {Promise<Cart[]>} 购物车列表 | getAllCarts(): Promise<Cart[]> {
return this.dataSource.getAllCarts();
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getAllCarts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | getAllCarts(): Promise<Cart[]> {
return this.dataSource.getAllCarts();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 390122270527b521a499d97dee0005a1d84099b3 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CartManager.ets | arkts | loadUserCart | Load cart data for specific user | static async loadUserCart(username: string): Promise<void> {
if (!cartPreferences || !username) {
cachedCartList = [];
return;
}
currentCartUsername = username;
const key = `cart_${username}`;
try {
const cartJson = await cartPreferences.get(key, '[]') as string;
... | 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 loadUserCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async loadUserCart(username: string): Promise<void> {
if (!cartPreferences || !username) {
cachedCartList = [];
return;
}
currentCartUsername = username;
const key = `cart_${username}`;
try {
const cartJson = await cartPreferences.get(key, '[]') as string;
... | https://github.com/Harrisonls2004/WaterFlow | cd41e0b4d32db904123f81492dabe10e63db0eb4 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/RDPDisplay.ets | arkts | getFrameBuffer | 获取当前帧缓冲 | getFrameBuffer(): ArrayBuffer | null {
return this.frameBuffer
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFrameBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identi... | getFrameBuffer(): ArrayBuffer | null {
return this.frameBuffer
} | https://github.com/AetheriumSimulator/qemu-hmos | 427f2bd92e43d224bba96e9dbd5502b53f95e239 | github |
offlinecat-dev/OCNetORM | src/main/ets/core/EntityMetadata.ets | arkts | addColumn | 添加列元数据
@param column 列元数据 | addColumn(column: ColumnMetadata): void {
this.columns.push(column)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addColumn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ColumnMetadata AST#identifier#Right AST#)#Le... | addColumn(column: ColumnMetadata): void {
this.columns.push(column)
} | https://github.com/offlinecat-dev/OCNetORM | d7c8e676609d76f5a4507733087306ab6f6bac15 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/smartHome/src/main/ets/pages/alarm.ets | arkts | startCountdownInterval | 启动倒计时 | startCountdownInterval() {
if (this.intervalId !== null) {
clearInterval(this.intervalId);
}
this.intervalId = setInterval(() => {
if (this.remainingTime > 0) {
this.remainingTime -= 1;
// 更新状态到AppStorage
AppStorage.setOrCreate('remainingTime', this.remainingTime);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startCountdownInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_b... | startCountdownInterval() {
if (this.intervalId !== null) {
clearInterval(this.intervalId);
}
this.intervalId = setInterval(() => {
if (this.remainingTime > 0) {
this.remainingTime -= 1;
// 更新状态到AppStorage
AppStorage.setOrCreate('remainingTime', this.remainingTime);
... | https://gitee.com/openharmony/vendor_unionman.git | 3acbb266e4f4bf2c605c54476a58cc703e844e47 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | filter | Creates a new Float64Array from current Float64Array based on a condition fn.
@param { function } fn - the condition to apply for each element
@returns { Float64Array } - a new Float64Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public filter(fn: (val: number, index: int, array: Float64Array) => boolean): Float64Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; ++i) {
markers[i] = fn((this.getUnsafe(i)).toDouble(), i, th... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: number, index: int, array: Float64Array) => boolean): Float64Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; ++i) {
markers[i] = fn((this.getUnsafe(i)).toDouble(), i, th... | https://gitcode.com/iop123123/arkts-static-skills | bde9dd954019457f999b841155399e9b898a4be5 | gitcode |
din0sauria/audio-deepfake-detection | entry/src/main/ets/Audio/AudioPlayer.ets | arkts | calculateDuration | 计算持续时间 * | calculateDuration(time: number) {
const totalSecond = Math.floor(time / 1000)
const mm = Math.floor(totalSecond / 60)
const ss = totalSecond - mm * 60
return `${mm < 10 ? "0" + mm.toString() : mm}:${ss < 10 ? "0" + ss.toString() : ss}`
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calculateDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#R... | calculateDuration(time: number) {
const totalSecond = Math.floor(time / 1000)
const mm = Math.floor(totalSecond / 60)
const ss = totalSecond - mm * 60
return `${mm < 10 ? "0" + mm.toString() : mm}:${ss < 10 ? "0" + ss.toString() : ss}`
} | https://github.com/din0sauria/audio-deepfake-detection | 281ce904ec4188e6736d06f28483ed67b4cb1f84 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/DataCollector.ets | arkts | unsubscribe | 取消订阅数据更新 | public unsubscribe(callback: (data: Map<string, DeviceStatus>) => void): void {
const index = this.subscribers.indexOf(callback);
if (index > -1) {
this.subscribers.splice(index, 1);
console.log('DataCollector: Subscriber removed');
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left unsubscribe AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#R... | public unsubscribe(callback: (data: Map<string, DeviceStatus>) => void): void {
const index = this.subscribers.indexOf(callback);
if (index > -1) {
this.subscribers.splice(index, 1);
console.log('DataCollector: Subscriber removed');
}
} | https://github.com/LJ666-ui/harmony-health-care | 525f71c521abea22e789506dbae2e01898bb8f4f | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/interceptor/InterceptorHttpClient.ets | arkts | constructor | Create a new InterceptorHttpClient.
@param delegate The underlying HttpClient to delegate to.
@param interceptors The list of interceptors to apply to requests. | constructor(delegate: HttpClient, interceptors: Interceptor[] = []) {
this.delegate = delegate;
this.interceptors = interceptors;
} | 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 delegate AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left HttpClient AST#identifier... | constructor(delegate: HttpClient, interceptors: Interceptor[] = []) {
this.delegate = delegate;
this.interceptors = interceptors;
} | https://github.com/killetom/ktretrofit | c16279188909f45961a4a106d09ec75bd9ed6b8f | github |
azhu0001/localsend-harmony | entry/src/main/ets/theme/ThemeProvider.ets | arkts | getThemeModel | 当前APP设置的颜色模式
@returns | static getThemeModel(): ConfigurationConstant.ColorMode {
const mode: ConfigurationConstant.ColorMode | undefined = AppStorage.get<ConfigurationConstant.ColorMode>(Keys.COLOR_MODE)
if (mode == undefined) {
return ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET
} else {
return mode
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getThemeModel 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#member_expression#Left A... | static getThemeModel(): ConfigurationConstant.ColorMode {
const mode: ConfigurationConstant.ColorMode | undefined = AppStorage.get<ConfigurationConstant.ColorMode>(Keys.COLOR_MODE)
if (mode == undefined) {
return ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET
} else {
return mode
}
} | https://gitcode.com/azhu0001/localsend-harmony | 4c5e7a3a4cf0bc40fc22c1d6da2d79d66782a710 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | transferGroupOwner | 转让群主
@param conversationId 会话ID
@param newOwnerId 新群主ID | async transferGroupOwner(conversationId: string, newOwnerId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/owner`, { newOwnerId })
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left transferGroupOwner AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left... | async transferGroupOwner(conversationId: string, newOwnerId: string): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/owner`, { newOwnerId })
} | https://github.com/David8Idira/AI-OA | eb12e5b2d2bb84d9e29c92853c197440dc6563cd | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/products/phone/src/main/ets/entryability/EntryAbility.ets | arkts | checkAndHandleParams | 检查和监听参数
@param want Want | checkAndHandleParams(want: Want): void {
Logger.info(TAG, `checkAndHandleParams`)
try {
if (want === null || want.parameters === null || want === undefined || want.parameters === undefined) {
return
}
} catch (error) {
const businessError: BusinessError = error as BusinessError
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkAndHandleParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#)#Lef... | checkAndHandleParams(want: Want): void {
Logger.info(TAG, `checkAndHandleParams`)
try {
if (want === null || want.parameters === null || want === undefined || want.parameters === undefined) {
return
}
} catch (error) {
const businessError: BusinessError = error as BusinessError
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | a343468e7dcaca7a3fd4041b298e313cb00c93bf | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | subarray | Creates a Uint8ClampedArray with the same ArrayBuffer
@param begin start index, inclusive
@returns new Uint8ClampedArray with the same ArrayBuffer | public subarray(begin: number): Uint8ClampedArray {
return this.subarray(begin as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public subarray(begin: number): Uint8ClampedArray {
return this.subarray(begin as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | dc9ef8c4197897004be82da468dbe631b23f9736 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/common/utils/Geography.ets | arkts | MercatorY | Find radians based on latitude.
@param latitude.
@returns Radiance corresponding to the latitude. | public static MercatorY(latitude: number): number {
return Math.log(Math.tan((latitude * Const.RADIAN_CONSTANT / Const.DOUBLE_OR_HALF) +
(Const.QUARTER_CIRCLE)));
} | 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 MercatorY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left latitude AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public static MercatorY(latitude: number): number {
return Math.log(Math.tan((latitude * Const.RADIAN_CONSTANT / Const.DOUBLE_OR_HALF) +
(Const.QUARTER_CIRCLE)));
} | https://gitee.com/harmonyos/codelabs.git | e9d11124ca760d44490c6b60f429d83fdee7065d | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | from | 从 EntityDataInput 快速构建实体数据
根据 MetadataStorage 中的列定义自动匹配属性
@param entityName 实体名称
@param input 输入数据
@returns EntityData 实例
@throws EntityMappingError 如果实体未注册 | static from(entityName: string, input: EntityDataInput): EntityData {
const metadata = MetadataStorage.getInstance().getEntityMetadata(entityName)
if (metadata === null) {
throw new EntityMappingError(entityName, '实体未注册')
}
const entityData = new EntityData(entityName)
const inputKeys = inp... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | static from(entityName: string, input: EntityDataInput): EntityData {
const metadata = MetadataStorage.getInstance().getEntityMetadata(entityName)
if (metadata === null) {
throw new EntityMappingError(entityName, '实体未注册')
}
const entityData = new EntityData(entityName)
const inputKeys = inp... | https://github.com/offlinecat-dev/OCNetORM | f7268ad2528953df9470cb298a650fc61a2480cd | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/call/common/CallStore.ets | arkts | reset | 重置设备状态 | reset(): void {
this.microphoneStatus = DeviceStatus.off;
this.cameraStatus = DeviceStatus.off;
this.currentAudioRoute = AudioRoute.earpiece;
this.isFrontCamera = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | reset(): void {
this.microphoneStatus = DeviceStatus.off;
this.cameraStatus = DeviceStatus.off;
this.currentAudioRoute = AudioRoute.earpiece;
this.isFrontCamera = true;
} | https://github.com/Tencent-RTC/TUIKit_Harmony | a0ac9b029420bb12162acc561bb976b85cb6ae97 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/DigitPanelController.ets | arkts | getDigitPanelModel | get digitPanelModel
@return DigitPanelModel | private getDigitPanelModel(): DigitPanelModel {
return this.digitPanelModel;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDigitPanelModel 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 ... | private getDigitPanelModel(): DigitPanelModel {
return this.digitPanelModel;
} | https://gitee.com/openharmony-sig/applications_calculator.git | b51333ac9d49e11d44cd2cabf098cac517047b75 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets | arkts | executeInRhino | 在Rhino沙箱中执行 | private async executeInRhino(code: string, context: JsContext): Promise<JsExecuteResult> {
if (!this.rhinoExecutor) {
throw new Error('Rhino执行器未初始化');
}
// 转换上下文格式
const rhinoContext: RhinoContext = {
result: context.result,
baseUrl: context.baseUrl,
sourceUrl: context.var... | 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 executeInRhino AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left :... | private async executeInRhino(code: string, context: JsContext): Promise<JsExecuteResult> {
if (!this.rhinoExecutor) {
throw new Error('Rhino执行器未初始化');
}
// 转换上下文格式
const rhinoContext: RhinoContext = {
result: context.result,
baseUrl: context.baseUrl,
sourceUrl: context.var... | https://github.com/DaLongZhuaZi/manxia | a48926c4680e9b6fd404106619035bf611e57e0b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamWindowManager.ets | arkts | maximizeImmersive | 最大化窗口并进入沉浸式,禁用标题栏和 Dock 悬停(3 级回退链)
优先级:
1. ENTER_IMMERSIVE_DISABLE_TITLE_AND_DOCK_HOVER (API 14+) — 彻底禁用 Dock 悬停
2. ENTER_IMMERSIVE (API 12+) + setTitleAndDockHoverShown(false)
3. maximize() + setTitleAndDockHoverShown(false) | private async maximizeImmersive(win: window.Window): Promise<void> {
try {
await win.maximize(window.MaximizePresentation.ENTER_IMMERSIVE_DISABLE_TITLE_AND_DOCK_HOVER);
} catch (_e) {
try {
await win.maximize(window.MaximizePresentation.ENTER_IMMERSIVE);
} catch (_e2) {
try {... | 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 maximizeImmersive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left win AST#identifier#Right AST#:#Left... | private async maximizeImmersive(win: window.Window): Promise<void> {
try {
await win.maximize(window.MaximizePresentation.ENTER_IMMERSIVE_DISABLE_TITLE_AND_DOCK_HOVER);
} catch (_e) {
try {
await win.maximize(window.MaximizePresentation.ENTER_IMMERSIVE);
} catch (_e2) {
try {... | https://github.com/AlkaidLab/moonlight-harmony | 2685f6750cc6879c780a4a1d293364bce8838fee | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets | arkts | getSourceCacheConfig | 获取图源缓存配置
[修复] 从user_settings表读取设置(与SourceSettingsPage保存位置一致) | async getSourceCacheConfig(sourceId: number): Promise<SourceCacheConfig> {
try {
const dataManager = DataManager.getInstance();
// 从user_settings表读取设置
const downloadWhileReadingRecord = await dataManager.getSourceUserSetting(sourceId, 'downloadWhileReading');
const maxCacheSizeRecor... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSourceCacheConfig 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 AST... | async getSourceCacheConfig(sourceId: number): Promise<SourceCacheConfig> {
try {
const dataManager = DataManager.getInstance();
// 从user_settings表读取设置
const downloadWhileReadingRecord = await dataManager.getSourceUserSetting(sourceId, 'downloadWhileReading');
const maxCacheSizeRecor... | https://github.com/DaLongZhuaZi/manxia | 68aa6c8903eba474b7051ab129a1d21cd2ca6273 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets | arkts | hashPassword | 简单的密码哈希(实际应用中应使用更安全的算法) | private hashPassword(password: string): string {
// 这里使用简单的哈希,实际应用中应该使用 crypto 模块
let hash = 0;
for (let i = 0; i < password.length; i++) {
const char = password.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
return hash.toString(16);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hashPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin... | private hashPassword(password: string): string {
// 这里使用简单的哈希,实际应用中应该使用 crypto 模块
let hash = 0;
for (let i = 0; i < password.length; i++) {
const char = password.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
return hash.toString(16);
} | https://github.com/DaLongZhuaZi/manxia | 02137e5c44f103d2625bf5ae17d242fadc94bf2e | github |
openharmony/web_webview | interfaces/kits/ani/webview/ets/@ohos.web.webview.ets | arkts | saveCookieAsync | Save the cookies Asynchronously.
@returns { Promise<void> } - A promise resolved after the cookies have been saved.
@throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
<br>2. Incorrect parameter types. 3.Parameter verification failed.
@syscap SystemCapability.... | static saveCookieAsync(): Promise<void> {
let pPromise = new Promise<void>((resolve: (v: undefined) => void,
reject: (error: Error) => void): void => {
let pPromise1 = taskpool.execute(():undefined => {
WebCookieManage... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveCookieAsync 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_expressi... | static saveCookieAsync(): Promise<void> {
let pPromise = new Promise<void>((resolve: (v: undefined) => void,
reject: (error: Error) => void): void => {
let pPromise1 = taskpool.execute(():undefined => {
WebCookieManage... | https://gitee.com/openharmony/web_webview.git | ed72352f2643683d403873ec58c05b59a7c03477 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamLifecycleManager.ets | arkts | setDisableWarnings | 设置是否禁用串流期间的连接警告消息 | setDisableWarnings(disabled: boolean): void {
this.disableWarnings = disabled;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDisableWarnings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left disabled AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left... | setDisableWarnings(disabled: boolean): void {
this.disableWarnings = disabled;
} | https://github.com/AlkaidLab/moonlight-harmony | 1d190eb8d24ecc58ad58005541bedb6155e7bf32 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/IsoFileUtil.ets | arkts | detectIsoType | 检测ISO文件类型
@param isoPath ISO文件路径
@returns ISO文件类型 | static async detectIsoType(isoPath: string): Promise<IsoFileType> {
try {
salmonLogger.addLog(TAG, `检测ISO文件类型: ${isoPath}`, false)
// 获取文件扩展名
const extension = isoPath.toLowerCase().split('.').pop()
if (extension !== 'iso') {
salmonLogger.addLog(TAG, '文件不是ISO格式', true)
ret... | 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 detectIsoType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isoPath AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async detectIsoType(isoPath: string): Promise<IsoFileType> {
try {
salmonLogger.addLog(TAG, `检测ISO文件类型: ${isoPath}`, false)
// 获取文件扩展名
const extension = isoPath.toLowerCase().split('.').pop()
if (extension !== 'iso') {
salmonLogger.addLog(TAG, '文件不是ISO格式', true)
ret... | https://github.com/Yebingiscn/SweetVideo | ba2dd543b66a683a2850088e7c35a306e1f9b793 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | rebuildBillFromEvents | 从事件重建Bill对象
@param events 事件列表(按版本顺序) | static rebuildBillFromEvents(events: DomainEvent[]): Bill | null {
if (events.length === 0) {
return null;
}
let bill: Bill | null = null;
for (let i = 0; i < events.length; i++) {
const event = events[i];
if (event.eventType === EVENT_TYPE_BILL_CREATED) {
try {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left rebuildBillFromEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left events AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscrip... | static rebuildBillFromEvents(events: DomainEvent[]): Bill | null {
if (events.length === 0) {
return null;
}
let bill: Bill | null = null;
for (let i = 0; i < events.length; i++) {
const event = events[i];
if (event.eventType === EVENT_TYPE_BILL_CREATED) {
try {
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9a96be5d8403490aa58784cb385726702c45864f | github |
apap6628114/nga_oh | entry/src/main/ets/service/api/ThreadApi.ets | arkts | fillThreadResult | 从 NGA 原始 JSON 填充 ThreadResult(JSON API 与 HTML 降级共享) | function fillThreadResult(raw: Record<string, Object>, result: ThreadResult,
blacklist: Set<string>, keywords: string[] = [],
noteMap: Record<string, string> = {}): void {
const data: ThreadData = parseThreadData(raw, blacklist, keywords, noteMap);
const dataObj: Record<string, Object> | undefined = raw?.['data... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fillThreadResult AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left raw AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function fillThreadResult(raw: Record<string, Object>, result: ThreadResult,
blacklist: Set<string>, keywords: string[] = [],
noteMap: Record<string, string> = {}): void {
const data: ThreadData = parseThreadData(raw, blacklist, keywords, noteMap);
const dataObj: Record<string, Object> | undefined = raw?.['data... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/service/api/ThreadApi.ets#L151-L278 | a42f7979eb6f61fbb9a2a4b277b064f7efb6ec79 | github |
openharmony/codelabs | ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets | arkts | addMoodRecord | ==================== 心情模块方法 ==================== | async addMoodRecord(record: MoodRecord): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
mood: record.mood,
score: record.score,
date: record.date || this.getTodayStrin... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addMoodRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left record AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async addMoodRecord(record: MoodRecord): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
mood: record.mood,
score: record.score,
date: record.date || this.getTodayStrin... | https://gitcode.com/openharmony/codelabs | c0eef3e1e518742294be4612b09ab6545bd884b9 | gitcode |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets | arkts | constructor | Default constructor. | constructor(label?: string) {
this.mColors = new JArrayList<Number>();
this.mValueColors = new JArrayList<Number>();
// default color
this.mColors.add(0x8ceaff);
this.mValueColors.add(0x000000);
this.mLabel = label;
} | 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 label AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | constructor(label?: string) {
this.mColors = new JArrayList<Number>();
this.mValueColors = new JArrayList<Number>();
// default color
this.mColors.add(0x8ceaff);
this.mValueColors.add(0x000000);
this.mLabel = label;
} | https://gitee.com/openharmony/developtools_profiler.git | 983bca500a7e6a23271ba971f41e3d63ab92b75a | gitee |
arkui-x/samples | CodeLab/Cases/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets | arkts | exchangeIconAnimationFunction | 图标旋转动画 | exchangeIconAnimationFunction(): void {
// 图标一次旋转的角度
const rotateAddAngle: number = 180;
animateTo({ curve: curves.springMotion() }, () => {
this.rotateAngle += rotateAddAngle;
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exchangeIconAnimationFunction 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 AS... | exchangeIconAnimationFunction(): void {
// 图标一次旋转的角度
const rotateAddAngle: number = 180;
animateTo({ curve: curves.springMotion() }, () => {
this.rotateAngle += rotateAddAngle;
})
} | https://gitcode.com/arkui-x/samples | c28d64f384f4534b1e0282032bcb5ccae2baf9b2 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | banner | banner内容
https://www.wanandroid.com/banner/json
@returns | public banner(): Promise<AxiosResponse<IWanCommonResponse<Array<IBanner>>>> {
return this.getRequest("/banner/json")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left banner 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_stat... | public banner(): Promise<AxiosResponse<IWanCommonResponse<Array<IBanner>>>> {
return this.getRequest("/banner/json")
} | https://github.com/RedRackham-R/WanAndroidHarmoney | c951004cef640eb2edbeb44c400ecde2faff4983 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | handlePollFailure | 处理一次轮询失败:累计失败次数,达到阈值后才标 OFFLINE | private handlePollFailure(computer: ComputerInfo): void {
// 避免在轮询 in-flight 期间 PC 被 removeComputer 删掉后,这里又把计数写回 offlineCount
// (孤儿条目会一直留到下次 startPolling 才被清理)
if (!this.computers.has(computer.uuid)) {
this.offlineCount.delete(computer.uuid);
return;
}
const next = (this.offlineCount.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handlePollFailure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private handlePollFailure(computer: ComputerInfo): void {
// 避免在轮询 in-flight 期间 PC 被 removeComputer 删掉后,这里又把计数写回 offlineCount
// (孤儿条目会一直留到下次 startPolling 才被清理)
if (!this.computers.has(computer.uuid)) {
this.offlineCount.delete(computer.uuid);
return;
}
const next = (this.offlineCount.... | https://github.com/AlkaidLab/moonlight-harmony | d39dec187ba7b6b650cb0f594f0ec5bb51110cd8 | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | callEditor | Edit Before Call | callEditor(number) {
var actionData: LooseObject = {};
actionData.phoneNumber = number;
actionData.pageFlag = common.contactPage.PAGE_FLAG_EDIT_BEFORE_CALLING;
this.jumpToContact(actionData);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left callEditor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expres... | callEditor(number) {
var actionData: LooseObject = {};
actionData.phoneNumber = number;
actionData.pageFlag = common.contactPage.PAGE_FLAG_EDIT_BEFORE_CALLING;
this.jumpToContact(actionData);
} | https://gitee.com/openharmony/applications_mms.git | 9da47b7f23e627669f04567e06ecaee24ff49b6d | gitee |
the-wwyang/kids-learning-app | src/main/ets/storage/LearningRecordStorageService.ets | arkts | addAnswerRecord | 添加单条答题记录
@param record 答题记录 | static async addAnswerRecord(record: AnswerRecord): Promise<void> {
try {
const records = await LearningRecordStorageService.loadAnswerRecords();
records.push(record);
await LearningRecordStorageService.saveAnswerRecords(records);
console.log(`[LearningRecordStorage] Added answer record: $... | 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 addAnswerRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left :... | static async addAnswerRecord(record: AnswerRecord): Promise<void> {
try {
const records = await LearningRecordStorageService.loadAnswerRecords();
records.push(record);
await LearningRecordStorageService.saveAnswerRecords(records);
console.log(`[LearningRecordStorage] Added answer record: $... | https://github.com/the-wwyang/kids-learning-app | 6ee1e06e57d66d674cd787deaebfd2ffd3345621 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Atomics.ets | arkts | notify | Notifies (wakes up) threads that are suspended by the Atomics.wait() calls at the given index.
(index = typedArray.byteOffset + offset * 4)
Note: This method also wakes up threads suspended by the BigInt64Array Atomics.wait(t64, offset64) calls.
But if and only if 't64' views the same Buffer as 'typedArray' and 'offset... | public static notify(typedArray: Int32Array, offset: int): int {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int32Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let buffer = typedArray.buffer
if (buffer instanceof ArrayBuffer) {
return 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 notify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typedArray AST#identifier#Right AST#:#Left : AST... | public static notify(typedArray: Int32Array, offset: int): int {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int32Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let buffer = typedArray.buffer
if (buffer instanceof ArrayBuffer) {
return 0
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e86ad96ca67add8b9117d3cb21ce4bade68d8281 | gitee |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/utils/TranslationTextParser.ets | arkts | getUnicodeEmojiRegex | Get Unicode emoji regex
Matches common emoji ranges including:
- Emoticons (U+1F600-U+1F64F)
- Symbols & Pictographs (U+1F300-U+1F5FF)
- Transport & Map Symbols (U+1F680-U+1F6FF)
- Regional Indicator Symbols (U+1F1E0-U+1F1FF)
- Supplemental Symbols (U+1F900-U+1F9FF)
- Misc Symbols (U+2600-U+26FF)
- Dingbats (U+2700-U+2... | private static getUnicodeEmojiRegex(): RegExp {
// Comprehensive Unicode emoji regex
return /[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{1F900}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{FE00}-\u{FE0F}]|[\u{1F018}-\u{1F270}]|[\u{238C}-\u{2454}]|[\u{2... | 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 getUnicodeEmojiRegex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private static getUnicodeEmojiRegex(): RegExp {
// Comprehensive Unicode emoji regex
return /[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{1F900}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{FE00}-\u{FE0F}]|[\u{1F018}-\u{1F270}]|[\u{238C}-\u{2454}]|[\u{2... | https://github.com/Tencent-RTC/TUIKit_Harmony | d9c67de0405a89c8a8c98defce51bc4823cc9be0 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | constructor | Creates a new `BigInt` instance from a short value.
@param { short } d The short value to convert.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(d: short) {
this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1)
this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d.toLong(), 16, this.sign)
} | 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 d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left short AST#identifier#Right AST#)... | constructor(d: short) {
this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1)
this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d.toLong(), 16, this.sign)
} | https://gitcode.com/iop123123/arkts-static-skills | 80fd10076dc369a10ea38beef4c11fe82fca7afd | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.