nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Editor/FileEditorService.ets | arkts | normalizeSaveTarget | 标准化保存目标 | public normalizeSaveTarget(target: FileEditorSaveTarget | undefined, filePath: string | undefined): FileEditorSaveTarget {
if (target) {
const normalized: FileEditorSaveTarget = {
type: target.type,
id: target.id ?? '',
name: target.name ?? '',
path: target.path ?? filePath ?... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left normalizeSaveTarget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_exp... | public normalizeSaveTarget(target: FileEditorSaveTarget | undefined, filePath: string | undefined): FileEditorSaveTarget {
if (target) {
const normalized: FileEditorSaveTarget = {
type: target.type,
id: target.id ?? '',
name: target.name ?? '',
path: target.path ?? filePath ?... | https://github.com/DaLongZhuaZi/manxia | f997a8ecb583beb355fbaea1ac8667c7994bd142 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/AppStorageManager.ets | arkts | completeLesson | 完成一节课 | public async completeLesson(moduleName: string, starsEarned: number): Promise<boolean> {
// 获取当前进度
let progress = await this.getLearningProgress(moduleName);
if (progress === null) {
// 创建新进度
progress = new LearningProgress(moduleName, 0, 0, 0, 0);
}
// 更新进度
progress.completedLes... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left completeLesson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async completeLesson(moduleName: string, starsEarned: number): Promise<boolean> {
// 获取当前进度
let progress = await this.getLearningProgress(moduleName);
if (progress === null) {
// 创建新进度
progress = new LearningProgress(moduleName, 0, 0, 0, 0);
}
// 更新进度
progress.completedLes... | https://github.com/the-wwyang/kids-learning-app | 7ed9231d233eaf2fd170b43f0da1d0dbf062af71 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | batchSet | 批量设置多个值
Requirements: 12.2, 12.4
@param settings 设置键值对映射
@returns 操作结果 | public async batchSet(settings: Map<string, SettingValue>): Promise<SettingsResult<void>> {
if (settings.size === 0) {
return createSuccessResult();
}
const errors: string[] = [];
// 先验证所有设置
const settingsEntries = Array.from(settings.entries());
for (let i = 0; i < settingsEntries.len... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left batchSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left settings AST#identifier#Righ... | public async batchSet(settings: Map<string, SettingValue>): Promise<SettingsResult<void>> {
if (settings.size === 0) {
return createSuccessResult();
}
const errors: string[] = [];
// 先验证所有设置
const settingsEntries = Array.from(settings.entries());
for (let i = 0; i < settingsEntries.len... | https://github.com/richshaw2015/nds | b2edef702bc1b0c9e96fc846346980dfb33f0c52 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | saveSingleSetting | 保存单个设置值到 Preferences
@param key 设置键名
@param value 设置值
@param type 设置类型 | private async saveSingleSetting(key: string, value: SettingValue, type: SettingType): Promise<void> {
if (!this.dataPreferences) {
throw new Error('Preferences not initialized');
}
switch (type) {
case SettingType.BOOLEAN:
await this.dataPreferences.put(key, value as boolean);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveSingleSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left... | private async saveSingleSetting(key: string, value: SettingValue, type: SettingType): Promise<void> {
if (!this.dataPreferences) {
throw new Error('Preferences not initialized');
}
switch (type) {
case SettingType.BOOLEAN:
await this.dataPreferences.put(key, value as boolean);
... | https://github.com/richshaw2015/nds | 75bc3c730a4a17cdca54bd7a6ebf9027eca5d531 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ProviderShareCodec.ets | arkts | decode | 解析 envelope JSON 字符串、校验来源、用密码解密、返回明文 data。
校验失败 / 密码错 / JSON 损坏分别返回不同 error code。 | async decode(envelopeJson: string, password: string): Promise<ProviderShareCodecDecodeResult> {
let envelope: ProviderShareEnvelopeV1
try {
const parsed = JSON.parse(envelopeJson) as ProviderShareEnvelopeV1
if (parsed === null || typeof parsed !== 'object') {
return { ok: false, data: null... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left decode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left envelopeJson AST#identifier#Right AST#type_annotation#Left AST#... | async decode(envelopeJson: string, password: string): Promise<ProviderShareCodecDecodeResult> {
let envelope: ProviderShareEnvelopeV1
try {
const parsed = JSON.parse(envelopeJson) as ProviderShareEnvelopeV1
if (parsed === null || typeof parsed !== 'object') {
return { ok: false, data: null... | https://github.com/LongLiveY96/chatcube | 40a7eb2b07e0a83f7fe348e6739ed18df6cd70f5 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | wakeComputer | 网络唤醒 (Wake-on-LAN) | async wakeComputer(uuid: string): Promise<void> {
const computer = this.computers.get(uuid);
if (!computer || !computer.macAddress) {
throw new Error('无法唤醒:缺少 MAC 地址');
}
await WakeOnLan.sendWolToAddresses(
computer.macAddress,
this.collectAddresses(computer),
computer.httpPor... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left wakeComputer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uuid AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async wakeComputer(uuid: string): Promise<void> {
const computer = this.computers.get(uuid);
if (!computer || !computer.macAddress) {
throw new Error('无法唤醒:缺少 MAC 地址');
}
await WakeOnLan.sendWolToAddresses(
computer.macAddress,
this.collectAddresses(computer),
computer.httpPor... | https://github.com/AlkaidLab/moonlight-harmony | 9e7450b4aa08cb503e12b00fc7a34cc64d47712b | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | dispatchCallback | 分发回调到主线程 | private dispatchCallback(task: Task, type: string, data?: number | Error): void {
// 使用 setTimeout 切换到主线程
setTimeout(() => {
try {
const callback = task.getCallback();
switch (type) {
case 'start':
callback.onStart();
break;
case 'prog... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dispatchCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private dispatchCallback(task: Task, type: string, data?: number | Error): void {
// 使用 setTimeout 切换到主线程
setTimeout(() => {
try {
const callback = task.getCallback();
switch (type) {
case 'start':
callback.onStart();
break;
case 'prog... | https://github.com/jjjjjjava/ffmpeg_tools | c8a03a1479b0325427563b494361ef41f76bb220 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Initialization/DataInitializer.ets | arkts | initializeSandboxManager | 初始化沙箱存储管理器 | private async initializeSandboxManager(context: common.UIAbilityContext): Promise<void> {
try {
logger.info(TAG, '开始初始化沙箱存储管理器...');
const sandboxManager = SandboxManager.getInstance();
await sandboxManager.initialize(context);
// 验证关键目录路径
const cacheDir = sandboxManage... | 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 initializeSandboxManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right... | private async initializeSandboxManager(context: common.UIAbilityContext): Promise<void> {
try {
logger.info(TAG, '开始初始化沙箱存储管理器...');
const sandboxManager = SandboxManager.getInstance();
await sandboxManager.initialize(context);
// 验证关键目录路径
const cacheDir = sandboxManage... | https://github.com/DaLongZhuaZi/manxia | c685569470cb6cd0cf150104b55e710e698ec082 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setDrawBottomYLabelEntry | set this to true to enable drawing the bottom y-label entry. Disabling this can be helpful
when the bottom y-label and
left x-label interfere with each other. default: true
@param enabled | public setDrawBottomYLabelEntry(enabled: boolean): void {
this.mDrawBottomYLabelEntry = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawBottomYLabelEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | public setDrawBottomYLabelEntry(enabled: boolean): void {
this.mDrawBottomYLabelEntry = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d7d0746d55773ed448a99cf1b9c3904ff48e5739 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/ModelManager.ets | arkts | preloadAllModels | 预加载所有模型
应用启动时调用,提前加载所有模型到内存 | async preloadAllModels(): Promise<void> {
console.info('ModelManager: 开始预加载所有模型');
const loadPromises = Object.values(ImagingType).map(type =>
this.loadModel(type as ImagingType).catch(error => {
console.error(`ModelManager: 预加载模型失败 ${type}`, error);
// 不抛出异常,继续加载其他模型
})
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left preloadAllModels 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#:#Righ... | async preloadAllModels(): Promise<void> {
console.info('ModelManager: 开始预加载所有模型');
const loadPromises = Object.values(ImagingType).map(type =>
this.loadModel(type as ImagingType).catch(error => {
console.error(`ModelManager: 预加载模型失败 ${type}`, error);
// 不抛出异常,继续加载其他模型
})
... | https://github.com/LJ666-ui/harmony-health-care | 6dbf8494ffce53099cb4615db6677189d94b7be3 | github |
webabcd/HarmonyDemo | entry/src/main/ets/entryability/EntryAbility.ets | arkts | stopErrorManager | 停止监听未处理异常 | stopErrorManager() {
if (this.errorManagerId > -1) {
errorManager.off("error", this.errorManagerId, (err: BusinessError) => {
// 注:我是在 onDestroy() 中调用这里的,此时 MyLog 不能用了,需要直接用 hilog 或 console 写日志
console.info(`errorManager.off("error") errorManagerId:${this.errorManagerId}, errCode:${err.code}... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left stopErrorManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | stopErrorManager() {
if (this.errorManagerId > -1) {
errorManager.off("error", this.errorManagerId, (err: BusinessError) => {
// 注:我是在 onDestroy() 中调用这里的,此时 MyLog 不能用了,需要直接用 hilog 或 console 写日志
console.info(`errorManager.off("error") errorManagerId:${this.errorManagerId}, errCode:${err.code}... | https://github.com/webabcd/HarmonyDemo | 975d2674a5610c628216ee24cc6248c9d19e4236 | github |
openharmony-sig/qr-code-generator | library/src/main/ets/components/MainPage/qrcodegen.ets | arkts | getNumDataCodewords | Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
QR Code of the given version number and error correction level, with remainder bits discarded.
This stateless pure function could be implemented as a (40*4)-cell lookup table. | private static getNumDataCodewords(ver: int, ecl: QrCode.Ecc): int {
return Math.floor(QrCode.getNumRawDataModules(ver) / 8) -
QrCode.ECC_CODEWORDS_PER_BLOCK [ecl.ordinal][ver] *
QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
} | 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 getNumDataCodewords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ver AST#identifier#Right AST#:#L... | private static getNumDataCodewords(ver: int, ecl: QrCode.Ecc): int {
return Math.floor(QrCode.getNumRawDataModules(ver) / 8) -
QrCode.ECC_CODEWORDS_PER_BLOCK [ecl.ordinal][ver] *
QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
} | https://gitee.com/openharmony-sig/qr-code-generator.git | 9e7ce0252523e67bde67a31d0a25fd11b8dd2219 | gitee |
CLMC2025/Vignette | entry/src/main/ets/ui/Animations.ets | arkts | StaggeredAnimation | 交错动画组件 | @Builder
function StaggeredAnimation(
key: string,
count: number,
duration: number = 300,
staggerDelay: number = 100,
progress: number
): void {
Column() {
ForEach(Array.from({ length: count }), (item: ESObject, index: number) => {
Column() {
// 内容直接嵌入
}
.opacity(progress)
... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left StaggeredAnimation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AS... | @Builder
function StaggeredAnimation(
key: string,
count: number,
duration: number = 300,
staggerDelay: number = 100,
progress: number
): void {
Column() {
ForEach(Array.from({ length: count }), (item: ESObject, index: number) => {
Column() {
// 内容直接嵌入
}
.opacity(progress)
... | https://github.com/CLMC2025/Vignette | 69570bd204006fcb613881fdde1ff7c0240f1d33 | github |
the-wwyang/kids-learning-app | src/main/ets/services/ScoreService.ets | arkts | getLevelTitle | 获取等级标题 | public getLevelTitle(level: number): string {
if (level >= 50) return '学霸';
if (level >= 40) return '优等生';
if (level >= 30) return '好学生';
if (level >= 20) return '进步之星';
if (level >= 10) return '努力者';
return '初学者';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLevelTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | public getLevelTitle(level: number): string {
if (level >= 50) return '学霸';
if (level >= 40) return '优等生';
if (level >= 30) return '好学生';
if (level >= 20) return '进步之星';
if (level >= 10) return '努力者';
return '初学者';
} | https://github.com/the-wwyang/kids-learning-app | fe05695c990454cf71fc8e6ce180f6839c931dbd | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | setPropertyValue | 设置属性值(自动触发 UI 刷新)
@param propertyName 属性名
@param value 属性值 | setPropertyValue(propertyName: string, value: ValueType): void {
// 更新 properties 数组(向后兼容)
for (let i = 0; i < this.properties.length; i++) {
if (this.properties[i].propertyName === propertyName) {
this.properties[i].value = value
break
}
}
// 更新 propertyMap(触发响应式更新)
th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPropertyValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left ... | setPropertyValue(propertyName: string, value: ValueType): void {
// 更新 properties 数组(向后兼容)
for (let i = 0; i < this.properties.length; i++) {
if (this.properties[i].propertyName === propertyName) {
this.properties[i].value = value
break
}
}
// 更新 propertyMap(触发响应式更新)
th... | https://github.com/offlinecat-dev/OCNetORM | ede058f9bb8ec437108ff50961ae10a9c21f206b | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/CupertinoIcons.ets | arkts | registerFont | 注册 CupertinoIcons 字体
需要在应用启动时调用一次
@param uiContext - UI上下文对象 | static registerFont(uiContext: UIContext): void {
try {
const font = uiContext.getFont();
font.registerFont({
familyName: 'CupertinoIcons',
familySrc: $rawfile('CupertinoIcons.ttf')
});
} catch (error) {
console.error('Failed to register CupertinoIcons font:', JSON.stri... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left registerFont AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static registerFont(uiContext: UIContext): void {
try {
const font = uiContext.getFont();
font.registerFont({
familyName: 'CupertinoIcons',
familySrc: $rawfile('CupertinoIcons.ttf')
});
} catch (error) {
console.error('Failed to register CupertinoIcons font:', JSON.stri... | https://github.com/richshaw2015/nds | dbb6d34716ec08b3e9dc2d731979347a70c6a5ab | github |
openharmony-sig/applications_compass | feature/compass/src/main/ets/controller/CompassController.ets | arkts | setAngleUpdateListener | Set angle changed listener. | public setAngleUpdateListener(listener: (Angle: number) => void) {
this.angleUpdateListener = listener;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left setAngleUpdateListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#assignment_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public setAngleUpdateListener(listener: (Angle: number) => void) {
this.angleUpdateListener = listener;
} | https://gitee.com/openharmony-sig/applications_compass.git | f34651bf1a621497ead567ca4ffde7b9ffcee274 | gitee |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/CartRepository.ets | arkts | getCartCount | 获取购物车商品总数量
@returns {Promise<number>} 商品总数 | getCartCount(): Promise<number> {
return this.dataSource.getCartCount();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCartCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right... | getCartCount(): Promise<number> {
return this.dataSource.getCartCount();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 25463c8e729a0b72cdb333b01a3767ef0f691168 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | getPOIById | 根据ID获取POI详情 | public getPOIById(id: string): NavigationDestination | null {
if (!this.buildingData) return null;
return this.buildingData.pois.find(poi => poi.id === id) ?? null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPOIById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | public getPOIById(id: string): NavigationDestination | null {
if (!this.buildingData) return null;
return this.buildingData.pois.find(poi => poi.id === id) ?? null;
} | https://github.com/LJ666-ui/harmony-health-care | dee81248ddd80ad2a0cedbe6f26790b441408276 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DataValidator.ets | arkts | validateDownloadStatus | 验证下载状态
@param value - 要验证的状态
@param fieldName - 字段名称
@returns 验证结果 | static validateDownloadStatus(value: string | undefined | null, fieldName: string = 'downloadStatus'): ValidationResult {
const errors: string[] = [];
if (value === null || value === undefined) {
errors.push(`${fieldName} 不能为空`);
} else if (typeof value !== 'string') {
errors.push(`${fiel... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateDownloadStatus 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#binary_e... | static validateDownloadStatus(value: string | undefined | null, fieldName: string = 'downloadStatus'): ValidationResult {
const errors: string[] = [];
if (value === null || value === undefined) {
errors.push(`${fieldName} 不能为空`);
} else if (typeof value !== 'string') {
errors.push(`${fiel... | https://github.com/DaLongZhuaZi/manxia | 54e00b299358b0523c64ede62a169a23925d9b05 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | sendTextMessage | 发送文本消息
@param conversationId 会话ID
@param content 文本内容 | async sendTextMessage(conversationId: string, content: string): Promise<ApiResponse<Message>> {
return this.sendMessage({
conversationId,
type: MessageType.TEXT,
content
})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendTextMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AS... | async sendTextMessage(conversationId: string, content: string): Promise<ApiResponse<Message>> {
return this.sendMessage({
conversationId,
type: MessageType.TEXT,
content
})
} | https://github.com/David8Idira/AI-OA | 9ad7cde1b9a325ba5e6521cc04246863ffc1b2f5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | analyzePluginFiles | 分析插件文件 | private async analyzePluginFiles(): Promise<StorageItem> {
try {
const pluginsPath = this.sandboxManager.getDirectory('plugins');
const dirInfo = await this.getDirectoryInfo(pluginsPath);
const size = dirInfo.size;
const count = dirInfo.count;
return {
type: StorageTyp... | 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 analyzePluginFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async analyzePluginFiles(): Promise<StorageItem> {
try {
const pluginsPath = this.sandboxManager.getDirectory('plugins');
const dirInfo = await this.getDirectoryInfo(pluginsPath);
const size = dirInfo.size;
const count = dirInfo.count;
return {
type: StorageTyp... | https://github.com/DaLongZhuaZi/manxia | d2b01b1578c368e1aa43e311690578deaa355384 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | insertText | ==================== Text Editing ==================== | insertText(text: string): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.editorInsertText(this.handle, text));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertText 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#... | insertText(text: string): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.editorInsertText(this.handle, text));
} | https://github.com/FinalScave/SweetEditor | 24bb4b67ee1024de65bf613a6ffb5c4a6cf7256b | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/clog/Clog.ets | arkts | disableSave | 关闭除 error 外的落盘
调用后:info/warn 不再写入本地文件;error 仍会写入
不会清空或删除已有目录与文件 | public static disableSave(): void {
Clog.DISABLE_NON_ERROR_SAVE = true;
} | 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 disableSave 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 disableSave(): void {
Clog.DISABLE_NON_ERROR_SAVE = true;
} | https://github.com/ZestBox-18/kitebook-frontend | b9f4f008c2491097f6a4347e8411fe9ad030ef47 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | pushPartReasoning | 按到达顺序把一段 reasoning 文本合并到 aiMessage.parts。
若最后一个 part 就是尚未完成的 REASONING,则追加;否则 push 一个新的 reasoning part。
这是支持 DeepSeek V4 等 thinking↔tool 交错的核心:
每次出现 tool 后再回来的 reasoning 会被归为新 part, UI 可按顺序渲染。 | private pushPartReasoning(aiMessage: ChatMessage, delta: string): void {
if (delta === '') {
return
}
const last = aiMessage.parts.length > 0 ? aiMessage.parts[aiMessage.parts.length - 1] : null
if (last !== null && last.kind === MessagePartKind.REASONING && last.reasoningFinishedAt === 0) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left pushPartReasoning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private pushPartReasoning(aiMessage: ChatMessage, delta: string): void {
if (delta === '') {
return
}
const last = aiMessage.parts.length > 0 ? aiMessage.parts[aiMessage.parts.length - 1] : null
if (last !== null && last.kind === MessagePartKind.REASONING && last.reasoningFinishedAt === 0) {
... | https://github.com/LongLiveY96/chatcube | 7f10c6b3372e060605b676a59c5168cdb2df981e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/WeakMap.ets | arkts | set | The set() method adds a new element with a specified key
and value to a WeakMap object. | set(k: K, v: V): WeakMap<K, V> {
throw new Error("Not implemented");
return this;
} | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | set(k: K, v: V): WeakMap<K, V> {
throw new Error("Not implemented");
return this;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a8532c4600a6fd8ab9b7df05494c56acd9d47f6f | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | resetAll | 重置所有设置为默认值
@returns 操作结果 | public async resetAll(): Promise<SettingsResult<void>> {
// 重置缓存
this.settingsCache.clear();
const keys = Object.keys(SETTINGS_DEFINITIONS);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const definition = SETTINGS_DEFINITIONS[key];
if (definition !== undefined) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left resetAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ... | public async resetAll(): Promise<SettingsResult<void>> {
// 重置缓存
this.settingsCache.clear();
const keys = Object.keys(SETTINGS_DEFINITIONS);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const definition = SETTINGS_DEFINITIONS[key];
if (definition !== undefined) {
... | https://github.com/richshaw2015/nds | 59772738434806dc6be25a541eb19737c1ce6e70 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | constructor | `Date` constructor.
@param ms
@see ECMA-262, 21.4.2.1
@description Initialize `Date` instance with milliseconds given. | constructor(ms: long) {
this.ms = ms
this.TZOffset = Date.getLocalTimezoneOffset()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long AST#identifier#Right AST#)... | constructor(ms: long) {
this.ms = ms
this.TZOffset = Date.getLocalTimezoneOffset()
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5a89c635d13bfdc893fc8ec5f1e6b003b5e64c8d | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets | arkts | findStaticMethodByNameUnchecked | NOTE(kurnevichstanislav): squash two implementations into one after #31016 is fixed. | private static findStaticMethodByNameUnchecked(
methods: FixedArray<reflect.StaticMethod>,
name: string
): reflect.StaticMethod | undefined {
let candidate: reflect.StaticMethod | undefined = undefined
for (let method of methods) {
if (method.getName() == name) {
... | 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 findStaticMethodByNameUnchecked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left methods AST#identifi... | private static findStaticMethodByNameUnchecked(
methods: FixedArray<reflect.StaticMethod>,
name: string
): reflect.StaticMethod | undefined {
let candidate: reflect.StaticMethod | undefined = undefined
for (let method of methods) {
if (method.getName() == name) {
... | https://gitcode.com/iop123123/arkts-static-skills | 758edfa229173e65fab9626627dce8e4b82d6b7a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | setComicSourceEnabledByPkg | 按 pkg 启用/停用图源记录 | async setComicSourceEnabledByPkg(pkg: string, enabled: boolean): Promise<void> {
try {
const sql: string = 'UPDATE comic_source SET isEnabled = ?, lastUpdateTime = ? WHERE pkg = ?';
await this.databaseManager.executeSql(sql, [enabled ? 1 : 0, Date.now(), pkg]);
logger.info(TAG, `已更新图源启用状态: pkg=$... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setComicSourceEnabledByPkg AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pkg AST#identifier#Right AST#type_annotation#Left AS... | async setComicSourceEnabledByPkg(pkg: string, enabled: boolean): Promise<void> {
try {
const sql: string = 'UPDATE comic_source SET isEnabled = ?, lastUpdateTime = ? WHERE pkg = ?';
await this.databaseManager.executeSql(sql, [enabled ? 1 : 0, Date.now(), pkg]);
logger.info(TAG, `已更新图源启用状态: pkg=$... | https://github.com/DaLongZhuaZi/manxia | f03af7794aae320f33c3a87e6716f38e4aa1a7a5 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Double.ets | arkts | equals | Checks for equality this instance with provided object, treated as a Double
@param other object to be checked against
@returns true if provided object and this instance have same value, false otherwise
Returns false if type of provided object is not the same as this type | public override equals(other: Object|null): boolean {
if (other instanceof Double) {
return Double.compare(this.value, (other as Double).unboxed());
}
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#... | public override equals(other: Object|null): boolean {
if (other instanceof Double) {
return Double.compare(this.value, (other as Double).unboxed());
}
return false;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 228a14bd84c5f979c18e68f361ff30aea1041084 | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | setState | setState
@param state CalculatorState | setState(state: CalculatorState): void {
this.calculatorState = state;
AppStorage.set<CalculatorState>('calculatorState', state);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CalculatorState AST#identifier#Right AST#)#Lef... | setState(state: CalculatorState): void {
this.calculatorState = state;
AppStorage.set<CalculatorState>('calculatorState', state);
} | https://gitee.com/openharmony-sig/applications_calculator.git | 64a374147d6dc07590ab222e7abe359a940d2bec | gitee |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | extractHeader | ---------- header helpers ----------
@ohos.net.http does not guarantee header-name case. We check both the
canonical spelling and the all-lowercase form. | function extractHeader(headers: Record<string, string>, name: string): string | undefined {
const direct = headers[name];
if (direct !== undefined) {
return direct;
}
const lower = headers[name.toLowerCase()];
if (lower !== undefined) {
return lower;
}
return undefined;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractHeader AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left headers AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function extractHeader(headers: Record<string, string>, name: string): string | undefined {
const direct = headers[name];
if (direct !== undefined) {
return direct;
}
const lower = headers[name.toLowerCase()];
if (lower !== undefined) {
return lower;
}
return undefined;
} | https://github.com/Vincent-Leon/zotero-harmony | 1b821314f7c7b62f49170ea964c14c2646d8b6e1 | github |
aimilin6688/KeePassHO | entry/src/main/ets/components/PasswordGeneratorDialog.ets | arkts | aboutToAppear | 显示时评估密码强度 | aboutToAppear(): void {
this.resetPassword();
this.evaluatePasswordStrength();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
this.resetPassword();
this.evaluatePasswordStrength();
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/PasswordGeneratorDialog.ets#L35-L38 | 511f4993623476e8d82d9825cf0b572290940700 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates a copy of BigInt64Array.
@param { BigInt64Array } other - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(other: BigInt64Array) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLength = other.byteLength
this.lengthInt = other.length
this.byteOffset = 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Big... | public constructor(other: BigInt64Array) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLength = other.byteLength
this.lengthInt = other.length
this.byteOffset = 0
} | https://gitcode.com/iop123123/arkts-static-skills | db8f273ef4f5dd4877652a0a0e26f27b50ed5679 | gitcode |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | executeTopicFavoriteToggleWithCookie | Execute topic favorite toggle (requires Cookie session)
- Returns favorite state after operation | async executeTopicFavoriteToggleWithCookie(
cookie: string,
topicId: number,
toggle: V2exToggleAction,
): Promise<boolean> {
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
const topicPath = `/t/${topicId}`
await ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left executeTopicFavoriteToggleWithCookie AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie A... | async executeTopicFavoriteToggleWithCookie(
cookie: string,
topicId: number,
toggle: V2exToggleAction,
): Promise<boolean> {
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
const topicPath = `/t/${topicId}`
await ... | https://github.com/honjow/Next2V | 62d2d89328b864c6cc3ada91f4f49ac313518ed7 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | insertGeneratedMedia | ============ 生成图片图库 ============ | async insertGeneratedMedia(media: GeneratedMedia): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
id: media.id,
type: media.type,
prompt: media.prompt,
provider_id: media.provid... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insertGeneratedMedia AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left media AST#identifier#Right AST#type_annotation#Left AST#:#... | async insertGeneratedMedia(media: GeneratedMedia): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
id: media.id,
type: media.type,
prompt: media.prompt,
provider_id: media.provid... | https://github.com/LongLiveY96/chatcube | 4b3b19bf88b44b4284af96178be9cc6a12298235 | github |
egavrin/arkts_agent_kit | examples/fslib/src/tests/fslib.test.ets | arkts | testAppendText | --- appendText convenience --- | function testAppendText(): void {
ensureSetup()
let fs = new FileSystem()
let fpath: string = TMPDIR + "/append.txt"
fs.writeText(fpath, "first")
fs.appendText(fpath, "second")
fs.appendText(fpath, "third")
arktest.assertEQ(fs.readText(fpath), "firstsecondthird")
fs.remove(fpath)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testAppendText 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 testAppendText(): void {
ensureSetup()
let fs = new FileSystem()
let fpath: string = TMPDIR + "/append.txt"
fs.writeText(fpath, "first")
fs.appendText(fpath, "second")
fs.appendText(fpath, "third")
arktest.assertEQ(fs.readText(fpath), "firstsecondthird")
fs.remove(fpath)
} | https://gitcode.com/egavrin/arkts_agent_kit | b00e8ddb625a47952fda5d5a22b33a74f5d40e76 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | stack | Does stack replacement and clears previously collected stack info
@param { String | undefined } newStack - New stacktrace for the error
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | set stack(newStack: String | undefined) {
this.stack_ = newStack
this.stackLines = []
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left stack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left newStack AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Stri... | set stack(newStack: String | undefined) {
this.stack_ = newStack
this.stackLines = []
} | https://gitcode.com/iop123123/arkts-static-skills | b45f1d887f55214b2cd1e5f911f446482d363b27 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/utils/ThrottleUtil.ets | arkts | reset | 重置节流器状态 | reset(): void {
if (this.timerId !== -1) {
clearTimeout(this.timerId)
this.timerId = -1
}
this.pendingContent = ''
this.lastExecuteTime = 0
hilog.debug(DOMAIN, 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 {
if (this.timerId !== -1) {
clearTimeout(this.timerId)
this.timerId = -1
}
this.pendingContent = ''
this.lastExecuteTime = 0
hilog.debug(DOMAIN, TAG, '🔄 节流器已重置')
} | https://github.com/LongLiveY96/chatcube | 73f24ac2e6fb7bb9c929ad6a32f275e3242535d2 | github |
arkui-x/samples | CodeLab/Cases/feature/compressfile/src/main/ets/components/CompressFileComponent.ets | arkts | listCompressBundle | 读取压缩包输出目录下压缩包
@param outDir 压缩包输出目录
@returns | listCompressBundle(outDir: string) {
fs.listFile(outDir).then((fileNames: Array<string>) => {
this.compressBundleName = fileNames[0];
}).catch((err: BusinessError) => {
logger.error(TAG, `list file failed with error message: ${err.message}, error code: ${err.code}`)
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left listCompressBundle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left outDir AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifie... | listCompressBundle(outDir: string) {
fs.listFile(outDir).then((fileNames: Array<string>) => {
this.compressBundleName = fileNames[0];
}).catch((err: BusinessError) => {
logger.error(TAG, `list file failed with error message: ${err.message}, error code: ${err.code}`)
})
} | https://gitcode.com/arkui-x/samples | b24634b3ff3dfb7ae916cad24a6f7e227922a03d | gitcode |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | selectSQL | 查询指定SQL,仅最后调用有效
@param sql sql语句
@returns Wrapper | selectSQL(sql: string): Wrapper {
this.selectSql = sql
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectSQL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sql AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#... | selectSQL(sql: string): Wrapper {
this.selectSql = sql
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L331-L334 | 2aa3a4ec0a95626ff1de24187eb090e11934e960 | github |
YANGZX22/Voot | entry/src/main/ets/services/ContinuityService.ets | arkts | getDeviceTypeIconName | 获取设备类型图标名称(返回字符串,UI 层处理显示) | static getDeviceTypeIconName(deviceType: number): string {
switch (deviceType) {
case 0x0E:
return 'phone';
case 0x11:
return 'tablet';
case 0x6D:
return 'phone_flip';
case 0x0A:
return 'laptop';
default:
return 'device';
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDeviceTypeIconName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | static getDeviceTypeIconName(deviceType: number): string {
switch (deviceType) {
case 0x0E:
return 'phone';
case 0x11:
return 'tablet';
case 0x6D:
return 'phone_flip';
case 0x0A:
return 'laptop';
default:
return 'device';
}
} | https://github.com/YANGZX22/Voot | b91e545209b3200a1384c37c7b8b6b6d79decc35 | github |
Eklps/harmony-mall-perf | entry/src/main/ets/viewmodel/ListDataSource.ets | arkts | advancedFilter | 高级筛选接口 | public advancedFilter(minPrice: number, maxPrice: number, sortType: SortType) {
this.currentMinPrice = minPrice;
this.currentMaxPrice = maxPrice;
this.currentSortType = sortType;
this.applyFilter();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left advancedFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minPrice AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public advancedFilter(minPrice: number, maxPrice: number, sortType: SortType) {
this.currentMinPrice = minPrice;
this.currentMaxPrice = maxPrice;
this.currentSortType = sortType;
this.applyFilter();
} | https://github.com/Eklps/harmony-mall-perf | 91744e5312d9228bbf75dbd607df7e115b6e8941 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceMethod.ets | arkts | isFinal | Checks if the method is a final method.
@returns { boolean } Returns true if the method is final, otherwise returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isFinal(): boolean {
return (this.attributes & Attributes.FINAL) != 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFinal 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#boole... | public isFinal(): boolean {
return (this.attributes & Attributes.FINAL) != 0
} | https://gitcode.com/iop123123/arkts-static-skills | 5327bd139963ad69d2d81e6c3a37794bc326d927 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | length | Gets the number of elements in the list.
@returns The number of elements in the list. | public get length(): int {
return this.buffer.length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | public get length(): int {
return this.buffer.length;
} | https://gitcode.com/iop123123/arkts-static-skills | 9d7c544f17233263549744a43254a8dfef103a2e | gitcode |
Cool_foolisher1/ArkTSRepository | MultiCalculator/features/calculator/src/main/ets/components/Calculator.ets | arkts | getSymbol | 获取运算符 | getSymbol(value: string) {
if (checkEmptyUtil.isEmpty(value)) {
return ''
}
let symbol = ''
switch (value) {
case Symbol.ADD:
symbol = CommonConstants.ADD
break
case Symbol.MIN:
symbol = CommonConstants.MIN
break
case Symbol.MUL:
symbol =... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSymbol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AS... | getSymbol(value: string) {
if (checkEmptyUtil.isEmpty(value)) {
return ''
}
let symbol = ''
switch (value) {
case Symbol.ADD:
symbol = CommonConstants.ADD
break
case Symbol.MIN:
symbol = CommonConstants.MIN
break
case Symbol.MUL:
symbol =... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 7fa26f21d1f62c8b36a5042370f85ac7886a9683 | gitcode |
killetom/ktretrofit | entry/src/main/ets/example/RetrofitConfigExample.ets | arkts | searchUsersWithNotNullBodyExample | Example using getNotNullBody() method for simplified error handling | searchUsersWithNotNullBodyExample(queryParams: Record<string, string>): User[] {
try {
const userService = this.createUserService();
const call = userService.searchUsers(queryParams);
const response = call.execute();
// Using getNotNullBody() to automatically check for successful re... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchUsersWithNotNullBodyExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left queryParams AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | searchUsersWithNotNullBodyExample(queryParams: Record<string, string>): User[] {
try {
const userService = this.createUserService();
const call = userService.searchUsers(queryParams);
const response = call.execute();
// Using getNotNullBody() to automatically check for successful re... | https://github.com/killetom/ktretrofit | c5c99df1c8de878839fe5c7b72b9fc04715c4a8c | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | selectCoupon | 选择优惠券
@param {Coupon | null} coupon 选中的优惠券,null表示不使用优惠券
@returns {void} 无返回值 | selectCoupon(coupon: Coupon | null): void {
this.selectedCoupon = coupon;
this.hideCouponModal();
this.calculatePrices();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectCoupon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left coupon AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left Coupon AST#ide... | selectCoupon(coupon: Coupon | null): void {
this.selectedCoupon = coupon;
this.hideCouponModal();
this.calculatePrices();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 4c1aa0259a2962b464dcad4d93dbbef7ce24734f | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/components/ImageCropper.ets | arkts | canRedo | / history | private canRedo(): boolean {
if (this._actionDetails == null) {
return false;
}
return this._currentIndex < this._history.length - 1;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left canRedo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo... | private canRedo(): boolean {
if (this._actionDetails == null) {
return false;
}
return this._currentIndex < this._history.length - 1;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/components/ImageCropper.ets#L1212-L1218 | 7fae9bc63dd28c64bfa94a467457e36f1e837ea5 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/common/base/BaseViewModel.ets | arkts | processIntent | 异步的方式执行intention
@param intention view的意图
return 执行结果 | public async processIntent(intention: BaseIntent): Promise<ProcessResult> {
Log.info(`start processIntent: ${intention.getIntentTag()}.`);
if (this._model === null || this._model === undefined) {
this._model = this.initModel();
}
if (this._viewState === null || this._viewState === undefined) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left processIntent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left intention AST#identifier#Right AST#:#Left ... | public async processIntent(intention: BaseIntent): Promise<ProcessResult> {
Log.info(`start processIntent: ${intention.getIntentTag()}.`);
if (this._model === null || this._model === undefined) {
this._model = this.initModel();
}
if (this._viewState === null || this._viewState === undefined) {
... | https://gitee.com/openharmony/applications_permission_manager.git | 400a2cbac7974ef0fc9e896272b0424d7d8edb25 | gitee |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/database-crud-template.ets | arkts | deleteUser | ==================== DELETE ==================== | async deleteUser(id: number): Promise<number> {
if (!this.rdbStore) throw new Error('DB not initialized');
let predicates = new relationalStore.RdbPredicates('users');
predicates.equalTo('id', id);
let rows = await this.rdbStore.delete(predicates);
console.log(`Deleted ${rows} rows`);
return r... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteUser AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left ... | async deleteUser(id: number): Promise<number> {
if (!this.rdbStore) throw new Error('DB not initialized');
let predicates = new relationalStore.RdbPredicates('users');
predicates.equalTo('id', id);
let rows = await this.rdbStore.delete(predicates);
console.log(`Deleted ${rows} rows`);
return r... | https://github.com/Goway-Hui/harmonyos-next-dev | 6e160d1c330129a44051e75885263459456a1790 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | getActiveAnimationCount | 获取活跃动画数量 | public getActiveAnimationCount(): number {
return this.activeAnimations.size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getActiveAnimationCount 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 nu... | public getActiveAnimationCount(): number {
return this.activeAnimations.size;
} | https://github.com/DaLongZhuaZi/manxia | afabb8ee76d4240cb880eb8858b4f621796df3a0 | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/SchedulePage.ets | arkts | build | --------------------------------------------------------------------------
主布局渲染 (Build)
-------------------------------------------------------------------------- | build() {
Stack() {
Column() {
// 1. 顶部导航
this.buildNavigationBar()
// 2. 课程表主体内容
Column() {
// 2.1 星期表头
this.buildWeekHeader()
// 2.2 课程表网格区域
// 使用 Grid 布局:左侧1列时间 + 右侧7列课程
Grid() {
ForEach(ScheduleConfig.PERIODS... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack() {
Column() {
// 1. 顶部导航
this.buildNavigationBar()
// 2. 课程表主体内容
Column() {
// 2.1 星期表头
this.buildWeekHeader()
// 2.2 课程表网格区域
// 使用 Grid 布局:左侧1列时间 + 右侧7列课程
Grid() {
ForEach(ScheduleConfig.PERIODS... | https://gitcode.com/openharmony/codelabs | f6e0646cda1501ec549681c1d4882ebcc64e686b | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | MemoryDetection/entry/src/main/ets/pages/MemoryLeakDetection.ets | arkts | onInit | 正确声明类属性 | onInit() {
this.timer = setInterval(() => {
this.updateData(); // 通过this调用类方法
}, 1000);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onInit 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#... | onInit() {
this.timer = setInterval(() => {
this.updateData(); // 通过this调用类方法
}, 1000);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | ee457d390ca6b475d49fefecead89fb4e58d1d88 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | isTimeoutError | 判断错误是否为超时错误 | private isTimeoutError(errMsg: string): boolean {
return NvHttp.isTimeoutError(errMsg);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isTimeoutError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left errMsg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private isTimeoutError(errMsg: string): boolean {
return NvHttp.isTimeoutError(errMsg);
} | https://github.com/AlkaidLab/moonlight-harmony | 9d46c2e99d2d4a2bbf243e184512f371d7da5fcf | github |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/SshClient.ets | arkts | sftpReadFile | Read a remote text file. | async sftpReadFile(remotePath: string): Promise<string> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
return await ssh.sftpReadFile(this.handle, remotePath);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP readFile failed';
const e... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpReadFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Right AST#type_annota... | async sftpReadFile(remotePath: string): Promise<string> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
return await ssh.sftpReadFile(this.handle, remotePath);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP readFile failed';
const e... | https://github.com/UnbalancedCat/ohos-ssh-core | 114622cca5aa080a89be863d2e4241436672c512 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | rawQuery | ==================== 原生 SQL 查询 ====================
执行原生 SQL 查询(只读)
@param sql SQL 查询语句
@param args 查询参数
@returns Promise<Array<EntityData>> | async rawQuery(sql: string, args: Array<ValueType> = []): Promise<Array<EntityData>> {
const startTime = Date.now()
return await this.withSessionStore(async (repo) => {
try {
const normalizedSql = validateRawQuerySql(sql)
const placeholderCount = countSqlPlaceholders(normalizedSql)
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left rawQuery AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sql AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async rawQuery(sql: string, args: Array<ValueType> = []): Promise<Array<EntityData>> {
const startTime = Date.now()
return await this.withSessionStore(async (repo) => {
try {
const normalizedSql = validateRawQuerySql(sql)
const placeholderCount = countSqlPlaceholders(normalizedSql)
... | https://github.com/offlinecat-dev/OCNetORM | acca8bdbbc3604948bf3f6c92b10d0b71cbf3b66 | github |
Gokr-ble/LocalSendLite_HarmonyOS_NEXT | entry/src/main/ets/utils/Server.ets | arkts | startServer | constructor(animControllerRef: AnimController) {
this.animController = animControllerRef
} | startServer() {
this.dataPreferences.putSync('showRestartServerHind', false)
let animatorOptions: AnimatorResult | undefined = AppStorage.get('animatorOptions')
animatorOptions?.play()
LogUtil.info(`animatorOptions: ${animatorOptions}`)
let port = this.dataPreferences.getSync('serverPort', 'defa... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startServer 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... | startServer() {
this.dataPreferences.putSync('showRestartServerHind', false)
let animatorOptions: AnimatorResult | undefined = AppStorage.get('animatorOptions')
animatorOptions?.play()
LogUtil.info(`animatorOptions: ${animatorOptions}`)
let port = this.dataPreferences.getSync('serverPort', 'defa... | https://github.com/Gokr-ble/LocalSendLite_HarmonyOS_NEXT | 4008b2589f9bcb9c3ec9ef229b35a928f81731c0 | github |
gongshijier/harmonyLab | entry/src/main/ets/components/FeedList.ets | arkts | longPressLoadDB | db load case | longPressLoadDB() {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left longPressLoadDB 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... | longPressLoadDB() {
} | https://github.com/gongshijier/harmonyLab | bd9d34c18b2ea76a58ce632bc6c0b1350c3d1680 | github |
arkui-x/samples | CodeLab/Cases/feature/customkeyboardtoh5/src/main/ets/components/TitleBar.ets | arkts | changeDialogOpen | 监听dialogOpen触发开启弹窗事件 | changeDialogOpen() {
if (this.dialogOpen) {
this.dialogController?.open();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeDialogOpen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | changeDialogOpen() {
if (this.dialogOpen) {
this.dialogController?.open();
}
} | https://gitcode.com/arkui-x/samples | 14088fefa4ea99eb099eedcd59bf7b134a3588c3 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new OutOfMemoryError 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("OutOfMemoryError", 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("OutOfMemoryError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 24959be289d0513a9b32af126c938a7e5b977efa | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | clearLocalCoverPath | 清除本地封面路径记录 | private async clearLocalCoverPath(sourceId: number, externalId: string): Promise<void> {
try {
const id = `${sourceId}_${externalId}`;
const sql = `UPDATE temp_manga_info SET localCoverPath = NULL WHERE id = ?`;
await this.dbManager.executeSql(sql, [id]);
} catch (error) {
logger.error... | 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 clearLocalCoverPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST... | private async clearLocalCoverPath(sourceId: number, externalId: string): Promise<void> {
try {
const id = `${sourceId}_${externalId}`;
const sql = `UPDATE temp_manga_info SET localCoverPath = NULL WHERE id = ?`;
await this.dbManager.executeSql(sql, [id]);
} catch (error) {
logger.error... | https://github.com/DaLongZhuaZi/manxia | bc92392799bb878a58f7819c788940f3b4218dfc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RejectedHandler.ets | arkts | register | Registers a new rejection handler.
@param cb new callback | public register(cb: RejectedObjectListener): void {
this.handlers.add(cb);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cb AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RejectedO... | public register(cb: RejectedObjectListener): void {
this.handlers.add(cb);
} | https://gitcode.com/iop123123/arkts-static-skills | f661aef2cf2170f9733a2bb7e4522bda82c5b357 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/LogUtil.ets | arkts | print | 打印JSON对象和JSON字符串
@param msg | static print(msg: object | string) {
try {
let content = '';
if (typeof msg === 'object') {
if (msg instanceof Error) {
content = content + LogUtil.getErrorStr(msg, false);
} else {
content = content + LogUtil.getObjectToJson(msg, false);
}
} else if (... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left print AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:... | static print(msg: object | string) {
try {
let content = '';
if (typeof msg === 'object') {
if (msg instanceof Error) {
content = content + LogUtil.getErrorStr(msg, false);
} else {
content = content + LogUtil.getObjectToJson(msg, false);
}
} else if (... | https://github.com/tdcare/tdwebrtc | d7f2d34c9d8aafae975949ca7dbd7fa1baac314a | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets | arkts | showRefundModal | 显示退款原因选择弹窗
@returns {void} 无返回值 | showRefundModal(): void {
this.refundModalVisible = true;
this.loadRefundReasons();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showRefundModal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl... | showRefundModal(): void {
this.refundModalVisible = true;
this.loadRefundReasons();
} | https://github.com/Joker-x-dev/CoolMallArkTS | b325883ef137fc839fae27a47b37e986d0630a66 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Models/EBookModels.ets | arkts | getCurrentChapter | 获取当前章节 | getCurrentChapter(): EBookChapter | null {
const chapter = this.chapters.find((ch: EBookChapter) => ch.id === this.readingProgress.currentChapterId);
return chapter || null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide... | getCurrentChapter(): EBookChapter | null {
const chapter = this.chapters.find((ch: EBookChapter) => ch.id === this.readingProgress.currentChapterId);
return chapter || null;
} | https://github.com/DaLongZhuaZi/manxia | 24abeaef82fdc3ed5e313c0234b1969d4996c3e2 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_or_equal/less_or_equal_ulong.ets | arkts | main | ---
desc: check less or equal operation for unsigned long integer
--- | function main(): void {
const a: ulong = {{v.left}}
const b: ulong = {{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: ulong = {{v.left}}
const b: ulong = {{v.right}}
assert (a <= b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b4a88394dec303c056ed1293e930667f9394ea5a | gitee |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets | arkts | isExecutingDart | Is this {@link DartExecutor} currently executing Dart code?
@return true if Dart code is being executed, false otherwise | isExecutingDart(): boolean {
return this.isApplicationRunning;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isExecutingDart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#sta... | isExecutingDart(): boolean {
return this.isApplicationRunning;
} | https://gitee.com/openharmony-sig/flutter_engine.git | b05fc214fd1812b7a4926d65dc89580cf82991dc | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/Matcher.ets | arkts | parseSelectorPart | 解析单个选择器部分 | private static parseSelectorPart(selector: string): SelectorPartResult | null {
const part = new SelectorPart();
let i = 0;
const len = selector.length;
if (i < len && /[a-zA-Z*]/.test(selector[i])) {
let tagName = '';
while (i < len && /[a-zA-Z0-9*-]/.test(selector[i])) {
tagNam... | 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 parseSelectorPart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#... | private static parseSelectorPart(selector: string): SelectorPartResult | null {
const part = new SelectorPart();
let i = 0;
const len = selector.length;
if (i < len && /[a-zA-Z*]/.test(selector[i])) {
let tagName = '';
while (i < len && /[a-zA-Z0-9*-]/.test(selector[i])) {
tagNam... | https://github.com/DaLongZhuaZi/manxia | 5fb121e816eb937ddba04b9ddcd11bf931555f23 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/download/DownloadPaths.ets | arkts | buildFilePath | 解析 AppStorage[DOWNLOAD_PATH]:
'' / 'default' / undefined → ctx.filesDir/Downloads(应用沙箱内)
'public' → 公共「下载」目录下的应用专属目录(Environment.getUserDownloadDir);
不支持 / 未授权时回退沙箱。 | static buildFilePath(ctx: common.UIAbilityContext, filename: string): string {
const custom: string | undefined = AppStorage.get<string>(AppStorageKeys.DOWNLOAD_PATH);
// 仅平板静默路线可按原始路径写公共目录;手机端公共目录只能经 picker 导出,故下载一律落沙箱。
if (custom === 'public' && PublicDownloadDir.isTabletSilent()) {
const dir: str... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#L... | static buildFilePath(ctx: common.UIAbilityContext, filename: string): string {
const custom: string | undefined = AppStorage.get<string>(AppStorageKeys.DOWNLOAD_PATH);
// 仅平板静默路线可按原始路径写公共目录;手机端公共目录只能经 picker 导出,故下载一律落沙箱。
if (custom === 'public' && PublicDownloadDir.isTabletSilent()) {
const dir: str... | https://github.com/LZZLHY/hlib | bbae7a8c802ee37f702594718070adef5d62797a | github |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertFrequency | FREQUENCY
Base unit: Hz. | static convertFrequency(value: number, from: FrequencyUnit, to: FrequencyUnit): number {
const toHz: Record<FrequencyUnit, number> = {
[FrequencyUnit.MILLIHERTZ]: 0.001,
[FrequencyUnit.HERTZ]: 1,
[FrequencyUnit.KILOHERTZ]: 1e3,
[FrequencyUnit.MEGAHERTZ]: 1e6,
[FrequencyUnit.GI... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertFrequency 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#Lef... | static convertFrequency(value: number, from: FrequencyUnit, to: FrequencyUnit): number {
const toHz: Record<FrequencyUnit, number> = {
[FrequencyUnit.MILLIHERTZ]: 0.001,
[FrequencyUnit.HERTZ]: 1,
[FrequencyUnit.KILOHERTZ]: 1e3,
[FrequencyUnit.MEGAHERTZ]: 1e6,
[FrequencyUnit.GI... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | c9faecb38ac64621cd2f0aebda01909166453eb7 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/datasources/DataSources.ets | arkts | replaceAll | 全量替换数据 (搜索/筛选变更时调用) | replaceAll(hosts: RemoteHost[]): void {
this.dataArray = hosts;
this.notifyDataReload();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left replaceAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hosts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left RemoteHost AST... | replaceAll(hosts: RemoteHost[]): void {
this.dataArray = hosts;
this.notifyDataReload();
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | db0557a08b86b61caaabaa628b6f152b723faeee | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Annotations/UnifiedAnnotationManager.ets | arkts | deleteAnnotation | Soft delete annotation by id. | async deleteAnnotation(annotationId: string): Promise<void> {
await this.ensureSchema();
const now = Date.now();
await this.dbManager.executeSql(
'UPDATE unified_annotation SET isDeleted = 1, updateTime = ? WHERE id = ?',
[now, annotationId]
);
// 删除划线时,级联软删除其关联想法,避免出现孤儿想法记录。
await... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteAnnotation AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left annotationId AST#identifier#Right AST#type_annotation#Left AST... | async deleteAnnotation(annotationId: string): Promise<void> {
await this.ensureSchema();
const now = Date.now();
await this.dbManager.executeSql(
'UPDATE unified_annotation SET isDeleted = 1, updateTime = ? WHERE id = ?',
[now, annotationId]
);
// 删除划线时,级联软删除其关联想法,避免出现孤儿想法记录。
await... | https://github.com/DaLongZhuaZi/manxia | 6f8d29024448c60b73e1efbaacdadae7ef86b520 | github |
CLMC2025/Vignette | entry/src/main/ets/context/ContextValidator.ets | arkts | getErrors | 获取错误问题 | getErrors(): ValidationIssue[] {
return this.issues.filter((issue: ValidationIssue): boolean =>
issue.severity === IssueSeverity.ERROR
);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getErrors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left A... | getErrors(): ValidationIssue[] {
return this.issues.filter((issue: ValidationIssue): boolean =>
issue.severity === IssueSeverity.ERROR
);
} | https://github.com/CLMC2025/Vignette | c10abb1755d7c135bfffcadd55b9582213afb40c | github |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | isFrequentWord | 判断是否为频繁词 | private isFrequentWord(word: string): boolean {
// 频繁词汇(CET6级别)
const frequentWords = ['substantial', 'significant', 'comprehensive', 'subsequent'];
return frequentWords.includes(word);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isFrequentWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private isFrequentWord(word: string): boolean {
// 频繁词汇(CET6级别)
const frequentWords = ['substantial', 'significant', 'comprehensive', 'subsequent'];
return frequentWords.includes(word);
} | https://github.com/CLMC2025/Vignette | 41db35e02f33a7d1afde622b2a8b10c623da2298 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | analyzeStorage | 分析所有存储使用情况 | public async analyzeStorage(forceRefresh: boolean = false): Promise<StorageStatistics> {
try {
const now = Date.now();
// 如果有缓存且未过期,直接返回
if (!forceRefresh && this.cachedStatistics && (now - this.lastAnalysisTime) < this.CACHE_DURATION) {
logger.debug(TAG, '使用缓存的存储统计信息');
r... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left analyzeStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left forceRefresh AST#identifier#Right AST#:#L... | public async analyzeStorage(forceRefresh: boolean = false): Promise<StorageStatistics> {
try {
const now = Date.now();
// 如果有缓存且未过期,直接返回
if (!forceRefresh && this.cachedStatistics && (now - this.lastAnalysisTime) < this.CACHE_DURATION) {
logger.debug(TAG, '使用缓存的存储统计信息');
r... | https://github.com/DaLongZhuaZi/manxia | 298967cf015df43c0b10ed747b66afdfd95d1373 | github |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/database-crud-template.ets | arkts | insertUser | ==================== CREATE ==================== | async insertUser(user: Omit<User, 'id'>): Promise<number> {
if (!this.rdbStore) throw new Error('DB not initialized');
let row = {
name: user.name,
age: user.age,
email: user.email || '',
created_at: Date.now()
};
let rowId = await this.rdbStore.insert('users', row);
consol... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertUser AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left user AST#identifier#Right AST#type_annotation#Lef... | async insertUser(user: Omit<User, 'id'>): Promise<number> {
if (!this.rdbStore) throw new Error('DB not initialized');
let row = {
name: user.name,
age: user.age,
email: user.email || '',
created_at: Date.now()
};
let rowId = await this.rdbStore.insert('users', row);
consol... | https://github.com/Goway-Hui/harmonyos-next-dev | 069a8b93ac0779d75e354e92077778c11c292f83 | github |
darcycui/DarcyHarmonyNext | entry/src/main/ets/pages/background_task/ShortTaskPage.ets | arkts | startTask | 申请短时任务
@param id 短时任务ID | function startTask() {
let myReason = 'test requestSuspendDelay'; // 申请原因
let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => {
// 回调函数。应用申请的短时任务即将超时,通过此函数回调应用,执行一些清理和标注工作,并取消短时任务
Log.info(`任务超时回调 ${myReason}`);
backgroundTaskManager.cancelSuspendDelay(taskID);
})
taskID = dela... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left startTask AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declarati... | function startTask() {
let myReason = 'test requestSuspendDelay'; // 申请原因
let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => {
// 回调函数。应用申请的短时任务即将超时,通过此函数回调应用,执行一些清理和标注工作,并取消短时任务
Log.info(`任务超时回调 ${myReason}`);
backgroundTaskManager.cancelSuspendDelay(taskID);
})
taskID = dela... | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/background_task/ShortTaskPage.ets#L39-L55 | ed435c803c4bac41d4508c9fe9af097e42bfd314 | github |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue450.ets.audit.ets | arkts | initSize | HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 82 : issue450.ets | public initSize(maxWindowWidth: number, minWindowWidth: number, maxWindowHeight: number, minWindowHeight: number): void {
this.maxWindowWidth = maxWindowWidth;
this.minWindowWidth = minWindowWidth;
this.maxWindowHeight = maxWindowHeight;
this.minWindowHeight = minWindowHeight;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxWindowWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public initSize(maxWindowWidth: number, minWindowWidth: number, maxWindowHeight: number, minWindowHeight: number): void {
this.maxWindowWidth = maxWindowWidth;
this.minWindowWidth = minWindowWidth;
this.maxWindowHeight = maxWindowHeight;
this.minWindowHeight = minWindowHeight;
} | https://gitee.com/openharmony-sig/earth.git | 5ee7a6fa8877074c9a35383f455380af27fdbb75 | gitee |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/ui/ui.ets | arkts | aboutToAppear | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
基础函数 //
//////////
进入app操作 // | aboutToAppear(): void {
// 检查配置文件 //
try {fs.statSync(ui_path)} catch {fs.mkdir(ui_path)}
// 开启广播 //
this.emitter_status(true)
// 配置放行 //
this.ui_mode = this.global_config.ui_mode
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
// 检查配置文件 //
try {fs.statSync(ui_path)} catch {fs.mkdir(ui_path)}
// 开启广播 //
this.emitter_status(true)
// 配置放行 //
this.ui_mode = this.global_config.ui_mode
} | https://github.com/Nekofox-POT/LinMusic | 9a70a2b03be9d6327cbbf10cad89ef1129c0ceb4 | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | updateRegionPickerVisible | 更新地区选择弹窗可见状态
@param {boolean} visible - 是否可见
@returns {void} 无返回值 | updateRegionPickerVisible(visible: boolean): void {
this.isRegionPickerVisible = visible;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateRegionPickerVisible AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left visible AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Righ... | updateRegionPickerVisible(visible: boolean): void {
this.isRegionPickerVisible = visible;
} | https://github.com/Joker-x-dev/CoolMallArkTS | e19c8f66afe45995161fefdf693d4e7b4843c660 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets | arkts | hasKey | Checks if the key exists in the HashMap
@param key the key to check in the HashMap
@returns true if the key exists, false otherwise | hasKey(key: K): boolean {
return this.buckets.has(key);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AS... | hasKey(key: K): boolean {
return this.buckets.has(key);
} | https://gitcode.com/iop123123/arkts-static-skills | 27c54393edcefdf8fa06aa3c4ba4da9d609142af | gitcode |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/ai/ImageGenerationService.ets | arkts | createProvider | ============ 提供者配置 ============ | function createProvider(value: string, label: string, desc: string, ep: string, models: string[]): ImageProviderInfo {
const provider = new ImageProviderInfo()
provider.value = value
provider.label = label
provider.description = desc
provider.endpoint = ep
provider.models = models
return provider
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createProvider 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#:#... | function createProvider(value: string, label: string, desc: string, ep: string, models: string[]): ImageProviderInfo {
const provider = new ImageProviderInfo()
provider.value = value
provider.label = label
provider.description = desc
provider.endpoint = ep
provider.models = models
return provider
} | https://github.com/encorexin/WordPressCMS | 337e4bcdab86107337a39c165ed2c53bd44391e0 | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | isFinite | Whether both components are finite (neither infinite nor NaN). | get isFinite(): boolean {
return isFinite(this._dx) && isFinite(this._dy);
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isFinite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right... | get isFinite(): boolean {
return isFinite(this._dx) && isFinite(this._dy);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L23-L25 | f80c9d62c70b8643ea829f774c6cbb90334b8e04 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/client/tools/NativeStreamClient.ets | arkts | sendControl | Send control message (e.g. touch event) | sendControl(data: ArrayBuffer): boolean {
try {
return libscrcpy.nativeSendControl(data);
} catch (err) {
LoggerClientStream.error('[NativeStreamClient] Send control failed:', err);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendControl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArrayBuffer AST#identifier#Right AST#)#Left ... | sendControl(data: ArrayBuffer): boolean {
try {
return libscrcpy.nativeSendControl(data);
} catch (err) {
LoggerClientStream.error('[NativeStreamClient] Send control failed:', err);
return false;
}
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | f6537fff1d0ebd9d1cfe3871dfb9f62eb4a1b3c1 | github |
lidaixian999/Smart_Car | entry/src/main/ets/model/SsapManager.ets | arkts | stringToArrayBuffer | 字符串转ArrayBuffer(实例方法) | private stringToArrayBuffer(str: string): ArrayBuffer {
return stringToArrayBuffer(str);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stringToArrayBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private stringToArrayBuffer(str: string): ArrayBuffer {
return stringToArrayBuffer(str);
} | https://github.com/lidaixian999/Smart_Car | 0f14b710261ec512e58b45e3c6182c5ebf454e27 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | updateSourceWarningGroups | 更新书源的非致命问题分组 | private async updateSourceWarningGroups(source: LegadoBookSource, warningGroups: string[]): Promise<void> {
try {
await this.updateSourceErrorGroups(source, warningGroups);
logger.debug(TAG, `更新书源非致命问题分组 [${source.bookSourceName}]: ${warningGroups.join(',')}`);
} catch (error) {
logger.warn(... | 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 updateSourceWarningGroups AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right... | private async updateSourceWarningGroups(source: LegadoBookSource, warningGroups: string[]): Promise<void> {
try {
await this.updateSourceErrorGroups(source, warningGroups);
logger.debug(TAG, `更新书源非致命问题分组 [${source.bookSourceName}]: ${warningGroups.join(',')}`);
} catch (error) {
logger.warn(... | https://github.com/DaLongZhuaZi/manxia | de1c9f1271ad7049a92034bd4583e04fd09cfb6c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets | arkts | handleImplicitAuthCallback | 处理 Implicit Grant 回调(用于移动端 OAuth) | public async handleImplicitAuthCallback(accessToken: string, expiresIn: number): Promise<boolean> {
try {
this.log(`处理 Implicit Grant 回调`);
this.authState.accessToken = accessToken;
this.authState.refreshToken = '';
this.authState.expiresAt = expiresIn > 0 ? Date.now() + expiresIn *... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left handleImplicitAuthCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accessToken AST#identifier#Right AST#ERROR#L... | public async handleImplicitAuthCallback(accessToken: string, expiresIn: number): Promise<boolean> {
try {
this.log(`处理 Implicit Grant 回调`);
this.authState.accessToken = accessToken;
this.authState.refreshToken = '';
this.authState.expiresAt = expiresIn > 0 ? Date.now() + expiresIn *... | https://github.com/DaLongZhuaZi/manxia | d31145436f65ef9482f74fa9485d554220ae17ea | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SourceUpdateManager.ets | arkts | getLocalIndex | 获取本地索引 | public getLocalIndex(): SourceRepoIndex | null {
return this.localIndex;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLocalIndex 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... | public getLocalIndex(): SourceRepoIndex | null {
return this.localIndex;
} | https://github.com/DaLongZhuaZi/manxia | 24b759b49fdb0aa3d1d240c17b4a542dc5250bbd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | hasField | Checks if this class has a field with the specified name.
This method searches for a field (including inherited fields)
with the given name and returns true if found.
@param {string} name The name of the field to check.
@returns {boolean} True if the field exists in this class, false otherwise.
@syscap SystemCapability... | public hasField(name: string): boolean {
const fieldPtr = TypeAPI.getFieldPtrByName(this.cls, name)
return (fieldPtr !== undefined)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasField 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 ... | public hasField(name: string): boolean {
const fieldPtr = TypeAPI.getFieldPtrByName(this.cls, name)
return (fieldPtr !== undefined)
} | https://gitcode.com/iop123123/arkts-static-skills | dc9a69f6f646e6a80e04e8fe9882eb29623355ff | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BasePopup.ets | arkts | beforeDismiss | Popup隐藏之前,可做一些数据处理 | beforeDismiss() {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left beforeDismiss 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... | beforeDismiss() {
} | https://github.com/wuba/omni-ui | 6691b32ee3fdc3b3397a1a36d77edcaa1794da47 | github |
honjow/Next2V | shared/src/main/ets/utils/ImageUtils.ets | arkts | memberAvatarUrl | Selects the best avatar URL that the V2EX API actually returned for a member.
Do not synthesize xlarge/xxlarge/xxxlarge URLs here; some users only have large. | static memberAvatarUrl(member: V2exMember | null | undefined, preferred: AvatarSize = 'xlarge'): string {
if (!member) {
return ''
}
const source = ImageUtils.memberAvatarSource(member, preferred)
return ImageUtils.avatarUrl(source)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left memberAvatarUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left member AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_express... | static memberAvatarUrl(member: V2exMember | null | undefined, preferred: AvatarSize = 'xlarge'): string {
if (!member) {
return ''
}
const source = ImageUtils.memberAvatarSource(member, preferred)
return ImageUtils.avatarUrl(source)
} | https://github.com/honjow/Next2V | bbac46e393f964fe912f4855a0c43f67eb893510 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | constructor | Creates a new Set instance from another Set.
@param { Set<K> } set - Another Set instance used for initialization.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(set: Set<K>) {
this.elements = new FinalMap<K, K>(set.elements)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#L... | constructor(set: Set<K>) {
this.elements = new FinalMap<K, K>(set.elements)
} | https://gitcode.com/iop123123/arkts-static-skills | ab0c71c0c2873e8c52e35d1e2a7ce5f73822e7f8 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/downloads/classes/meowDawnloada.ets | arkts | startDownload | Start a download task.
@param url The url. | async startDownload(url: string) {
meow(`startDownload: [${url}]`, 'meowDawnloada][startDownload', meowLevel.WARN);
const wIds = getAllWindowIds();
for (const wId of wIds) {
const theTabs = AppStorageV2.connect(meowTabsBunch, `meowTabsBunch_${wId}`);
if (theTabs?.currentTab?.controller) {
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startDownload AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#... | async startDownload(url: string) {
meow(`startDownload: [${url}]`, 'meowDawnloada][startDownload', meowLevel.WARN);
const wIds = getAllWindowIds();
for (const wId of wIds) {
const theTabs = AppStorageV2.connect(meowTabsBunch, `meowTabsBunch_${wId}`);
if (theTabs?.currentTab?.controller) {
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 9ac81d3760d1a6b6706c70b3c3d852d3ea4ecd19 | github |
fbinba3955/Flymby | common/src/main/ets/utils/BrightnessUtil.ets | arkts | initWindow | 初始化窗口对象 | public static async initWindow(context: Context): Promise<void> {
try {
BrightnessUtil.currentWindow = await window.getLastWindow(context);
LogUtil.info('BrightnessUtil 窗口初始化成功');
} catch (err) {
const error = err as BusinessError;
LogUtil.error(`BrightnessUtil 窗口初始化失败: ${error.code}, ... | 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 initWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context... | public static async initWindow(context: Context): Promise<void> {
try {
BrightnessUtil.currentWindow = await window.getLastWindow(context);
LogUtil.info('BrightnessUtil 窗口初始化成功');
} catch (err) {
const error = err as BusinessError;
LogUtil.error(`BrightnessUtil 窗口初始化失败: ${error.code}, ... | https://github.com/fbinba3955/Flymby | 69cf1e308802d60308669a0ee23e187b12dc77e2 | github |
HarmonyOS_Samples/HMRouter | entry/src/main/ets/component/shoppingBag/ShoppingBagContent.ets | arkts | onBackPressed | [StartExclude example_life_cycle] | onBackPressed(ctx: HMLifecycleContext): boolean {
HMRouterMgr.popAsync({ navigationId: 'mainNavigationId', animator: false });
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackPressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left HMLifecycleContext AST#identifier#Right AST... | onBackPressed(ctx: HMLifecycleContext): boolean {
HMRouterMgr.popAsync({ navigationId: 'mainNavigationId', animator: false });
return true;
} | https://gitcode.com/HarmonyOS_Samples/HMRouter | e15110b182877447088eba97a81a8272d313ed11 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | matchNthExpression | 匹配 nth 表达式 | private matchNthExpression(index: number, expression: string): boolean {
const expr = expression.trim().toLowerCase();
if (expr === 'odd') {
return index % 2 === 1;
}
if (expr === 'even') {
return index % 2 === 0;
}
const numMatch = expr.match(/^(\d+)$/);
if (numMatch... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left matchNthExpression 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#identifie... | private matchNthExpression(index: number, expression: string): boolean {
const expr = expression.trim().toLowerCase();
if (expr === 'odd') {
return index % 2 === 1;
}
if (expr === 'even') {
return index % 2 === 0;
}
const numMatch = expr.match(/^(\d+)$/);
if (numMatch... | https://github.com/DaLongZhuaZi/manxia | cf01aa463de274f2e988a98d370ab4af058c41ee | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics2D/TextEngine/ComplexTextDrawing/entry/src/main/ets/pages/shape/IndependentShaping.ets | arkts | drawText | 文本绘制代码逻辑 | function drawText(canvas: drawing.Canvas) {
// [Start arkts_independent_shaping_text_paragraph_builder]
let myTextStyle: text.TextStyle = {
// 文本大小
fontSize: 60
};
let myParagraphStyle: text.ParagraphStyle = {
textStyle: myTextStyle,
};
let fontCollection = text.FontCollection.getGlobalInstance(... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left drawText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left canvas AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function drawText(canvas: drawing.Canvas) {
// [Start arkts_independent_shaping_text_paragraph_builder]
let myTextStyle: text.TextStyle = {
// 文本大小
fontSize: 60
};
let myParagraphStyle: text.ParagraphStyle = {
textStyle: myTextStyle,
};
let fontCollection = text.FontCollection.getGlobalInstance(... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 555d74f994a2d214b2b90fd335f16b2cc54f6d7a | gitcode |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/image-preview/TnImagePreview.ets | arkts | hide | 关闭图片预览 | public hide(): void {
if (this.contentNode !== null && this.uiContext !== null) {
const node: ComponentContent<TnImagePreviewParams> = this.contentNode;
try {
this.uiContext.getPromptAction().closeCustomDialog(node);
} catch (error) {
// 对话框可能已关闭
}
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left hide 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 hide(): void {
if (this.contentNode !== null && this.uiContext !== null) {
const node: ComponentContent<TnImagePreviewParams> = this.contentNode;
try {
this.uiContext.getPromptAction().closeCustomDialog(node);
} catch (error) {
// 对话框可能已关闭
}
}
} | https://github.com/codelably/tuniao-ui | c2179a92518dcedba0ac12b3db3677a157efbe45 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.