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/Data/EBookDataManager.ets | arkts | getSFWEBooks | [新增] 获取SFW(非NSFW)电子书列表
@returns Promise<EBook[]> SFW电子书列表 | public async getSFWEBooks(): Promise<EBook[]> {
try {
const sql = `SELECT * FROM ebook_info WHERE (isNSFW = 0 OR isNSFW IS NULL) ORDER BY lastUpdateTime DESC`;
const records = await this.dbManager.querySql(sql, []);
const ebooks: EBook[] = [];
for (const record of records) {
... | 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 getSFWEBooks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async getSFWEBooks(): Promise<EBook[]> {
try {
const sql = `SELECT * FROM ebook_info WHERE (isNSFW = 0 OR isNSFW IS NULL) ORDER BY lastUpdateTime DESC`;
const records = await this.dbManager.querySql(sql, []);
const ebooks: EBook[] = [];
for (const record of records) {
... | https://github.com/DaLongZhuaZi/manxia | 0265b00511ca1d8a80dfe9dd0c094638bff8dd3d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DynamicUrlResolver.ets | arkts | isValidUrl | 验证URL是否有效 | isValidUrl(url: string): boolean {
try {
// 简单验证URL格式
return url.startsWith('http://') || url.startsWith('https://');
} catch (e) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValidUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | isValidUrl(url: string): boolean {
try {
// 简单验证URL格式
return url.startsWith('http://') || url.startsWith('https://');
} catch (e) {
return false;
}
} | https://github.com/DaLongZhuaZi/manxia | b81daa6e8f66ab5b4f2208e5dad6291733afa8f4 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | getAll | 获取所有键值对 | async getAll(): Promise<Map<string, preferences.ValueType>> {
const result = new Map<string, preferences.ValueType>()
if (this.dataPreferences === null) {
return result
}
try {
const allData = await this.dataPreferences.getAll()
const keys = Object.keys(allData)
for (let i = 0;... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#... | async getAll(): Promise<Map<string, preferences.ValueType>> {
const result = new Map<string, preferences.ValueType>()
if (this.dataPreferences === null) {
return result
}
try {
const allData = await this.dataPreferences.getAll()
const keys = Object.keys(allData)
for (let i = 0;... | https://github.com/LongLiveY96/chatcube | abb22a247d3f62eff914a4338078fa9727444475 | github |
fbinba3955/Flymby | main/src/main/ets/pages/player/EmbyPlayer.ets | arkts | doReportProgress | 上报播放进度 | doReportProgress(value: number, playStatus: PlayerStatus) {
this.mPlaybackInfo && this.currentVideoParam.itemId &&
doReportProgress(this.mPlaybackInfo, this.currentVideoParam.itemId, value, playStatus)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doReportProgress 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 number AST#identifier#R... | doReportProgress(value: number, playStatus: PlayerStatus) {
this.mPlaybackInfo && this.currentVideoParam.itemId &&
doReportProgress(this.mPlaybackInfo, this.currentVideoParam.itemId, value, playStatus)
} | https://github.com/fbinba3955/Flymby | 903e151af17ce9a6107cac5b4d699dfbbc5f1b42 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/DigitPanelController.ets | arkts | handleInput | handleInput
@param value PhysicsButtonInfo
@param callBack Function | public handleInput(callBack: Function, value?: PhysicsButtonInfo, keyValue?: string): void {
if (this.evaluator !== null) {
this.evaluator.addExpression(callBack, value, keyValue);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callBack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public handleInput(callBack: Function, value?: PhysicsButtonInfo, keyValue?: string): void {
if (this.evaluator !== null) {
this.evaluator.addExpression(callBack, value, keyValue);
}
} | https://gitee.com/openharmony-sig/applications_calculator.git | 5ea279a1bd670d72fe7be4801a9c09c87f2582c1 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getGridLineWidth | Returns the width of the grid lines that are drawn away from each axis
label.
@return | public getGridLineWidth(): number {
return this.mGridLineWidth;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGridLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS... | public getGridLineWidth(): number {
return this.mGridLineWidth;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 353e3e0c45ebcd83496990a1160dab873d3b2c3d | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoader.ets | arkts | loadManyToOne | 加载 MANY_TO_ONE 关联数据
根据外键值查询单个关联实体
@param entities 主实体数据数组
@param relation 关联关系元数据
@returns 带有关联数据的实体数组 | private async loadManyToOne(
entities: Array<EntityData>,
relation: RelationMetadata,
options: RelationQueryOptions | null = null
): Promise<Array<EntityData>> {
return await this.coreRelationSupport.loadManyToOne(entities, relation, options)
} | 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 loadManyToOne AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left entities AST#identif... | private async loadManyToOne(
entities: Array<EntityData>,
relation: RelationMetadata,
options: RelationQueryOptions | null = null
): Promise<Array<EntityData>> {
return await this.coreRelationSupport.loadManyToOne(entities, relation, options)
} | https://github.com/offlinecat-dev/OCNetORM | 4f05f3c27f5cb889b48ac3877bdde731c99335ad | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/UsbDriverService.ets | arkts | setListener | 设置输入监听器 | setListener(listener: UsbDriverListener | null): void {
this.listener = listener;
// 仅通知已就绪的控制器(状态机保证 Ready 意味着初始化完成)
if (listener) {
for (const controller of this.controllers) {
if (controller.isReady()) {
listener.deviceAdded(controller);
}
}
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left UsbDriverList... | setListener(listener: UsbDriverListener | null): void {
this.listener = listener;
// 仅通知已就绪的控制器(状态机保证 Ready 意味着初始化完成)
if (listener) {
for (const controller of this.controllers) {
if (controller.isReady()) {
listener.deviceAdded(controller);
}
}
}
} | https://github.com/AlkaidLab/moonlight-harmony | 30ffd8e363de3cb2f322f8d827a73ff65b6bcbcd | github |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/manager/WorldClockManager.ets | arkts | getRdbStore | rdb store
@return rdb store object | async getRdbStore(): Promise<dataRdb.RdbStore> {
return await super.getRdbStore(SQL_CREATE_TABLE);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getRdbStore(): Promise<dataRdb.RdbStore> {
return await super.getRdbStore(SQL_CREATE_TABLE);
} | https://gitee.com/openharmony-sig/applications_clock.git | 0847ba791374db1afbc9f10c92b02f83c0dd506c | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | saveConfig | 保存配置到文件
@returns 保存是否成功 | static saveConfig(): boolean {
return MelonDSNative.native.saveConfig();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo... | static saveConfig(): boolean {
return MelonDSNative.native.saveConfig();
} | https://github.com/richshaw2015/nds | c56018d7c470d0e15f57085f9cac7aa4d145917a | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/NetHelper.ets | arkts | normalizeIPv6 | ─────────────────────── IPv6 工具 ───────────────────────
标准化 IPv6 地址:去除可能的 [] 包裹和 %scopeId 后缀 | function normalizeIPv6(address: string): string {
let addr = address;
// 去 []
if (addr.startsWith('[') && addr.includes(']')) {
addr = addr.substring(1, addr.indexOf(']'));
}
// 去 %scopeId
const pctIdx = addr.indexOf('%');
if (pctIdx !== -1) {
addr = addr.substring(0, pctIdx);
}
return addr.to... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left normalizeIPv6 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left address AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function normalizeIPv6(address: string): string {
let addr = address;
// 去 []
if (addr.startsWith('[') && addr.includes(']')) {
addr = addr.substring(1, addr.indexOf(']'));
}
// 去 %scopeId
const pctIdx = addr.indexOf('%');
if (pctIdx !== -1) {
addr = addr.substring(0, pctIdx);
}
return addr.to... | https://github.com/AlkaidLab/moonlight-harmony | d9d762a0d33b6236af98f99b1c93577749fa5881 | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | isEmpty | Check if the size is empty | get isEmpty(): boolean {
return this.width <= 0 || this.height <= 0;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isEmpty 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 isEmpty(): boolean {
return this.width <= 0 || this.height <= 0;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L215-L217 | a7f76ba1e511e263601e9b90df07ca1060028be6 | github |
openharmony/applications_photos | feature/browser/src/main/ets/default/view/photoGrid/BatchRecoverMenuOperation.ets | arkts | requestOneBatchOperation | Delete a batch of data | async requestOneBatchOperation(): Promise<void> {
if (this.isCancelled) {
return;
}
this.currentBatch++;
let startIndex = (this.currentBatch - 1) * this.BATCH_SIZE;
let endIndex = this.currentBatch * this.BATCH_SIZE;
endIndex = Math.min(endIndex, this.uris.length);
let operationImpl ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left requestOneBatchOperation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annota... | async requestOneBatchOperation(): Promise<void> {
if (this.isCancelled) {
return;
}
this.currentBatch++;
let startIndex = (this.currentBatch - 1) * this.BATCH_SIZE;
let endIndex = this.currentBatch * this.BATCH_SIZE;
endIndex = Math.min(endIndex, this.uris.length);
let operationImpl ... | https://gitee.com/openharmony/applications_photos.git | 5ce5661879602d6a3a2a38c630e15e11436c2213 | gitee |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/viewmodel/RecommendViewModel.ets | arkts | load | Loads all recommendation UI data from RecommendDataUtil into trace fields. | public load(): void {
this.heroCards = RecommendDataUtil.getHeroCards();
this.recommendItems = RecommendDataUtil.getRecommendPlaylists();
this.privateSongDisplayList = RecommendDataUtil.getPrivateSongDisplayList();
this.privateSongDataSource = new RecommendSongUiDataSource(this.privateSongDisplayList)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left load 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 load(): void {
this.heroCards = RecommendDataUtil.getHeroCards();
this.recommendItems = RecommendDataUtil.getRecommendPlaylists();
this.privateSongDisplayList = RecommendDataUtil.getPrivateSongDisplayList();
this.privateSongDataSource = new RecommendSongUiDataSource(this.privateSongDisplayList)... | https://gitcode.com/HarmonyOS_Samples/MusicHome | fa03076d6549f7375ea2e88d1ead0bbb128b352e | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/SwitchProController.ets | arkts | sendSubcommand | 发送子命令 | private async sendSubcommand(subcommand: number, payload: Uint8Array): Promise<Uint8Array | null> {
const data = new Uint8Array(11 + payload.length);
data[0] = 0x01; // Rumble + subcommand
data[1] = this.sendPacketCount++;
if (this.sendPacketCount > 0xF) {
this.sendPacketCount = 0;
}
da... | 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 sendSubcommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left subcommand AST#identifier#Right AST#ERROR#Left AST#:#... | private async sendSubcommand(subcommand: number, payload: Uint8Array): Promise<Uint8Array | null> {
const data = new Uint8Array(11 + payload.length);
data[0] = 0x01; // Rumble + subcommand
data[1] = this.sendPacketCount++;
if (this.sendPacketCount > 0xF) {
this.sendPacketCount = 0;
}
da... | https://github.com/AlkaidLab/moonlight-harmony | a5281c8e8433d3f850f8ec6e0afcbc0e40ad245b | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _normalizeXmlString | 处理文件首部可能存在的编解码符号,同时全局替换文本中的回车及换行符为 \n
@param xml svg文件的xml字符串
@return 处理之后的文本字符串 | private _normalizeXmlString(xml: string): string{
if (xml[0] === SVGXMLChecker.UNICODE_FEFF) {
xml = xml.slice(1);
}
return xml.replace(RegexConstants.REGEX_GLOBAL_REPLACE_ENTER, XMLConstants.XML_LINE_FEED);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _normalizeXmlString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xml AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private _normalizeXmlString(xml: string): string{
if (xml[0] === SVGXMLChecker.UNICODE_FEFF) {
xml = xml.slice(1);
}
return xml.replace(RegexConstants.REGEX_GLOBAL_REPLACE_ENTER, XMLConstants.XML_LINE_FEED);
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 6502e0a9e9bb96302ee8653e97677fb2f1034151 | gitee |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/SshClient.ets | arkts | sftpRename | Rename or move a remote file/directory. | async sftpRename(src: string, dst: string): Promise<void> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
await ssh.sftpRename(this.handle, src, dst);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP rename failed';
const error = new ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpRename AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left src AST#identifier#Right AST#type_annotation#Left... | async sftpRename(src: string, dst: string): Promise<void> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
await ssh.sftpRename(this.handle, src, dst);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP rename failed';
const error = new ... | https://github.com/UnbalancedCat/ohos-ssh-core | b5c69fb9426aeac70d547199ceabf56b838fc53d | github |
the-wwyang/kids-learning-app | src/main/ets/storage/UserSettingsStorageService.ets | arkts | updateDailyGoal | 更新每日目标
@param goal 目标题数 | static async updateDailyGoal(goal: number): Promise<void> {
try {
const settings = await UserSettingsStorageService.loadSettings();
settings.dailyGoal = Math.max(1, Math.min(100, goal)); // 限制范围1-100
await UserSettingsStorageService.saveSettings(settings);
console.log(`[UserSettingsStorage... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left updateDailyGoal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left goal AST#identifier#Right AST#:#Left : A... | static async updateDailyGoal(goal: number): Promise<void> {
try {
const settings = await UserSettingsStorageService.loadSettings();
settings.dailyGoal = Math.max(1, Math.min(100, goal)); // 限制范围1-100
await UserSettingsStorageService.saveSettings(settings);
console.log(`[UserSettingsStorage... | https://github.com/the-wwyang/kids-learning-app | c6a1e2521735a419b1fb0a320fe7916239cf9479 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVErrorAnalyzer.ets | arkts | formatErrorForUser | 生成用户友好的错误信息 | static formatErrorForUser(analysis: WebDAVErrorAnalysis): string {
let message = `❌ ${analysis.title}\n\n`;
message += `${analysis.description}\n\n`;
message += `💡 建议:\n`;
analysis.suggestions.forEach((suggestion, index) => {
message += `${index + 1}. ${suggestion}\n`;
});
return messag... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatErrorForUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left analysis AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | static formatErrorForUser(analysis: WebDAVErrorAnalysis): string {
let message = `❌ ${analysis.title}\n\n`;
message += `${analysis.description}\n\n`;
message += `💡 建议:\n`;
analysis.suggestions.forEach((suggestion, index) => {
message += `${index + 1}. ${suggestion}\n`;
});
return messag... | https://github.com/DaLongZhuaZi/manxia | d3309fd7c28a1f03af70daf7ed731a2b95d6ac8b | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11CompatibilityTester.ets | arkts | isKvmCapableDevice | 检查设备型号是否在支持 KVM 的列表中 | private isKvmCapableDevice(productModel: string): boolean {
if (!productModel) return false;
const modelLower = productModel.toLowerCase();
for (const device of KVM_CAPABLE_DEVICES) {
if (modelLower.includes(device.toLowerCase())) {
return true;
}
}
// 额外检查:包含特定关... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isKvmCapableDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productModel AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | private isKvmCapableDevice(productModel: string): boolean {
if (!productModel) return false;
const modelLower = productModel.toLowerCase();
for (const device of KVM_CAPABLE_DEVICES) {
if (modelLower.includes(device.toLowerCase())) {
return true;
}
}
// 额外检查:包含特定关... | https://github.com/AetheriumSimulator/qemu-hmos | 05d2476aec9f5d6033f84d4de046658e822856d2 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets | arkts | getFirstKey | Return the key of the first element in the TreeMap
@returns the key of the first element | getFirstKey(): K {
this.checkEmptyContainer();
let entry = this.rootEntry!;
while (entry.left !== undefined) {
entry = entry.left!;
}
return entry.key;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFirstKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#stateme... | getFirstKey(): K {
this.checkEmptyContainer();
let entry = this.rootEntry!;
while (entry.left !== undefined) {
entry = entry.left!;
}
return entry.key;
} | https://gitcode.com/iop123123/arkts-static-skills | 36f1d285faa6583dbbd665b156d918b35fd5da98 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyManager.ets | arkts | handleAnalogStickClick | 处理模拟摇杆的 L3/R3 点击(双击触发,与 AnalogStick.ets 行为一致)
发送短暂的按下+释放(50ms),而非持续按住。
@param stick 'left' | 'right' | handleAnalogStickClick(stick: string): void {
const mask: number = stick === 'left' ? GamepadButton.LS : GamepadButton.RS;
// 按下
this.gamepadInputMap |= mask;
this.sendGamepadState();
// 50ms 后自动释放(与 AnalogStick.ets 一致)
setTimeout(() => {
this.gamepadInputMap &= ~mask;
this.sendGam... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleAnalogStickClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stick AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#... | handleAnalogStickClick(stick: string): void {
const mask: number = stick === 'left' ? GamepadButton.LS : GamepadButton.RS;
// 按下
this.gamepadInputMap |= mask;
this.sendGamepadState();
// 50ms 后自动释放(与 AnalogStick.ets 一致)
setTimeout(() => {
this.gamepadInputMap &= ~mask;
this.sendGam... | https://github.com/AlkaidLab/moonlight-harmony | b9073ee1b31f55f1bb519ab8524f4d21e6ea41b9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/DiskCacheManager.ets | arkts | saveIndex | 保存缓存索引 | private async saveIndex(): Promise<void> {
try {
interface IndexData {
version: number;
entries: Array<[string, CacheEntry]>;
totalSize: number;
}
const indexData: IndexData = {
version: this.INDEX_VERSION,
entries: Array.from(this.cacheIndex.entries()),
... | 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 saveIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | private async saveIndex(): Promise<void> {
try {
interface IndexData {
version: number;
entries: Array<[string, CacheEntry]>;
totalSize: number;
}
const indexData: IndexData = {
version: this.INDEX_VERSION,
entries: Array.from(this.cacheIndex.entries()),
... | https://github.com/DaLongZhuaZi/manxia | 9c1e8007f640b42720d811388eb5e9ed8b239fb9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets | arkts | initializePreferences | 初始化Preferences存储 | private async initializePreferences(): Promise<void> {
try {
const context = getContext();
this.preferencesStore = await preferences.getPreferences(context, this.PREFERENCES_NAME);
logger.info(TAG, 'Preferences存储初始化成功');
} catch (error) {
logger.error(TAG, 'Preferences存储初始化失败', String(... | 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 initializePreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async initializePreferences(): Promise<void> {
try {
const context = getContext();
this.preferencesStore = await preferences.getPreferences(context, this.PREFERENCES_NAME);
logger.info(TAG, 'Preferences存储初始化成功');
} catch (error) {
logger.error(TAG, 'Preferences存储初始化失败', String(... | https://github.com/DaLongZhuaZi/manxia | 2e82e21773f61faa9d326f6002f8ca9cb27122db | github |
harmonyos/codelabs | HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/TaskItemBean.ets | arkts | constructor | Construction method.
@param progressValue progress value.
@param updateDate update time. | constructor(taskName: string, progressValue: number, updateDate: string) {
this.taskName = taskName;
this.progressValue = progressValue;
this.updateDate = updateDate;
} | 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 taskName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,... | constructor(taskName: string, progressValue: number, updateDate: string) {
this.taskName = taskName;
this.progressValue = progressValue;
this.updateDate = updateDate;
} | https://gitee.com/harmonyos/codelabs.git | e08a8786e27b78d6dce3d2b6d8c417fe55fb6c55 | gitee |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | registerWlPlayerCallbacks | 设置wlmedia播放器回调 | registerWlPlayerCallbacks() {
if (!this.wlPlayer) {
return
}
this.wlPlayer.setOnMediaInfoListener({
onPrepared: () => {
LogUtil.info("WlPlayer onPrepared");
this.mPlayerStatus = PlayerStatus.PREPARED;
// 获取当前视频的相关信息
this.mVideoTracks = this.wlPlayer?.getVideoTr... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerWlPlayerCallbacks 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#statemen... | registerWlPlayerCallbacks() {
if (!this.wlPlayer) {
return
}
this.wlPlayer.setOnMediaInfoListener({
onPrepared: () => {
LogUtil.info("WlPlayer onPrepared");
this.mPlayerStatus = PlayerStatus.PREPARED;
// 获取当前视频的相关信息
this.mVideoTracks = this.wlPlayer?.getVideoTr... | https://github.com/fbinba3955/Flymby | 3c86561753ca2fa9515d1c5ce037ca92eabf9ce1 | github |
the-wwyang/kids-learning-app | src/main/ets/services/ProfileService.ets | arkts | loadOrCreateDefaultProfile | 加载或创建默认档案 | private async loadOrCreateDefaultProfile(): Promise<void> {
// 尝试加载当前档案
const currentProfileId = await this.getCurrentProfileId();
if (currentProfileId) {
// 加载现有档案
const profile = await this.getProfileById(currentProfileId);
if (profile) {
this.currentProfile = profile;
... | 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 loadOrCreateDefaultProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express... | private async loadOrCreateDefaultProfile(): Promise<void> {
// 尝试加载当前档案
const currentProfileId = await this.getCurrentProfileId();
if (currentProfileId) {
// 加载现有档案
const profile = await this.getProfileById(currentProfileId);
if (profile) {
this.currentProfile = profile;
... | https://github.com/the-wwyang/kids-learning-app | 19d8a050ca8a7467da41b132b21a84e15085d5ac | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | normalizeRect | Normalized rectangle.
@param rect
@param width
@param height | static normalizeRect(rect: RectF, width: number, height: number): void {
rect.left /= width;
rect.right /= width;
rect.top /= height;
rect.bottom /= height;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left normalizeRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rect AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Re... | static normalizeRect(rect: RectF, width: number, height: number): void {
rect.left /= width;
rect.right /= width;
rect.top /= height;
rect.bottom /= height;
} | https://gitee.com/openharmony/codelabs.git | 50e8a890c795be3b1b1802ea477e609a00bca546 | gitee |
yang-kun-long/HarmonyAccounting | entry/src/main/ets/common/database/Rdb.ets | arkts | deleteData | 删除数据
@param predicates 删除条件
@param callback 回调函数,当数据删除成功时被调用,参数为删除结果 | deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => {
}) {
// 检查回调函数是否有效
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!');
return;
}
let resFlag: boolean = fals... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Le... | deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => {
}) {
// 检查回调函数是否有效
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!');
return;
}
let resFlag: boolean = fals... | https://github.com/yang-kun-long/HarmonyAccounting | 30b69b105816c1cf55726028c051cea7a771f7f7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | handleFileOpenFallback | 处理文件打开请求
根据文件类型设置不同的AppStorage标记,供后续页面处理 | private handleFileOpenFallback(uri: string, mimeType: string): void {
const fileType = this.getFileTypeFromUri(uri);
logger.info('EntryAbility', `📁 文件独立实例不可用,回退旧流程: ${fileType}, URI: ${uri}`);
switch (fileType) {
case EntryAbility.FILE_TYPE_AVIF:
// AVIF文件:跳转到AVIF查看器
logger.inf... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleFileOpenFallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private handleFileOpenFallback(uri: string, mimeType: string): void {
const fileType = this.getFileTypeFromUri(uri);
logger.info('EntryAbility', `📁 文件独立实例不可用,回退旧流程: ${fileType}, URI: ${uri}`);
switch (fileType) {
case EntryAbility.FILE_TYPE_AVIF:
// AVIF文件:跳转到AVIF查看器
logger.inf... | https://github.com/DaLongZhuaZi/manxia | 32d3ba5be1b3a9967335caa7edbf180101e1d9a0 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | registWithLogin | 注册并登录
@param username wanandroid账号
@param password 密码
@param repassword 二次密码 | async registWithLogin(username: string, password: string, repassword: string) {
try {
const result = await WanHttpClient.regist(username, password, repassword);
if (result.response.errorCode === 0) {
await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left registWithLogin AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async registWithLogin(username: string, password: string, repassword: string) {
try {
const result = await WanHttpClient.regist(username, password, repassword);
if (result.response.errorCode === 0) {
await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password);
... | https://github.com/RedRackham-R/WanAndroidHarmoney | dac742fc22cec7bfb8d4849ec7d417b717e4e3fa | github |
Joker-x-dev/CoolMallArkTS | core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets | arkts | onRefresh | 触发下拉刷新
@returns {void} 无返回值 | onRefresh(): void {
if (this.isLoading) {
return;
}
this.isLoading = true;
this.currentPage = 1;
this.loadListData();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left ... | onRefresh(): void {
if (this.isLoading) {
return;
}
this.isLoading = true;
this.currentPage = 1;
this.loadListData();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2a22408c66c06fa91dfb64d5d707ed573ace97e6 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/TerminalManager.ets | arkts | getCurrentUserId | 获取当前用户ID | getCurrentUserId(): string {
return this.currentUserId;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#state... | getCurrentUserId(): string {
return this.currentUserId;
} | https://github.com/LJ666-ui/harmony-health-care | c1b216886c96c47731094e3645e2a01bf608ac90 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | executeWithPriority | 执行FFmpeg任务(带优先级) | public executeWithPriority(
commands: string[],
duration: number,
priority: TaskPriority,
callback: TaskCallback
): string {
const taskId = util.generateRandomUUID(true);
const task = new Task(taskId, commands, duration, TaskConfig.defaultConfig(), callback);
task.setPriority(priority)... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left executeWithPriority AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commands AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | public executeWithPriority(
commands: string[],
duration: number,
priority: TaskPriority,
callback: TaskCallback
): string {
const taskId = util.generateRandomUUID(true);
const task = new Task(taskId, commands, duration, TaskConfig.defaultConfig(), callback);
task.setPriority(priority)... | https://github.com/jjjjjjava/ffmpeg_tools | 41ddd963d80f4a841945162f4c8cfa7d73908d2d | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/Category.ets | arkts | canCreateTopic | 是否允许在此分类创建话题 | get canCreateTopic(): boolean {
return this.permission !== null && this.permission <= 1;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left canCreateTopic 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... | get canCreateTopic(): boolean {
return this.permission !== null && this.permission <= 1;
} | https://github.com/Amaz1ny/HarmonyDO-public | a9fcfd77dd93e17f2656e96bc3e98fb9ac803766 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | setInvertX | 设置 X 轴反转 | setInvertX(invert: boolean): void {
this._invertX = invert;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInvertX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left invert AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) A... | setInvertX(invert: boolean): void {
this._invertX = invert;
} | https://github.com/AlkaidLab/moonlight-harmony | 86f18fd84ae7c17a623022540dc929b07fc5ab1e | github |
dingzhilin1990/zhilinclaw | src/security/OAuthGateway.ets | arkts | generateRandomState | 生成随机 state 参数 | private generateRandomState(): string {
const array = new Uint8Array(32);
// 实际项目中应使用安全的随机数生成器
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256);
}
return Array.from(array).map(b => b.toString(16).padStart(2, '0')).join('');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateRandomState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left str... | private generateRandomState(): string {
const array = new Uint8Array(32);
// 实际项目中应使用安全的随机数生成器
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256);
}
return Array.from(array).map(b => b.toString(16).padStart(2, '0')).join('');
} | https://github.com/dingzhilin1990/zhilinclaw | 771f9a9fbf10728a17170621337071a6079abd0c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadVibrationService.ets | arkts | rumbleUsbControllersOnly | 仅向 USB 控制器发送振动(跳过设备马达路由)
供 AudioVibrationService 独立路由使用,避免经过设备振动的
防抖逻辑和参数变换,保证最高精度。 | rumbleUsbControllersOnly(controllerNumber: number, lowFreqMotor: number, highFreqMotor: number): void {
const controllers = this.usbDriverService.getControllers();
if (controllers.length > 0) {
this.rumbleUsbControllers(controllers, controllerNumber, lowFreqMotor, highFreqMotor, false);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rumbleUsbControllersOnly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right... | rumbleUsbControllersOnly(controllerNumber: number, lowFreqMotor: number, highFreqMotor: number): void {
const controllers = this.usbDriverService.getControllers();
if (controllers.length > 0) {
this.rumbleUsbControllers(controllers, controllerNumber, lowFreqMotor, highFreqMotor, false);
}
} | https://github.com/AlkaidLab/moonlight-harmony | 094c93da7e245e6ff0025d731793816110784254 | github |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/AssetOverviewCardComponent.ets | arkts | VerticalDivider | 构建资产统计区域中间的竖向分隔线。 | private VerticalDivider() {
Column()
.width(1)
.height(this.compactLayout ? 46 : 54)
.backgroundColor('#ECE2D3')
.margin({ left: 12, right: 12 })
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left VerticalDivider AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#L... | private VerticalDivider() {
Column()
.width(1)
.height(this.compactLayout ? 46 : 54)
.backgroundColor('#ECE2D3')
.margin({ left: 12, right: 12 })
} | https://github.com/ZestBox-18/kitebook-frontend | d74f3be7094729b90a5f2ae7e2a0c7e8e8e27180 | github |
openharmony/app_samples | ETSUI/Web/entry/src/main/ets/MainAbility/model/Error.ets | arkts | constructor | 资源响应的媒体(MIME)类型 | constructor(message: string, code: number, data: string, enCoding: string, header: string, mimeType: string) {
this.message = message
this.code = code
this.data = data
this.enCoding = enCoding
this.header = header
this.mimeType = mimeType
} | 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#string#Left string AST#string#Right AST#ERROR#Right AST#,#... | constructor(message: string, code: number, data: string, enCoding: string, header: string, mimeType: string) {
this.message = message
this.code = code
this.data = data
this.enCoding = enCoding
this.header = header
this.mimeType = mimeType
} | https://gitee.com/openharmony/app_samples.git | 64e8b4b80c0406eeb3a21ab082ea722a34ab0b70 | gitee |
openharmony/applications_dlp_manager | entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets | arkts | showOpeningDialog | openDLPFile前调用,或者zip格式提前调用 | public async showOpeningDialog(uri: string, requestId: string, needShowDialog: boolean,
isZip?: boolean): Promise<void> {
this.printAllDecryptingMap();
HiLog.info(TAG, 'OpeningDialogManager showOpeningDialog');
if (this._decryptingMap.has(requestId)) {
HiLog.info(TAG, 'OpeningDialogManager showO... | 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 showOpeningDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : ... | public async showOpeningDialog(uri: string, requestId: string, needShowDialog: boolean,
isZip?: boolean): Promise<void> {
this.printAllDecryptingMap();
HiLog.info(TAG, 'OpeningDialogManager showOpeningDialog');
if (this._decryptingMap.has(requestId)) {
HiLog.info(TAG, 'OpeningDialogManager showO... | https://gitee.com/openharmony/applications_dlp_manager.git | 74ce2b800253c402ac8d0916ed17f73c469785c3 | gitee |
genjishare/snake-game | entry/src/main/ets/common/service/EventBus.ets | arkts | off | 取消订阅事件
@param event 事件名称
@param callback 回调函数,如果不提供则移除所有该事件的监听器 | public off<T extends Object | null = null>(event: string, callback?: (data: T) => void): void {
if (!callback) {
this.listeners.delete(event);
return;
}
const callbacks = this.listeners.get(event);
if (callbacks) {
// 类型转换确保类型兼容性
const typedCallback = callback as (data: Object... | AST#program#Left AST#ERROR#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left off AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#type_identifier#Left Object AST#type_id... | public off<T extends Object | null = null>(event: string, callback?: (data: T) => void): void {
if (!callback) {
this.listeners.delete(event);
return;
}
const callbacks = this.listeners.get(event);
if (callbacks) {
// 类型转换确保类型兼容性
const typedCallback = callback as (data: Object... | https://github.com/genjishare/snake-game | f123d725862188e70a3b7200d7d12d72bac579fb | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets | arkts | setSystemBarEnabled | 设置系统状态栏是否可见 | setSystemBarEnabled(isVisible: boolean): void {
this.mainWindow.setSpecificSystemBarEnabled('status', isVisible)
.then(() => {
hilog.info(0x0000, 'testLog', `Succeeded in setting status bar to be invisible.`);
})
.catch((err: BusinessError) => {
hilog.error(0x0000, 'testLog',
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSystemBarEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isVisible AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Le... | setSystemBarEnabled(isVisible: boolean): void {
this.mainWindow.setSpecificSystemBarEnabled('status', isVisible)
.then(() => {
hilog.info(0x0000, 'testLog', `Succeeded in setting status bar to be invisible.`);
})
.catch((err: BusinessError) => {
hilog.error(0x0000, 'testLog',
... | https://github.com/ZestBox-18/kitebook-frontend | fa046dd7a9207c10244d3d591a3eb0e42582f895 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/EBookDataManager.ets | arkts | getChaptersByBookId | 获取章节列表 | private async getChaptersByBookId(bookId: string): Promise<EBookChapter[]> {
try {
const sql = `SELECT * FROM ebook_chapter WHERE bookId = ? ORDER BY chapterNumber ASC`;
const records = await this.dbManager.querySql(sql, [bookId]);
const chapters: EBookChapter[] = [];
for (co... | 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 getChaptersByBookId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:... | private async getChaptersByBookId(bookId: string): Promise<EBookChapter[]> {
try {
const sql = `SELECT * FROM ebook_chapter WHERE bookId = ? ORDER BY chapterNumber ASC`;
const records = await this.dbManager.querySql(sql, [bookId]);
const chapters: EBookChapter[] = [];
for (co... | https://github.com/DaLongZhuaZi/manxia | 52d2e8d4e8088282c913734d54abdfd7d02d1bfe | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/TerminalManager.ets | arkts | logout | 登出并清理 | async logout(): Promise<void> {
this.currentTerminal = null;
this.currentUserRole = null;
this.currentUserId = '';
const settings = SettingsUtil.getInstance();
await settings.clearAll();
// 跳转到登录页
await router.replaceUrl({ url: 'pages/Login' });
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left logout AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right ... | async logout(): Promise<void> {
this.currentTerminal = null;
this.currentUserRole = null;
this.currentUserId = '';
const settings = SettingsUtil.getInstance();
await settings.clearAll();
// 跳转到登录页
await router.replaceUrl({ url: 'pages/Login' });
} | https://github.com/LJ666-ui/harmony-health-care | b20cbe0224d25706375404511793887bc8ceba48 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | recallMessage | 撤回消息
@param messageId 消息ID | async recallMessage(messageId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/im/messages/${messageId}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left recallMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left messageId AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async recallMessage(messageId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/im/messages/${messageId}`)
} | https://github.com/David8Idira/AI-OA | 3ee4bf4b581e3c978bffad7a6cf1ba46aed72b4d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | updateSourceErrorGroups | 更新书源的错误分组 | private async updateSourceErrorGroups(source: LegadoBookSource, errorGroups: string[]): Promise<void> {
try {
// 获取当前分组
const currentGroups = source.bookSourceGroup ? source.bookSourceGroup.split(',').map(g => g.trim()) : [];
// 移除所有已知的错误分组和"工作正常"分组
const knownErrorGroups = Object.v... | 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 updateSourceErrorGroups AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right A... | private async updateSourceErrorGroups(source: LegadoBookSource, errorGroups: string[]): Promise<void> {
try {
// 获取当前分组
const currentGroups = source.bookSourceGroup ? source.bookSourceGroup.split(',').map(g => g.trim()) : [];
// 移除所有已知的错误分组和"工作正常"分组
const knownErrorGroups = Object.v... | https://github.com/DaLongZhuaZi/manxia | 7640fb59571408cb5dc2e80b1469a7b2448d87af | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readInt32 | Reads the next signed integer.
@param littleEndian If the value is little endian.
@returns The value. | readInt32(littleEndian?: boolean): number {
const value = this.getInt32(this.mByteOffset, littleEndian)
this.mByteOffset += 4
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readInt32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left littleEndian AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ER... | readInt32(littleEndian?: boolean): number {
const value = this.getInt32(this.mByteOffset, littleEndian)
this.mByteOffset += 4
return value
} | https://gitee.com/openharmony-sig/flutter_engine.git | ca74a015209f0b18387a8cb40ab6dfd846a3905f | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | insert | 插入识别记录 | static async insert(record: OCRRecognitionRecord): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
record.createdAt = now;
record.updatedAt = now;
const values: relationalStore.ValuesBucket = {
user_id: record.userId... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Ri... | static async insert(record: OCRRecognitionRecord): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
record.createdAt = now;
record.updatedAt = now;
const values: relationalStore.ValuesBucket = {
user_id: record.userId... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 636e1382c7666d0f160160fa6b41e035fe115aa2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/NamingConventions.ets | arkts | validateEnumName | 验证枚举名称是否符合规范
@param name - 枚举名称
@returns 是否符合规范 | static validateEnumName(name: string): boolean {
// 直接复用 PascalCase 规则,避免使用 this
const pascalCaseRegex = /^[A-Z][a-zA-Z0-9]*$/;
return pascalCaseRegex.test(name);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateEnumName 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... | static validateEnumName(name: string): boolean {
// 直接复用 PascalCase 规则,避免使用 this
const pascalCaseRegex = /^[A-Z][a-zA-Z0-9]*$/;
return pascalCaseRegex.test(name);
} | https://github.com/DaLongZhuaZi/manxia | c448a2f8a966c3d60c84a9584b8bb32e760f1b11 | github |
HarmonyOS_Samples/BestPracticeSnippets | Privacy/privacy/src/main/ets/pages/CheckWantOne.ets | arkts | checkWant | Check function | function checkWant(want: Want): boolean {
if (want === null || want === undefined) {
return false;
}
if (want.parameters === null || want.parameters === undefined) {
return false;
}
return true;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkWant AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left want AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function checkWant(want: Want): boolean {
if (want === null || want === undefined) {
return false;
}
if (want.parameters === null || want.parameters === undefined) {
return false;
}
return true;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 6d6a3998b58e0690bb6fa7d13e511210275f0970 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | splitRuleStr | 分割规则字符串
支持 &&, ||, %% 分割符 | private splitRuleStr(ruleStr: string): RuleSplitResult {
const cached = LegadoRuleAnalyzer.RULE_SPLIT_CACHE.get(ruleStr);
if (cached) {
return cached;
}
// 按优先级检查分割符: %%, ||, &&
// 注意:需要避免在引号内或JS代码内分割
let result: RuleSplitResult = { rules: [ruleStr], splitType: '' };
const percentR... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitRuleStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | private splitRuleStr(ruleStr: string): RuleSplitResult {
const cached = LegadoRuleAnalyzer.RULE_SPLIT_CACHE.get(ruleStr);
if (cached) {
return cached;
}
// 按优先级检查分割符: %%, ||, &&
// 注意:需要避免在引号内或JS代码内分割
let result: RuleSplitResult = { rules: [ruleStr], splitType: '' };
const percentR... | https://github.com/DaLongZhuaZi/manxia | b4c64841067da30bdee263c5a88a7d521d1e5cc9 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | writeInt16BE | Writes a signed 16-bit integer to the buffer at the specified offset using big-endian format
@param {long} value - Value to write
@param {int} [offset=0] - Number of bytes to skip before writing
@returns {int} Offset plus the number of bytes written | public writeInt16BE(value: long, offset: int = 0): int {
this.checkOffset(offset, 2);
this.checkValue(value, (-Math.pow(2, 15).toLong()), (Math.pow(2, 15).toLong() - 1), (-Math.pow(2, 15)).toString(), (Math.pow(2, 15) - 1).toString());
this.getDataView().setInt16(offset, valu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeInt16BE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifie... | public writeInt16BE(value: long, offset: int = 0): int {
this.checkOffset(offset, 2);
this.checkValue(value, (-Math.pow(2, 15).toLong()), (Math.pow(2, 15).toLong() - 1), (-Math.pow(2, 15)).toString(), (Math.pow(2, 15) - 1).toString());
this.getDataView().setInt16(offset, valu... | https://gitcode.com/iop123123/arkts-static-skills | 6325c57c8ff0d4d89f5e69774b958865788e3a2d | gitcode |
CLMC2025/Vignette | entry/src/main/ets/model/ChartModel.ets | arkts | constructor | minutes | constructor(
date: number,
wordsLearned: number = 0,
wordsReviewed: number = 0,
accuracy: number = 0,
studyTime: number = 0
) {
this.date = date;
this.wordsLearned = wordsLearned;
this.wordsReviewed = wordsReviewed;
this.accuracy = accuracy;
this.studyTime = studyTime;
} | 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 date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A... | constructor(
date: number,
wordsLearned: number = 0,
wordsReviewed: number = 0,
accuracy: number = 0,
studyTime: number = 0
) {
this.date = date;
this.wordsLearned = wordsLearned;
this.wordsReviewed = wordsReviewed;
this.accuracy = accuracy;
this.studyTime = studyTime;
} | https://github.com/CLMC2025/Vignette | 23c3312d4187789c4d60167e2d5103be4793362f | github |
lidaixian999/Smart_Car | entry/src/main/ets/model/SsapManager.ets | arkts | registerConnectionStateChangeCallback | 注册连接状态变化回调 | private registerConnectionStateChangeCallback(): void {
if (!this.client) {
hilog.error(this.domainId, this.logTag, 'Client not initialized');
return;
}
hilog.info(this.domainId, this.logTag, 'Registering connection state change callback...');
try {
this.client.on('connectionStateCh... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerConnectionStateChangeCallback 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 A... | private registerConnectionStateChangeCallback(): void {
if (!this.client) {
hilog.error(this.domainId, this.logTag, 'Client not initialized');
return;
}
hilog.info(this.domainId, this.logTag, 'Registering connection state change callback...');
try {
this.client.on('connectionStateCh... | https://github.com/lidaixian999/Smart_Car | 1fd967ce1534ef040c10161329170b0120ea509e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/DualSenseController.ets | arkts | normalizeThumbStickAxis | 标准化摇杆轴值 | private normalizeThumbStickAxis(value: number): number {
return (2.0 * value / TRIGGER_MAX) - 1.0;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeThumbStickAxis 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#iden... | private normalizeThumbStickAxis(value: number): number {
return (2.0 * value / TRIGGER_MAX) - 1.0;
} | https://github.com/AlkaidLab/moonlight-harmony | ae1c21aed405e1e17b8fc74ba0cd40fe59e138c6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setFullYear | Sets the full year for a specified date according to local time.
@param value new year | public setFullYear(value: number): void {
this.setFullYear(value as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFullYear 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 num... | public setFullYear(value: number): void {
this.setFullYear(value as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 86d2dc030e6f4a9a3efe9557966a3eabe7feab08 | gitee |
dingzhilin1990/zhilinclaw | src/security/SecurityContext.ets | arkts | updatePolicy | 更新安全策略
@param policy 新策略 | public updatePolicy(policy: Partial<SecurityPolicy>): void {
this.policy = { ...this.policy, ...policy };
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updatePolicy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left policy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public updatePolicy(policy: Partial<SecurityPolicy>): void {
this.policy = { ...this.policy, ...policy };
} | https://github.com/dingzhilin1990/zhilinclaw | 63d02917a01b0634806d55d5e143e841a2bea32b | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WishlistStore.ets | arkts | confirmByParent | @deprecated V0.3.9: see `request`. Use `markConfirmed` after
`CoinAccount.redeem` succeeds. | confirmByParent(wishId: string, account: CoinAccount, nowMs: number): boolean {
const w: MagicWish | undefined = this.findWish(wishId);
if (w === undefined) {
return false;
}
if (w.state !== WishState.Pending) {
return false;
}
const ok: boolean = account.redeem(w.id, w.costCoins);... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmByParent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wishId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left... | confirmByParent(wishId: string, account: CoinAccount, nowMs: number): boolean {
const w: MagicWish | undefined = this.findWish(wishId);
if (w === undefined) {
return false;
}
if (w.state !== WishState.Pending) {
return false;
}
const ok: boolean = account.redeem(w.id, w.costCoins);... | https://github.com/terryma2024/happyword | d672979ac72802a192081f8e9240191090020f3c | github |
CLMC2025/Vignette | entry/src/main/ets/sync/WebDavConflictResolver.ets | arkts | checkBackupRestore | Check if backup restore should proceed based on remote HEAD response and local manifest.
Returns a result if the operation should be skipped or if there was an error.
Returns null if the operation should proceed. | static checkBackupRestore(
headRes: WebDavResponse,
manifest: WebDavManifest,
force: boolean
): WebDavSyncResult | null {
if (headRes.statusCode === 404) {
return WebDavSyncResult.fail('云端暂无备份', '云端不存在备份文件,请先在其他设备上创建备份');
}
if (headRes.statusCode >= 400 || headRes.statusCode === 0) {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkBackupRestore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left headRes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static checkBackupRestore(
headRes: WebDavResponse,
manifest: WebDavManifest,
force: boolean
): WebDavSyncResult | null {
if (headRes.statusCode === 404) {
return WebDavSyncResult.fail('云端暂无备份', '云端不存在备份文件,请先在其他设备上创建备份');
}
if (headRes.statusCode >= 400 || headRes.statusCode === 0) {
... | https://github.com/CLMC2025/Vignette | 5aa2de396ac5942327442ab6b5fa24c88802e268 | github |
popsiclelmlm/Hey | entry/src/main/ets/services/DelayTester.ets | arkts | runNativeDelayTest | 在 TaskPool worker 线程上执行 native 延迟测试。pingNativeOutbound 是同步 cgo
(建临时 Xray + ping),放到 worker 跑避免阻塞 UI 线程。cgo 在 worker 线程上由
OHOS Go fork 的 TLSDESC 保证安全。必须是顶层 @Concurrent 函数(无闭包捕获)。
socksPort 由调用方分配:并发测速时每个"槽"用固定且互不相同的端口,槽内顺序处理,
因此并发的 ping 不会撞端口,也无需 getNativeFreePorts(旧 .so 未导出该符号)。 | @Concurrent
function runNativeDelayTest(outboundJson: string, datDir: string, url: string, timeoutSeconds: number, configType: string, socksPort: number): NativePingResult {
const effectiveType: XrayConfigType | undefined = configType.length > 0 ? (configType as XrayConfigType) : undefined;
let configJson = '';
t... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left runNativeDelayTest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right... | @Concurrent
function runNativeDelayTest(outboundJson: string, datDir: string, url: string, timeoutSeconds: number, configType: string, socksPort: number): NativePingResult {
const effectiveType: XrayConfigType | undefined = configType.length > 0 ? (configType as XrayConfigType) : undefined;
let configJson = '';
t... | https://github.com/popsiclelmlm/Hey | 4bd187570d7eac8df475ff7d99a6e72008670fdc | github |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/view/GoodsListComponent.ets | arkts | onReachEnd | 到达列表底部 | onReachEnd() {
if (this.goodsListData.hasMore()) {
this.goodsListData.loadNextPage()
this.hasMoreData = this.goodsListData.hasMore()
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onReachEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onReachEnd() {
if (this.goodsListData.hasMore()) {
this.goodsListData.loadNextPage()
this.hasMoreData = this.goodsListData.hasMore()
}
} | https://github.com/ChangJing01/HarmonyOS-FinalProject | 18eb2b9a880765a3ad669c6956dcf74b77b555e3 | github |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets | arkts | totalCount | 存储实际的数据项
返回数据项的总数 | totalCount(): number {
return this.originDataArray.length;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left totalCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_b... | totalCount(): number {
return this.originDataArray.length;
} | https://gitee.com/openharmony/arkui_ace_engine.git | cfb1e890c93f82428c2c3d685bf7f04647984628 | gitee |
CLMC2025/Vignette | entry/src/main/ets/utils/Logger.ets | arkts | enableProductionMode | 启用生产模式(禁用 DEBUG/VERBOSE 日志) | static enableProductionMode(): void {
DEFAULT_CONFIG.productionMode = true;
DEFAULT_CONFIG.minLevel = LogLevel.WARN;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left enableProductionMode 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#e... | static enableProductionMode(): void {
DEFAULT_CONFIG.productionMode = true;
DEFAULT_CONFIG.minLevel = LogLevel.WARN;
} | https://github.com/CLMC2025/Vignette | 6446e9565d71480a4a73e81c5806ad55b8c02307 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | getInstance | 说明:不做“内容像推理”的启发式判断(Kelivo 策略)
若供应商未提供结构化推理字段(reasoning_content/reasoning_details 等)或显式 <think> 标签,
则不尝试拆分,避免出现“推理被拆出一部分、另一部分仍在正文”的不一致体验。 | static getInstance(): AIApiService {
if (AIApiService.instance === null) {
AIApiService.instance = new AIApiService()
}
return AIApiService.instance
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left AIApiServi... | static getInstance(): AIApiService {
if (AIApiService.instance === null) {
AIApiService.instance = new AIApiService()
}
return AIApiService.instance
} | https://github.com/LongLiveY96/chatcube | 0969339317afff3bf10b0be023e4bd9c76b07f8b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getElementsSingle | 获取单个规则的元素列表 | private getElementsSingle(ruleStr: string): string[] {
const chainedParts = this.splitJsonFirstRuleChain(ruleStr);
if (chainedParts.length > 1) {
return this.getElementsFromJsonFirstRuleChain(chainedParts);
}
const parsedRule = this.parseRule(ruleStr);
// 性能优化:减少日志输出
// logger.debug(TAG... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsSingle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private getElementsSingle(ruleStr: string): string[] {
const chainedParts = this.splitJsonFirstRuleChain(ruleStr);
if (chainedParts.length > 1) {
return this.getElementsFromJsonFirstRuleChain(chainedParts);
}
const parsedRule = this.parseRule(ruleStr);
// 性能优化:减少日志输出
// logger.debug(TAG... | https://github.com/DaLongZhuaZi/manxia | 1189e1bbfdf5f667f04e3e3efb778bb5c47a8bd9 | github |
Joker-x-dev/CoolMallArkTS | core/ibestui/src/main/ets/IBestUIInitializer.ets | arkts | setIBestUIBaseStyle | 设置 IBest UI 组件库基础样式
@returns {void} 无返回值 | static setIBestUIBaseStyle(): void {
IBestSetUIBaseStyle({
primary: $r("app.color.primary"),
success: $r("app.color.success"),
warning: $r("app.color.warning"),
danger: $r("app.color.danger"),
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setIBestUIBaseStyle 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#ex... | static setIBestUIBaseStyle(): void {
IBestSetUIBaseStyle({
primary: $r("app.color.primary"),
success: $r("app.color.success"),
warning: $r("app.color.warning"),
danger: $r("app.color.danger"),
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | 67324281df5a1fe783e678f2ff2d6f87eb60715f | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitSint32 | 访问 sint32 字段
JSON: number | visitSint32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitSint32 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 number AST#identifier#Right AST#,#Left , AS... | visitSint32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | ebf261fcc2ab38e910acc54033761d13c8413320 | gitcode |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getGenreAlbums | 查询流派专辑
@param id
@returns | public async getGenreAlbums(id: string): Promise<Array<BaseItemDto>> {
return this.requireApi().getGenreAlbums(id)
} | 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 getGenreAlbums AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#... | public async getGenreAlbums(id: string): Promise<Array<BaseItemDto>> {
return this.requireApi().getGenreAlbums(id)
} | https://github.com/OHPG/FinMusic | b9adab0348b517bdb2048bcfd1e3c1350bfc1379 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | constructor | Return a new Decimal whose value is the absolute value of this Decimal.
@param { Value } n {double | string | Decimal} | constructor(n: Value) {
if (Utils.isDecimalInstance(n)) {
this.initializeByDecimal(n as Decimal);
} else if (typeof n === 'number') {
this.initializeByNumber(n as double);
} else if (typeof n === 'string') {
this.initializeByString(n as string);
} ... | 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 n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Value AST#identifier#Right AST#)... | constructor(n: Value) {
if (Utils.isDecimalInstance(n)) {
this.initializeByDecimal(n as Decimal);
} else if (typeof n === 'number') {
this.initializeByNumber(n as double);
} else if (typeof n === 'string') {
this.initializeByString(n as string);
} ... | https://gitcode.com/iop123123/arkts-static-skills | 10fc5363d08f45179408f0a5f23bda0a2d820c16 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | $_invoke | Constructs a new FormatError instance with provided message and error specific information
@param { String } [message] - Error text
@param { ErrorOptions } [options] - Error options
@returns { FormatError } - Newly created FormatError instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(message?: String, options?: ErrorOptions): FormatError {
return new FormatError(message, options)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke 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#... | static $_invoke(message?: String, options?: ErrorOptions): FormatError {
return new FormatError(message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 58a8f27fa2b9ce5a557659babc98da3b0675bf22 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test9_original_index.ets | arkts | testInRange | --- Chained comparison --- | function testInRange(x: number): boolean {
if (x > 0 && x < 100) {
return true;
}
return false;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testInRange AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function testInRange(x: number): boolean {
if (x > 0 && x < 100) {
return true;
}
return false;
} | https://github.com/miaochiahao/ark-ghidra | aa44c5a644af9b1d94616a4682ff2d9b650017ac | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BillManager.ets | arkts | mapRowsToBills | 将查询结果行映射为账单实体,避免不同查询重复手写转换逻辑。 | private static mapRowsToBills(rows: Record<string, object>[], categories: CategoryBean[]): BillBean[] {
return rows.map((row: Record<string, object>) => {
const bill: BillBean = new BillBean();
bill.id = Number(row['id']);
bill.type = String(row['type']);
bill.category = String(row['catego... | 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 mapRowsToBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rows AST#identifier#Right AST#:#Left ... | private static mapRowsToBills(rows: Record<string, object>[], categories: CategoryBean[]): BillBean[] {
return rows.map((row: Record<string, object>) => {
const bill: BillBean = new BillBean();
bill.id = Number(row['id']);
bill.type = String(row['type']);
bill.category = String(row['catego... | https://github.com/ZestBox-18/kitebook-frontend | 4122b8a8740c461806771e3b9c6cb4476d546f36 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets | arkts | getSignalLevel | 获取当前连接Wi-Fi的信号强度
通过获取信号强度,用户可以初步判断当前网络是否能够满足其对速度的需求。
取值范围为[0, 4],取值越大表示信号越强
@returns 信号强度,取值范围[0, 4],-1表示报错 | async getSignalLevel(): Promise<number> {
try {
let wifiLinkedInfo: wifiManager.WifiLinkedInfo = await wifiManager.getLinkedInfo();
let rssi = wifiLinkedInfo.rssi;
let band = wifiLinkedInfo.band;
let level = wifiManager.getSignalLevel(rssi, band);
logger.info('level:' + JSON.stringif... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSignalLevel AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener... | async getSignalLevel(): Promise<number> {
try {
let wifiLinkedInfo: wifiManager.WifiLinkedInfo = await wifiManager.getLinkedInfo();
let rssi = wifiLinkedInfo.rssi;
let band = wifiLinkedInfo.band;
let level = wifiManager.getSignalLevel(rssi, band);
logger.info('level:' + JSON.stringif... | https://github.com/openharmony/applications_app_samples | acac5bdf83a082cf71f664bee7a7dff3e4ba6443 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | valueOf | The valueOf() method returns the primitive value of a String object.
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public valueOf(): String {
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#ide... | public valueOf(): String {
return this;
} | https://gitcode.com/iop123123/arkts-static-skills | 5d98fd0cfb07b7b4b255d084d484829a4238b107 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | toISOString | Returns a string in simplified extended ISO format (ISO 8601),
which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or
±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always zero UTC offset,
as denoted by the suffix Z.
@returns { string } get new date value
@syscap SystemCapability.Utils.Lang
... | public toISOString(): string {
let sb = new StringBuilder();
let y = this.getUTCFullYear();
if (y > 9999) {
sb.append("+");
if (y < 100000) {
sb.append("0");
}
}
if (y < 0) {
sb.append("-");
}
if ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toISOString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public toISOString(): string {
let sb = new StringBuilder();
let y = this.getUTCFullYear();
if (y > 9999) {
sb.append("+");
if (y < 100000) {
sb.append("0");
}
}
if (y < 0) {
sb.append("-");
}
if ... | https://gitcode.com/iop123123/arkts-static-skills | ed765143607a753b894fec30c5eac6468447ae85 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringListByRegexSingle | 单个正则获取字符串列表 | private getStringListByRegexSingle(pattern: string): string[] {
const results: string[] = [];
try {
// 处理多个正则组合 (用&&分隔)
const patterns = pattern.split('&&').map(p => p.trim());
if (patterns.length === 1) {
// 单个正则,全局匹配
const regex = new RegExp(pattern, 'gs');
l... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringListByRegexSingle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pattern AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left str... | private getStringListByRegexSingle(pattern: string): string[] {
const results: string[] = [];
try {
// 处理多个正则组合 (用&&分隔)
const patterns = pattern.split('&&').map(p => p.trim());
if (patterns.length === 1) {
// 单个正则,全局匹配
const regex = new RegExp(pattern, 'gs');
l... | https://github.com/DaLongZhuaZi/manxia | bcdbdc69a3e125902ba1b4d381e0972f6e43e8ce | github |
codelably/HCompass | core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets | arkts | log | 核心日志处理方法
@param level 日志级别
@param data 日志内容
@param tag 自定义标签 | private static log(level: LogLevel, data: Any, tag?: string) {
if (Logger.option.close) return;
const domain = Logger.option.domain!;
const finalTag = tag || Logger.option.tag!;
const message = Logger.format(data);
/**
* 通过写入器写入日志(解耦具体的输出方式)
*/
Logger.writer.write(level, domain, fina... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left log AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L... | private static log(level: LogLevel, data: Any, tag?: string) {
if (Logger.option.close) return;
const domain = Logger.option.domain!;
const finalTag = tag || Logger.option.tag!;
const message = Logger.format(data);
/**
* 通过写入器写入日志(解耦具体的输出方式)
*/
Logger.writer.write(level, domain, fina... | https://github.com/codelably/HCompass | bcd487f072be0eefbd8647f870344c95c98751de | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | fallbackToPreviousPhase | 回退到上一个阶段 | private fallbackToPreviousPhase(): RecoveryResult {
const previousPhase = this.getPreviousPhase(this.currentPhase);
if (!previousPhase) {
return {
success: false,
strategy: RecoveryStrategy.FALLBACK,
message: '没有可回退的阶段',
duration: 0
};
}
return this.res... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fallbackToPreviousPhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#... | private fallbackToPreviousPhase(): RecoveryResult {
const previousPhase = this.getPreviousPhase(this.currentPhase);
if (!previousPhase) {
return {
success: false,
strategy: RecoveryStrategy.FALLBACK,
message: '没有可回退的阶段',
duration: 0
};
}
return this.res... | https://github.com/DaLongZhuaZi/manxia | f7135958d78515115c57c7b894068ef4a06586a1 | github |
xblLab/HarmonyProjectTemplate | commons/lib_api/src/main/ets/services/MineService.ets | arkts | addMark | 收藏
@param label | public addMark(label: string) {
const mineUserInfo = this.queryAuthorRaw() as MyAuthor;
mineUserInfo?.myMarks.splice(0, 0, label);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addMark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | public addMark(label: string) {
const mineUserInfo = this.queryAuthorRaw() as MyAuthor;
mineUserInfo?.myMarks.splice(0, 0, label);
} | https://github.com/xblLab/HarmonyProjectTemplate | 29d4aec279db50976c2af184a9b957bfef68b157 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/DatabaseHelper.ets | arkts | clearDatabase | 清空数据库数据
删除数据库文件并重新初始化 | public static async clearDatabase(): Promise<void> {
try {
// 如果数据库已初始化,先关闭连接
if (DatabaseHelper.isInitialized) {
await DatabaseHelper.close();
}
// 删除数据库文件
if (DatabaseHelper.dbManager) {
await DatabaseHelper.dbManager.deleteDB();
} else {
// 如果没有实例,创建... | 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 clearDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#... | public static async clearDatabase(): Promise<void> {
try {
// 如果数据库已初始化,先关闭连接
if (DatabaseHelper.isInitialized) {
await DatabaseHelper.close();
}
// 删除数据库文件
if (DatabaseHelper.dbManager) {
await DatabaseHelper.dbManager.deleteDB();
} else {
// 如果没有实例,创建... | https://github.com/fuhhhhhhhh/openharmony | 44da743e5892ab99e2d72c581eadf479965d23cf | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/AccountKitService.ets | arkts | getOpenID | 获取 OpenID | getOpenID(): string {
return this.credential?.openID || '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOpenID AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bl... | getOpenID(): string {
return this.credential?.openID || '';
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 9df5889deb19d0c6664c1dba4624697ddedb8698 | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/crypto/CryptoService.ets | arkts | setPassword | ===== AES-GCM 字段加密 =====
设置运行时密码(登录时调用) | static setPassword(password: string): void {
cachedPassword = password
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | static setPassword(password: string): void {
cachedPassword = password
} | https://github.com/encorexin/WordPressCMS | 7d66eb424f007a4ee04853118ba27b1ba990d2a1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | getBooksWithReadingTime | 获取所有有阅读记录的书籍(用于阅读统计) | async getBooksWithReadingTime(): Promise<NovelBook[]> {
const store = this.getStore();
const rs = await store.querySql(
'SELECT * FROM novel_book WHERE totalReadingTime > 0 OR lastReadTime > 0 ORDER BY lastReadTime DESC'
);
return this.parseBookResults(rs);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBooksWithReadingTime AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | async getBooksWithReadingTime(): Promise<NovelBook[]> {
const store = this.getStore();
const rs = await store.querySql(
'SELECT * FROM novel_book WHERE totalReadingTime > 0 OR lastReadTime > 0 ORDER BY lastReadTime DESC'
);
return this.parseBookResults(rs);
} | https://github.com/DaLongZhuaZi/manxia | b905887d677f6c896dd3d839089e94f7b652767a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets | arkts | getStatus | 获取引擎状态信息 | getStatus(): EngineStatus {
const status: EngineStatus = {
initialized: this.isInitialized,
currentEngine: this.currentEngineType,
rhinoReady: this.rhinoExecutor !== null ? this.rhinoExecutor.isSandboxReady() : false,
legadoEngineAvailable: this.legadoEngine !== null,
rhinoSandboxMod... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left EngineStatus AST#identifier#Right AST#ERROR#Right AS... | getStatus(): EngineStatus {
const status: EngineStatus = {
initialized: this.isInitialized,
currentEngine: this.currentEngineType,
rhinoReady: this.rhinoExecutor !== null ? this.rhinoExecutor.isSandboxReady() : false,
legadoEngineAvailable: this.legadoEngine !== null,
rhinoSandboxMod... | https://github.com/DaLongZhuaZi/manxia | 271c36b278b18c1527f041fd2b5b1e0438493daf | github |
openharmony/arkui_ace_engine | advanced_ui_component/treeviewv2/source/treeviewv2.ets | arkts | offNodeDelete | Destroy node delete callback event.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 26 | public offNodeDelete(callback?: OnChangedCallback): void {
if (callback === undefined) {
this.nodeDeleteEvents = [];
this.nodeDeleteOnceEvents = [];
} else {
let index = this.nodeDeleteEvents.indexOf(callback);
if (index >= 0) {
this.nodeDeleteEvents.splice(index, 1);
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left offNodeDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR... | public offNodeDelete(callback?: OnChangedCallback): void {
if (callback === undefined) {
this.nodeDeleteEvents = [];
this.nodeDeleteOnceEvents = [];
} else {
let index = this.nodeDeleteEvents.indexOf(callback);
if (index >= 0) {
this.nodeDeleteEvents.splice(index, 1);
}
... | https://gitcode.com/openharmony/arkui_ace_engine | 2f568f01b9962211a21ead69845b7d41848683a0 | gitcode |
LZZLHY/hlib | entry/src/main/ets/viewmodel/FavoritesVM.ets | arkts | isFavorite | 当前书是否被收藏(本地源)。 | static async isFavorite(bookId: number): Promise<boolean> {
return await FavoritesStore.has(bookId);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left isFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#... | static async isFavorite(bookId: number): Promise<boolean> {
return await FavoritesStore.has(bookId);
} | https://github.com/LZZLHY/hlib | 79c096fd0b6812eca2da3547eb207048b0c6827b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | from | @returns created {@link TypeOrCreator_Creator} or TypeOrCreator_Type if it was already created | static from(typ: TypeCreator): TypeOrCreator {
if (typ.typ != null) {
return new TypeOrCreator_Type(typ.typ!)
}
return new TypeOrCreator_Creator(typ)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typ AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | static from(typ: TypeCreator): TypeOrCreator {
if (typ.typ != null) {
return new TypeOrCreator_Type(typ.typ!)
}
return new TypeOrCreator_Creator(typ)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 67b2d5c7134d98150a79dd0f97ead377a7cea0d2 | gitee |
JackJiang2011/harmonychat | entry/src/main/ets/pages/ChatPage.ets | arkts | addEvents | 添加事件监听。 | addEvents() {
// 【1】增加了聊天消息
IMClientManager.getInstance().getEmitter().on(UIEvent.UIEVENT_messageAdded, this.meessageAddedEventCallback = (index: number) => {
// 通知ListView的数据源,刷新消息显示
this.messagesDataSource.notifyDataAdd(index);
// 滚动消息列表至底部(以备显示最新消息)
this.scrollToBottom();
});
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | addEvents() {
// 【1】增加了聊天消息
IMClientManager.getInstance().getEmitter().on(UIEvent.UIEVENT_messageAdded, this.meessageAddedEventCallback = (index: number) => {
// 通知ListView的数据源,刷新消息显示
this.messagesDataSource.notifyDataAdd(index);
// 滚动消息列表至底部(以备显示最新消息)
this.scrollToBottom();
});
... | https://github.com/JackJiang2011/harmonychat | 9811a3455d7084146c0276346e941db509f9f7f8 | github |
erosTeam/NextE | shared/src/main/ets/settings/ThemeColorSettings.ets | arkts | isCustom | NextE extension: a custom accent is any valid #RRGGBB hex. | static isCustom(color: string): boolean {
return /^#[0-9a-fA-F]{6}$/.test(color.trim())
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isCustom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | static isCustom(color: string): boolean {
return /^#[0-9a-fA-F]{6}$/.test(color.trim())
} | https://github.com/erosTeam/NextE | 5cbb6b19a2728f35d35403c2a169626ce3d0ab46 | github |
openharmony/napi_generator | examples/Index.ets | arkts | onCallbackfunnm | register注册的回调 | function onCallbackfunnm(wid: number) {
AppStorage.SetOrCreate("callBackNum", JSON.stringify(wid))
console.info("napiTestDemo ----onCallbackfunnm wid = " + wid)
return "ocCallbackfuncnm";
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left onCallbackfunnm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left wid AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function onCallbackfunnm(wid: number) {
AppStorage.SetOrCreate("callBackNum", JSON.stringify(wid))
console.info("napiTestDemo ----onCallbackfunnm wid = " + wid)
return "ocCallbackfuncnm";
} | https://gitee.com/openharmony/napi_generator.git | 43aa299e9b3d5883da7767d7d6a742f51fea9e5f | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | getSourceCount | 获取书源数量 | getSourceCount(): number {
return this.sources.size;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSourceCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getSourceCount(): number {
return this.sources.size;
} | https://github.com/DaLongZhuaZi/manxia | b6d669e9e44ffe89169d1b8c2fff0476d950cf20 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/DigitPanelController.ets | arkts | getEvaluator | 获取Evaluator
returns Evaluator. | public getEvaluator(): Evaluator {
if (this.evaluator === null) {
this.evaluator = new Evaluator(this.worker);
}
return this.evaluator;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEvaluator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Evaluator... | public getEvaluator(): Evaluator {
if (this.evaluator === null) {
this.evaluator = new Evaluator(this.worker);
}
return this.evaluator;
} | https://gitee.com/openharmony-sig/applications_calculator.git | 367c2f0a54c2d35dc759018da39ab74224dc9718 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | isSourcePinned | 检查图源是否已置顶 | async isSourcePinned(sourceId: number): Promise<boolean> {
const pinnedList = await this.getSourcePinnedList();
return pinnedList.includes(sourceId);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isSourcePinned AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async isSourcePinned(sourceId: number): Promise<boolean> {
const pinnedList = await this.getSourcePinnedList();
return pinnedList.includes(sourceId);
} | https://github.com/DaLongZhuaZi/manxia | dc52330e5f78d1cef745f25700d179b8851ae203 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/multiplication/multiplication_ubyte.ets | arkts | main | ---
desc: check multiplication of two unsigned bytes
--- | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{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: ubyte = {{v.left}}
const b: ubyte = {{v.right}}
assert (a * b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 06875068e0f51d52a8f10e867e060f96fd0f8830 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | evictLeastRecentlyUsed | 淘汰最少使用的缓存项 | private evictLeastRecentlyUsed(count: number): void {
const items: CacheItem[] = this.cacheItems.values();
if (items.length === 0) {
return;
}
// 按最后访问时间排序
items.sort((a: CacheItem, b: CacheItem) => a.lastAccessTime - b.lastAccessTime);
// 移除最少使用的项目
for (let i = 0; i < Math.min(cou... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left evictLeastRecentlyUsed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private evictLeastRecentlyUsed(count: number): void {
const items: CacheItem[] = this.cacheItems.values();
if (items.length === 0) {
return;
}
// 按最后访问时间排序
items.sort((a: CacheItem, b: CacheItem) => a.lastAccessTime - b.lastAccessTime);
// 移除最少使用的项目
for (let i = 0; i < Math.min(cou... | https://github.com/DaLongZhuaZi/manxia | d3056f39c664e3e4c44970861bab14d586dfc351 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpSessionManager.ets | arkts | startSession | Start a new RDP session | async startSession(instance: number, sessionInfo: SessionInfo): Promise<boolean> {
console.info(`${TAG}: Starting session`);
currentInstance = instance;
isSessionActive = true;
// Save session info for reconnection
NetworkManager.setSessionInfo(sessionInfo);
// Request audio foc... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startSession AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left instance AST#identifier#Right AST#type_annotation#Left AS... | async startSession(instance: number, sessionInfo: SessionInfo): Promise<boolean> {
console.info(`${TAG}: Starting session`);
currentInstance = instance;
isSessionActive = true;
// Save session info for reconnection
NetworkManager.setSessionInfo(sessionInfo);
// Request audio foc... | https://github.com/tangwengang-del/freerdp-harmonyos | 072613826c558f9cbb689c1888fbf94d81a8a0ed | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | constructor | `Date` constructor.
@param year
@param month
@param day
@param hours
@param minutes
@param seconds
@param ms
@see ECMA-262, 21.4.2.1
@description Initialize `Date` instance with year, month, day, hours, minutes, seconds and milliseconds given. | constructor(year: long, month: long, day: long, hours: long, minutes: long, seconds: long, ms: long) {
this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, 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 year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long AST#identifier#Right AST... | constructor(year: long, month: long, day: long, hours: long, minutes: long, seconds: long, ms: long) {
this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, ms))
this.TZOffset = Date.getLocalTimezoneOffset()
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2de434c2a76b228f51df9dbe1d39c5569a2d064f | gitee |
Gramony/Gramony | features/home/src/main/ets/viewmodel/Chat/AnimationProperties.ets | arkts | getRectInfoById | 根据组件的id获取组件的位置信息 | private getRectInfoById(id: string): RectInfoInPx {
let componentInfo: componentUtils.ComponentInfo = componentUtils.getRectangleById(id);
if (!componentInfo) {
throw Error('object is empty');
}
let rstRect: RectInfoInPx = new RectInfoInPx();
const widthScaleGap = componentInfo.size.width ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getRectInfoById 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... | private getRectInfoById(id: string): RectInfoInPx {
let componentInfo: componentUtils.ComponentInfo = componentUtils.getRectangleById(id);
if (!componentInfo) {
throw Error('object is empty');
}
let rstRect: RectInfoInPx = new RectInfoInPx();
const widthScaleGap = componentInfo.size.width ... | https://github.com/Gramony/Gramony | 36453860f339e9454ab73e02b147a144ecd281a1 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamIMEManager.ets | arkts | hide | 关闭系统键盘并清理回调 | hide(): void {
// 主动 hide 时释放锁定状态,避免下次 show 时锁定误传递
this.locked = false;
try {
if (this.imeController) {
this.imeController.off('insertText');
this.imeController.off('deleteLeft');
this.imeController.off('sendFunctionKey');
this.imeController.off('sendKeyboardStatus');... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hide 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 AS... | hide(): void {
// 主动 hide 时释放锁定状态,避免下次 show 时锁定误传递
this.locked = false;
try {
if (this.imeController) {
this.imeController.off('insertText');
this.imeController.off('deleteLeft');
this.imeController.off('sendFunctionKey');
this.imeController.off('sendKeyboardStatus');... | https://github.com/AlkaidLab/moonlight-harmony | eaa8fab43606e3bd9a7bc291f2fd2290d1609c0e | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.