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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/TraceSection.ets | arkts | begin | Wraps Trace.beginSection to ensure that the line length stays below 127 code units.
@param sectionName The string to display as the section name in the trace. | public static begin(sectionName: string): number {
TraceSection.taskId++;
hiTraceMeter.startTrace(TraceSection.cropSectionName(sectionName), TraceSection.taskId);
return TraceSection.taskId;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sectionName AST#identifie... | public static begin(sectionName: string): number {
TraceSection.taskId++;
hiTraceMeter.startTrace(TraceSection.cropSectionName(sectionName), TraceSection.taskId);
return TraceSection.taskId;
} | https://gitee.com/openharmony-sig/flutter_engine.git | 8672e59941de37e48fd1ca3f9c3c174a9b5c9ebc | gitee |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/signature/index.ets | arkts | fillBgColor | 填充背景颜色 | fillBgColor() {
if (this.bgColor !== this.theme.ghostWhite) {
this.context.fillStyle = this.bgColor
this.context.fillRect(0, 0, this.cWidth, this.cHeight)
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fillBgColor 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... | fillBgColor() {
if (this.bgColor !== this.theme.ghostWhite) {
this.context.fillStyle = this.bgColor
this.context.fillRect(0, 0, this.cWidth, this.cHeight)
}
} | https://github.com/itrainhub/wu-ui | 4e08641795605831badab83234008e6bde212285 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets | arkts | getCheckInRecords | 获取打卡记录列表
@param params 查询参数 | async getCheckInRecords(params?: {
startDate?: string
endDate?: string
type?: CheckInType
page?: number
pageSize?: number
}): Promise<ApiResponse<{ records: CheckInRecord[]; total: number }>> {
return this.client.get<{ records: CheckInRecord[]; total: number }>('/api/v1/attendance/records', ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCheckInRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type... | async getCheckInRecords(params?: {
startDate?: string
endDate?: string
type?: CheckInType
page?: number
pageSize?: number
}): Promise<ApiResponse<{ records: CheckInRecord[]; total: number }>> {
return this.client.get<{ records: CheckInRecord[]; total: number }>('/api/v1/attendance/records', ... | https://github.com/David8Idira/AI-OA | ab62c384dd45fe60fe83cad053507892d46855f8 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AutomationEngine.ets | arkts | evaluateConditionGroup | 评估条件组 | private evaluateConditionGroup(group: ConditionGroup, data: any): boolean {
const results = group.conditions.map(condition =>
this.evaluateCondition(condition, data)
);
if (group.logic === 'AND') {
return results.every(result => result);
} else {
return results.some(result => result... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left evaluateConditionGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private evaluateConditionGroup(group: ConditionGroup, data: any): boolean {
const results = group.conditions.map(condition =>
this.evaluateCondition(condition, data)
);
if (group.logic === 'AND') {
return results.every(result => result);
} else {
return results.some(result => result... | https://github.com/LJ666-ui/harmony-health-care | 7541f0c21d7108925bb293806bd03a5f407529b5 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | addReasoningSignatureBlobColumnIfNeeded | 添加 reasoning_signature_blob 字段(用于 OpenAI Responses 跨轮保持推理状态) | private async addReasoningSignatureBlobColumnIfNeeded(): Promise<void> {
if (this.rdbStore === null) {
return
}
try {
await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.MESSAGES} ADD COLUMN reasoning_signature_blob TEXT DEFAULT ''`)
} catch (error) {
console.info('DatabaseServi... | 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 addReasoningSignatureBlobColumnIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST... | private async addReasoningSignatureBlobColumnIfNeeded(): Promise<void> {
if (this.rdbStore === null) {
return
}
try {
await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.MESSAGES} ADD COLUMN reasoning_signature_blob TEXT DEFAULT ''`)
} catch (error) {
console.info('DatabaseServi... | https://github.com/LongLiveY96/chatcube | bc99521f740ed15fafa3e98d2c5546c40e9b4e20 | github |
openharmony-sig/ohos_byte_global_viewpool | byte_global_viewpool/src/main/ets/schedule/ScheduleService.ets | arkts | postFrameOnIdleTaskList | @description 下一帧的OnIdle时机调用,主要用于预创建组件
@param {UIContext} uiContext
@param {ArrayList<()=>void>} taskList
@param {number} timeout 如果OnIdle剩余时间小于timeout,不执行callback | public static postFrameOnIdleTaskList(uiContext: UIContext, taskList: ArrayList<()=>void>, timeout: number) {
try {
MissionFrameOnIdleEngine.getInstance().addOnIdleTaskList(uiContext, taskList, timeout)
} catch (error) {
}
} | 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 postFrameOnIdleTaskList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right ... | public static postFrameOnIdleTaskList(uiContext: UIContext, taskList: ArrayList<()=>void>, timeout: number) {
try {
MissionFrameOnIdleEngine.getInstance().addOnIdleTaskList(uiContext, taskList, timeout)
} catch (error) {
}
} | https://gitee.com/openharmony-sig/ohos_byte_global_viewpool.git | 9f57d734d6cfce2f54fb47a34bded8dcf541057a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | onBackground | 应用进入后台时的回调
注意事项:
- 长时任务应在业务开始时已申请(用户触发下载/校验时)
- onBackground 中可申请短时任务(秒级,用于应急收尾)
- 业务监听后台事件:eventBus.subscribe(GameEvent.APP_ENTER_BACKGROUND, callback) | onBackground(): void {
logger.lifecycle('EntryAbility', '应用进入后台');
// 设置后台状态(统一由WindowManager管理)
WindowManager.syncBackgroundState(true, '应用进入后台');
// 触发业务注册的后台事件(下载管理器、校验器等可监听此事件)
try {
eventBus.publish(GameEvent.APP_ENTER_BACKGROUND, new BasePayload());
} catch (error) {
lo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackground 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... | onBackground(): void {
logger.lifecycle('EntryAbility', '应用进入后台');
// 设置后台状态(统一由WindowManager管理)
WindowManager.syncBackgroundState(true, '应用进入后台');
// 触发业务注册的后台事件(下载管理器、校验器等可监听此事件)
try {
eventBus.publish(GameEvent.APP_ENTER_BACKGROUND, new BasePayload());
} catch (error) {
lo... | https://github.com/DaLongZhuaZi/manxia | 5943d604b5f8ad0542c23b34d984a9a2b5c01657 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | insert | Inserts an element at the specified index.
@param element The element to insert.
@param index The index at which to insert the element.
@throws BusinessError if the index is out of range. | public insert(element: T, index: int): void {
this.checkIndex(index, this.length);
this.buffer.insert(index, element);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right... | public insert(element: T, index: int): void {
this.checkIndex(index, this.length);
this.buffer.insert(index, element);
} | https://gitcode.com/iop123123/arkts-static-skills | b40d6400425700872ce70296d3a40e9ccdbc64ad | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | tryGetDouble | Attempts to get a double value from an object by key and ensures it is a double.
Returns the fallback value if the key is not found or if the value is not a double.
@param {string} key - The key to look up
@param {double | undefined} [fallback=undefined] - The fallback value to return if the key is not found
@returns {... | tryGetDouble(key: string, fallback?: double): double | undefined {
return this.tryGetElement(key)?.tryAsDouble() ?? fallback
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left tryGetDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | tryGetDouble(key: string, fallback?: double): double | undefined {
return this.tryGetElement(key)?.tryAsDouble() ?? fallback
} | https://gitcode.com/iop123123/arkts-static-skills | 96aca0c52640bc02ccf50c3b552847b1956db488 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/HttpUtil.ets | arkts | getNurseToken | ==================== 护士相关方法 ====================
获取护士Token | static getNurseToken(): string | null {
try {
const tokenFromAppStorage: string | undefined = AppStorage.get<string>('nurseToken');
if (tokenFromAppStorage && tokenFromAppStorage.length > 0) {
return tokenFromAppStorage;
}
const settings: SettingsUtil = SettingsUtil.getInstance();
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNurseToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left A... | static getNurseToken(): string | null {
try {
const tokenFromAppStorage: string | undefined = AppStorage.get<string>('nurseToken');
if (tokenFromAppStorage && tokenFromAppStorage.length > 0) {
return tokenFromAppStorage;
}
const settings: SettingsUtil = SettingsUtil.getInstance();
... | https://github.com/LJ666-ui/harmony-health-care | dd190848560a8a6291a366304b537aaa95067370 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/pages/DiscoverPage.ets | arkts | loadAllData | 统一加载数据 | loadAllData() {
this.loadBanners();
this.loadCategories();
this.loadArticles();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left loadAllData 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... | loadAllData() {
this.loadBanners();
this.loadCategories();
this.loadArticles();
} | https://github.com/LJ666-ui/harmony-health-care | e59a4fa5ae6167bc7d788464b3ad4721a3e047f5 | github |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/NativeBridge.ets | arkts | getUploadsList | 把课程列表展开成可下载文件清单。courses 直接来自 getCourses()。 | static async getUploadsList(courses: Course[], syncUpload: boolean, savePath: string): Promise<Upload[]> {
const json: string = await zla.getUploadsList(JSON.stringify(courses), syncUpload, savePath);
return JSON.parse(json) as Upload[];
} | 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 getUploadsList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left courses AST#identifier#Right AST#:#Left :... | static async getUploadsList(courses: Course[], syncUpload: boolean, savePath: string): Promise<Upload[]> {
const json: string = await zla.getUploadsList(JSON.stringify(courses), syncUpload, savePath);
return JSON.parse(json) as Upload[];
} | https://github.com/picklerick422/zju-learning-assistant-OH | 251a6b6264f1ea9f7356fe7b03e060a30f853aa8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Int.ets | arkts | toInt | Returns the primitive as int value
@param value value to cast
@returns casted value | public static toInt(value: int): int {
return value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left toInt AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Righ... | public static toInt(value: int): int {
return value;
} | https://gitcode.com/iop123123/arkts-static-skills | cca888e368f4e7e82ad5167daf46809eb43a5cf5 | gitcode |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/ai/KeywordFetcherService.ets | arkts | fetchKeywordsFromAI | 从 AI 获取关键词 | static async fetchKeywordsFromAI(
userId: string,
topic: string,
count: number = 20
): Promise<FetchKeywordsResult> {
const result = new FetchKeywordsResult()
try {
const settings = await AISettingsDao.findDefault(userId)
if (settings === null || settings.apiKey.length === 0 || set... | 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 fetchKeywordsFromAI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Le... | static async fetchKeywordsFromAI(
userId: string,
topic: string,
count: number = 20
): Promise<FetchKeywordsResult> {
const result = new FetchKeywordsResult()
try {
const settings = await AISettingsDao.findDefault(userId)
if (settings === null || settings.apiKey.length === 0 || set... | https://github.com/encorexin/WordPressCMS | 4bc347f2cf80b29a0eefcc48f6c2422a0a8e13e9 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RomParser.ets | arkts | expand5to8 | 将 5 位颜色值扩展到 8 位 (与 Android 版本一致)
使用 (rawColor << 3) + (rawColor >> 2) 的方式进行精确转换 | function expand5to8(value: number): number {
return ((value << 3) | (value >> 2)) & 0xFF;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left expand5to8 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function expand5to8(value: number): number {
return ((value << 3) | (value >> 2)) & 0xFF;
} | https://github.com/richshaw2015/nds | 084a5d2fd1e8dbf21362da78c825edb4cd8b1516 | github |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/common/DiskCacheManager.ets | arkts | submitToDisk | 保存数据到磁盘中
@param key 键值
@param data 数据 | submitToDisk(url: string, data: ResponseDataType) {
this.cache.set(url, data);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left submitToDisk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | submitToDisk(url: string, data: ResponseDataType) {
this.cache.set(url, data);
} | https://gitcode.com/arkui-x/samples | 38430e1ad21ad59e78435e5e4568836403cb5f73 | gitcode |
OHPG/FinMusic | entry/src/main/ets/player/AppPlaybackManager.ets | arkts | onBackPress | 返回键不拦截,允许正常返回 | public onBackPress(): boolean {
return false
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | public onBackPress(): boolean {
return false
} | https://github.com/OHPG/FinMusic | 63c07cd2ae84541e642307ccd33c6316b0454a07 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/AuthenticationHandler.ets | arkts | extractTokenFromResponse | 从响应中提取令牌 | extractTokenFromResponse(response: ESObject): string | null {
try {
if (!this.config.tokenExtraction) {
return null;
}
const extraction = this.config.tokenExtraction;
if (extraction.type === 'json' && extraction.path) {
// 使用JSONPath提取
return this.extractByPath(re... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left extractTokenFromResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left response AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i... | extractTokenFromResponse(response: ESObject): string | null {
try {
if (!this.config.tokenExtraction) {
return null;
}
const extraction = this.config.tokenExtraction;
if (extraction.type === 'json' && extraction.path) {
// 使用JSONPath提取
return this.extractByPath(re... | https://github.com/DaLongZhuaZi/manxia | 195462e3abdeff994c5ba739b65d7869baab9937 | github |
erosTeam/NextE | shared/src/main/ets/backup/BackupPreferencesAdapter.ets | arkts | exportSecrets | Secret keys → encrypted-only section. | static async exportSecrets(context: common.UIAbilityContext): Promise<SettingsMap> {
return BackupPreferencesAdapter.dump(context, true)
} | 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 exportSecrets AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : ... | static async exportSecrets(context: common.UIAbilityContext): Promise<SettingsMap> {
return BackupPreferencesAdapter.dump(context, true)
} | https://github.com/erosTeam/NextE | b81b84d68890e88c3944d9c981e3527508d1dabe | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/common/VNCConnection.ets | arkts | createKeyEvent | 创建键盘事件消息 | static createKeyEvent(key: number, down: boolean): ArrayBuffer {
const buffer = new ArrayBuffer(8);
const view = new DataView(buffer);
view.setUint8(0, 4); // KeyEvent message type
view.setUint8(1, down ? 1 : 0); // Down flag
view.setUint16(2, 0, false); // Padding
view.setUint32(4, key, ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createKeyEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | static createKeyEvent(key: number, down: boolean): ArrayBuffer {
const buffer = new ArrayBuffer(8);
const view = new DataView(buffer);
view.setUint8(0, 4); // KeyEvent message type
view.setUint8(1, down ? 1 : 0); // Down flag
view.setUint16(2, 0, false); // Padding
view.setUint32(4, key, ... | https://github.com/AetheriumSimulator/qemu-hmos | 826194f0360b20f1c8ab6c81a5718b349d259e2c | github |
CLMC2025/Vignette | entry/src/main/ets/utils/TimerManager.ets | arkts | setTimeout | 设置超时定时器
@param callback 回调函数
@param delay 延迟时间(毫秒)
@returns 定时器 ID | setTimeout(callback: () => void, delay: number): TimerId {
if (this.destroyed) {
console.warn('[TimerManager] setTimeout called after destroy, ignoring');
return -1;
}
const timerId = setTimeout(() => {
this.timers.delete(timerId);
try {
callback();
} catch (e) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#argum... | setTimeout(callback: () => void, delay: number): TimerId {
if (this.destroyed) {
console.warn('[TimerManager] setTimeout called after destroy, ignoring');
return -1;
}
const timerId = setTimeout(() => {
this.timers.delete(timerId);
try {
callback();
} catch (e) {
... | https://github.com/CLMC2025/Vignette | 6c0f1b7b030e68173499459ab9cfadb8c2ac53bf | github |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets | arkts | getKey | 返回缓存文件key值 | getKey(): string {
return this.key;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_block... | getKey(): string {
return this.key;
} | https://gitcode.com/arkui-x/samples | a9583e8aa11061bdd6d8ed2d098a0660eec0b850 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AlertManager.ets | arkts | getInstance | 获取告警管理器单例实例 | public static getInstance(): AlertManager {
if (!AlertManager.instance) {
AlertManager.instance = new AlertManager();
}
return AlertManager.instance;
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): AlertManager {
if (!AlertManager.instance) {
AlertManager.instance = new AlertManager();
}
return AlertManager.instance;
} | https://github.com/LJ666-ui/harmony-health-care | 6132d94e47009320747f70b3a89bb2ae003178e3 | github |
openharmony/arkui_advanced_ui_component | atomicservicenavigation/source/atomicservicenavigation.ets | arkts | isShowSideBar | 获取侧边栏显示隐藏状态
@returns 侧边栏是否显示 | public isShowSideBar(): boolean {
return this.isExpandSideBar;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isShowSideBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST... | public isShowSideBar(): boolean {
return this.isExpandSideBar;
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 0db6620c4fd22a6ff479b53ed229c928248c363d | gitee |
codelably/HCompass | entry/src/main/ets/entryability/AppInterceptors.ets | arkts | onRequest | 优先级最高,最先执行 | onRequest(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig {
this.logRequest(config);
return config;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InternalAxiosRequestConfig AST#identifier#Ri... | onRequest(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig {
this.logRequest(config);
return config;
} | https://github.com/codelably/HCompass | befe28ba10bcc1077cfa84361f3802881addef53 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | fetchAndSubSize | Atomically decrements the queue size and returns the previous value.
Uses the internal atomic counter shared by producers and consumers.
@returns { int } The previous queue size before the decrement is applied,
and before the new element count becomes visible.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private fetchAndSubSize(): int {
return this.actualSize.fetchSub(1);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fetchAndSubSize 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 int... | private fetchAndSubSize(): int {
return this.actualSize.fetchSub(1);
} | https://gitcode.com/iop123123/arkts-static-skills | ffbdfa3ce647123a9d385d422288bba706394c0c | gitcode |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/feature/mine/src/main/ets/view/MinePrivacyTitleItemView.ets | arkts | build | 超链接点击 | build() {
Column() {
Row() {
Text(this.title)
.margin({ left: $r('app.float.size_16'), right: $r('app.float.size_5') })
.fontColor(Color.Black)
.fontSize($r('app.float.size_text_15'))
Row() {
//右边文案
Text(this.rightTitle)
.margin(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Row() {
Text(this.title)
.margin({ left: $r('app.float.size_16'), right: $r('app.float.size_5') })
.fontColor(Color.Black)
.fontSize($r('app.float.size_text_15'))
Row() {
//右边文案
Text(this.rightTitle)
.margin(... | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 86ec2521231d190f395ee5ba82804dfa7393be39 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/ClipboardBridgeService.ets | arkts | startMonitoring | 启动监听 (定时轮询) | startMonitoring(callback: (text: string) => void): void {
if (this.enabled) {
return;
}
try {
this.enabled = true;
this.onLocalTextChanged = callback;
this.lastHash = 0;
// 先读一次建立基线
this.getSystemText().then((text: string) => {
this.lastHash = this.hashText(tex... | AST#program#Left AST#ERROR#Left AST#identifier#Left startMonitoring AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L... | startMonitoring(callback: (text: string) => void): void {
if (this.enabled) {
return;
}
try {
this.enabled = true;
this.onLocalTextChanged = callback;
this.lastHash = 0;
// 先读一次建立基线
this.getSystemText().then((text: string) => {
this.lastHash = this.hashText(tex... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | a2bfdc68e6fff53c54ee454ee33117368fce9bd2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringList | 获取字符串列表
支持规则分割符: && (与), || (或), %% (交叉合并) | getStringList(ruleStr: string | undefined): string[] {
if (!ruleStr || ruleStr.trim() === '') {
return [];
}
try {
const processedRule = this.preprocessRuleText(ruleStr);
// 处理规则分割符
const splitResult = this.splitRuleStr(processedRule);
if (splitResult.rules.length > 1) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStringList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ruleStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left string AST#i... | getStringList(ruleStr: string | undefined): string[] {
if (!ruleStr || ruleStr.trim() === '') {
return [];
}
try {
const processedRule = this.preprocessRuleText(ruleStr);
// 处理规则分割符
const splitResult = this.splitRuleStr(processedRule);
if (splitResult.rules.length > 1) {
... | https://github.com/DaLongZhuaZi/manxia | 1ddf4e5aeeb476373abf48a6ef4c83c0bf690426 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | downloadAttachment | GET /users/{uid}/items/{key}/file. Returns the attachment binary as an
ArrayBuffer. Zotero may 302 redirect to its CDN — @ohos.net.http follows
redirects automatically. | async downloadAttachment(itemKey: string): Promise<ArrayBuffer> {
if (itemKey.length === 0) {
throw new ZoteroApiError(0, 'downloadAttachment: itemKey must not be empty');
}
const uid = this.requireUserId();
const path = `/users/${uid}/items/${itemKey}/file`;
const request = http.createHttp... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left downloadAttachment AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left itemKey AST#identifier#Rig... | async downloadAttachment(itemKey: string): Promise<ArrayBuffer> {
if (itemKey.length === 0) {
throw new ZoteroApiError(0, 'downloadAttachment: itemKey must not be empty');
}
const uid = this.requireUserId();
const path = `/users/${uid}/items/${itemKey}/file`;
const request = http.createHttp... | https://github.com/Vincent-Leon/zotero-harmony | b424cae03b57c3613a8307f2c66ee336e6e3f668 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | textSecondary | 快捷方法:获取次要文字颜色 | public static get textSecondary(): string {
return AppColors.textSecondary;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left textSecondary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right ... | public static get textSecondary(): string {
return AppColors.textSecondary;
} | https://github.com/DaLongZhuaZi/manxia | 283af453ce95366a3a9be8fa001065a62c410df1 | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | getNickNameText | 获取昵称展示文本
@returns {ResourceStr} 昵称文本 | getNickNameText(): ResourceStr {
return this.getUserInfo().nickName ?? $r("app.string.not_set");
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNickNameText 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 ResourceStr AST#identifier#Right AST#ERROR#Rig... | getNickNameText(): ResourceStr {
return this.getUserInfo().nickName ?? $r("app.string.not_set");
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2a78352e6b7c68e486b592522054dee03a9d547f | github |
CPF-ApplicationTPC/openharmony_tpc_samples | bc_ohos/library/src/main/ets/ISO9797Alg3Mac.ets | arkts | doFinal | 完成 MAC 计算
@param out 输出缓冲区
@param outOff 输出偏移
@returns MAC 大小 | doFinal(out: Uint8Array, outOff: number): number {
if (this.padding === null) {
// 零填充
while (this.bufOff < this.blockSize) {
this.buf[this.bufOff++] = 0;
}
} else {
if (this.bufOff === this.blockSize) {
this.processBlock();
this.bufOff = 0;
}
this.p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left doFinal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left out AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AST#,#Left , AST#... | doFinal(out: Uint8Array, outOff: number): number {
if (this.padding === null) {
// 零填充
while (this.bufOff < this.blockSize) {
this.buf[this.bufOff++] = 0;
}
} else {
if (this.bufOff === this.blockSize) {
this.processBlock();
this.bufOff = 0;
}
this.p... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 31364a82bb0b8dc2cc4a0929fb45202b5871aeda | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/21.shift_expressions/shift_int.ets | arkts | main | ---
desc: Shift of int type, large shift value
tags: [negative]
--- | function main(): void {
let v: {{se.type}} = 1; | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let v: {{se.type}} = 1; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 844177a064ed7d167e8921eeb05bcdbde730c4fa | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test41_original_index.ets | arkts | testRegExpExec | === Round 41: RegExp exec/test, Array.sort complex comparator,
StringBuilder chain, switch with counters, String.split with limit,
Array.entries iteration, nested ternary ===
--- RegExp exec and test --- | function testRegExpExec(): string {
let pattern: RegExp = /(\d+)-(\d+)/;
let text: string = 'abc 123-456 def 789-012';
let match: RegExpExecArray | null = pattern.exec(text);
if (match !== null) {
let full: string = match[0];
let g1: string = match[1];
let g2: string = match[2];
return full + ',... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testRegExpExec AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t... | function testRegExpExec(): string {
let pattern: RegExp = /(\d+)-(\d+)/;
let text: string = 'abc 123-456 def 789-012';
let match: RegExpExecArray | null = pattern.exec(text);
if (match !== null) {
let full: string = match[0];
let g1: string = match[1];
let g2: string = match[2];
return full + ',... | https://github.com/miaochiahao/ark-ghidra | c584efced0c93c259572441656a2633d69f557ee | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getNavButtonBackgroundColor | 获取导航按钮背景色 | static getNavButtonBackgroundColor(): string {
return 'rgba(255, 255, 255, 0.6)';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNavButtonBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Lef... | static getNavButtonBackgroundColor(): string {
return 'rgba(255, 255, 255, 0.6)';
} | https://github.com/chendi126/harmonyOS-TCP | b707a8c4ac7b71e0c12d6d23c53af3e97449f852 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ChineseConverter.ets | arkts | autoConvert | 自动检测并转换 | autoConvert(text: string, targetVariant: ChineseVariant): string {
if (!text) {
return text;
}
// 检测文本中的简繁体比例
const variant = this.detectVariant(text);
if (targetVariant === 'zh-CN') {
// 目标是简体
if (variant === 'traditional') {
return this.traditionalToSimplified(text);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left autoConvert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | autoConvert(text: string, targetVariant: ChineseVariant): string {
if (!text) {
return text;
}
// 检测文本中的简繁体比例
const variant = this.detectVariant(text);
if (targetVariant === 'zh-CN') {
// 目标是简体
if (variant === 'traditional') {
return this.traditionalToSimplified(text);
... | https://github.com/DaLongZhuaZi/manxia | 0c74cfdb6a0067d43d041cefe2c76b541737cd93 | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/ChatPage.ets | arkts | onPageHide | 界面隐藏时被调用。 | onPageHide(): void {
// 本界面不显示时,将输入法软键盘避让模式还原为系统默认的KeyboardAvoidMode.OFFSET
ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageHide 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#L... | onPageHide(): void {
// 本界面不显示时,将输入法软键盘避让模式还原为系统默认的KeyboardAvoidMode.OFFSET
ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false);
} | https://github.com/JackJiang2011/harmonychat | aac61d7e7bfe8caf63237a2a5857d560d626f867 | github |
LZZLHY/hlib | entry/src/main/ets/api/HttpClient.ets | arkts | swapUrlHost | 仅替换 URL 的 host 段(scheme://host 后必须是 / ? # 或结尾),
避免 oldDomain 作为子串出现在 path/query 时被误改。 | private static swapUrlHost(url: string, oldDomain: string, newDomain: string): string {
const schemes: string[] = ['https://', 'http://'];
for (let i = 0; i < schemes.length; i++) {
const prefix: string = schemes[i] + oldDomain;
if (url.startsWith(prefix)) {
const rest: string = url.substr... | 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 swapUrlHost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AS... | private static swapUrlHost(url: string, oldDomain: string, newDomain: string): string {
const schemes: string[] = ['https://', 'http://'];
for (let i = 0; i < schemes.length; i++) {
const prefix: string = schemes[i] + oldDomain;
if (url.startsWith(prefix)) {
const rest: string = url.substr... | https://github.com/LZZLHY/hlib | fb4eab9ad7a78494f568dcd04c94cf2167aa16bf | github |
Joker-x-dev/CoolMallArkTS | core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets | arkts | clearAll | 清除所有订单缓存
@returns {Promise<void>} Promise<void> | async clearAll(): Promise<void> {
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_CARTS);
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAll 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_typ... | async clearAll(): Promise<void> {
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_CARTS);
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST);
} | https://github.com/Joker-x-dev/CoolMallArkTS | d7444aa09075828a49c74a04f57d134659947e43 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnCountDownViewModel.ets | arkts | pauseControl | 暂停手动控制的倒计时 | pauseControl(): void {
this.controlController.pause();
this.controlStatusText = "已暂停";
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pauseControl 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... | pauseControl(): void {
this.controlController.pause();
this.controlStatusText = "已暂停";
} | https://github.com/codelably/tuniao-ui | c8b0d6f001e395a8f49d1a36d951150a255eb636 | github |
openharmony-sig/jtar | entry/src/main/ets/pages/index.ets | arkts | TestTarInit | tartest初始化(主要是创建一个压缩目标,供demo测试使用) | TestTarInit(): void {
fs.mkdir(this.GetDirName(), (err) => {
if (err) {
console.info("mkdir failed with error message:" + err.message + ",errorcode:" + err.code);
} else {
let filePath = this.GetDirName() + "/test.txt";
let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left TestTarInit 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#... | TestTarInit(): void {
fs.mkdir(this.GetDirName(), (err) => {
if (err) {
console.info("mkdir failed with error message:" + err.message + ",errorcode:" + err.code);
} else {
let filePath = this.GetDirName() + "/test.txt";
let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | ... | https://gitee.com/openharmony-sig/jtar.git | 0dbfbd71364b14cc660da9b8688091af5925c729 | gitee |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/common/PreferencesUtil.ets | arkts | getBoolean | 读取布尔值数据
@param context 应用上下文
@param key 键
@param defaultValue 默认值
@returns 布尔值 | static async getBoolean(context: common.UIAbilityContext, key: string,
defaultValue: boolean = false): Promise<boolean> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
return await dataPreferences.get(key, defaultValue) as boolean;
} catch (error) {
console... | 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 getBoolean AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST... | static async getBoolean(context: common.UIAbilityContext, key: string,
defaultValue: boolean = false): Promise<boolean> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
return await dataPreferences.get(key, defaultValue) as boolean;
} catch (error) {
console... | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | 2f9ed5015ecd5e7746863bb45e9f2da20ea439d7 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | getIDAlarmFrom | 根据闹钟id查询数据 | async getIDAlarmFrom(alarmId: string | undefined): Promise<AlarmInfo[]> {
const rdbStore = await this.getRdbStore();
const predicates = new dataRdb.RdbPredicates(ALARM_CLOCK_DATA_TABLE);
predicates.equalTo('ID', alarmId);
let resultSet: rdb.ResultSet = await rdbStore.query(predicates);
try {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getIDAlarmFrom AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getIDAlarmFrom(alarmId: string | undefined): Promise<AlarmInfo[]> {
const rdbStore = await this.getRdbStore();
const predicates = new dataRdb.RdbPredicates(ALARM_CLOCK_DATA_TABLE);
predicates.equalTo('ID', alarmId);
let resultSet: rdb.ResultSet = await rdbStore.query(predicates);
try {
... | https://gitee.com/openharmony-sig/applications_clock.git | 876f20d39e163e84fccf5cdeecfe4012a230b419 | gitee |
Cool_foolisher1/ArkTSRepository | MultiCalculator/features/calculator/src/main/ets/utils/CalculateUtil.ets | arkts | comparePriority | 比较加法、减法、乘法和除法的优先级 | comparePriority(arg1: string, arg2: string): boolean {
if (checkEmptyUtil.isEmpty(arg1) || checkEmptyUtil.isEmpty(arg2)) {
return false
}
return (this.getPriority(arg1) <= this.getPriority(arg2))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left comparePriority AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arg1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,... | comparePriority(arg1: string, arg2: string): boolean {
if (checkEmptyUtil.isEmpty(arg1) || checkEmptyUtil.isEmpty(arg2)) {
return false
}
return (this.getPriority(arg1) <= this.getPriority(arg2))
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 6d17689bd435638f23546f8e2f906699725d031e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVErrorAnalyzer.ets | arkts | formatShortError | 生成简短的错误提示(用于Toast) | static formatShortError(analysis: WebDAVErrorAnalysis): string {
return `${analysis.title}: ${analysis.suggestions[0]}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatShortError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left analysis AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static formatShortError(analysis: WebDAVErrorAnalysis): string {
return `${analysis.title}: ${analysis.suggestions[0]}`;
} | https://github.com/DaLongZhuaZi/manxia | fc6cb0e57fb0302365db28b7fdd6fadccb9a8b1b | github |
GrassyUnknown/Health-Life-HarmonyOS-Next | entry/src/main/ets/view/HomeComponent.ets | arkts | taskItemAction | 打卡 点任务列表时触发 | taskItemAction(item: TaskInfo, isClick: boolean): void {
if (!this.homeStore.checkCurrentDay()) {// 今天才能打卡
return;
}
// 点击
if (isClick) {
// click to clock
let callback: CustomDialogCallback = {
confirmCallback: (taskTemp: TaskInfo) => {
this.onConfirm(taskTemp)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left taskItemAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TaskInfo AST#identifier#Right AST#,#Left ... | taskItemAction(item: TaskInfo, isClick: boolean): void {
if (!this.homeStore.checkCurrentDay()) {// 今天才能打卡
return;
}
// 点击
if (isClick) {
// click to clock
let callback: CustomDialogCallback = {
confirmCallback: (taskTemp: TaskInfo) => {
this.onConfirm(taskTemp)
... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | 4d18c638ab61a677238fa736e3bc136c76072566 | github |
huaiminqin/TankWar-Master-with-Many-Tasks | game/src/main/ets/actors/Tanks.ets | arkts | create | 提高玩家默认速度 | public static create() {
// 清空现有数组,确保每次进入关卡都是新开始
Tanks.TANKS = [];
//player tank
Tanks.TANKS.push(new PlayerTank());
//max 7 simple tanks
for (let i = 1; i < 8; i++) {
Tanks.TANKS.push(new SimpleTank(false));
}
//max 4 fast tanks
for (let i = 8; i < 12; i++) {
Tanks.TAN... | 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 create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Ri... | public static create() {
// 清空现有数组,确保每次进入关卡都是新开始
Tanks.TANKS = [];
//player tank
Tanks.TANKS.push(new PlayerTank());
//max 7 simple tanks
for (let i = 1; i < 8; i++) {
Tanks.TANKS.push(new SimpleTank(false));
}
//max 4 fast tanks
for (let i = 8; i < 12; i++) {
Tanks.TAN... | https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks | adbca09ae95df22ccfcad208144bcd4f8058c905 | github |
honjow/Next2V | feature/node/src/main/ets/viewmodel/NodeViewModel.ets | arkts | loadNodeDetailV2 | Load node detail (API v2, requires Token) | async loadNodeDetailV2(nodeName: string, token: string): Promise<void> {
const cleanToken = token.trim()
if (!cleanToken) {
this.nodeDetail = null
this.nodeDetailError = ''
return
}
this.nodeDetailError = ''
try {
const res = await this.apiV2.getNode(cleanToken, nodeName)
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadNodeDetailV2 AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nodeName AST#identifier#Right AST#type_annotation#Left AST#:#L... | async loadNodeDetailV2(nodeName: string, token: string): Promise<void> {
const cleanToken = token.trim()
if (!cleanToken) {
this.nodeDetail = null
this.nodeDetailError = ''
return
}
this.nodeDetailError = ''
try {
const res = await this.apiV2.getNode(cleanToken, nodeName)
... | https://github.com/honjow/Next2V | b929160a3371a6c2c6bb688c061eb684c8e42cd1 | github |
HarmonyOS_Samples/MusicHome | products/tv/src/main/ets/tvability/TvAbility.ets | arkts | onWindowStageCreate | Loads pages/Index and constructs MediaService when load succeeds.
@param windowStage Window stage for this ability. | onWindowStageCreate(windowStage: window.WindowStage): void {
Logger.info('TvAbility: Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
Logger.error(`Failed to load the content. Cause: ${JSON.stringify(err)}`);
return;
}
Logger.i... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | onWindowStageCreate(windowStage: window.WindowStage): void {
Logger.info('TvAbility: Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
Logger.error(`Failed to load the content. Cause: ${JSON.stringify(err)}`);
return;
}
Logger.i... | https://gitcode.com/HarmonyOS_Samples/MusicHome | cb6249971fa4de2ba8b6b18cdb3186cb5385c98d | gitcode |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/uiTheme/facades/ComponentThemeOverrideFacade.ets | arkts | getOverride | 获取具名主题覆盖(不存在则返回 null) | getOverride(name: string): NGFComponentThemeOverride | null {
const found = this.overrides.get(name);
return found !== undefined ? found : null;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOverride AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST... | getOverride(name: string): NGFComponentThemeOverride | null {
const found = this.overrides.get(name);
return found !== undefined ? found : null;
} | https://github.com/DaLongZhuaZi/NGF | 693350ed2cedb847d9b9a4df20004951c60c2158 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelInitializer.ets | arkts | reset | 重置初始化状态 | reset(): void {
this.isInitialized = false;
this.context = null;
logger.info(TAG, '小说模块初始化状态已重置');
} | 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.isInitialized = false;
this.context = null;
logger.info(TAG, '小说模块初始化状态已重置');
} | https://github.com/DaLongZhuaZi/manxia | 11ec5f7cdc819d5a1806a12e92d0c97c4de46150 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringListWithSplitRules | 使用分割规则获取字符串列表 | private getStringListWithSplitRules(rules: string[], splitType: string): string[] {
const allResults: string[][] = [];
for (const rule of rules) {
const results = this.getStringListSingle(rule);
if (results.length > 0) {
allResults.push(results);
// || 操作:第一个有结果就返回
if ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringListWithSplitRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rules AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private getStringListWithSplitRules(rules: string[], splitType: string): string[] {
const allResults: string[][] = [];
for (const rule of rules) {
const results = this.getStringListSingle(rule);
if (results.length > 0) {
allResults.push(results);
// || 操作:第一个有结果就返回
if ... | https://github.com/DaLongZhuaZi/manxia | 7aabb6c9e0f59fd7ce7ebac4a9bebcf0f5f1e637 | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets | arkts | onBTStateChange | 订阅蓝牙设备开关状态事件 | private onBTStateChange() {
Log.showInfo(TAG, `onBTStateChange`);
try {
access.on('stateChange', (data: access.BluetoothState) => {
Log.showInfo(TAG, `onBTStateChange: data = ${data}`);
if (data === access.BluetoothState.STATE_ON) {
AppStorage.setOrCreate('bluetoothEnable', tru... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onBTStateChange 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#{#L... | private onBTStateChange() {
Log.showInfo(TAG, `onBTStateChange`);
try {
access.on('stateChange', (data: access.BluetoothState) => {
Log.showInfo(TAG, `onBTStateChange: data = ${data}`);
if (data === access.BluetoothState.STATE_ON) {
AppStorage.setOrCreate('bluetoothEnable', tru... | https://gitcode.com/arkui-x/samples | d82eb23b87a0e13cc2197af55065a1e20a331a1b | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component/treeviewv2/source/treeviewv2.ets | arkts | emitNodeClick | Triggers all callbacks of node click event.
@since 26 | public emitNodeClick(argument: CallbackParamV2): void {
this.triggerCallbacks(this.nodeClickEvents, argument);
this.triggerOnceCallbacks(this.nodeClickOnceEvents, argument);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left emitNodeClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left argument AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public emitNodeClick(argument: CallbackParamV2): void {
this.triggerCallbacks(this.nodeClickEvents, argument);
this.triggerOnceCallbacks(this.nodeClickOnceEvents, argument);
} | https://gitcode.com/openharmony/arkui_ace_engine | aaaada3d9323dd3cc3e0593d682c2f2ef07eb0fd | gitcode |
openharmony/third_party_typescript | tests/arkTSTest/testcase/arkts-no-symbol/arkts-no-symbol-4-ok.ets | arkts | printValues | Use the custom type CustomIterable | function printValues<T>(iterable: CustomIterable<T>): void {
for (const item of iterable) {
console.log(item);
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left printValues AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#Rig... | function printValues<T>(iterable: CustomIterable<T>): void {
for (const item of iterable) {
console.log(item);
}
} | https://gitee.com/openharmony/third_party_typescript.git | d8ba221521a6d57e1f147124a6a24897d9c94daf | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitRepeatedSfixed32 | 访问 repeated sfixed32 字段
JSON: array of number | visitRepeatedSfixed32(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = [...value] as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedSfixed32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left num... | visitRepeatedSfixed32(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = [...value] as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 4ea2022c8fb908dfe0c567513b1126ad40707a50 | gitcode |
midori52000/ArkPilot | Agent/entry/src/main/ets/apim/ApiManagementService.ets | arkts | queryUsage | ========== 用量查询 ========== | async queryUsage(provider: ProviderRecord): Promise<UsageQueryResult> {
if (provider.usageScript === null || !provider.usageScript.enabled) {
throw new ApiError(ApiErrorCode.USAGE_NOT_CONFIGURED, '',
'此 Provider 未配置用量查询');
}
if (provider.usageScript.scriptType === 'openai') {
return t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryUsage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left provider AST#identifier#Right AST#... | async queryUsage(provider: ProviderRecord): Promise<UsageQueryResult> {
if (provider.usageScript === null || !provider.usageScript.enabled) {
throw new ApiError(ApiErrorCode.USAGE_NOT_CONFIGURED, '',
'此 Provider 未配置用量查询');
}
if (provider.usageScript.scriptType === 'openai') {
return t... | https://github.com/midori52000/ArkPilot | f127631da31cc0225e5ef8ee01f99977cb7aaee7 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | endCropRectMove | End crop rect move. | endCropRectMove() {
this.isLeft = false;
this.isRight = false;
this.isTop = false;
this.isBottom = false;
this.isHorizontalSide = false;
this.isVerticalSide = false;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left endCropRectMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | endCropRectMove() {
this.isLeft = false;
this.isRight = false;
this.isTop = false;
this.isBottom = false;
this.isHorizontalSide = false;
this.isVerticalSide = false;
} | https://gitee.com/openharmony/codelabs.git | 9c0c903332e10d57214fca4252a52ad46e028046 | gitee |
openharmony-sig/smartperf | device/device_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | xAnimator | constructor(listener:AnimatorUpdateListener) {
this.mListener = listener;
} | private xAnimator(duration:number, easing:EasingFunction):ObjectAnimator {
let animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0, 1);
animatorX.setInterpolator(easing);
animatorX.setDuration(duration);
return animatorX;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left xAnimator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R... | private xAnimator(duration:number, easing:EasingFunction):ObjectAnimator {
let animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0, 1);
animatorX.setInterpolator(easing);
animatorX.setDuration(duration);
return animatorX;
} | https://gitee.com/openharmony-sig/smartperf.git | 643b08c29014944650cf5645d8aa34ef5a13f83e | gitee |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertAngle | ANGLE | static convertAngle(value: number, from: AngleUnit, to: AngleUnit): number {
const toDegrees: Record<AngleUnit, number> = {
[AngleUnit.DEGREE]: 1,
[AngleUnit.RADIAN]: 180 / Math.PI,
[AngleUnit.GRADIAN]: 0.9
};
const decimalCount: Record<AngleUnit, number> = {
[AngleUnit.DEGREE]: 2... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertAngle 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 nu... | static convertAngle(value: number, from: AngleUnit, to: AngleUnit): number {
const toDegrees: Record<AngleUnit, number> = {
[AngleUnit.DEGREE]: 1,
[AngleUnit.RADIAN]: 180 / Math.PI,
[AngleUnit.GRADIAN]: 0.9
};
const decimalCount: Record<AngleUnit, number> = {
[AngleUnit.DEGREE]: 2... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | e3260337b0d751d142caa1b56a17f197ffb718f4 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | downloadImageData | 下载图片数据(公共方法,供 SaveButton 使用)
@param imageUrl 图片 URL
@returns 图片二进制数据 | async downloadImageData(imageUrl: string): Promise<ArrayBuffer | null> {
if (!imageUrl || imageUrl.length === 0) {
return null;
}
try {
// 如果是 file:// 路径,直接读取本地文件
if (imageUrl.startsWith('file://')) {
const filePath = imageUrl.replace('file://', '');
try {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left downloadImageData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageUrl AST#identifier#Rig... | async downloadImageData(imageUrl: string): Promise<ArrayBuffer | null> {
if (!imageUrl || imageUrl.length === 0) {
return null;
}
try {
// 如果是 file:// 路径,直接读取本地文件
if (imageUrl.startsWith('file://')) {
const filePath = imageUrl.replace('file://', '');
try {
... | https://github.com/AlkaidLab/moonlight-harmony | 5d1c167b93786a5927c86a52c26d9336cb40a8bb | github |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets | arkts | getChamfer | 获取 tabs 尺寸信息 | getChamfer() {
let onLayoutComplete: () => void = (): void => {
let modePosition = componentUtils.getRectangleById(this.tabsId)
if (modePosition.size) {
this.chamfer = new ChamferInfo(modePosition, this.tabsMenu.length)
this.tabsListener?.off('draw')
}
}
let FuncDraw = on... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getChamfer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | getChamfer() {
let onLayoutComplete: () => void = (): void => {
let modePosition = componentUtils.getRectangleById(this.tabsId)
if (modePosition.size) {
this.chamfer = new ChamferInfo(modePosition, this.tabsMenu.length)
this.tabsListener?.off('draw')
}
}
let FuncDraw = on... | https://gitcode.com/arkui-x/samples | 7999a823eff7a54a3eaf19c8f3c30f2cfb48c3fb | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/query/AggregateResult.ets | arkts | getString | 获取字符串类型的列值
@param key 列名或别名
@returns 字符串,不存在返回空字符串 | getString(key: string): string {
const value = this.get(key)
if (value === null) {
return ''
}
return String(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#... | getString(key: string): string {
const value = this.get(key)
if (value === null) {
return ''
}
return String(value)
} | https://github.com/offlinecat-dev/OCNetORM | 8f95f196acdb2d0f65a2de6eb79238c645afcdf4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies elements from an ArrayLike object to the Int8Array.
@param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy.
@param { int } [offset] - Optional. The offset into the target array at which to begin
writing values from the source array. The default value is 0.
@throws { RangeError }... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | https://gitcode.com/iop123123/arkts-static-skills | 774891ac3ab7bb3cda8424332a9b8ec18b3335b1 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/AchievementService.ets | arkts | getAchievementsByType | 根据类型获取成就列表
@param type 成就类型
@returns 成就配置列表 | static getAchievementsByType(type: AchievementType): AchievementConfig[] {
return AchievementService.ACHIEVEMENT_CONFIGS.filter(config => config.type === type);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAchievementsByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static getAchievementsByType(type: AchievementType): AchievementConfig[] {
return AchievementService.ACHIEVEMENT_CONFIGS.filter(config => config.type === type);
} | https://github.com/the-wwyang/kids-learning-app | 28d6d35eabb28e0ff14b9b147eaca8c43f24d358 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/AccountKitService.ets | arkts | init | 初始化持久化存储, 从磁盘恢复 | async init(context: common.Context): Promise<void> {
try {
this.dataPreferences = preferences.getPreferencesSync(context, { name: STORE_NAME });
await this.loadFromDisk();
} catch (err) {
hilog.error(0x0015, 'AccountKit', 'AccountKitService 初始化失败: ' + JSON.stringify(err));
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async init(context: common.Context): Promise<void> {
try {
this.dataPreferences = preferences.getPreferencesSync(context, { name: STORE_NAME });
await this.loadFromDisk();
} catch (err) {
hilog.error(0x0015, 'AccountKit', 'AccountKitService 初始化失败: ' + JSON.stringify(err));
}
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | c2bf7d27a6702f53246ea29ed6e6fbc39c42af10 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | toLocaleString | Converts Uint32Array to a string with respect to locale
@param locales
@param options
@returns string representation | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Uint32Array.toLocaleString: not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Uint32Array.toLocaleString: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9a3226643418310f2c11bc2f3adbc35cd395ff60 | gitee |
openharmony-sig/flutter_packages | packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets | arkts | setup | Sets up an instance of `InstanceManagerHostApi` to handle messages through the
`binaryMessenger`. | static setup(binaryMessenger: BinaryMessenger, api: InstanceManagerApi) {
{
const channel: BasicMessageChannel<ESObject> =
new BasicMessageChannel<ESObject>(
binaryMessenger, "dev.flutter.pigeon.webview_flutter_ohos.InstanceManagerHostApi.clear", OhosObjectHostApi.getCodec()
);
i... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left setup AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left binaryMessenger AST#identifier#Right AST#:#... | static setup(binaryMessenger: BinaryMessenger, api: InstanceManagerApi) {
{
const channel: BasicMessageChannel<ESObject> =
new BasicMessageChannel<ESObject>(
binaryMessenger, "dev.flutter.pigeon.webview_flutter_ohos.InstanceManagerHostApi.clear", OhosObjectHostApi.getCodec()
);
i... | https://gitee.com/openharmony-sig/flutter_packages.git | d1ac821b53a9beae943caa832c7480c8a0a85333 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | sort | TODO(kprokopenko): this may be not skipped
Sorts in-place
@param fn comparator
@returns sorted Int8Array | public sort(fn: (a: byte, b: byte) => int): Int8Array {
let arr: byte[] = new byte[this.length]
for (let i = 0; i < this.length; ++i) {
arr[i] = this.at(i)
}
// TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961
/*
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public sort(fn: (a: byte, b: byte) => int): Int8Array {
let arr: byte[] = new byte[this.length]
for (let i = 0; i < this.length; ++i) {
arr[i] = this.at(i)
}
// TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961
/*
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b56b3806a9281d9805f6a1cad0418ada0401bc9a | gitee |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | products/phone/src/main/ets/pages/customScan/model/WindowService.ets | arkts | enterCustomScanPage | Open the custom barcode scanning page. | enterCustomScanPage(): void {
this.isCustomScanPage = true;
DeviceService.refreshDisplayInfoAndSelectSuitableRatio();
this.refreshLayoutByDensityPixels(DeviceService.densityPixels);
Logger.info(TAG, `enter CustomScanPage. isCustomScanPage: ${this.isCustomScanPage}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left enterCustomScanPage 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#statemen... | enterCustomScanPage(): void {
this.isCustomScanPage = true;
DeviceService.refreshDisplayInfoAndSelectSuitableRatio();
this.refreshLayoutByDensityPixels(DeviceService.densityPixels);
Logger.info(TAG, `enter CustomScanPage. isCustomScanPage: ${this.isCustomScanPage}`);
} | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | 2d544d3a5cf8b3ab4bb710e73df1eab5220a3a11 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/BarHighlighter.ets | arkts | getClosestStackIndex | Returns the index of the closest value inside the values array / ranges (stacked barchart) to the value
given as
a parameter.
@param ranges
@param value
@return | protected getClosestStackIndex(ranges: Range[], value: number): number {
if (ranges == null || ranges.length == 0)
return 0;
let stackIndex: number = 0;
for (let range of ranges) {
if (range.contains(value))
return stackIndex;
else
stackIndex++;
}
let length: ... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getClosestStackIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ranges AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | protected getClosestStackIndex(ranges: Range[], value: number): number {
if (ranges == null || ranges.length == 0)
return 0;
let stackIndex: number = 0;
for (let range of ranges) {
if (range.contains(value))
return stackIndex;
else
stackIndex++;
}
let length: ... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f105d6c2a395a7a6077eca382928cb62a1e25711 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new JSONTypeError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super("JSONTypeError", message, options)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super("JSONTypeError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 0c2c9345a6d4ec8223a5889457487ed81caf9f42 | gitcode |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setDanmakuStyle | ���������ʽ
@param style DANMAKU_STYLE_NONE DANMAKU_STYLE_SHADOW or
DANMAKU_STYLE_STROKEN or DANMAKU_STYLE_PROJECTION
@param values
DANMAKU_STYLE_SHADOW ��Ӱģʽ�£�values������Ӱ�뾶
DANMAKU_STYLE_STROKEN ���ģʽ�£�values������߿��
DANMAKU_STYLE_PROJECTION
ͶӰģʽ�£�values����offsetX, offsetY, alpha
offsetX/offsetY: x/y �����ϵ�ƫ���... | public setDanmakuStyle(style: number, ...values: number[]): DanmakuContext {
this.mDisplayer.setDanmakuStyle(style, values);
this.notifyConfigureChanged(DanmakuConfigTag.DANMAKU_STYLE, [style, values]);
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDanmakuStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left style AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setDanmakuStyle(style: number, ...values: number[]): DanmakuContext {
this.mDisplayer.setDanmakuStyle(style, values);
this.notifyConfigureChanged(DanmakuConfigTag.DANMAKU_STYLE, [style, values]);
return this;
} | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | f7ea04ea289cfb2c6b56040448133418f6a11072 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | copySourceIcons | 复制图源icon文件到备份目录 | private async copySourceIcons(tempDir: string): Promise<void> {
const filesDir = this.sandboxManager.getDirectory('files');
const iconsSourceDir = `${filesDir}/extensions-source/icons`;
if (!SafeFileUtils.accessSync(iconsSourceDir)) {
logger.warn(TAG, `图源icon目录不存在: ${iconsSourceDir}`);
re... | 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 copySourceIcons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tempDir AST#identifier#Right AST#ERROR#Left AST#:#Le... | private async copySourceIcons(tempDir: string): Promise<void> {
const filesDir = this.sandboxManager.getDirectory('files');
const iconsSourceDir = `${filesDir}/extensions-source/icons`;
if (!SafeFileUtils.accessSync(iconsSourceDir)) {
logger.warn(TAG, `图源icon目录不存在: ${iconsSourceDir}`);
re... | https://github.com/DaLongZhuaZi/manxia | d43cd201a099f1548de6fa441073b984aef03b7c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/RAGRetriever.ets | arkts | retrieve | 检索相关知识
@param query 查询文本
@param topK 返回结果数量
@returns 知识上下文 | async retrieve(query: string, topK?: number): Promise<KnowledgeContext> {
const startTime = Date.now();
// 1. 文本向量化
const queryVector = await this.embed(query);
// 2. 向量相似度检索
const searchResults = await this.vectorDBClient.similaritySearch(
queryVector,
topK || this.config.topK
)... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left retrieve AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async retrieve(query: string, topK?: number): Promise<KnowledgeContext> {
const startTime = Date.now();
// 1. 文本向量化
const queryVector = await this.embed(query);
// 2. 向量相似度检索
const searchResults = await this.vectorDBClient.similaritySearch(
queryVector,
topK || this.config.topK
)... | https://github.com/LJ666-ui/harmony-health-care | b069b4f540e5cb6e21f4d3dff26e8c0eef8d8f8e | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/count-down/TnCountDown.ets | arkts | getSecsText | 获取秒数显示文本 | getSecsText(): string {
return padZero(Math.floor(this.getTotalSec() % MINUTE_S));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSecsText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_... | getSecsText(): string {
return padZero(Math.floor(this.getTotalSec() % MINUTE_S));
} | https://github.com/codelably/tuniao-ui | 8f9a8b96d9b3de917dba942753553e2b53e86e0f | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets | arkts | resetFilters | 重置筛选条件
@returns {void} 无返回值 | resetFilters(): void {
this.selectedCategoryIds = [];
this.minPrice = "";
this.maxPrice = "";
this.onRefresh();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetFilters 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... | resetFilters(): void {
this.selectedCategoryIds = [];
this.minPrice = "";
this.maxPrice = "";
this.onRefresh();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 333d2d3f6eff9ba7fad2b34334faf47cd8be1be2 | github |
aimilin6688/KeePassHO | entry/src/main/ets/workers/DatabaseLoad.ets | arkts | loadKdbxFileContent | 加载文件内容
@param request 请求
@return Promise<ArrayBuffer> 文件内容
@throws Error 加载失败 | async loadKdbxFileContent(request: LoadDatabase): Promise<FileContentInfo> {
if (!request.filePath) {
hilog.error(DOMAIN, TAG, 'Worker error loading database: file path is empty');
throw new Error();
}
let result = await new KdbxFileManager(request.storageType, request.storageConfig).read(requ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadKdbxFileContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left request AST#identifier#Ri... | async loadKdbxFileContent(request: LoadDatabase): Promise<FileContentInfo> {
if (!request.filePath) {
hilog.error(DOMAIN, TAG, 'Worker error loading database: file path is empty');
throw new Error();
}
let result = await new KdbxFileManager(request.storageType, request.storageConfig).read(requ... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/workers/DatabaseLoad.ets#L48-L56 | 47ccc5cd4e70cb669916a2c1c20b9efebf61ce83 | github |
yang-kun-long/HarmonyAccounting | entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | getRdbStore | 获取RdbStore实例的封装方法
@param callback 回调函数,获取RdbStore后执行 | getRdbStore(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier... | getRdbStore(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback);
} | https://github.com/yang-kun-long/HarmonyAccounting | a4c1483b52c5e2fde5811d1499007937e66ba531 | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Column.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
ColumnSpaceBetween() { Text("A"); Text("B"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.... | https://github.com/Joker-x-dev/CoolMallArkTS | 76f96425cfd6436c838ca7e5c55a37ef23f8d17e | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/DatabaseHelper.ets | arkts | deleteTransaction | 删除单个交易记录
@param transactionId 交易记录ID
@returns 是否删除成功 | public static async deleteTransaction(transactionId: number): Promise<boolean> {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return await DatabaseHelper.transactionDao.deleteTransaction(transactionId);
} | 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 deleteTransaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left transactionId A... | public static async deleteTransaction(transactionId: number): Promise<boolean> {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return await DatabaseHelper.transactionDao.deleteTransaction(transactionId);
} | https://github.com/fuhhhhhhhh/openharmony | 61c6fd6e1faa21f25015ef3c025ba44676e2df6f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/remainder/remainder_long.ets | arkts | main | ---
desc: check remainder of division operation for two long integer operands
--- | function main(): void {
const a: long = {{v.left}}
const b: long = {{v.right}}
assert (a % b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: long = {{v.left}}
const b: long = {{v.right}}
assert (a % b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e9099b3f39e757bb13bf0038920884ee49c639c3 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | writeIntBE | Writes a signed integer to the buffer at the specified offset using big-endian format
@param {long} value - Value to write
@param {int} offset - Number of bytes to skip before writing
@param {int} byteLength - Number of bytes to write (maximum 6)
@returns {int} Offset plus the number of bytes written
@throws {Error} If... | public writeIntBE(value: long, offset: int, byteLength: int): int {
Buffer.checkByteLengthConstraint(byteLength);
this.checkWriteInt(value, offset, byteLength);
const view = this.getDataView();
let remaining = value;
for (let i = byteLength - 1; i >= 0... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeIntBE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#... | public writeIntBE(value: long, offset: int, byteLength: int): int {
Buffer.checkByteLengthConstraint(byteLength);
this.checkWriteInt(value, offset, byteLength);
const view = this.getDataView();
let remaining = value;
for (let i = byteLength - 1; i >= 0... | https://gitcode.com/iop123123/arkts-static-skills | 744eee23f9c8e027c08b0075ef9f41d6288ef59e | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test9_original_index.ets | arkts | testEscapeStrings | --- Escape sequences in strings --- | function testEscapeStrings(): string {
let tab: string = 'a\tb';
let newline: string = 'line1\nline2';
let backslash: string = 'path\\to\\file';
let quote: string = 'it\'s';
return tab.length + ',' + newline.length + ',' + backslash.length + ',' + quote.length;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testEscapeStrings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testEscapeStrings(): string {
let tab: string = 'a\tb';
let newline: string = 'line1\nline2';
let backslash: string = 'path\\to\\file';
let quote: string = 'it\'s';
return tab.length + ',' + newline.length + ',' + backslash.length + ',' + quote.length;
} | https://github.com/miaochiahao/ark-ghidra | 317ca3040141e4c935435231e6f1b214c17f1c8c | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/StoragePaths.ets | arkts | checkVmIntegrity | 检查 VM 目录完整性 | static async checkVmIntegrity(vmName: string): Promise<VmIntegrityResult> {
const result: VmIntegrityResult = {
hasDir: false,
hasDisk: false,
hasConfig: false,
hasLog: false,
diskSize: 0
}
try {
const vmDir = StoragePaths.getVmDir(vmName)
await fs.access(vmD... | 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 checkVmIntegrity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left ... | static async checkVmIntegrity(vmName: string): Promise<VmIntegrityResult> {
const result: VmIntegrityResult = {
hasDir: false,
hasDisk: false,
hasConfig: false,
hasLog: false,
diskSize: 0
}
try {
const vmDir = StoragePaths.getVmDir(vmName)
await fs.access(vmD... | https://github.com/AetheriumSimulator/qemu-hmos | 428aa5bca69cbc72bae241dfb13510cd3a00d5e9 | github |
Joker-x-dev/CoolMallArkTS | feature/market/src/main/ets/navigation/MarketGraph.ets | arkts | register | 注册营销模块导航路由 | register(): void {
RouteBuild.register(MarketRoutes.Coupon, wrapBuilder(CouponNav));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register 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#Lef... | register(): void {
RouteBuild.register(MarketRoutes.Coupon, wrapBuilder(CouponNav));
} | https://github.com/Joker-x-dev/CoolMallArkTS | 24bc9d9830f60991b3763d69902a1135f24a3dc1 | github |
silence17/harmonydemo | common_lib/src/main/ets/app/GlobalConstant.ets | arkts | getVersionCode | 获取版本号
@returns 3.2.1 | public static getVersionCode(): string {
return this.appInfo.versionName;
} | 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 getVersionCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getVersionCode(): string {
return this.appInfo.versionName;
} | https://github.com/silence17/harmonydemo | ef1f03fd90927750a68ce44aef96e8c957ae59d2 | github |
the-wwyang/kids-learning-app | src/main/ets/common/ErrorHandler.ets | arkts | showUserError | 显示错误给用户 | private static showUserError(errorInfo: ErrorInfo): void {
const userMessage = this.getUserFriendlyMessage(errorInfo);
try {
switch (errorInfo.level) {
case ErrorLevel.INFO:
promptAction.showToast({
message: userMessage,
duration: 2000
});
b... | 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 showUserError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left errorInfo AST#identifier#Right AST#:#L... | private static showUserError(errorInfo: ErrorInfo): void {
const userMessage = this.getUserFriendlyMessage(errorInfo);
try {
switch (errorInfo.level) {
case ErrorLevel.INFO:
promptAction.showToast({
message: userMessage,
duration: 2000
});
b... | https://github.com/the-wwyang/kids-learning-app | 46175b4700355816ab0155f8fc1fecc30300f76b | github |
xiebyapps/ClipLink | entry/src/main/ets/services/ConfigService.ets | arkts | updateServerConfig | Update server config | async updateServerConfig(server: ServerConfig): Promise<void> {
this.config.server = server;
await this.saveConfig(this.config);
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateServerConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_p... | async updateServerConfig(server: ServerConfig): Promise<void> {
this.config.server = server;
await this.saveConfig(this.config);
} | https://github.com/xiebyapps/ClipLink | 72f21d3587cb18186786c4b13727e898cd3f2af5 | github |
apap6628114/nga_oh | entry/src/main/ets/common/managers/PaginationManager.ets | arkts | deletePrefetched | 删除指定页的预取缓存。commit 完成后调用以释放。
@param page - 页码 | protected deletePrefetched(page: number): void {
this.prefetchedPages.delete(page)
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left deletePrefetched AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | protected deletePrefetched(page: number): void {
this.prefetchedPages.delete(page)
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L103-L105 | aa9c2e333452a24c2dfe5b9124087d62a2566ba3 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | acos | Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of this Decimal.
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | public acos(): Decimal {
let x: Decimal = this;
let k = x.abs().comparedTo(1);
let pr = Decimal.precision;
let rm = Decimal.rounding;
if (k != -1) {
return k == 0
// |x| is 1
? x.isNegative() ? Utils.getPi(pr, rm) : new Decimal(0)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left acos AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public acos(): Decimal {
let x: Decimal = this;
let k = x.abs().comparedTo(1);
let pr = Decimal.precision;
let rm = Decimal.rounding;
if (k != -1) {
return k == 0
// |x| is 1
? x.isNegative() ? Utils.getPi(pr, rm) : new Decimal(0)
... | https://gitcode.com/iop123123/arkts-static-skills | 6fafb0fac6f96adb92b9b03f46b4bfab2d74ba79 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | make | Makes enum instance with constant name
@param {string} constantName Constant name
@returns {Object} Enum instance
@throws {Error} Not implemented yet
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public make(constantName: string): Object {
// NOTE(shumilov-petr): not implemented
throw new Error("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 make AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left constantName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | public make(constantName: string): Object {
// NOTE(shumilov-petr): not implemented
throw new Error("not implemented")
} | https://gitcode.com/iop123123/arkts-static-skills | e4dbc33f8be02f953df18ba7c5ab32b3fdc249c1 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | onClose | LIFE CYCLES
Called when the tab is being closed. | onClose() {
clearTimeout(this.saveHistoryTimeoutId);
clearTimeout(this.wsBackupReqTmId);
this.deleteWebState();
// Destroy the web node.
if (this.isActive) {
this.requestDestroyNode();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onClose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST... | onClose() {
clearTimeout(this.saveHistoryTimeoutId);
clearTimeout(this.wsBackupReqTmId);
this.deleteWebState();
// Destroy the web node.
if (this.isActive) {
this.requestDestroyNode();
}
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 6dd3a55633bc93905ab7e5f42bbc5079c1907263 | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics2D/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/CanvasGetResult.ets | arkts | draw | [Start arkts_graphics_draw_direct_canvas_api_rewrite] | async draw(context: DrawContext) {
const canvas = context.canvas;
if (canvas === null) {
console.error('Canvas is null.');
return;
}
// 4. 自定义的绘制相关操作
const brush = new drawing.Brush();
if (brush === null) {
console.error('Brush is null.');
return;
} else {
bru... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left draw AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async draw(context: DrawContext) {
const canvas = context.canvas;
if (canvas === null) {
console.error('Canvas is null.');
return;
}
// 4. 自定义的绘制相关操作
const brush = new drawing.Brush();
if (brush === null) {
console.error('Brush is null.');
return;
} else {
bru... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 1d2f932c7d1beeeaac96711dd84f030f4305809d | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/managers/VNCSettings.ets | arkts | getSettings | 获取当前设置 | getSettings(): VNCSettingsData {
return {
nativePort: this.settings.nativePort,
autoConnect: this.settings.autoConnect
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSettings 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 VNCSettingsData AST#identifier#Right AST#ERROR#Rig... | getSettings(): VNCSettingsData {
return {
nativePort: this.settings.nativePort,
autoConnect: this.settings.autoConnect
}
} | https://github.com/AetheriumSimulator/qemu-hmos | c896c42f392486a4aa75990592fae75801874ca3 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/view/NetworkDemoPage.ets | arkts | build | 构建 Network Demo 示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_base_network_title"),
viewModel: this.vm
}) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.NetworkDemoContent()
});
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.demo_base_network_title"),
viewModel: this.vm
}) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.NetworkDemoContent()
});
}
} | https://github.com/Joker-x-dev/HarmonyKit | 321807ff4bcd94f170cd7cd7bb7e4a9bf31fffd6 | github |
LZZLHY/hlib | entry/src/main/ets/utils/I18n.ets | arkts | isZh | 是否中文环境 | static isZh(): boolean {
const loc = I18n.currentLocale().toLowerCase();
return loc.startsWith('zh');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left isZh AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | static isZh(): boolean {
const loc = I18n.currentLocale().toLowerCase();
return loc.startsWith('zh');
} | https://github.com/LZZLHY/hlib | d27021a6746233d7e4fc3020a27f55217a89fa76 | github |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/viewmodel/MusicListPlaybackViewModel.ets | arkts | requestPlayByListIndex | Requests playback for the row at the given index, or opens the player if it is already the current song.
@param index Zero-based playlist index. | public requestPlayByListIndex(index: number): void {
if (index < 0 || index >= this.playlistSongUis.length) {
return;
}
const item = this.playlistSongUis[index];
if (this.isCurrentSong(item)) {
this.playbackIntent.pendingPlaySongId = -1;
this.playbackIntent.openPlayerUi = true;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left requestPlayByListIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public requestPlayByListIndex(index: number): void {
if (index < 0 || index >= this.playlistSongUis.length) {
return;
}
const item = this.playlistSongUis[index];
if (this.isCurrentSong(item)) {
this.playbackIntent.pendingPlaySongId = -1;
this.playbackIntent.openPlayerUi = true;
... | https://gitcode.com/HarmonyOS_Samples/MusicHome | aca62c52d267ab88b584f54dfcb9fa18b899a663 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | getValidationNotificationId | 获取当前校验任务的通知ID
用于外部取消通知 | getValidationNotificationId(): number {
if (!this.currentValidationTaskId) {
return 0;
}
// 使用与NotificationManager相同的哈希算法
let hash = 0;
for (let i = 0; i < this.currentValidationTaskId.length; i++) {
const char = this.currentValidationTaskId.charCodeAt(i);
hash = ((hash << 5) - h... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getValidationNotificationId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Righ... | getValidationNotificationId(): number {
if (!this.currentValidationTaskId) {
return 0;
}
// 使用与NotificationManager相同的哈希算法
let hash = 0;
for (let i = 0; i < this.currentValidationTaskId.length; i++) {
const char = this.currentValidationTaskId.charCodeAt(i);
hash = ((hash << 5) - h... | https://github.com/DaLongZhuaZi/manxia | f35a284f7c461ce973766e7e00548d1d4ba9b1d8 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.