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 |
|---|---|---|---|---|---|---|---|---|---|---|
azhu0001/localsend-harmony | entry/src/main/ets/pages/transfer/TransferPage.ets | arkts | setTransferProgressChangedObserver | 监听传输进度 | setTransferProgressChangedObserver() {
EventBus.getInstance().on(EventType.TRANSFER_PROGRESS_CHANGED_ACTION, (data: emitter.EventData) => {
const action = data.data as TransferProgressChangedAction
if (action) {
if (action.status == FileTransferStatus.TRANSFERRING) {
this.progress = ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setTransferProgressChangedObserver 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... | setTransferProgressChangedObserver() {
EventBus.getInstance().on(EventType.TRANSFER_PROGRESS_CHANGED_ACTION, (data: emitter.EventData) => {
const action = data.data as TransferProgressChangedAction
if (action) {
if (action.status == FileTransferStatus.TRANSFERRING) {
this.progress = ... | https://gitcode.com/azhu0001/localsend-harmony | 35ff46bba93d3865ddc949caf2b4f9f5f60d9f1e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getElementsByJsonPath | 通过JSONPath获取元素列表 | private getElementsByJsonPath(path: string): string[] {
try {
// 检查内容是否为空
if (!this.content || this.content.trim() === '') {
this.selectorTrace((): string => `JSONPath解析: 内容为空`);
return [];
}
// 尝试解析JSON
let data: Object;
try {
data = SafeUtils.pa... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsByJsonPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private getElementsByJsonPath(path: string): string[] {
try {
// 检查内容是否为空
if (!this.content || this.content.trim() === '') {
this.selectorTrace((): string => `JSONPath解析: 内容为空`);
return [];
}
// 尝试解析JSON
let data: Object;
try {
data = SafeUtils.pa... | https://github.com/DaLongZhuaZi/manxia | cc0691adf6b74a878f365c423bfba6132318fab0 | github |
ZHCOOL520/HarmonyOS-AUTOcall | entry/src/main/ets/utils/FileImportManager.ets | arkts | importFromCSV | 从CSV文件导入电话列表 | static async importFromCSV(context: common.UIAbilityContext, filePath: string): Promise<PhoneEntry[]> {
try {
if (!fs.accessSync(filePath)) {
throw new Error('CSV文件不存在')
}
const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY)
const buffer = new ArrayBuffer(1024 * 1024) // 1MB ... | 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 importFromCSV AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : ... | static async importFromCSV(context: common.UIAbilityContext, filePath: string): Promise<PhoneEntry[]> {
try {
if (!fs.accessSync(filePath)) {
throw new Error('CSV文件不存在')
}
const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY)
const buffer = new ArrayBuffer(1024 * 1024) // 1MB ... | https://github.com/ZHCOOL520/HarmonyOS-AUTOcall | 448047f5b9f6a622f77641101ee53ce4ae990ecd | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/FamilyService.ets | arkts | init | 初始化家属服务 | async init(familyId: string): Promise<void> {
this.currentFamilyId = familyId;
await this.loadRelations();
} | 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 init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left familyI... | async init(familyId: string): Promise<void> {
this.currentFamilyId = familyId;
await this.loadRelations();
} | https://github.com/LJ666-ui/harmony-health-care | 5fad414c6eda85334bf533a3bb0c1e9ae15af952 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/ComicInfoParser.ets | arkts | validateComicInfo | 验证解析结果
@param comicInfo 解析后的漫画信息
@returns 验证结果 | public static validateComicInfo(comicInfo: ComicInfo): ValidationResult {
const errors: string[] = [];
// 检查必需字段
if (!comicInfo.title && !comicInfo.series) {
errors.push('缺少标题或系列名称');
}
// 检查数值字段的有效性
if (comicInfo.year !== undefined && (comicInfo.year < 1900 || comicInfo.year > 2100)) ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left validateComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comicInfo AST#identifier#Right AST#:#... | public static validateComicInfo(comicInfo: ComicInfo): ValidationResult {
const errors: string[] = [];
// 检查必需字段
if (!comicInfo.title && !comicInfo.series) {
errors.push('缺少标题或系列名称');
}
// 检查数值字段的有效性
if (comicInfo.year !== undefined && (comicInfo.year < 1900 || comicInfo.year > 2100)) ... | https://github.com/DaLongZhuaZi/manxia | 30afb94f9a6db3fed9e2ddc10380a458b97888f7 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/RustDeskLanDiscoveryService.ets | arkts | sendDiscoveryProbe | 发送 UDP 广播探测包 | private sendDiscoveryProbe(): void {
if (!this.udp || !this.scanning) {
return;
}
try {
// RustDesk LAN 发现探测: 发送 "RDCM" magic + version 到广播地址
const probe: Uint8Array = new Uint8Array(12);
const encoder: util.TextEncoder = new util.TextEncoder();
const magic: Uint8Array = enco... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendDiscoveryProbe 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 A... | private sendDiscoveryProbe(): void {
if (!this.udp || !this.scanning) {
return;
}
try {
// RustDesk LAN 发现探测: 发送 "RDCM" magic + version 到广播地址
const probe: Uint8Array = new Uint8Array(12);
const encoder: util.TextEncoder = new util.TextEncoder();
const magic: Uint8Array = enco... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | dc71e5cc1e7827c03b6a30f9c7a32615c466a7ed | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGRoot.ets | arkts | toObj | 获取设置的属性集合 | public toObj(): object{
let keys: string[] = Object.keys(this.attributesObj);
let indexOfXMLNS = keys.indexOf(XMLConstants.XMLNS_PREFIX);
if (indexOfXMLNS === -1) {
this.attributesObj[XMLConstants.XMLNS_PREFIX] = XMLConstants.XMLNS_NAMESPACE_URI_SVG;
}
let indexOfXMLNSLink = keys.indexOf(XM... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left toObj 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#:#Rig... | public toObj(): object{
let keys: string[] = Object.keys(this.attributesObj);
let indexOfXMLNS = keys.indexOf(XMLConstants.XMLNS_PREFIX);
if (indexOfXMLNS === -1) {
this.attributesObj[XMLConstants.XMLNS_PREFIX] = XMLConstants.XMLNS_NAMESPACE_URI_SVG;
}
let indexOfXMLNSLink = keys.indexOf(XM... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | e0835f70f23bf7708fb5c69cabee066b90fb896f | gitee |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/AnimationUtils.ets | arkts | calculateAnimationDuration | 根据速度计算动画持续时间
@param velocity - 滑动速度
@param baseDuration - 基础持续时间
@returns 计算后的动画持续时间 | static calculateAnimationDuration(velocity: number, baseDuration: number): number {
if (AnimationUtils.isFastSwipe(velocity)) {
return AnimationConstants.MIN_ANIMATION_DURATION;
}
const normalizedVelocity: number = Math.abs(velocity) / AnimationConstants.FAST_SWIPE_VELOCITY;
const duration: num... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateAnimationDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left velocity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numbe... | static calculateAnimationDuration(velocity: number, baseDuration: number): number {
if (AnimationUtils.isFastSwipe(velocity)) {
return AnimationConstants.MIN_ANIMATION_DURATION;
}
const normalizedVelocity: number = Math.abs(velocity) / AnimationConstants.FAST_SWIPE_VELOCITY;
const duration: num... | https://github.com/kumaleap/ArkSwipeDeck | d13a3a0abfdfefbd21685a71e47402a450d38ee7 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/client/tools/ControlPacket.ets | arkts | createHomeKey | 发送Home键 | static createHomeKey(): ArrayBuffer[] {
return ControlPacket.createKeyEventPair(KeyCode.KEYCODE_HOME);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createHomeKey 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 ArrayBuf... | static createHomeKey(): ArrayBuffer[] {
return ControlPacket.createKeyEventPair(KeyCode.KEYCODE_HOME);
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 2ed8fbdea9beaa38d6546e93d7b45eea7db249d6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | includes | Checks if specified argument is in BigUint64Array
@param e search element
@returns true if e is in BigUint64Array, false otherwise | public includes(e: BigInt): boolean {
return this.includes(new BigInt(e), 0)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BigInt AST... | public includes(e: BigInt): boolean {
return this.includes(new BigInt(e), 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4580340ae6a3e9d8b99773eb10b6ec191cd38727 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/JArrayList.ets | arkts | insert | 在列表中插入一个元素
@param {*} element
@param {*} after | insert(element: T) {
this.dataSource.push(element);
this.listSize++;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Le... | insert(element: T) {
this.dataSource.push(element);
this.listSize++;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 43bc1be9f34b78fd733bb41b741eb68ed6813748 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/EventSourcingService.ets | arkts | rebuildAggregateState | ==================== 状态重建 ====================
重建聚合状态(通过事件回放) | static async rebuildAggregateState(
aggregateType: string,
aggregateId: number
): Promise<AggregateState | null> {
try {
// 尝试从快照加载
const snapshot = await AggregateSnapshotDAO.getLatest(aggregateType, aggregateId);
let version = 0;
let state: Record<string, Object> = {};
... | 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 rebuildAggregateState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left... | static async rebuildAggregateState(
aggregateType: string,
aggregateId: number
): Promise<AggregateState | null> {
try {
// 尝试从快照加载
const snapshot = await AggregateSnapshotDAO.getLatest(aggregateType, aggregateId);
let version = 0;
let state: Record<string, Object> = {};
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7768e0f91f711ade316c68da2ebb6216394d5166 | github |
HarmonyOS_Samples/BestPracticeSnippets | UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement1.ets | arkts | additionDelay | [EndExclude seq_runner] | @Concurrent
function additionDelay(delay: number): void {
let start: number = new Date().getTime();
while (new Date().getTime() - start < delay) {
continue;
}
} | 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 additionDelay AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#... | @Concurrent
function additionDelay(delay: number): void {
let start: number = new Date().getTime();
while (new Date().getTime() - start < delay) {
continue;
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 87282b3fb1222286b9db770445c107286660a3f5 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/MedicalImageUtils.ets | arkts | calculateColorHistogram | 计算颜色直方图
@param pixelMap 图像
@param bins 直方图bin数量(默认16)
@returns 颜色直方图数组 | static async calculateColorHistogram(
pixelMap: image.PixelMap,
bins: number = 16
): Promise<number[]> {
try {
// 获取图像信息
const imageInfo = await pixelMap.getImageInfo();
const width = imageInfo.size.width;
const height = imageInfo.size.height;
// 读取像素数据
const pixelBy... | 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 calculateColorHistogram AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identif... | static async calculateColorHistogram(
pixelMap: image.PixelMap,
bins: number = 16
): Promise<number[]> {
try {
// 获取图像信息
const imageInfo = await pixelMap.getImageInfo();
const width = imageInfo.size.width;
const height = imageInfo.size.height;
// 读取像素数据
const pixelBy... | https://github.com/LJ666-ui/harmony-health-care | afa3018f2cc04e63d5fc57874576279fe57786ce | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/ScraperManager.ets | arkts | setSourceEnabled | 启用/禁用刮削源 | public setSourceEnabled(source: ScraperSource, enabled: boolean): void {
if (enabled) {
this.enabledSources.add(source);
} else {
this.enabledSources.delete(source);
}
logger.info(TAG, `刮削源 ${source} ${enabled ? '已启用' : '已禁用'}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSourceEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setSourceEnabled(source: ScraperSource, enabled: boolean): void {
if (enabled) {
this.enabledSources.add(source);
} else {
this.enabledSources.delete(source);
}
logger.info(TAG, `刮削源 ${source} ${enabled ? '已启用' : '已禁用'}`);
} | https://github.com/DaLongZhuaZi/manxia | 1e69bc737af7719366bc0cd2cc0f40619bc224e6 | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的房联网系统_谭宜潇/SmartHouse/entry/src/main/ets/MainAbility/model/UserData.ets | arkts | constructor | 当前用户的皮肤类型 | constructor(name:string, passwd:string) {
//this.id = `${ NextId++ }`;
this.userName = name;
this.userPasswd = passwd;
this.age = null
this.phone = NaN;
this.idcard = "";
this.head_image = $r("app.media.unlogin")
} | 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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | constructor(name:string, passwd:string) {
//this.id = `${ NextId++ }`;
this.userName = name;
this.userPasswd = passwd;
this.age = null
this.phone = NaN;
this.idcard = "";
this.head_image = $r("app.media.unlogin")
} | https://gitee.com/openharmony-sig/online_event.git | 87564b0ad5732994db88cff460cf4af3b4a31d75 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/skill/utils/SkillTestTool.ets | arkts | testHealthQuery | 测试健康查询意图 | private async testHealthQuery(): Promise<void> {
const testName = '健康查询';
const testCases = [
{ input: '血压怎么样', expectedContains: ['血压', '记录'] },
{ input: '查看血糖记录', expectedContains: ['血糖'] },
{ input: '我的健康数据', expectedContains: ['健康'] }
];
for (const tc of testCases) {
try {... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left testHealthQuery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async testHealthQuery(): Promise<void> {
const testName = '健康查询';
const testCases = [
{ input: '血压怎么样', expectedContains: ['血压', '记录'] },
{ input: '查看血糖记录', expectedContains: ['血糖'] },
{ input: '我的健康数据', expectedContains: ['健康'] }
];
for (const tc of testCases) {
try {... | https://github.com/LJ666-ui/harmony-health-care | e83529e2b08840f04a51d817384f25db068e0b99 | github |
wanrenhuifu/JLU | harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/components/TKExaminationItem.ets | arkts | ISHasAnswer | 判断当前这道题有没有答题 | ISHasAnswer(){
let question = this.userAnswers.find(obj=>obj.questionId===this.item.id)
if (question && question.userAnswer.length > 0) {
return true
}else{
return false
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ISHasAnswer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | ISHasAnswer(){
let question = this.userAnswers.find(obj=>obj.questionId===this.item.id)
if (question && question.userAnswer.length > 0) {
return true
}else{
return false
}
} | https://github.com/wanrenhuifu/JLU | 927d19b028d43574fd5d9cb141420ceeee474061 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | refreshDestination | Refreshes the unified destination. | refreshDestination() {
this.searchUnifyResult = unifyDestination(this.addressBarContentMajor, this.addressBarPreferHttps);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshDestination 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... | refreshDestination() {
this.searchUnifyResult = unifyDestination(this.addressBarContentMajor, this.addressBarPreferHttps);
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 40c75a9e3dfdf01d173752af4995e3c50693b3af | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t4_commaSeparated | T4: Comma-separated values | t4_commaSeparated(): void {
const opts: ParseOptions = { comma: true };
const r: Record<string, Object> = parse('a=1,2,3', opts);
const rec: Record<string, Object> = r as Record<string, Object>;
const arr: Object[] = rec['a'] as Object[];
const passed: boolean = Array.isArray(arr) && arr.length ==... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t4_commaSeparated 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_... | t4_commaSeparated(): void {
const opts: ParseOptions = { comma: true };
const r: Record<string, Object> = parse('a=1,2,3', opts);
const rec: Record<string, Object> = r as Record<string, Object>;
const arr: Object[] = rec['a'] as Object[];
const passed: boolean = Array.isArray(arr) && arr.length ==... | https://github.com/wgli-collab/qs-arkts | 7e3129c10a67a102fac3e3c508619252ca11de9a | github |
honjow/Next2V | shared/src/main/ets/backup/BackupPreferencesAdapter.ets | arkts | restoreLegacyTypedSection | Legacy import path for backups created before the whole-store dump (typed per-setting fields). | private static async restoreLegacyTypedSection(
context: common.UIAbilityContext,
section: BackupPreferencesSection,
): Promise<void> {
if (section.apiDomain && section.apiDomain.baseUrl) {
await ApiDomainSettings.save(context, section.apiDomain.baseUrl)
} else if (section.apiDomain && typeof ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left restoreLegacyTypedSection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#ident... | private static async restoreLegacyTypedSection(
context: common.UIAbilityContext,
section: BackupPreferencesSection,
): Promise<void> {
if (section.apiDomain && section.apiDomain.baseUrl) {
await ApiDomainSettings.save(context, section.apiDomain.baseUrl)
} else if (section.apiDomain && typeof ... | https://github.com/honjow/Next2V | d2ccefe3d3fde6c8e5999aac9883c3b77c5d7747 | github |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnIconPage.ets | arkts | build | 构建图标展示页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "图标",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.IconContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "图标",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.IconContent();
}
} | https://github.com/codelably/tuniao-ui | a105248946f317210625faea0b1816c58145bd19 | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/component/OrderCard.ets | arkts | build | 构建订单卡片
@returns {void} 无返回值 | build(): void {
Card({
onTap: (): void => this.toOrderDetail(this.order.id)
}) {
this.buildHeader();
this.buildGoodsPreview();
this.buildDivider();
this.buildActionBar();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Card({
onTap: (): void => this.toOrderDetail(this.order.id)
}) {
this.buildHeader();
this.buildGoodsPreview();
this.buildDivider();
this.buildActionBar();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | bae8a652b72bd556411f4b9de2bc20517d338d8d | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getAllWidgetData | 异步获取所有卡片数据 | async function getAllWidgetData(context: Context): Promise<Record<string, string>> {
const weekData = await getWeekDataFromDb(context);
const monthData = await getMonthDataFromDb(context);
const result: Record<string, string> = {};
Object.keys(weekData).forEach((key: string) => {
(result as Record<string, ... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getAllWidgetData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST... | async function getAllWidgetData(context: Context): Promise<Record<string, string>> {
const weekData = await getWeekDataFromDb(context);
const monthData = await getMonthDataFromDb(context);
const result: Record<string, string> = {};
Object.keys(weekData).forEach((key: string) => {
(result as Record<string, ... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 2a729ab43f29ce585ffe323e956e9b37d00b547d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskHelper.ets | arkts | startAutoRefresh | 启动自动续期,避免长任务在后台运行过程中被系统提前回收 | private static startAutoRefresh(): void {
BackgroundTaskHelper.stopAutoRefresh();
BackgroundTaskHelper.refreshTimer = setInterval(() => {
void BackgroundTaskHelper.handleAutoRefresh();
}, AUTO_REFRESH_INTERVAL_MS) as number;
logger.info(TAG, `后台长时任务自动续期已启动,间隔=${AUTO_REFRESH_INTERVAL_MS}ms`);
} | 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 startAutoRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private static startAutoRefresh(): void {
BackgroundTaskHelper.stopAutoRefresh();
BackgroundTaskHelper.refreshTimer = setInterval(() => {
void BackgroundTaskHelper.handleAutoRefresh();
}, AUTO_REFRESH_INTERVAL_MS) as number;
logger.info(TAG, `后台长时任务自动续期已启动,间隔=${AUTO_REFRESH_INTERVAL_MS}ms`);
} | https://github.com/DaLongZhuaZi/manxia | 7b0c49bfd5750c043dbab9c2a246bcf51ea480e3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getConstructorsNum | Returns number of constructors of this class
Note that constructors of super class isn't considered as constructors of this class
@returns {long} number of constructors
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getConstructorsNum(): long {
return TypeAPI.getConstructorsNum(this.cls)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getConstructorsNum 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 lon... | public getConstructorsNum(): long {
return TypeAPI.getConstructorsNum(this.cls)
} | https://gitcode.com/iop123123/arkts-static-skills | 5718b571875c9eceb751a7393a3add756a935c48 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitSint64 | 访问 sint64 字段
JSON: string (避免精度丢失) | visitSint64(value: bigint, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.toString() as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitSint64 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 bigint AST#identifier#Right AST#,#Left , AS... | visitSint64(value: bigint, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.toString() as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | a6d40e435d607cf1ea0be2c8cdf8a2f493a6175e | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Assigns val as element on insertPos.
@param { int } insertPos - index to change
@param { float } val - value to set
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(insertPos: int, val: float): void {
this.$_set(insertPos, val)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | public set(insertPos: int, val: float): void {
this.$_set(insertPos, val)
} | https://gitcode.com/iop123123/arkts-static-skills | 0d36c433dcfa803144e4e8f957c0df4ea921762b | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/AudioApi.ets | arkts | getAudioStream | @summary Gets an audio stream.
@param {AudioApiGetAudioStreamRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof AudioApi | public getAudioStream(requestParameters: AudioApiGetAudioStreamRequest) {
this.assertParam(requestParameters.itemId)
return this.apiClient.createUrl({ method: "GET", path: `/Audio/${requestParameters.itemId}/stream`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAudioStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | public getAudioStream(requestParameters: AudioApiGetAudioStreamRequest) {
this.assertParam(requestParameters.itemId)
return this.apiClient.createUrl({ method: "GET", path: `/Audio/${requestParameters.itemId}/stream`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 1a25156f49be57042f757caf264d40173c587d28 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test29_original_index.ets | arkts | simpleHash | --- charCodeAt chain (string hash) --- | function simpleHash(s: string): number {
let h: number = 0;
for (let i: number = 0; i < s.length; i++) {
let code: number = s.charCodeAt(i);
h = h + code;
}
return h;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left simpleHash AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS... | function simpleHash(s: string): number {
let h: number = 0;
for (let i: number = 0; i < s.length; i++) {
let code: number = s.charCodeAt(i);
h = h + code;
}
return h;
} | https://github.com/miaochiahao/ark-ghidra | 9694b3b258f789f63e9892844c58308332804a94 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | constructor | Constructor. | constructor() {
this.limitRect = new RectF();
this.imageRect = new RectF();
this.cropRect = new RectF();
this.ratio = new Ratio(CommonConstants.DEFAULT_RATIO, CommonConstants.DEFAULT_RATIO);
let screenWidth = Math.ceil(ScreenManager.getInstance().getWinWidth());
let screenHeight = Math.ceil(S... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.limitRect = new RectF();
this.imageRect = new RectF();
this.cropRect = new RectF();
this.ratio = new Ratio(CommonConstants.DEFAULT_RATIO, CommonConstants.DEFAULT_RATIO);
let screenWidth = Math.ceil(ScreenManager.getInstance().getWinWidth());
let screenHeight = Math.ceil(S... | https://gitee.com/openharmony/codelabs.git | 6af762e4db87f3e329978f857450fb734fbeea1c | gitee |
yongoe1024/RdbPlus | rdbplus/src/main/ets/BaseMapper.ets | arkts | getObjectBySql | 传入SQL,查询得到对象
@param sql sql语句
@param params 占位符参数
@returns 对象数组 | async getObjectBySql(sql: string, params: relationalStore.ValueType[], db?: Connection): Promise<ESObject[]> {
let isClose: boolean = true
if (db === undefined) {
db = await this.getConnection()
} else {
isClose = false
}
const res: relationalStore.ResultSet = await db.execDQL(sql, par... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getObjectBySql AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sql AST#identifier#Right AST#type_annotation#Left AST#:... | async getObjectBySql(sql: string, params: relationalStore.ValueType[], db?: Connection): Promise<ESObject[]> {
let isClose: boolean = true
if (db === undefined) {
db = await this.getConnection()
} else {
isClose = false
}
const res: relationalStore.ResultSet = await db.execDQL(sql, par... | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L124-L146 | d1269d6720857c83e5d5cbc9f5862aa5c1a5f87a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | analyzeSystemCache | 分析系统缓存目录(context.cacheDir) | private async analyzeSystemCache(): Promise<StorageItem> {
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
logger.warn(TAG, 'Context未初始化,无法分析系统缓存');
return this.createEmptyItem(StorageType.SYSTEM_CACHE, '系统缓存');
}
// 系统缓存目录(包含所有cacheDir下的内... | 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 analyzeSystemCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async analyzeSystemCache(): Promise<StorageItem> {
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
logger.warn(TAG, 'Context未初始化,无法分析系统缓存');
return this.createEmptyItem(StorageType.SYSTEM_CACHE, '系统缓存');
}
// 系统缓存目录(包含所有cacheDir下的内... | https://github.com/DaLongZhuaZi/manxia | 2fefba9213b94bf61008ba74256f868640198e7f | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets | arkts | increaseCapacity | Increases the capacity of the deque.
@throws {BusinessError} If the current capacity has reached the maximum limit. | private increaseCapacity(): void {
let newCap: int = min(this.capacity * 2, Int.MAX_VALUE);
let newBuffer = Array.create<T | undefined>(newCap, undefined);
let i: int = this.front, k = 0;
while (i != this.rear) {
newBuffer[k++] = this.buffer[i];
i = (i + 1) ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left increaseCapacity 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... | private increaseCapacity(): void {
let newCap: int = min(this.capacity * 2, Int.MAX_VALUE);
let newBuffer = Array.create<T | undefined>(newCap, undefined);
let i: int = this.front, k = 0;
while (i != this.rear) {
newBuffer[k++] = this.buffer[i];
i = (i + 1) ... | https://gitcode.com/iop123123/arkts-static-skills | c95e79c02fe526de6c3e9f33fa3b6630d7a95d76 | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/RouterManager.ets | arkts | pushPath | 跳转到指定页面 | static pushPath(name: string, param: Object | null = null): void {
if (RouterManager.pathStack !== null) {
if (param !== null) {
RouterManager.pathStack.pushPath({ name: name, param: param });
} else {
RouterManager.pathStack.pushPath({ name: name });
}
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left pushPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static pushPath(name: string, param: Object | null = null): void {
if (RouterManager.pathStack !== null) {
if (param !== null) {
RouterManager.pathStack.pushPath({ name: name, param: param });
} else {
RouterManager.pathStack.pushPath({ name: name });
}
}
} | https://github.com/Amaz1ny/HarmonyDO-public | 0f89d18e72be15321273454449e487f454f71a72 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | saveSingleSettingWithoutFlush | 保存单个设置值(不刷新) | private async saveSingleSettingWithoutFlush(key: string, value: SettingValue, type: SettingType): Promise<void> {
if (!this.dataPreferences) {
throw new Error('Preferences not initialized');
}
switch (type) {
case SettingType.BOOLEAN:
await this.dataPreferences.put(key, value as boole... | 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 saveSingleSettingWithoutFlush AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Righ... | private async saveSingleSettingWithoutFlush(key: string, value: SettingValue, type: SettingType): Promise<void> {
if (!this.dataPreferences) {
throw new Error('Preferences not initialized');
}
switch (type) {
case SettingType.BOOLEAN:
await this.dataPreferences.put(key, value as boole... | https://github.com/richshaw2015/nds | bd0a136bef073094ff354986ab0c1408d9120735 | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | getCurrentPosition | 获取当前播放位置
@returns 当前播放位置(毫秒),未播放时返回 0
@remarks
位置来自解码器的 getPosition() 方法 | public getCurrentPosition(): number {
if (!this.decoder) {
return 0;
}
return this.decoder.getPosition();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number ... | public getCurrentPosition(): number {
if (!this.decoder) {
return 0;
}
return this.decoder.getPosition();
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L270-L275 | 867fd2fdbdf2cd3d89d7893de1960c9d146bd72e | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/model/CardComponentDataModel.ets | arkts | getInstance | 获取CardComponentDataModel实例
@returns CardComponentDataModel | public static getInstance(): CardComponentDataModel {
if (!CardComponentDataModel.instance) {
CardComponentDataModel.instance = new CardComponentDataModel()
}
return CardComponentDataModel.instance
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): CardComponentDataModel {
if (!CardComponentDataModel.instance) {
CardComponentDataModel.instance = new CardComponentDataModel()
}
return CardComponentDataModel.instance
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | faa86a7fe6fec51f40517fff3f66ff64341cae84 | gitcode |
yang-kun-long/HarmonyAccounting | entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | deleteData | 从账户表格中删除数据
@param account 要删除的账户数据
@param callback 回调函数,在数据删除完成后执行 | deleteData(account: AccountData, callback: Function) {
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
predicates.equalTo('id', account.id);
this.accountTable.deleteData(predicates, callback);
} | 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 account AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AccountData AST#identifier#... | deleteData(account: AccountData, callback: Function) {
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
predicates.equalTo('id', account.id);
this.accountTable.deleteData(predicates, callback);
} | https://github.com/yang-kun-long/HarmonyAccounting | 5b45060269de5c141f22dd3be670824474a3bbca | github |
pangpang20/antennaPodHM | entry/src/main/ets/model/Episode.ets | arkts | getFormattedPubDate | 格式化发布日期 | getFormattedPubDate(): string {
if (!this.pubDate) {
return '';
}
const date = new Date(this.pubDate);
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormattedPubDate 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#st... | getFormattedPubDate(): string {
if (!this.pubDate) {
return '';
}
const date = new Date(this.pubDate);
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${... | https://github.com/pangpang20/antennaPodHM | da046d732e9c7cc202b61d1a04c582dd8d01e054 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets | arkts | unregisterResource | 取消注册资源
@param resource 可释放资源 | unregisterResource(resource: Disposable): void {
this.resources.delete(resource);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Disposable AST#identifier#Right A... | unregisterResource(resource: Disposable): void {
this.resources.delete(resource);
} | https://github.com/DaLongZhuaZi/manxia | d576d48677d437a4267c458d384483073b951598 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | saveToolEvent | ============ 工具事件操作 ============
保存工具事件 | async saveToolEvent(
sessionId: string,
messageId: string,
toolCallId: string,
toolName: string,
toolDisplayName: string,
sourceLabel: string,
sourceType: string,
permissionLevel: string,
toolArguments: string,
toolResult: string,
status: string
): Promise<void> {
awa... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveToolEvent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sessionId AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async saveToolEvent(
sessionId: string,
messageId: string,
toolCallId: string,
toolName: string,
toolDisplayName: string,
sourceLabel: string,
sourceType: string,
permissionLevel: string,
toolArguments: string,
toolResult: string,
status: string
): Promise<void> {
awa... | https://github.com/LongLiveY96/chatcube | 4e9125c8e68f61413125c60c062aaa7bd210b7b3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/JSONSourceParser.ets | arkts | parseItem | 解析单个项目 | private parseItem(item: Record<string, Object | undefined>, mapping: Record<string, Object | undefined>): Record<string, Object | undefined> {
const result: Record<string, Object | undefined> = {};
const mappingKeys = Object.keys(mapping);
for (const key of mappingKeys) {
const value: Object | unde... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre... | private parseItem(item: Record<string, Object | undefined>, mapping: Record<string, Object | undefined>): Record<string, Object | undefined> {
const result: Record<string, Object | undefined> = {};
const mappingKeys = Object.keys(mapping);
for (const key of mappingKeys) {
const value: Object | unde... | https://github.com/DaLongZhuaZi/manxia | ef33ba04b981fa19d1578b4c89a5db132d7feb81 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Transformer.ets | arkts | generateTransformedValuesCandle | Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the CANDLESTICKCHART.
@param data
@return | public generateTransformedValuesCandle(data: ICandleDataSet,
phaseX: number, phaseY: number, fromValue: number, toValue: number): number[] {
const count: number = Math.floor(((toValue - fromValue) * phaseX + 1) * 2);
if (this.valuePointsForGenerateTransformedValuesCa... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateTransformedValuesCandle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | public generateTransformedValuesCandle(data: ICandleDataSet,
phaseX: number, phaseY: number, fromValue: number, toValue: number): number[] {
const count: number = Math.floor(((toValue - fromValue) * phaseX + 1) * 2);
if (this.valuePointsForGenerateTransformedValuesCa... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7e647b95330fedfc45702707029d1c876d2a7cf2 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayAsListInt.ets | arkts | toArray | Gets a shallow-copy of the underlying array
@returns a shallow-copy of the underlying array | public toArray(): Int[] {
let data = new Int[this.curSize](0);
for (let i = 0; i < this.curSize; ++i) {
data[i] = this.data[i];
}
return data;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Int AST#identi... | public toArray(): Int[] {
let data = new Int[this.curSize](0);
for (let i = 0; i < this.curSize; ++i) {
data[i] = this.data[i];
}
return data;
} | https://gitcode.com/iop123123/arkts-static-skills | bfd8ad93da1d16bc63fcc8d57332616b27388f01 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | slice | Creates a new `Array` object and populates it with elements of `this` instance of `Array` class
@returns `Array` instance, constructed all elements of `this` instance.
@note This method creates full copy of original `Array` instance. | public slice(): Array<T> {
return new Array<T>(this.sliceArray(Int.MIN_VALUE as int, Int.MAX_VALUE as int));
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right... | public slice(): Array<T> {
return new Array<T>(this.sliceArray(Int.MIN_VALUE as int, Int.MAX_VALUE as int));
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3b23866ab56631844ee06780e57832ee6c4fadea | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LargeFileJSONParser.ets | arkts | parseFile | 静态方法:快速解析大文件 | static async parseFile<T = object>(
filePath: string,
config?: ParseConfig,
callback?: ParseProgressCallback
): Promise<ParseResult<T>> {
const parser = new LargeFileJSONParser<T>(config, callback);
return parser.parseFromFile(filePath);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left parseFile AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left T... | static async parseFile<T = object>(
filePath: string,
config?: ParseConfig,
callback?: ParseProgressCallback
): Promise<ParseResult<T>> {
const parser = new LargeFileJSONParser<T>(config, callback);
return parser.parseFromFile(filePath);
} | https://github.com/DaLongZhuaZi/manxia | c2634565db787321080ded879e1417580ce5bae1 | github |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/view/ResetPasswordPage.ets | arkts | build | 构建重置密码页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.ResetPasswordContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.ResetPasswordContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 4faaaf2448025421949faab2d1281d4202c48ff9 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/WebUploadServer.ets | arkts | findSequence | 在二进制数据中查找指定序列 | private findSequence(data: Uint8Array, sequence: Uint8Array, startOffset: number): number {
for (let i = startOffset; i <= data.length - sequence.length; i++) {
let found = true;
for (let j = 0; j < sequence.length; j++) {
if (data[i + j] !== sequence[j]) {
found = false;
b... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findSequence AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private findSequence(data: Uint8Array, sequence: Uint8Array, startOffset: number): number {
for (let i = startOffset; i <= data.length - sequence.length; i++) {
let found = true;
for (let j = 0; j < sequence.length; j++) {
if (data[i + j] !== sequence[j]) {
found = false;
b... | https://github.com/richshaw2015/nds | fbb97d67e922e795ec098c33dc30378d82a11e2b | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/DataCollector.ets | arkts | getInstance | 获取数据采集器单例实例 | public static getInstance(): DataCollector {
if (!DataCollector.instance) {
DataCollector.instance = new DataCollector();
}
return DataCollector.instance;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): DataCollector {
if (!DataCollector.instance) {
DataCollector.instance = new DataCollector();
}
return DataCollector.instance;
} | https://github.com/LJ666-ui/harmony-health-care | 2703b7eff2facf13f3e8067f90ecb20ba10d22c2 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a copy with replaced value on index
@param index
@param value
@returns an Uint16Array with replaced value on index
public | /* public */ internal with(index: int, value: number): Uint16Array {
let res = new Uint16Array(this)
res.set(index, value)
return res
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#R... | /* public */ internal with(index: int, value: number): Uint16Array {
let res = new Uint16Array(this)
res.set(index, value)
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e8af366f275cb85974d02c6f516b7a4f6d901eee | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | batchAddPageInfo | [优化] 批量添加页面信息(事务包裹)
替代逐条 addPageInfo,将所有 INSERT 放在一个事务内执行 | public async batchAddPageInfo(pages: PageInfoInput[]): Promise<void> {
if (pages.length === 0) return;
try {
const now = Date.now();
await this.databaseManager.beginTransaction();
try {
const sql = `INSERT INTO page
(id, chapterId, pageNumber, imageUrl, localPath... | 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 batchAddPageInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pages AST#identifier#Right AST#:#Left :... | public async batchAddPageInfo(pages: PageInfoInput[]): Promise<void> {
if (pages.length === 0) return;
try {
const now = Date.now();
await this.databaseManager.beginTransaction();
try {
const sql = `INSERT INTO page
(id, chapterId, pageNumber, imageUrl, localPath... | https://github.com/DaLongZhuaZi/manxia | 8696f89aff9ef4c3590f5b0ea1c6cfb28b394891 | github |
apap6628114/nga_oh | entry/src/main/ets/parser/nga/html-thread/DomMarkerExtractor.ets | arkts | extractPostSubject | 提取指定楼层的帖子标题(已反转 HTML 实体)。
@param html 源 HTML
@param lou 楼层号
@returns 帖子标题;未找到时返回空串 | function extractPostSubject(html: string, lou: number): string {
const marker: string = `<h3 id='postsubject${lou}'>`;
const startIdx: number = html.indexOf(marker);
if (startIdx < 0) {
return '';
}
const contentStart: number = startIdx + marker.length;
const endIdx: number = html.indexOf('</h3>', conte... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractPostSubject AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function extractPostSubject(html: string, lou: number): string {
const marker: string = `<h3 id='postsubject${lou}'>`;
const startIdx: number = html.indexOf(marker);
if (startIdx < 0) {
return '';
}
const contentStart: number = startIdx + marker.length;
const endIdx: number = html.indexOf('</h3>', conte... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/nga/html-thread/DomMarkerExtractor.ets#L44-L56 | fdeb2ee0d5b75a7a12ce4cbfd41f38da7dcf14a0 | github |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/pages/RegisterPage.ets | arkts | showToast | 显示简单的提示信息 (Toast)
【修复点 1】加上 try-catch 消除警告 | showToast(msg: string) {
try {
promptAction.showToast({
message: msg,
duration: 2000,
bottom: 600
});
} catch (error) {
console.error(`[RegisterPage] showToast error: ${JSON.stringify(error)}`);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#... | showToast(msg: string) {
try {
promptAction.showToast({
message: msg,
duration: 2000,
bottom: 600
});
} catch (error) {
console.error(`[RegisterPage] showToast error: ${JSON.stringify(error)}`);
}
} | https://gitcode.com/openharmony/codelabs | aea8799a0e20954ff0e88f831f891f23c709d8aa | gitcode |
OHPG/FinSdk | emby/src/main/ets/api/SystemApi.ets | arkts | restartApplication | restartApplication
@summary Restarts the application.
@throws {RequiredError}
@memberof SystemApi | public async restartApplication(): Promise<void> {
return this.apiClient.post({ path: "/System/Restart" })
} | 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 restartApplication AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public async restartApplication(): Promise<void> {
return this.apiClient.post({ path: "/System/Restart" })
} | https://github.com/OHPG/FinSdk | 4e32674a9bf8e13f3fd6a5ab857a73673e35bc1b | github |
openharmony/applications_call | entry/src/main/ets/model/CallDataManager.ets | arkts | removeCallById | remove call by call id
@param { object } callId - call id | private removeCallById(callId) {
const index = this.callList.findIndex((v) => v.callId === callId);
this.callList.splice(index, 1);
if (this.callTimeList.find((v) => v.callId === callId)) {
this.callTimeList.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left removeCallById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callId AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private removeCallById(callId) {
const index = this.callList.findIndex((v) => v.callId === callId);
this.callList.splice(index, 1);
if (this.callTimeList.find((v) => v.callId === callId)) {
this.callTimeList.splice(index, 1);
}
} | https://gitee.com/openharmony/applications_call.git | ba45f30c6c57399666909962c78daaaba98cbc6d | gitee |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/clog/Clog.ets | arkts | formatContent | 格式化日志内容
@param content 支持的日志内容类型
@returns 格式化后的字符串 | private static formatContent(content: LogContent): string {
if (typeof content === 'string') {
return content;
} else if (typeof content === 'number' || typeof content === 'boolean') {
return content.toString();
} else if (Array.isArray(content)) {
const formattedItems = content.map((ite... | 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 formatContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left content AST#identifier#Right AST#:#Lef... | private static formatContent(content: LogContent): string {
if (typeof content === 'string') {
return content;
} else if (typeof content === 'number' || typeof content === 'boolean') {
return content.toString();
} else if (Array.isArray(content)) {
const formattedItems = content.map((ite... | https://github.com/ZestBox-18/kitebook-frontend | 134cfbe1efbbc37d3f515b39da62fdf1d1c81228 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/SessionApi.ets | arkts | sendPlaystateCommand | sendPlaystateCommand
@summary Issues a playstate command to a client.
@param {SessionApiSendPlaystateCommandRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof SessionApi | public async sendPlaystateCommand(requestParameters: SessionApiSendPlaystateCommandRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.command)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Playing/${requestParameters.com... | 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 sendPlaystateCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Ri... | public async sendPlaystateCommand(requestParameters: SessionApiSendPlaystateCommandRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.command)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Playing/${requestParameters.com... | https://github.com/OHPG/FinSdk | 26adecade5c21290ad18228e2c16fd8e6bd48d16 | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | reloadDefaultModels | 强制刷新(DefaultModelPage.loadConfig 的语义) | async reloadDefaultModels(): Promise<void> {
await this.doInitializeDefaultModels()
getAppSettingsState().defaultModelsInitialized = true
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reloadDefaultModels 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#... | async reloadDefaultModels(): Promise<void> {
await this.doInitializeDefaultModels()
getAppSettingsState().defaultModelsInitialized = true
} | https://github.com/LongLiveY96/chatcube | a0f8b6e1ba763ca91383b6964f8abf3e4729ae2d | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readFloat64 | Reads the next double.
@param littleEndian If the value is little endian.
@returns The value. | readFloat64(littleEndian?: boolean): number {
const value = this.getFloat64(this.mByteOffset, littleEndian)
this.mByteOffset += 8
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readFloat64 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#... | readFloat64(littleEndian?: boolean): number {
const value = this.getFloat64(this.mByteOffset, littleEndian)
this.mByteOffset += 8
return value
} | https://gitee.com/openharmony-sig/flutter_engine.git | a791ed5544ee3f5c6cf86061d010fe79b1af761e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets | arkts | parseError | 解析错误信息 | private parseError(error: Object): ErrorInfo {
let code = 0;
let message = '未知错误';
if (error && typeof error === 'object') {
const errObj = error as Record<string, Object>;
if (errObj.code !== undefined) {
code = Number(errObj.code);
if (code >= 2300000) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left O... | private parseError(error: Object): ErrorInfo {
let code = 0;
let message = '未知错误';
if (error && typeof error === 'object') {
const errObj = error as Record<string, Object>;
if (errObj.code !== undefined) {
code = Number(errObj.code);
if (code >= 2300000) {
... | https://github.com/DaLongZhuaZi/manxia | 6548dd7acba31c3c631b2460143ab9a5cc7db628 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/RDPDisplay.ets | arkts | getState | 获取连接状态 | getState(): RDPConnectionState {
return this.state
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left RDPConnectionState AST#identifier#Right AST#ERROR#Rig... | getState(): RDPConnectionState {
return this.state
} | https://github.com/AetheriumSimulator/qemu-hmos | be6ae0a5e75a10d49b4ef5c87faf3768c5efc5cf | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Long.ets | arkts | toLong | Returns value of this instance
@returns value as long | public override toLong(): long {
return this.value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toLong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | public override toLong(): long {
return this.value;
} | https://gitcode.com/iop123123/arkts-static-skills | bec5c2ae07f83fcf976c0abe1ff7185b9fec3ae7 | gitcode |
openharmony/codelabs | ETSUI/CoinNote/entry/src/main/ets/component/CalendarView.ets | arkts | getDailyStats | 获取每日收支统计 | getDailyStats(): Record<number, DailyStat> {
const stats: Record<number, DailyStat> = {};
const year = this.currentMonth.getFullYear();
const month = this.currentMonth.getMonth();
this.bills.forEach(bill => {
const dateParts = bill.date.split('/'); // 格式: YYYY/MM/DD
if (dateParts.length =... | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDailyStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#L... | getDailyStats(): Record<number, DailyStat> {
const stats: Record<number, DailyStat> = {};
const year = this.currentMonth.getFullYear();
const month = this.currentMonth.getMonth();
this.bills.forEach(bill => {
const dateParts = bill.date.split('/'); // 格式: YYYY/MM/DD
if (dateParts.length =... | https://gitcode.com/openharmony/codelabs | 4ec11090903e53c7d68448d42735adfc9ec1fb9c | gitcode |
XHXYT/Pixark | entry/src/main/ets/viewmodel/DownloadsViewModel.ets | arkts | addTask | 添加 Pixiv 图片下载任务 | async addTask(context: common.Context, illustInfo: PixivIllust, url: string) {
// 根据 illust_id 检查是否已存在
const existingTask = this.tasks.find(t => t.illust_id === illustInfo.id);
if (existingTask) {
// 存在则弹窗询问,用 Promise 等待用户选择
const shouldContinue = await new Promise<boolean>((resolve) => {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addTask AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async addTask(context: common.Context, illustInfo: PixivIllust, url: string) {
// 根据 illust_id 检查是否已存在
const existingTask = this.tasks.find(t => t.illust_id === illustInfo.id);
if (existingTask) {
// 存在则弹窗询问,用 Promise 等待用户选择
const shouldContinue = await new Promise<boolean>((resolve) => {
... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L325-L375 | 10e6651ae307832747b4a43991c721e62de9e566 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets | arkts | initialize | 初始化动画设置管理器
从持久化存储加载设置 | public async initialize(): Promise<void> {
if (this.initialized) {
return;
}
try {
await this.loadSettings();
this.initialized = true;
logger.info(TAG, '✅ 动画设置管理器初始化完成');
} catch (error) {
logger.error(TAG, '❌ 动画设置管理器初始化失败', String(error));
// 使用默认设置
this.cur... | 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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public async initialize(): Promise<void> {
if (this.initialized) {
return;
}
try {
await this.loadSettings();
this.initialized = true;
logger.info(TAG, '✅ 动画设置管理器初始化完成');
} catch (error) {
logger.error(TAG, '❌ 动画设置管理器初始化失败', String(error));
// 使用默认设置
this.cur... | https://github.com/DaLongZhuaZi/manxia | a14bd6b6d639d6d2c67882b3598f3fe15d9b2aa8 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnImagePreviewViewModel.ets | arkts | updateClickedIndex | 更新点击索引
@param index 图片索引 | updateClickedIndex(index: number): void {
this.clickedIndex = index;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateClickedIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Le... | updateClickedIndex(index: number): void {
this.clickedIndex = index;
} | https://github.com/codelably/tuniao-ui | 9536f36d1f6d6776e43c486046a4cb9fa12c97c3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets | arkts | mergeJsRuleResult | 合并JS规则执行结果 | private mergeJsRuleResult(beforeJs: string, jsResult: string, afterJs: string): string {
if (!beforeJs) {
return jsResult + afterJs;
}
if (beforeJs.includes('@result')) {
return beforeJs.replace('@result', jsResult) + afterJs;
}
// JS结果已是完整URL时,优先直接使用JS结果
if (jsResult.startsWith(... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeJsRuleResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left beforeJs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private mergeJsRuleResult(beforeJs: string, jsResult: string, afterJs: string): string {
if (!beforeJs) {
return jsResult + afterJs;
}
if (beforeJs.includes('@result')) {
return beforeJs.replace('@result', jsResult) + afterJs;
}
// JS结果已是完整URL时,优先直接使用JS结果
if (jsResult.startsWith(... | https://github.com/DaLongZhuaZi/manxia | a7551feed628700f4cbc7c64415ee57604f2dda4 | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的独居女性关怀系统_张富裕/MyApplicationUI/MyApplicationUI_20220809/entry/src/main/ets/MainAbility/pages/forhelp.ets | arkts | routerPage | 页面跳转
path: 页面路径 | async function routerPage(path) {
let option = {
uri: `pages/${path}`
}
try {
await router.push(option)
} catch (err) {
console.log(`fail callback, code: ${err.code}, msg: ${err.msg}`)
}
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left routerPage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#required... | async function routerPage(path) {
let option = {
uri: `pages/${path}`
}
try {
await router.push(option)
} catch (err) {
console.log(`fail callback, code: ${err.code}, msg: ${err.msg}`)
}
} | https://gitee.com/openharmony-sig/online_event.git | dd0935d4faaf94b19e7b6b854e7dc32fa4469a46 | gitee |
arkui-x/samples | CodeLab/Cases/feature/blendmode/src/main/ets/view/BlendModeView.ets | arkts | getResourceString | Resource转化为string函数
@param resource
@returns string | getResourceString(resourceMsg: Resource): string {
return this.context.resourceManager.getStringSync(resourceMsg.id);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getResourceString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resourceMsg AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Resource AST#identifier#Right AST#ERROR#Right A... | getResourceString(resourceMsg: Resource): string {
return this.context.resourceManager.getStringSync(resourceMsg.id);
} | https://gitcode.com/arkui-x/samples | 9ab5aff56b3082827f5733ff7bdf48446a5a66a9 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/danmakuplayer/src/main/ets/model/DanmakuVideoPlayer.ets | arkts | onDanmakuClick | 弹幕点击逻辑 | onDanmakuClick(danmakus: IDanmakus): boolean {
console.log('DFM onDanmakuClick: danmakus size:' + danmakus.size());
const latest: BaseDanmaku = danmakus.last();
if (null !== latest) {
console.log('DFM onDanmakuClick: text of latest danmaku:' + latest.text);
return true;
}
return false;... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDanmakuClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left danmakus AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IDanmakus AST#identifier#Right AST#)#... | onDanmakuClick(danmakus: IDanmakus): boolean {
console.log('DFM onDanmakuClick: danmakus size:' + danmakus.size());
const latest: BaseDanmaku = danmakus.last();
if (null !== latest) {
console.log('DFM onDanmakuClick: text of latest danmaku:' + latest.text);
return true;
}
return false;... | https://gitcode.com/arkui-x/samples | e77fd00cbb3e73592613d46e64610ad069b2f6ac | gitcode |
HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | entry/src/main/ets/pages/AudioCapturer.ets | arkts | stop | stop recording | public async stop() {
this.mAudioCapturer?.off('readData');
if (null === this.mAudioCapturer) {
console.error(TAG, `AudioCapturerUtil have not init`);
return;
}
if (this.mAudioCapturer.state !== audio.AudioState.STATE_RUNNING && this.mAudioCapturer.state !== audio.AudioState.STATE_PAUSED) ... | 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 stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right... | public async stop() {
this.mAudioCapturer?.off('readData');
if (null === this.mAudioCapturer) {
console.error(TAG, `AudioCapturerUtil have not init`);
return;
}
if (this.mAudioCapturer.state !== audio.AudioState.STATE_RUNNING && this.mAudioCapturer.state !== audio.AudioState.STATE_PAUSED) ... | https://gitcode.com/HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | c08a32a1d9e6d84a7475dad8b0dfc6d3139cfbe6 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/NativeHidParserService.ets | arkts | isSupportedGamepad | 检查是否为支持的手柄
@param vendorId 设备厂商 ID
@param productId 设备产品 ID
@returns 是否支持 | isSupportedGamepad(vendorId: number, productId: number): boolean {
if (!this.gamepadModule) {
return false;
}
try {
return this.gamepadModule.isSupportedGamepad(vendorId, productId);
} catch (err) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSupportedGamepad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left vendorId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , ... | isSupportedGamepad(vendorId: number, productId: number): boolean {
if (!this.gamepadModule) {
return false;
}
try {
return this.gamepadModule.isSupportedGamepad(vendorId, productId);
} catch (err) {
return false;
}
} | https://github.com/AlkaidLab/moonlight-harmony | 7c9b79941cfb46868cdad3a898cadce291715e4a | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | starDocument | ============ 收藏与标签 ============
收藏文档
@param documentId 文档ID | async starDocument(documentId: string): Promise<ApiResponse<any>> {
return this.client.post<any>('/api/v1/knowledge/stars', { documentId })
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left starDocument AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documentId AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async starDocument(documentId: string): Promise<ApiResponse<any>> {
return this.client.post<any>('/api/v1/knowledge/stars', { documentId })
} | https://github.com/David8Idira/AI-OA | bcc43b10ee54d90eecfe05183ace6779bab38f43 | github |
openharmony-sig/shimmer-ohos | library/src/main/ets/components/MainPage/Shimmer.ets | arkts | setBaseAlpha | Sets the base alpha, which is the alpha of the underlying children, amount in the range [0,
1]. | setBaseAlpha(alpha: number): Shimmer {
let intAlpha = this.clamp(0, 1, alpha) * 255;
this.baseColor = intAlpha << 24 | (this.baseColor & 0x00FFFFFF);
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBaseAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alpha AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A... | setBaseAlpha(alpha: number): Shimmer {
let intAlpha = this.clamp(0, 1, alpha) * 255;
this.baseColor = intAlpha << 24 | (this.baseColor & 0x00FFFFFF);
return this
} | https://gitee.com/openharmony-sig/shimmer-ohos.git | 58107b4bc77620f96a5b6997c5c2b635be3ca741 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/pages/AppListPageV2.ets | arkts | onPageShow | 页面重新显示时刷新应用列表状态 | onPageShow(): void {
this.updateLayoutConfig();
if (!this.nvHttp && this.computerId) {
this.loadApps();
return;
}
if (this.isLoading && this.nvHttp) {
this.isLoading = false;
}
// 页面重新展示时的自动刷新使用静默模式,不弹 toast
// (退出串流或唤醒主机时 GFE 可能还未就绪,短暂失败是正常的)
this.refr... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | onPageShow(): void {
this.updateLayoutConfig();
if (!this.nvHttp && this.computerId) {
this.loadApps();
return;
}
if (this.isLoading && this.nvHttp) {
this.isLoading = false;
}
// 页面重新展示时的自动刷新使用静默模式,不弹 toast
// (退出串流或唤醒主机时 GFE 可能还未就绪,短暂失败是正常的)
this.refr... | https://github.com/AlkaidLab/moonlight-harmony | efb87d0b4cfe1cc1dcf493fbe92a3190f045b640 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyManager.ets | arkts | sendGamepadState | 发送当前累积的手柄状态
通过 session 的 sendVirtualControllerInput 发送,确保 controllerArrival 已注册。
参照 Android ElementController.sendGamepadEvent() | private sendGamepadState(): void {
const session = this.host.getSession();
if (!session) return;
session.sendVirtualControllerInput(
this.gamepadInputMap,
this.gamepadLeftTrigger,
this.gamepadRightTrigger,
this.leftStickX,
this.leftStickY,
this.rightStickX,
this.r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendGamepadState 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... | private sendGamepadState(): void {
const session = this.host.getSession();
if (!session) return;
session.sendVirtualControllerInput(
this.gamepadInputMap,
this.gamepadLeftTrigger,
this.gamepadRightTrigger,
this.leftStickX,
this.leftStickY,
this.rightStickX,
this.r... | https://github.com/AlkaidLab/moonlight-harmony | 2e2e43378d34dfdae32cd17945b083ad382bf031 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets | arkts | constructor | Constructs a Map from Array of entries
@param entries Array of entries | constructor(entries: Array<[K, V]>) {
const capacity = Map.computeCapacity(entries.length)
const alloc = this.allocDataAndBuckets(capacity)
this.data = alloc[0]
this.buckets = alloc[1]
this.cap = capacity
this.initialCapacity = capacity
entries.forEach((entry... | 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#instantiation_expression#Left AST#identifier#Left entries AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AS... | constructor(entries: Array<[K, V]>) {
const capacity = Map.computeCapacity(entries.length)
const alloc = this.allocDataAndBuckets(capacity)
this.data = alloc[0]
this.buckets = alloc[1]
this.cap = capacity
this.initialCapacity = capacity
entries.forEach((entry... | https://gitcode.com/iop123123/arkts-static-skills | f743a379b474251b4f56001bc6e68b5d5975317d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Initialization/DataInitializer.ets | arkts | initializePluginManager | 初始化插件管理器 | private async initializePluginManager(): Promise<void> {
try {
// 这里需要导入并初始化HSPPluginManager
// const pluginManager = HSPPluginManager.getInstance();
// await pluginManager.initialize();
logger.debug(TAG, '插件管理器初始化占位符');
} catch (error) {
throw new Error(`插件管理器初始化失败: ${err... | 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 initializePluginManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | private async initializePluginManager(): Promise<void> {
try {
// 这里需要导入并初始化HSPPluginManager
// const pluginManager = HSPPluginManager.getInstance();
// await pluginManager.initialize();
logger.debug(TAG, '插件管理器初始化占位符');
} catch (error) {
throw new Error(`插件管理器初始化失败: ${err... | https://github.com/DaLongZhuaZi/manxia | 1bda80378379ef18e03f9fd4ad3f4427a86543b2 | github |
openharmony/codelabs | Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets | arkts | setAVPlayState | Setting the Playback Status of the Playback Control Center.
@param state Status of the Playback Control Center. | public static setAVPlayState(state: avSession.PlaybackState) {
if (state === undefined) {
Logger.info(TAG, 'setAVPlayState fail,state is empty.');
return;
}
let currentSession = GlobalContext.getContext().getObject('currentSession') as avSession.AVSession;
currentSession.setAVPlaybackState... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left setAVPlayState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : ... | public static setAVPlayState(state: avSession.PlaybackState) {
if (state === undefined) {
Logger.info(TAG, 'setAVPlayState fail,state is empty.');
return;
}
let currentSession = GlobalContext.getContext().getObject('currentSession') as avSession.AVSession;
currentSession.setAVPlaybackState... | https://gitee.com/openharmony/codelabs.git | 50a1ba7a90ebc9488ae6b8ebd78ee9bf53716077 | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleUserProfile.ets | arkts | applyCustomCacheLimit | SDK Behavior Settings `upcl` enforcement: cap distinct custom keys at
the server-configured `userPropertyCacheLimit`. Drops oldest
insertion-order keys until size ≤ limit. ArkTS strict mode bans
`delete record[key]`, so we rebuild a survivors-only Record and swap
the field reference. | private applyCustomCacheLimit(): void {
const limit: number = this.config.serverConfig.userPropertyCacheLimit;
const keys: string[] = Object.keys(this.customSet);
if (keys.length <= limit) return;
const dropCount: number = keys.length - limit;
const rebuilt: Record<string, SegmentationValue> = {};... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyCustomCacheLimit 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 voi... | private applyCustomCacheLimit(): void {
const limit: number = this.config.serverConfig.userPropertyCacheLimit;
const keys: string[] = Object.keys(this.customSet);
if (keys.length <= limit) return;
const dropCount: number = keys.length - limit;
const rebuilt: Record<string, SegmentationValue> = {};... | https://github.com/Countly/countly-sdk-hos | cea92da89b49553649c93e96c5617978cd95aba2 | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/theme/SystemColorModeUtil.ets | arkts | getSystemColorMode | 将应用内保存的模式值映射为系统颜色模式。 | static getSystemColorMode(mode: string): ConfigurationConstant.ColorMode {
switch (mode) {
case 'dark':
return ConfigurationConstant.ColorMode.COLOR_MODE_DARK;
case 'light':
return ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
default:
return ConfigurationConstant.Col... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSystemColorMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static getSystemColorMode(mode: string): ConfigurationConstant.ColorMode {
switch (mode) {
case 'dark':
return ConfigurationConstant.ColorMode.COLOR_MODE_DARK;
case 'light':
return ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
default:
return ConfigurationConstant.Col... | https://github.com/ZestBox-18/kitebook-frontend | cc18740d7f260b68b554e2548a755540b9691c07 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _readEncodingInfo | 读取编码格式信息 | private _readEncodingInfo(): void{
let _svgStringReader = this._svgStringReader!;
let encoding: boolean = Boolean(_svgStringReader.readStringFast(XMLConstants.XML_ENCODING)) && this._readEqual();
let encodingValue: string = this._readSystemLiteral()as string ;
let encodingResult: string | boolean = e... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readEncodingInfo 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 AS... | private _readEncodingInfo(): void{
let _svgStringReader = this._svgStringReader!;
let encoding: boolean = Boolean(_svgStringReader.readStringFast(XMLConstants.XML_ENCODING)) && this._readEqual();
let encodingValue: string = this._readSystemLiteral()as string ;
let encodingResult: string | boolean = e... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 452331a49fd19b71540002b42c0e44ba55f6fa27 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/AccessibilityUtils.ets | arkts | parseColor | 解析颜色(支持多种格式)
@param color 颜色字符串(HEX、RGB、RGBA)
@returns RGB对象 | public static parseColor(color: string): RGB {
// 移除空格
color = color.trim();
// HEX格式
if (color.startsWith('#')) {
return this.hexToRgb(color);
}
// RGB格式:rgb(r, g, b)
if (color.startsWith('rgb(')) {
const match = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
i... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#... | public static parseColor(color: string): RGB {
// 移除空格
color = color.trim();
// HEX格式
if (color.startsWith('#')) {
return this.hexToRgb(color);
}
// RGB格式:rgb(r, g, b)
if (color.startsWith('rgb(')) {
const match = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
i... | https://github.com/LJ666-ui/harmony-health-care | 05ab4428b6aa84963aa6b135cfa5b2fbe3cba89c | github |
openharmony-sig/ohos_checksum | library/src/main/ets/md5.ets | arkts | rstr2hex | Convert a raw string to a hex string | rstr2hex(input: string) :string {
try {
this.hexcase
} catch (e) {
this.hexcase = 0;
}
let hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
let output = "";
let x: number;
for (let i = 0; i < input.length; i++) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rstr2hex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | rstr2hex(input: string) :string {
try {
this.hexcase
} catch (e) {
this.hexcase = 0;
}
let hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
let output = "";
let x: number;
for (let i = 0; i < input.length; i++) {
... | https://gitee.com/openharmony-sig/ohos_checksum.git | 67c5ccb9e5b2a91595a95b5923245f942c12f265 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | setNovelFont | 设置小说阅读字体 | async setNovelFont(fontType: FontType, fontId: string, uiContext?: UIContext | null): Promise<void> {
if (fontType === FontType.CUSTOM) {
await this.ensureCustomFontRegistered(fontId, FontScene.NOVEL, uiContext);
}
this.settings.novelFontType = fontType;
if (fontType === FontType.SYSTEM) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setNovelFont AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fontType AST#identifier#Right AS... | async setNovelFont(fontType: FontType, fontId: string, uiContext?: UIContext | null): Promise<void> {
if (fontType === FontType.CUSTOM) {
await this.ensureCustomFontRegistered(fontId, FontScene.NOVEL, uiContext);
}
this.settings.novelFontType = fontType;
if (fontType === FontType.SYSTEM) {
... | https://github.com/DaLongZhuaZi/manxia | edb9eb7c61a86dd6d41e64e36f73b124bab75128 | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | checkRulesReload | Apply rule edits live: when the UI rewrites the rules file, hot-swap the
running filter's rule set instead of forcing a full VPN restart. | private checkRulesReload(): void {
// In full mode rules are baked into AdGuardHome.yaml at start; AdGuardHome
// is not hot-reloaded here. Rule changes take effect on the next restart.
if (this.filterMode === FILTER_MODE_FULL) {
return;
}
const signature: string = this.rulesFileSignature();... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkRulesReload 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... | private checkRulesReload(): void {
// In full mode rules are baked into AdGuardHome.yaml at start; AdGuardHome
// is not hot-reloaded here. Rule changes take effect on the next restart.
if (this.filterMode === FILTER_MODE_FULL) {
return;
}
const signature: string = this.rulesFileSignature();... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1591-L1615 | 42b460c66d950f84a95e1769a591fbd627511e8b | github |
zhangmeng1847/RDB | entry/src/main/ets/viewmodels/TaskHandle.ets | arkts | deleteTaskById | 根据id删除任务
@param id 任务id | deleteTaskById(id: number){
// 1.删除的条件
let predicates = new relationalStore.RdbPredicates(this.tableName)
predicates.equalTo('ID', id)
// 2.删除操作
return this.rdbStore.delete(predicates)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteTaskById 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 number AST#identifier#Right ... | deleteTaskById(id: number){
// 1.删除的条件
let predicates = new relationalStore.RdbPredicates(this.tableName)
predicates.equalTo('ID', id)
// 2.删除操作
return this.rdbStore.delete(predicates)
} | https://github.com/zhangmeng1847/RDB | 4ae3316d22dcb623cd507ba440bf4e42c8066a9c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | deleteDownloadDirRecursive | 递归删除Download文件夹中的目录 | private async deleteDownloadDirRecursive(dirPath: string): Promise<DeleteRecursiveResult> {
let totalSize = 0;
let totalCount = 0;
try {
const entries = SafeFileUtils.listFileSync(dirPath);
for (const entry of entries) {
const fullPath = `${dirPath}/${entry}`;
try {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left deleteDownloadDirRecursive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Le... | private async deleteDownloadDirRecursive(dirPath: string): Promise<DeleteRecursiveResult> {
let totalSize = 0;
let totalCount = 0;
try {
const entries = SafeFileUtils.listFileSync(dirPath);
for (const entry of entries) {
const fullPath = `${dirPath}/${entry}`;
try {
... | https://github.com/DaLongZhuaZi/manxia | 77a4decaf2f0fe43f70942d44b0c67d30e958f1b | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/OCRRecognitionService.ets | arkts | cleanupOldRecords | 清理旧记录 | static async cleanupOldRecords(userId: number, keepCount: number = 100): Promise<number> {
try {
return await OCRRecognitionRecordDAO.cleanupOldRecords(userId, keepCount);
} catch (error) {
console.error('[OCRRecognitionService] 清理旧记录失败:', error);
return 0;
}
} | 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 cleanupOldRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left... | static async cleanupOldRecords(userId: number, keepCount: number = 100): Promise<number> {
try {
return await OCRRecognitionRecordDAO.cleanupOldRecords(userId, keepCount);
} catch (error) {
console.error('[OCRRecognitionService] 清理旧记录失败:', error);
return 0;
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f152bce1e2f2b9e16ba5ef549196deb59d8a8035 | github |
mybricks/comlib-harmony-normal | packages/rt-arkts/comlib/src/main/ets/AiMusic/model/AppMusicMediaPlayer.ets | arkts | startVinylRotation | 更新当前歌词索引
static updateLyricIndex() {
for (let i = MediaPlayer.lyrics.length - 1; i >= 0; i--) {
if (MediaPlayer.currentTime >= MediaPlayer.lyrics[i].time) {
if (MediaPlayer.currentLyricIndex !== i) {
MediaPlayer.currentLyricIndex = i
// 滚动到当前歌词
MediaPlayer.lyricListScroller.scrollToIndex(i)
}
break
}
}
}
开始唱片动画 | static startVinylRotation() {
if (!MediaPlayer.isRotating) {
MediaPlayer.isRotating = setInterval(() => {
animateTo({
duration: 20,
curve: Curve.Linear
}, () => {
MediaPlayer.rotationAngle = MediaPlayer.rotationAngle + 1
MediaPlayer.eventListener.get("... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left startVinylRotation 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... | static startVinylRotation() {
if (!MediaPlayer.isRotating) {
MediaPlayer.isRotating = setInterval(() => {
animateTo({
duration: 20,
curve: Curve.Linear
}, () => {
MediaPlayer.rotationAngle = MediaPlayer.rotationAngle + 1
MediaPlayer.eventListener.get("... | https://github.com/mybricks/comlib-harmony-normal | 4d0eb781b4241ad915252d269afd2c3fd7899218 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentSourceViewModel.ets | arkts | setData | 设置数据
@param cardComponentModels | public setData(cardComponentModels: CardComponentModel[]): void {
this.cardComponentModels = cardComponentModels
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cardComponentModels AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | public setData(cardComponentModels: CardComponentModel[]): void {
this.cardComponentModels = cardComponentModels
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 0decfa776cd9eff0dd84f58c52b698e443d137dd | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | saveCustomFonts | 保存自定义字体列表 | private async saveCustomFonts(): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put('custom_fonts', JSON.stringify(this.customFonts));
await this.preferences.flush();
logger.info(TAG, '自定义字体列表保存成功');
} catch (error) {
logger.error(TAG, `保存自定义字体列表失败: ${... | 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 saveCustomFonts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async saveCustomFonts(): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put('custom_fonts', JSON.stringify(this.customFonts));
await this.preferences.flush();
logger.info(TAG, '自定义字体列表保存成功');
} catch (error) {
logger.error(TAG, `保存自定义字体列表失败: ${... | https://github.com/DaLongZhuaZi/manxia | 944f71eab051d97ca88b2cf3e24a63b0902e763d | github |
LiMingKuan-UESTC/HarmonyOs-Clock-Demo | entry/src/main/ets/pages/ReminderSettings.ets | arkts | aboutToAppear | 生命周期回调:用于接收返回的时间 | aboutToAppear() {
const context = getContext(this) as common.UIAbilityContext
storageUtil.init(context) // 初始化 storageUtil
// 读取存储的数据,更新状态
this.morningOn = storageUtil.loadBoolean('morningOn', true)
this.morningHour = storageUtil.loadNumber('morningHour', 8)
this.morningMinute = storageUtil.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
const context = getContext(this) as common.UIAbilityContext
storageUtil.init(context) // 初始化 storageUtil
// 读取存储的数据,更新状态
this.morningOn = storageUtil.loadBoolean('morningOn', true)
this.morningHour = storageUtil.loadNumber('morningHour', 8)
this.morningMinute = storageUtil.... | https://github.com/LiMingKuan-UESTC/HarmonyOs-Clock-Demo | 086ea512c0c63ddc9230ee670723b1e1d82be036 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | showValidationConfigDialog | 显示校验配置对话框 | showValidationConfigDialog(sourceIds?: string[]): void {
const scope = this.resolveValidationDialogScope(sourceIds);
const targetCount = scope.validateAll ? this.allSources.length : scope.sourceIds.length;
if (targetCount === 0) {
this.getUIContext().getPromptAction().showToast({ message: '暂无可校验的书源'... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showValidationConfigDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceIds AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | showValidationConfigDialog(sourceIds?: string[]): void {
const scope = this.resolveValidationDialogScope(sourceIds);
const targetCount = scope.validateAll ? this.allSources.length : scope.sourceIds.length;
if (targetCount === 0) {
this.getUIContext().getPromptAction().showToast({ message: '暂无可校验的书源'... | https://github.com/DaLongZhuaZi/manxia | c16d94815d62dd958b9a95633d1a110bf347e01d | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | isNull | 单个字段为null
@param field 字段
@returns Wrapper | isNull(field: string, condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} is null`)
}
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R... | isNull(field: string, condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} is null`)
}
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L215-L220 | c489ba166aa979df6405fe2e21b24481788403fc | github |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/PureTabsExt/entry/src/main/ets/view/SwitchTabComponent.ets | arkts | build | [EndExclude custom_switch_tab] | build() {
Column() {
Row() {
Button('Previous Tab')
.onClick(() => {
this.tabController.changeIndex((this.currentIndex + 3) % 4); // call tabController.changeIndex() to switch tab
})
// [StartExclude custom_switch_tab]
.width(158)
.heigh... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
Row() {
Button('Previous Tab')
.onClick(() => {
this.tabController.changeIndex((this.currentIndex + 3) % 4); // call tabController.changeIndex() to switch tab
})
// [StartExclude custom_switch_tab]
.width(158)
.heigh... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 80dd6e616edf52bf4fe5735d9422df81aee0de92 | gitcode |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | onStateChange | 用于设置状态变化的回调函数。
@param callback - 状态变化的回调函数,接收状态参数并返回 void。 | async onStateChange(callback: (state: EfAVPlayerState) => void) {
this.stateChangeCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onStateChange AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left callback AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async onStateChange(callback: (state: EfAVPlayerState) => void) {
this.stateChangeCallback = callback;
} | https://github.com/yangyongzhen/hmmovie | c3d5e785ba1d12b37f896f629d6c7808ad7cf317 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | detached | Returns true if the ArrayBuffer has been detached.
@returns { boolean } True if the ArrayBuffer has been detached.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get detached(): boolean {
return this.data != undefined ? false : this.dataAddress == 0
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left detached 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 detached(): boolean {
return this.data != undefined ? false : this.dataAddress == 0
} | https://gitcode.com/iop123123/arkts-static-skills | 27f958e55a17ea717671c2b92d7a9af5118aacac | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxExportService.ets | arkts | doExport | 执行数据库导出
@param locationInfo
@param exportType | private static async doExport(locationInfo: LocationInfo, exportType: ExportType) {
LoadingDialog.showLoading($r("app.string.handling"));
return await DataService.saveKdbx({ kdbx: FileService.getDatabase(), exportType: exportType, locationInfo: locationInfo }).then(() => {
LoadingDialog.hideLoading();
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left doExport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locati... | private static async doExport(locationInfo: LocationInfo, exportType: ExportType) {
LoadingDialog.showLoading($r("app.string.handling"));
return await DataService.saveKdbx({ kdbx: FileService.getDatabase(), exportType: exportType, locationInfo: locationInfo }).then(() => {
LoadingDialog.hideLoading();
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxExportService.ets#L82-L93 | cb589bafe2c9a25a98590fe840cbae6ecfb2be31 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.