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 |
|---|---|---|---|---|---|---|---|---|---|---|
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/yearlySpendingChart.ets | arkts | toggleMode | 切换图表模式 | toggleMode() {
this.chartMode = this.chartMode === 'weekly' ? 'yearly' : 'weekly'
this.calculateData()
setTimeout(() => {
this.drawChart()
}, 100)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | toggleMode() {
this.chartMode = this.chartMode === 'weekly' ? 'yearly' : 'weekly'
this.calculateData()
setTimeout(() => {
this.drawChart()
}, 100)
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 0e73d10b8d96ee905a633f13e7e119ee67dc91d1 | github |
apap6628114/nga_oh | entry/src/main/ets/common/datasource/LazyDataSource.ets | arkts | indexOf | 按 section id 查找下标,未命中返回 -1。
@param sectionId - 分区 id
@returns 分区下标,未找到为 -1 | indexOf(sectionId: string): number {
for (let i = 0; i < this.dataList.length; i++) {
if (this.dataList[i].id === sectionId) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left indexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sectionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ... | indexOf(sectionId: string): number {
for (let i = 0; i < this.dataList.length; i++) {
if (this.dataList[i].id === sectionId) {
return i
}
}
return -1
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/LazyDataSource.ets#L71-L78 | 2013af89e9fe8a679700c95b028f8f7718d74e3f | github |
offlinecat-dev/OCNetORM | example/repository/UserRepository.ets | arkts | searchByUsername | 模糊查询用户名
@param keyword 关键字
@returns 匹配的用户列表 | async searchByUsername(keyword: string): Promise<Array<EntityData>> {
const queryBuilder = this.repository.createQueryBuilder()
queryBuilder.whereLike('username', `%${keyword}%`)
const executor = new QueryExecutor(queryBuilder)
return await executor.get()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchByUsername AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async searchByUsername(keyword: string): Promise<Array<EntityData>> {
const queryBuilder = this.repository.createQueryBuilder()
queryBuilder.whereLike('username', `%${keyword}%`)
const executor = new QueryExecutor(queryBuilder)
return await executor.get()
} | https://github.com/offlinecat-dev/OCNetORM | 12a963cff572a0de3794ad57b9d262876d702a6c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DependencyContainer.ets | arkts | isRegistered | 检查依赖是否已注册 | public isRegistered(token: string): boolean {
if (!this.dependencies) {
this.dependencies = new Map<string, DependencyDescriptor>();
}
return this.dependencies.has(token);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isRegistered AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public isRegistered(token: string): boolean {
if (!this.dependencies) {
this.dependencies = new Map<string, DependencyDescriptor>();
}
return this.dependencies.has(token);
} | https://github.com/DaLongZhuaZi/manxia | 6dbde560314743908922c9951b30e00e0a9002a1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | toISOString | 将时间戳转换为ISO字符串
@param timestamp - 时间戳(毫秒)
@returns ISO格式的时间字符串 | static toISOString(timestamp: number): string {
return new Date(timestamp).toISOString();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toISOString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R... | static toISOString(timestamp: number): string {
return new Date(timestamp).toISOString();
} | https://github.com/DaLongZhuaZi/manxia | c72e415591acfa6ed5a69725dcc2bda118871e8c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setYear | This function is an alias to @link{setFullYear} and left for compatibility with ECMA-262.
@param { int } value new year
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setYear(value: int): void {
this.setFullYear(value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Righ... | public setYear(value: int): void {
this.setFullYear(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 1871a51f353763a82613679d8c2c928f0ab4c24f | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/MessageHandler.ets | arkts | hasMessages | Check if messages with a specific identifier exist
@param { int } what The message identifier to check
@returns { boolean } True if messages with the identifier exist, false otherwise | public hasMessages(what: int): boolean {
if (this.workerIsMain()) {
return false;
}
if (what == this.defaultMessagewhat) {
return false;
}
return this.hasMessage((value: MessageStatus, key: Message) => {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left what AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R... | public hasMessages(what: int): boolean {
if (this.workerIsMain()) {
return false;
}
if (what == this.defaultMessagewhat) {
return false;
}
return this.hasMessage((value: MessageStatus, key: Message) => {
... | https://gitcode.com/iop123123/arkts-static-skills | eaf45f54537f27cf6c5f3de6630946cb4226a09f | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/HttpClient.ets | arkts | buildHeaders | 构建请求头 | private buildHeaders(
accept: string = 'application/json',
contentType: string = 'application/json',
extraHeaders: Record<string, string> | null = null,
cookieUrl: string = ''
): Record<string, string> {
const headers: Record<string, string> = {};
headers['User-Agent'] = AppConstants.USER_AG... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left accept AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_exp... | private buildHeaders(
accept: string = 'application/json',
contentType: string = 'application/json',
extraHeaders: Record<string, string> | null = null,
cookieUrl: string = ''
): Record<string, string> {
const headers: Record<string, string> = {};
headers['User-Agent'] = AppConstants.USER_AG... | https://github.com/Amaz1ny/HarmonyDO-public | 3ee2269bf87ba470ac81e84498738f363064d252 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | map | Creates a new Float64Array using fn(arr[i]) over all elements of current Float64Array.
@param fn a function to apply for each element of current Float64Array
@returns a new Float64Array where for each element from current Float64Array fn was applied | public map(fn: (val: double, index: int) => double): Float64Array {
let resBuf = new ArrayBuffer(this.length * Float64Array.BYTES_PER_ELEMENT)
let res = new Float64Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: double, index: int) => double): Float64Array {
let resBuf = new ArrayBuffer(this.length * Float64Array.BYTES_PER_ELEMENT)
let res = new Float64Array(resBuf)
for (let i = 0; i < this.length; ++i) {
res.set(i, fn(this.at(i), i))
}
return res
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 69bbb4554c20225a402cd92afceec8b1d86a3085 | gitee |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/services/PreferencesStore.ets | arkts | saveVoluntaryOTWeeklyEarnings | ---- Weekly Voluntary OT Accumulation ---- | public async saveVoluntaryOTWeeklyEarnings(amount: number): Promise<void> {
if (this.store === null) { return }
try {
await this.store.put('voluntaryOTWeeklyEarnings', amount)
await this.store.flush()
} catch (err) {
Log.error(`saveVoluntaryOTWeeklyEarnings failed: ${err}`)
}
} | 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 saveVoluntaryOTWeeklyEarnings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left amount AST#identifier#Righ... | public async saveVoluntaryOTWeeklyEarnings(amount: number): Promise<void> {
if (this.store === null) { return }
try {
await this.store.put('voluntaryOTWeeklyEarnings', amount)
await this.store.flush()
} catch (err) {
Log.error(`saveVoluntaryOTWeeklyEarnings failed: ${err}`)
}
} | https://github.com/OMGCA/sakipay | d11068eb05fa2317456c2bf1ce4f811b4f7121fc | github |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/AvPlayManager.ets | arkts | setAudioTrack | 设置视频多音轨轨道 | async setAudioTrack(audioTrackValue: number): Promise<void> {
Logger.info(this.tag, 'selectTrack set AudioTrackType value is:' + audioTrackValue);
switch (audioTrackValue) {
case 0:
if (this.avPlayer != null && this.currentAudioTrackValue != 0) {
Logger.info(this.tag, 'deselectTrack st... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setAudioTrack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left audioTrackValue AST#identifier#Right AST#type_annotation... | async setAudioTrack(audioTrackValue: number): Promise<void> {
Logger.info(this.tag, 'selectTrack set AudioTrackType value is:' + audioTrackValue);
switch (audioTrackValue) {
case 0:
if (this.avPlayer != null && this.currentAudioTrackValue != 0) {
Logger.info(this.tag, 'deselectTrack st... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 40bef082f6c3956a7595da75ddb4ea9fffb3a1de | gitee |
Tianpei-Shi/MusicDash | src/model/MusicItem.ets | arkts | formatDuration | 格式化时长
@returns 格式化后的时长字符串 (mm:ss) | formatDuration(): string {
const minutes = Math.floor(this.duration / 60);
const seconds = this.duration % 60;
return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatDuration 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#stateme... | formatDuration(): string {
const minutes = Math.floor(this.duration / 60);
const seconds = this.duration % 60;
return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
} | https://github.com/Tianpei-Shi/MusicDash | eae9fdd58c470ce4a80c206b1726ee74602d0601 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AnomalyDetection.ets | arkts | extractAmountsFromBills | ==================== Bill集成方法 ====================
从账单列表中提取金额数组
@param bills 账单列表
@param expenseOnly 是否只包含支出 | static extractAmountsFromBills(bills: Bill[], expenseOnly: boolean = true): number[] {
const amounts: number[] = [];
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.isDeleted === 0) {
if (expenseOnly) {
if (bill.type === 'expense') {
amounts.p... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractAmountsFromBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri... | static extractAmountsFromBills(bills: Bill[], expenseOnly: boolean = true): number[] {
const amounts: number[] = [];
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.isDeleted === 0) {
if (expenseOnly) {
if (bill.type === 'expense') {
amounts.p... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8d735fa5d1427517ce202acef47e37ea725ecbb2 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/OptionGroup.ets | arkts | isRequired | Tests whether this option group is required.
@return whether this option group is required | public isRequired(): boolean{
return this.required;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isRequired AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo... | public isRequired(): boolean{
return this.required;
} | https://gitee.com/openharmony-sig/commons-cli.git | 656ad6d79313dab3db949004083afe0773afae7d | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/FirmwareManager.ets | arkts | ensureUefi | 确保 UEFI 固件存在:优先从 rawfile 复制到 files 目录
@param ctx UIAbility 上下文
@returns 固件路径(成功)或 null(失败) | static async ensureUefi(ctx: common.UIAbilityContext): Promise<string | null> {
hilog.info(0x0000, 'FIRMWARE', '>>> ensureUefi 开始 <<<')
try {
// 使用 context.filesDir 获取正确的应用文件目录
const filesDir = ctx.filesDir
const targetPath = `${filesDir}/${FIRMWARE_CODE_FILENAME}`
const varsTargetPath... | 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 ensureUefi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#R... | static async ensureUefi(ctx: common.UIAbilityContext): Promise<string | null> {
hilog.info(0x0000, 'FIRMWARE', '>>> ensureUefi 开始 <<<')
try {
// 使用 context.filesDir 获取正确的应用文件目录
const filesDir = ctx.filesDir
const targetPath = `${filesDir}/${FIRMWARE_CODE_FILENAME}`
const varsTargetPath... | https://github.com/AetheriumSimulator/qemu-hmos | 0bb87378699fb3123e832516a251c69d2494065f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | slice | Creates a slice of current Uint32Array using range [begin, end]
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice}
@param { int } [begin] start - index to be taken into slice
@param { int } [end] - last index to be taken into slice
@returns { Uint32Array } - a new ... | public slice(begin?: int, end?: int): Uint32Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | AST#program#Left AST#ERROR#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#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#... | public slice(begin?: int, end?: int): Uint32Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | fca34c710a0c8d2325ba21dbeb8a60d1472f1637 | gitcode |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityUsage/entry/src/main/ets/context/BasicUsage.ets | arkts | build | [EndExclude terminateSelf]
页面展示 | build() {
// [StartExclude basicUsage]
Column() {
// [StartExclude terminateSelf]
Text('UIAbilityB')
.id('HelloWorld')
.fontSize(30)
.fontWeight(FontWeight.Bold)
.margin({bottom: 8})
// 请将$r('app.string.Start_UIAbilityB')替换为实际资源文件,在本示例中该资源文件的value值为"拉起UIAbili... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
// [StartExclude basicUsage]
Column() {
// [StartExclude terminateSelf]
Text('UIAbilityB')
.id('HelloWorld')
.fontSize(30)
.fontWeight(FontWeight.Bold)
.margin({bottom: 8})
// 请将$r('app.string.Start_UIAbilityB')替换为实际资源文件,在本示例中该资源文件的value值为"拉起UIAbili... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | aaa4b9fea8cf81890227841779bb4291ec1af0f1 | gitcode |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/SshClient.ets | arkts | sftpRmdir | Remove a remote directory (must be empty). | async sftpRmdir(path: string): Promise<void> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
await ssh.sftpRmdir(this.handle, path);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP rmdir failed';
const error = new SshError(msg, this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpRmdir AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left... | async sftpRmdir(path: string): Promise<void> {
if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED);
try {
await ssh.sftpRmdir(this.handle, path);
} catch (err) {
const msg = (err as Error).message ?? 'SFTP rmdir failed';
const error = new SshError(msg, this.... | https://github.com/UnbalancedCat/ohos-ssh-core | 36d78faec8811cad2054ad0e67c1157fbda6a8f3 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | persistPendingSession | 持久化待处理的会话 | private async persistPendingSession(): Promise<void> {
await this.sessionStore.persistPendingSession()
this.currentSession = this.sessionStore.getCurrentSession()
} | 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 persistPendingSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async persistPendingSession(): Promise<void> {
await this.sessionStore.persistPendingSession()
this.currentSession = this.sessionStore.getCurrentSession()
} | https://github.com/LongLiveY96/chatcube | 656a9b63704d7cb107f70d3b0d7e68a83f02f1e6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | initialize | 初始化数据库 | public async initialize(context: common.UIAbilityContext): Promise<void> {
if (this.isInitialized) {
return;
}
try {
logger.info(TAG, '开始初始化数据库');
const config: relationalStore.StoreConfig = {
name: DATABASE_CONFIG.DATABASE_NAME,
securityLevel: relationalStore.Sec... | 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#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST... | public async initialize(context: common.UIAbilityContext): Promise<void> {
if (this.isInitialized) {
return;
}
try {
logger.info(TAG, '开始初始化数据库');
const config: relationalStore.StoreConfig = {
name: DATABASE_CONFIG.DATABASE_NAME,
securityLevel: relationalStore.Sec... | https://github.com/DaLongZhuaZi/manxia | 40dc30a5061e718822495c911327409395e13709 | github |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets | arkts | updateCardData | Update card data. | public async updateCardData() {
try {
if (!this.context) {
return;
}
PreferencesUtil.getInstance().removePreferencesFromCache(this.context);
this.formIds = await PreferencesUtil.getInstance().getFormIds(this.context);
if (this.formIds === null || this.formIds === undefined) {... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left updateCardData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#E... | public async updateCardData() {
try {
if (!this.context) {
return;
}
PreferencesUtil.getInstance().removePreferencesFromCache(this.context);
this.formIds = await PreferencesUtil.getInstance().getFormIds(this.context);
if (this.formIds === null || this.formIds === undefined) {... | https://gitee.com/harmonyos/codelabs.git | 5ec5e1e2d3b9d4a2ea636e079acf38bb349f7014 | gitee |
SuperBird007/HarmonyApp_beichengyu | entry/src/main/ets/component/OptionButton.ets | arkts | build | [!code focus:end] | build() {
Stack() { // 将选项按钮和勾叉图标堆叠在一起
// 选项按钮
Button(this.option)
.optionButtonStyle({
bg: this.getBgColor(),
// [!code focus:start]
// 字体颜色适配
font: this.optionStatus === OptionStatus.Default ? $r('app.color.text_primary') : $r('app.color.text_on_primar... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack() { // 将选项按钮和勾叉图标堆叠在一起
// 选项按钮
Button(this.option)
.optionButtonStyle({
bg: this.getBgColor(),
// [!code focus:start]
// 字体颜色适配
font: this.optionStatus === OptionStatus.Default ? $r('app.color.text_primary') : $r('app.color.text_on_primar... | https://github.com/SuperBird007/HarmonyApp_beichengyu | 42b0fcfd9c967930f32d0e098d6d69a100fc66b1 | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | equals | Equality check | equals(other: ESObject): boolean {
return other instanceof Offset &&
other.dx === this.dx &&
other.dy === this.dy;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ESObject AST#identifier#Right AST#)#Left ) AST#)... | equals(other: ESObject): boolean {
return other instanceof Offset &&
other.dx === this.dx &&
other.dy === this.dy;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L155-L159 | 2ca385b83047bb8ec2e914f8ff04ba250fa001df | github |
awaLiny2333/Spaceow | woof/src/main/ets/pages/Index.ets | arkts | scan | Scans the directory.
@param path The path.
@returns True if succeeded. | scan(path: string) {
this.baseSize = 0;
this.basePath = path;
let workerInstance: worker.ThreadWorker | undefined = undefined;
try {
workerInstance = new worker.ThreadWorker("woof/ets/workers/Scanner.ets");
workerInstance.postMessage(path);
meow(`workerInstance.postMessage(${path})!... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left scan 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#identifier#Left string AST#identifier#Right AST#)#Le... | scan(path: string) {
this.baseSize = 0;
this.basePath = path;
let workerInstance: worker.ThreadWorker | undefined = undefined;
try {
workerInstance = new worker.ThreadWorker("woof/ets/workers/Scanner.ets");
workerInstance.postMessage(path);
meow(`workerInstance.postMessage(${path})!... | https://github.com/awaLiny2333/Spaceow/blob/d256e91c0feb34459ecf81ce388c749d614c3bfa/woof/src/main/ets/pages/Index.ets#L129-L163 | 9f002bc4afdf9a488a3c4ce7fa504d8d8ad3045d | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets | arkts | offConnectStateChange | 取消订阅连接状态变化事件 | private offConnectStateChange() {
Log.showInfo(TAG, `offConnectStateChange`);
if (!this.mGattServer) {
Log.showInfo(TAG, `offConnectStateChange: mGattServer is null`);
return;
}
try {
this.mGattServer.off('connectionStateChange');
} catch (err) {
Log.showError(TAG, `offCon... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left offConnectStateChange 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 A... | private offConnectStateChange() {
Log.showInfo(TAG, `offConnectStateChange`);
if (!this.mGattServer) {
Log.showInfo(TAG, `offConnectStateChange: mGattServer is null`);
return;
}
try {
this.mGattServer.off('connectionStateChange');
} catch (err) {
Log.showError(TAG, `offCon... | https://gitcode.com/arkui-x/samples | a327b8953bffcd3c1140cddd70262a887fd110a2 | gitcode |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | notifyDataAdd | 通知数据添加 | notifyDataAdd(index: number) {
this.listeners.forEach(listener => {
listener.onDataAdd(index)
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left notifyDataAdd 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#Righ... | notifyDataAdd(index: number) {
this.listeners.forEach(listener => {
listener.onDataAdd(index)
})
} | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | 1e55674fa6b2d63dcab90d45b085044fdd8c54fa | gitcode |
openharmony-sig/node_pool | nodepool/src/main/ets/lib/NodePool.ets | arkts | preCreateWebNode | 预创建web节点到节点池
@param type SceneType
@param data webData
@param builder 封装builder对象
@returns 预创建节点是否成功 | public preCreateWebNode(data: WebData, builder?: WrappedBuilder<WebData[]>): boolean {
let type = SceneType.WEB;
let offlineNodes: Array<NodeItem> | undefined = this.getOfflineNodes(type);
if (!offlineNodes) {
return false;
}
if (!builder) {
builder = wrapBuilder<WebData[]>(webBuilder)... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left preCreateWebNode 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... | public preCreateWebNode(data: WebData, builder?: WrappedBuilder<WebData[]>): boolean {
let type = SceneType.WEB;
let offlineNodes: Array<NodeItem> | undefined = this.getOfflineNodes(type);
if (!offlineNodes) {
return false;
}
if (!builder) {
builder = wrapBuilder<WebData[]>(webBuilder)... | https://gitee.com/openharmony-sig/node_pool.git | 748ea97ee52fc1512991a4e3c46d65c01272e826 | gitee |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | 1. Ability 创建 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 应用启动时调用,进行初始化配置
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JS... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 应用启动时调用,进行初始化配置
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JS... | https://github.com/OnceWeWere/Weather_HarmonyOS | 6d4d6ff211e380373d75ca46a39d1bbfeeb6bb9a | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/arkts/class/Class.ets | arkts | hello | 方法(返回类型可以省略) | hello(): string {
return `id:${this.id} name:${this.name}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hello AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_block#... | hello(): string {
return `id:${this.id} name:${this.name}`;
} | https://github.com/webabcd/HarmonyDemo | d6e2b03d76fe2c0ca41fa025e708644538470579 | github |
holg/eulumdat-rs | EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets | arkts | isLoaded | Check if a file is currently loaded | public isLoaded(): boolean {
return eulumdat_napi.isLoaded();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLoaded 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#bool... | public isLoaded(): boolean {
return eulumdat_napi.isLoaded();
} | https://github.com/holg/eulumdat-rs | 09b739b88214a57c79cdcaedb2230d42311e1151 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | parseFieldSelector | 解析字段选择器语法
支持:
- .selector::text - 提取文本内容
- .selector::attr(name) - 提取属性
- @href - 提取href属性(简写)
- @data-id - 提取data-id属性(简写) | private parseFieldSelector(fieldSelector: string): FieldSelectorParseResult {
// 处理 @属性名 简写
if (fieldSelector.startsWith('@')) {
const attrName = fieldSelector.substring(1);
const result: FieldSelectorParseResult = {
selector: '',
extractor: `attr:${attrName}`
};
ret... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseFieldSelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fieldSelector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | private parseFieldSelector(fieldSelector: string): FieldSelectorParseResult {
// 处理 @属性名 简写
if (fieldSelector.startsWith('@')) {
const attrName = fieldSelector.substring(1);
const result: FieldSelectorParseResult = {
selector: '',
extractor: `attr:${attrName}`
};
ret... | https://github.com/DaLongZhuaZi/manxia | 9d7a89694c821d71326cf43fa9809e7eaa522a97 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getDrawAngles | returns an integer array of all the different angles the chart slices
have the angles in the returned array determine how much space (of 360°)
each slice takes
@return | public getDrawAngles(): number[] {
return this.mDrawAngles;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDrawAngles 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#expressi... | public getDrawAngles(): number[] {
return this.mDrawAngles;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 82fb114f966dd2c7388a23c8c137c0f8ac1bab1c | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Array.ets | arkts | lastIndexOf | lastIndexOf(arr: double[], key: double, fromIndex: int) tries to find entry of key into arr which is not greater than fromIndex
@param arr array to find a key
@param key a value to find
@param fromIndex an index of arr to begin search with (including, search is performed backwards)
@returns last index of key if found i... | function lastIndexOf(arr: double[], key: double, fromIndex: int): int throws {
return lastIndexOf(arr, key, -1, fromIndex)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lastIndexOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function lastIndexOf(arr: double[], key: double, fromIndex: int): int throws {
return lastIndexOf(arr, key, -1, fromIndex)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1e3ef688436d29f979425facd21d98ebf06a03d3 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Atomics.ets | arkts | add | Int16Array | public static add(typedArray: Int16Array, index: int, value: short): short {
throw new Error("not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typedArray A... | public static add(typedArray: Int16Array, index: int, value: short): short {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7af92a76a79fe73e82b0ababd2ad65aedc30a58e | gitee |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets | arkts | getFirstDayData | 周视图切换时,将当前周数据的第一天(周日)日期数据传出去 | getFirstDayData() {
if (this.weekDays && this.weekDays[0][0].dayInfo) {
this.onWeekSwitch({
date: this.weekDays[0][0].dayInfo.date,
month: this.weekDays[0][0].dayInfo.month,
year: this.weekDays[0][0].dayInfo.year
})
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getFirstDayData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | getFirstDayData() {
if (this.weekDays && this.weekDays[0][0].dayInfo) {
this.onWeekSwitch({
date: this.weekDays[0][0].dayInfo.date,
month: this.weekDays[0][0].dayInfo.month,
year: this.weekDays[0][0].dayInfo.year
})
}
} | https://gitcode.com/arkui-x/samples | 654c5daf8bc691ca0e7058dcf52af5d796d778a0 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | isDefaultNetMetered | 检查当前网络上的数据流量使用是否被计量
@returns | static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
} | 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 isDefaultNetMetered AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
} | https://github.com/tdcare/tdwebrtc | ecef9a6a23834cf723ce080231b4b1b3e470e8d2 | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets | arkts | getBorderWidth | 获取日期选中框宽度(仅用于月视图和周视图)
@param day 日期信息
@param month 月
@param currentSelectDay 当前选择的日期
@param calendarViewType 日历视图类型
@returns 返回颜色 | static getBorderWidth(day: Day, month: number, currentSelectDay: DayInfo,
calendarViewType: CalendarViewType): number {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&
currentSelectDay.date === day.dayInfo.date;
con... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getBorderWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left day AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Da... | static getBorderWidth(day: Day, month: number, currentSelectDay: DayInfo,
calendarViewType: CalendarViewType): number {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&
currentSelectDay.date === day.dayInfo.date;
con... | https://gitcode.com/arkui-x/samples | 70f8cf5ac29a5afa2b578129ae1c70ab3b5863de | gitcode |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/view/ForYouSection.ets | arkts | build | Column with header and horizontal scroller of recommendation cards. | build() {
Column() {
this.SectionHeader()
Scroll() {
Row({ space: new BreakpointType(8, 12, 16, 16).getValue(this.breakpointEnv.widthBreakpoint) }) {
ForEach(this.recommendViewModel.recommendItems, (recommendCard: RecommendCardUi, index?: number) => {
Column() {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
this.SectionHeader()
Scroll() {
Row({ space: new BreakpointType(8, 12, 16, 16).getValue(this.breakpointEnv.widthBreakpoint) }) {
ForEach(this.recommendViewModel.recommendItems, (recommendCard: RecommendCardUi, index?: number) => {
Column() {
... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 1b8ca94b843e2569e47f0cdeaf8249bcc22f77d2 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractDualSenseController.ets | arkts | tryDdkPath | 尝试通过 USB DDK 路径启动控制器 | private tryDdkPath(): boolean {
console.info(`${TAG} 尝试 DDK 路径...`);
const initResult = DdkUsbPoller.init();
if (initResult.code !== 0) {
console.warn(`${TAG} DDK init 失败: ${initResult.error}`);
return false;
}
let ddkDeviceId: number | undefined;
// 方式 A: GetDevices + 匹配 VID/PI... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left tryDdkPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST... | private tryDdkPath(): boolean {
console.info(`${TAG} 尝试 DDK 路径...`);
const initResult = DdkUsbPoller.init();
if (initResult.code !== 0) {
console.warn(`${TAG} DDK init 失败: ${initResult.error}`);
return false;
}
let ddkDeviceId: number | undefined;
// 方式 A: GetDevices + 匹配 VID/PI... | https://github.com/AlkaidLab/moonlight-harmony | cdcb5313dad84774037007bbe0c6331db7b53457 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheConstants.ets | arkts | getCacheDir | 获取应用缓存目录
@returns 缓存目录路径 | static getCacheDir(): string {
const context = CommonUtils.getContext();
return context.getApplicationContext().cacheDir + '/' + CacheConstants.CACHE_DIR_NAME;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str... | static getCacheDir(): string {
const context = CommonUtils.getContext();
return context.getApplicationContext().cacheDir + '/' + CacheConstants.CACHE_DIR_NAME;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L35-L38 | a9e0651ba6f7716667f6b10fb6c8bcbb52bd1921 | github |
Joker-x-dev/CoolMallArkTS | core/state/src/main/ets/WindowSafeAreaState.ets | arkts | updateSafeAreaByInsets | 更新安全区数据(结构体方式)
@param {SafeAreaInsets} insets - 安全区数据
@returns {void} 无返回值
@example
state.updateSafeAreaByInsets({ top: 24, left: 0, bottom: 32, right: 0 }); | updateSafeAreaByInsets(insets: SafeAreaInsets): void {
this.updateSafeArea(insets.top, insets.left, insets.bottom, insets.right);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateSafeAreaByInsets AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left insets AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SafeAreaInsets AST#identifier#R... | updateSafeAreaByInsets(insets: SafeAreaInsets): void {
this.updateSafeArea(insets.top, insets.left, insets.bottom, insets.right);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 25d5babea868ac7dd0a2ada3cb4e88716238fda4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<bigint> } items - a set of elements to include in the new array object.
@returns { BigUint64Array } - a new BigUint64Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<bigint>): BigUint64Array {
let res = new BigUint64Array(items.length.toInt())
res.ofBigInt(items)
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<bigint>): BigUint64Array {
let res = new BigUint64Array(items.length.toInt())
res.ofBigInt(items)
return res
} | https://gitcode.com/iop123123/arkts-static-skills | e8e21ff6b0fce7319de043eae74bed3f1c5ae83a | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/LimitLine.ets | arkts | getLabel | Returns the label that is drawn next to the limit line.
@return | public getLabel(): string {
return this.mLabel;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabel 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... | public getLabel(): string {
return this.mLabel;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a5f9adf5a94b1ac1dc3be5c8abae4a5c902678cb | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getAllComicSources | ==================== 图源管理方法 ====================
获取所有图源 | async getAllComicSources(): Promise<DatabaseRecord[]> {
try {
const sql = 'SELECT * FROM comic_source ORDER BY priority DESC, createTime DESC';
const result = await this.databaseManager.querySql(sql);
return result;
} catch (error) {
logger.error(TAG, '获取所有图源失败', String(error));
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllComicSources 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#g... | async getAllComicSources(): Promise<DatabaseRecord[]> {
try {
const sql = 'SELECT * FROM comic_source ORDER BY priority DESC, createTime DESC';
const result = await this.databaseManager.querySql(sql);
return result;
} catch (error) {
logger.error(TAG, '获取所有图源失败', String(error));
... | https://github.com/DaLongZhuaZi/manxia | d42b91546f03a39d36c8a75abefc411dbd00cc36 | github |
genjishare/snake-game | entry/src/main/ets/entryability/EntryAbility.ets | arkts | setRemoteGameData | 接收远程设备发送的游戏状态数据
此方法将被远程设备调用 | setRemoteGameData(jsonData: string): string {
hilog.info(DOMAIN, TAG, `收到远程游戏数据: ${jsonData}`);
try {
// 解析接收到的JSON数据
const gameData = JSON.parse(jsonData) as GameData;
// 将游戏数据存入AppStorage
AppStorage.SetOrCreate('restoredGameData', gameData);
// 通过EventBus发送初始化游戏数据的事件
E... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRemoteGameData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | setRemoteGameData(jsonData: string): string {
hilog.info(DOMAIN, TAG, `收到远程游戏数据: ${jsonData}`);
try {
// 解析接收到的JSON数据
const gameData = JSON.parse(jsonData) as GameData;
// 将游戏数据存入AppStorage
AppStorage.SetOrCreate('restoredGameData', gameData);
// 通过EventBus发送初始化游戏数据的事件
E... | https://github.com/genjishare/snake-game | 4a78a3d995e1e1a06e2c1a48ec05b421145028b6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | isNaN | isNaN(double) checks if double is NaN (not a number)
@param { double } v the double to test
@returns { boolean } true if the argument is NaN
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isNaN(v: double): boolean {
// IEEE-754 feature
return v != v;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left isNaN AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#iden... | public static isNaN(v: double): boolean {
// IEEE-754 feature
return v != v;
} | https://gitcode.com/iop123123/arkts-static-skills | 9283d220c39887040be0240066286ad841d81ba6 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | unlikeDocument | 取消点赞
@param documentId 文档ID | async unlikeDocument(documentId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/knowledge/documents/${documentId}/like`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unlikeDocument 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#:#L... | async unlikeDocument(documentId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/knowledge/documents/${documentId}/like`)
} | https://github.com/David8Idira/AI-OA | a6d909037de4c6700a46484932ed301f1e7edec5 | github |
lidaixian999/Smart_Car | entry/src/main/ets/pages/map.ets | arkts | onPageHide | 页面每次隐藏时触发一次,包括路由过程、应用进入后台等场景,仅@Entry装饰的自定义组件生效 | onPageHide(): void {
// 将地图切换到后台
if (this.mapController) {
this.mapController.hide();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left... | onPageHide(): void {
// 将地图切换到后台
if (this.mapController) {
this.mapController.hide();
}
} | https://github.com/lidaixian999/Smart_Car | e772770c9c438a4f5ba52623d8a50491d0549188 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Set.ets | arkts | delete | Removes a value from the Set
@param v the value to remove | delete(v: K): void {
this.map.delete(v);
} | AST#program#Left AST#expression_statement#Left AST#unary_expression#Left AST#delete#Left delete AST#delete#Right AST#ERROR#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left v AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier... | delete(v: K): void {
this.map.delete(v);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b8e7ef82805e2c905a95a59d4c3c431d6be921ca | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getGlassRadius | 获取通用玻璃圆角半径(不区分主题) | public getGlassRadius(): number {
return this.getGlassToken(GlassLevel.CARD).radius;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGlassRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | public getGlassRadius(): number {
return this.getGlassToken(GlassLevel.CARD).radius;
} | https://github.com/DaLongZhuaZi/manxia | d05ae550694c6632170dd0f901e80681b8624b4f | github |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets | arkts | setPlayModel | Set music play mode.
@param playMode | public setPlayModel(playMode: MusicPlayMode) {
this.playMode = playMode;
Logger.info(TAG, 'setPlayModel mode: ' + this.playMode);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPlayModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left playMode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setPlayModel(playMode: MusicPlayMode) {
this.playMode = playMode;
Logger.info(TAG, 'setPlayModel mode: ' + this.playMode);
} | https://gitee.com/harmonyos/codelabs.git | 7c9390ad9d6f2ee0684481f67875207b77cc787f | gitee |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | common/sample_common/src/main/ets/model/ScanAccessibility.ets | arkts | announceForAccessibility | Actively announce the change text, interrupting the previous announcement.
@param isFlashlight - A boolean value indicating whether the flashlight should be turned on.
This function attempts to send an announcement event through the accessibility interface to notify the user of changes in the interface content.
If acce... | static announceForAccessibility(isFlashlight: boolean): void {
try {
if (ScanAccessibility.isOpenAccessibilitySync()) {
let eventInfo: accessibility.EventInfo = ({
type: 'announceForAccessibility',
bundleName: SampleConstants.BUNDLE_NAME,
triggerAction: 'common',
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left announceForAccessibility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFlashlight AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left bo... | static announceForAccessibility(isFlashlight: boolean): void {
try {
if (ScanAccessibility.isOpenAccessibilitySync()) {
let eventInfo: accessibility.EventInfo = ({
type: 'announceForAccessibility',
bundleName: SampleConstants.BUNDLE_NAME,
triggerAction: 'common',
... | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | 9fcca1c420cd6b2487bd3ae87492a0a44735e680 | gitcode |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | setVolume | 设置音量
@param volume - 音量值(0.0 ~ 1.0)
@returns Promise<void> 设置完成后 resolve
@remarks
- 0.0 = 静音
- 1.0 = 最大音量
- 值会被限制在 0.0 ~ 1.0 范围内
@throws
- AudioRenderer 未初始化 | public async setVolume(volume: number): Promise<void> {
if (!this.renderer) {
throw new Error('AudioRenderer not initialized');
}
await this.renderer.setVolume(volume);
} | 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 setVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left volume AST#identifier#Right AST#:#Left : AST#:... | public async setVolume(volume: number): Promise<void> {
if (!this.renderer) {
throw new Error('AudioRenderer not initialized');
}
await this.renderer.setVolume(volume);
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L443-L448 | c5046c86c27ed9f01246611b23e32bdd93fa1f5f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildLatestActions | 构建最新更新获取操作序列 | buildLatestActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'latest');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少最新更新工作流配置'
);
}
return this.processActions(workflow, {});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildLatestActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfig AS... | buildLatestActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'latest');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少最新更新工作流配置'
);
}
return this.processActions(workflow, {});
} | https://github.com/DaLongZhuaZi/manxia | a62d7c619d36909e4680e824d0f1f9b10de8e4dd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakSet.ets | arkts | add | The add() method appends a new object to the end of a WeakSet object
@param { K } v - The object to add
@returns { WeakSet<K> } Returns the WeakSet instance itself, supporting chaining
@syscap SystemCapability.Utils.Lang | add(v: K): WeakSet<K>{
this.elements.set(v, null)
return this
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | add(v: K): WeakSet<K>{
this.elements.set(v, null)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | e90f4ddb93883ca23160fbb1ad05fa6822a6b3b5 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/data/hospitalData.ets | arkts | getAllConnections | 获取所有楼层连接(电梯、楼梯) | function getAllConnections(): Connection[] {
return [
// 门诊大楼1号电梯
{
id: 'CONN_ELEV_001',
fromFloor: 1,
toFloor: 2,
fromPosition: { x: 30, y: 25 } as Position2D,
toPosition: { x: 30, y: 25 } as Position2D,
type: 'ELEVATOR',
name: '1号客运电梯'
} as Connection,
{
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getAllConnections AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#array_typ... | function getAllConnections(): Connection[] {
return [
// 门诊大楼1号电梯
{
id: 'CONN_ELEV_001',
fromFloor: 1,
toFloor: 2,
fromPosition: { x: 30, y: 25 } as Position2D,
toPosition: { x: 30, y: 25 } as Position2D,
type: 'ELEVATOR',
name: '1号客运电梯'
} as Connection,
{
... | https://github.com/LJ666-ui/harmony-health-care | f6563c9d31cd16279a583359e5377429616db363 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/TaskDao.ets | arkts | queryAll | 查询所有任务
@returns Promise<Array<Record<string, any>>> 任务记录数组 | async queryAll(): Promise<Array<Record<string, number | string | boolean>>> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return [];
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
const... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async queryAll(): Promise<Array<Record<string, number | string | boolean>>> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return [];
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
const... | https://github.com/Kira-Yagami-Light/Kira-Projects | 1ff2c1e75eec988f8722b9f2e4fb759db9f36256 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | performHighlight | Perform a highlight operation.
@param e | protected performHighlight(h: Highlight, e?: TouchEvent) {
if (h == null || Utils.isHighLightEquals(h, this.mLastHighlighted)) {
// this.mChart.highlightValue(0,undefined,undefined, undefined,true);
this.mChart.highlightValueForObject(null, true);
this.mLastHighlighted = null;
} else {
... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left performHighlight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left h AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | protected performHighlight(h: Highlight, e?: TouchEvent) {
if (h == null || Utils.isHighLightEquals(h, this.mLastHighlighted)) {
// this.mChart.highlightValue(0,undefined,undefined, undefined,true);
this.mChart.highlightValueForObject(null, true);
this.mLastHighlighted = null;
} else {
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 44dfe0cd452a384500c806a8e873dda9ea4d1289 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/SettingsManager.ets | arkts | getColorThemeDisplayText | 获取主题配色显示文本 | getColorThemeDisplayText(theme: ColorTheme): Resource {
if (theme === ColorTheme.DEFAULT) {
return $r('app.string.theme_color_default')
} else if (theme === ColorTheme.CLAUDE) {
return $r('app.string.theme_color_claude')
} else if (theme === ColorTheme.CHATGPT) {
return $r('app.string.th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColorThemeDisplayText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ColorTheme AST#identifier#Righ... | getColorThemeDisplayText(theme: ColorTheme): Resource {
if (theme === ColorTheme.DEFAULT) {
return $r('app.string.theme_color_default')
} else if (theme === ColorTheme.CLAUDE) {
return $r('app.string.theme_color_claude')
} else if (theme === ColorTheme.CHATGPT) {
return $r('app.string.th... | https://github.com/LongLiveY96/chatcube | acc1f8101e74113fcdbb44fa03c66809c97add6d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | bottomSources | 批量置底书源 | async bottomSources(sourceIds: string[]): Promise<number> {
// 获取当前最大的 customOrder
let maxOrder = 0;
this.sources.forEach(source => {
if (source.enabled !== false && source.customOrder !== undefined && source.customOrder > maxOrder) {
maxOrder = source.customOrder;
}
});
l... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left bottomSources AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceIds AST#identifier#Right AST#type_annotation#Left ... | async bottomSources(sourceIds: string[]): Promise<number> {
// 获取当前最大的 customOrder
let maxOrder = 0;
this.sources.forEach(source => {
if (source.enabled !== false && source.customOrder !== undefined && source.customOrder > maxOrder) {
maxOrder = source.customOrder;
}
});
l... | https://github.com/DaLongZhuaZi/manxia | 60f6e5bd9ed6a6412656b72e411500574c03a496 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/keyshortcuts/scripts/helpers.ets | arkts | modifierToString | Converts a modifier key into absolute string.
@param mod The modifier key to convert.
@returns The absolute string representation of the modifier key. | function modifierToString(mod: ModifierKey) {
switch (mod) {
case ModifierKey.CTRL: return 'CTRL';
case ModifierKey.SHIFT: return 'SHIFT';
case ModifierKey.ALT: return 'ALT';
default: return mod.toString();
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left modifierToString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left mod AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function modifierToString(mod: ModifierKey) {
switch (mod) {
case ModifierKey.CTRL: return 'CTRL';
case ModifierKey.SHIFT: return 'SHIFT';
case ModifierKey.ALT: return 'ALT';
default: return mod.toString();
}
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | d20a97a439302d4e2214c16f37f94bc9177db818 | github |
darcycui/DarcyHarmonyNext | entry/src/main/ets/pages/entry/basepage/ColumnPage.ets | arkts | onBackPress | 生命周期回调:返回键 只限入口组件 这里不生效 | onBackPress(): boolean | void {
Log.info(TAG2 + "onBackPress");
return false; // 返回false不消费回退事件
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : ... | onBackPress(): boolean | void {
Log.info(TAG2 + "onBackPress");
return false; // 返回false不消费回退事件
} | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/basepage/ColumnPage.ets#L103-L106 | 45f6950a65a1fc6fba8aa3b7f29480f907685f5b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/DialogAnimationState.ets | arkts | animateOut | 出场动画,完成后回调 | animateOut(uiContext: UIContext, onFinished?: () => void): void {
uiContext.animateTo({
duration: this.outDuration,
curve: this.outCurve
}, () => {
this.opacity = 0;
this.scale = this.closeScale;
this.translateY = this.closeTranslateY;
});
if (onFinished) {
setTimeo... | AST#program#Left AST#ERROR#Left AST#identifier#Left animateOut AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIContext AST#identifier#Right AST#,#Left , AST#,#Right AST#binary_expression#Left A... | animateOut(uiContext: UIContext, onFinished?: () => void): void {
uiContext.animateTo({
duration: this.outDuration,
curve: this.outCurve
}, () => {
this.opacity = 0;
this.scale = this.closeScale;
this.translateY = this.closeTranslateY;
});
if (onFinished) {
setTimeo... | https://github.com/DaLongZhuaZi/manxia | 03b4645854e88fbb1988ffa5da7c3f442641a22e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | tryGetInteger | Attempts to get an integer value from an object by key.
Returns the fallback value if the key is not found or if the value is not an integer.
@param {string} key - The key to look up
@param {int} [fallback=0] - The fallback value to return if the key is not found
@returns {int} The integer value if found, fallback valu... | tryGetInteger(key: string, fallback: int = 0): int {
return this.tryGetElement(key)?.tryAsInteger() ?? fallback
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left tryGetInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS... | tryGetInteger(key: string, fallback: int = 0): int {
return this.tryGetElement(key)?.tryAsInteger() ?? fallback
} | https://gitcode.com/iop123123/arkts-static-skills | c979694513da43a1997aa11dda9f66b19d3ec2a0 | gitcode |
robotzzh/AgricultureApp | entry/src/main/ets/common/History_Info.ets | arkts | JSON_to | 给一个JSON对象,返回一个FarmBean | static JSON_to(message):History_Info{
var temp:History_Info = new History_Info(
message.fieldId,
message.name,
message.sensor_IP,
message.sensor_port
);
temp.history_humidity = History_Info.to_arraylist(message.history_humidity);
//console.info('load len of '+temp.history_tempe... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left JSON_to AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | static JSON_to(message):History_Info{
var temp:History_Info = new History_Info(
message.fieldId,
message.name,
message.sensor_IP,
message.sensor_port
);
temp.history_humidity = History_Info.to_arraylist(message.history_humidity);
//console.info('load len of '+temp.history_tempe... | https://github.com/robotzzh/AgricultureApp | 75e0328428f2cc11bdb6c7717b297f443a14c57d | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | setOnStateChange | ---- 事件回调设置 ---- | public setOnStateChange(callback: (state: string) => void): void {
this.onStateChange = callback;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left setOnStateChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AS... | public setOnStateChange(callback: (state: string) => void): void {
this.onStateChange = callback;
} | https://github.com/tdcare/tdwebrtc | 23bcebc9ff1f7681ee7e1613e176233d01234fc9 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | refreshAllComputers | ═══════════════════════════════════════════════════════════
轮询 & 网络监听
═══════════════════════════════════════════════════════════
刷新所有电脑状态
并行轮询,每台完成后立即通知 UI
对齐 Android ComputerManagerService.createPollingJob:
每个轮询周期都对所有 PC 执行 pollComputer,不跳过;
`pollComputer` 内部根据 offlineCount 决定是否真的把状态标 OFFLINE,
这样网络抖动 / Sunshine 重启时 P... | async refreshAllComputers(): Promise<void> {
try {
await Promise.all(
Array.from(this.computers.values()).map(async (computer) => {
try {
await this.pollComputer(computer);
} catch (err) {
// pollComputer 内部已处理网络错误;意外异常仍按一次失败计数
console.warn(`Co... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left refreshAllComputers 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 refreshAllComputers(): Promise<void> {
try {
await Promise.all(
Array.from(this.computers.values()).map(async (computer) => {
try {
await this.pollComputer(computer);
} catch (err) {
// pollComputer 内部已处理网络错误;意外异常仍按一次失败计数
console.warn(`Co... | https://github.com/AlkaidLab/moonlight-harmony | 45899fd54d52ff7be7ebf49a241e349633a228e5 | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/viewmodel/DetailViewModel.ets | arkts | removeAlarmRemind | Remove the alarm remind.
@param id number | public async removeAlarmRemind(id: number) {
this.reminderService.deleteReminder(id);
let index = await this.findAlarmWithId(id);
if (index !== CommonConstants.DEFAULT_NUMBER_NEGATIVE) {
this.alarms.splice(index, CommonConstants.DEFAULT_SINGLE);
}
let preference = GlobalContext.getContext().... | 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 removeAlarmRemind AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : A... | public async removeAlarmRemind(id: number) {
this.reminderService.deleteReminder(id);
let index = await this.findAlarmWithId(id);
if (index !== CommonConstants.DEFAULT_NUMBER_NEGATIVE) {
this.alarms.splice(index, CommonConstants.DEFAULT_SINGLE);
}
let preference = GlobalContext.getContext().... | https://gitee.com/harmonyos/codelabs.git | 1be62d4134b1dbe3481647c62e2b9ebcdd31bbe4 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/IntentClassifier.ets | arkts | classifyByKeywords | 基于关键词的意图分类
@param question 用户问题
@returns 意图 | private classifyByKeywords(question: string): Intent {
const questionLower = question.toLowerCase();
// 症状咨询关键词
const symptomKeywords = ['症状', '头痛', '发烧', '咳嗽', '腹痛', '恶心', '乏力', '不舒服', '疼痛'];
if (symptomKeywords.some(kw => questionLower.includes(kw))) {
return {
type: IntentType.SYMPTO... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left classifyByKeywords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left question AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private classifyByKeywords(question: string): Intent {
const questionLower = question.toLowerCase();
// 症状咨询关键词
const symptomKeywords = ['症状', '头痛', '发烧', '咳嗽', '腹痛', '恶心', '乏力', '不舒服', '疼痛'];
if (symptomKeywords.some(kw => questionLower.includes(kw))) {
return {
type: IntentType.SYMPTO... | https://github.com/LJ666-ui/harmony-health-care | 300c75485aff5a2ac814177fa2fac9b250ddece7 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | udpSendData | UDP发送消息
@param data
@param oppositeAddress
@param oppositePort | public udpSendData(data: string, oppositeAddress: string, oppositePort: number): void {
this.mSocket?.sendData(data, oppositeAddress, oppositePort);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left udpSendData 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 stri... | public udpSendData(data: string, oppositeAddress: string, oppositePort: number): void {
this.mSocket?.sendData(data, oppositeAddress, oppositePort);
} | https://github.com/openharmony/applications_app_samples | 34c51d450f065d074b58f04922a7468f0316fa83 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/BookmarkBase.ets | arkts | toJson | Convert bookmark to JSON object | toJson(): Record<string, Object> {
const result: Record<string, Object> = {};
result['id'] = this.id;
result['label'] = this.label;
result['type'] = this.type;
result['hostname'] = this.hostname;
result['port'] = this.port;
result['username'] = this.username;
result['domain'] = this.do... | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left toJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : A... | toJson(): Record<string, Object> {
const result: Record<string, Object> = {};
result['id'] = this.id;
result['label'] = this.label;
result['type'] = this.type;
result['hostname'] = this.hostname;
result['port'] = this.port;
result['username'] = this.username;
result['domain'] = this.do... | https://github.com/tangwengang-del/freerdp-harmonyos | 47b7ed991cf30cfee931e49a5b89308322702ff6 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets | arkts | getDefaultAddress | 获取默认地址
@returns {Promise<NetworkResponse<Address | null>>} 默认地址 | async getDefaultAddress(): Promise<NetworkResponse<Address | null>> {
const resp: AxiosResponse<NetworkResponse<Address | null>> =
await NetworkClient.http.get("user/address/default");
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDefaultAddress 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#ge... | async getDefaultAddress(): Promise<NetworkResponse<Address | null>> {
const resp: AxiosResponse<NetworkResponse<Address | null>> =
await NetworkClient.http.get("user/address/default");
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 8332cc3b4dd6db3f2c0cb7e16806c839082a645c | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | fragment | Sets the fragment portion of the URI
@param { string } input | set fragment(input: string) {
this.uriEntry.setFragment(encodeURIComponent(input));
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left fragment 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#iden... | set fragment(input: string) {
this.uriEntry.setFragment(encodeURIComponent(input));
} | https://gitcode.com/iop123123/arkts-static-skills | fdff0c19b4d83803b1e201614f485eeda0443638 | gitcode |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/DataManager.ets | arkts | saveReminder | 保存提醒设置 | async saveReminder(reminder: ReminderSettings): Promise<boolean> {
try {
const reminders = await this.getAllReminders();
const index = reminders.findIndex(r => r.id === reminder.id);
if (index >= 0) {
reminders[index] = reminder;
} else {
reminders.push(reminder);
}
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveReminder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left reminder AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async saveReminder(reminder: ReminderSettings): Promise<boolean> {
try {
const reminders = await this.getAllReminders();
const index = reminders.findIndex(r => r.id === reminder.id);
if (index >= 0) {
reminders[index] = reminder;
} else {
reminders.push(reminder);
}
... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 793d347dfb62ce21f98a58c5b5c2caf138043a2b | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/DataMapper.ets | arkts | fromResultSetRow | 从结果集行转换为实体数据
@param row 结果集行
@returns 实体数据 | fromResultSetRow(row: ResultSetRow): EntityData {
const entityData = new EntityData(this.entityMetadata.entityName)
for (let i = 0; i < this.entityMetadata.columns.length; i++) {
const column = this.entityMetadata.columns[i]
// 获取数据库值
const dbValue = row.get(column.columnName)
// 确定... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fromResultSetRow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left row AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ResultSetRow AST#identifier#Right AST#)#... | fromResultSetRow(row: ResultSetRow): EntityData {
const entityData = new EntityData(this.entityMetadata.entityName)
for (let i = 0; i < this.entityMetadata.columns.length; i++) {
const column = this.entityMetadata.columns[i]
// 获取数据库值
const dbValue = row.get(column.columnName)
// 确定... | https://github.com/offlinecat-dev/OCNetORM | d5762f9b3c4c0c641f2ad06f87e47c94b99337e0 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/beans/LocationParam.ets | arkts | callOnLocation | 获取选择回调
@return (param: LocationInfo) => void | public static callOnLocation(param: LocationInfo): void {
const instance = LocationParam.getInstance();
if (instance && instance.onLocation !== undefined) {
return instance.onLocation(param);
} else {
CommonUtils.showToast($r('app.string.location_not_set_callback'));
}
} | 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 callOnLocation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : ... | public static callOnLocation(param: LocationInfo): void {
const instance = LocationParam.getInstance();
if (instance && instance.onLocation !== undefined) {
return instance.onLocation(param);
} else {
CommonUtils.showToast($r('app.string.location_not_set_callback'));
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/beans/LocationParam.ets#L181-L188 | 83e0c1716df1d2214da28afc69b42db82e472737 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | isInstanceConnected | Check if an instance is connected | static isInstanceConnected(inst: number): boolean {
return instanceState.get(inst) ?? false;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isInstanceConnected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static isInstanceConnected(inst: number): boolean {
return instanceState.get(inst) ?? false;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 8fe9cd25e3d8f6b0af6de58d4b7bff07915c70c0 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets | arkts | requestRepository | 请求推荐搜索关键词列表
@returns {Promise<NetworkResponse<GoodsSearchKeyword[]>>} 网络请求 Promise | protected requestRepository(): Promise<NetworkResponse<GoodsSearchKeyword[]>> {
return this.goodsRepository.getSearchKeywordList();
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestRepository 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... | protected requestRepository(): Promise<NetworkResponse<GoodsSearchKeyword[]>> {
return this.goodsRepository.getSearchKeywordList();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 4f8d0c8449d05b06e0cf7917c028a79766059714 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets | arkts | drop_it | 销毁 // | drop_it() {
// 保存数据
this.play_data_save()
// 清除定时器
this.clear_timer_interval()
// ffmpeg_player 原生层会在 set_audio 新文件时自动清理旧资源,
// 或在进程退出时由系统回收
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left drop_it 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#comment#Left // 保存数据 AST#comm... | drop_it() {
// 保存数据
this.play_data_save()
// 清除定时器
this.clear_timer_interval()
// ffmpeg_player 原生层会在 set_audio 新文件时自动清理旧资源,
// 或在进程退出时由系统回收
} | https://github.com/Nekofox-POT/LinMusic | 3ef7e7c2644e87be8ebd4c94be4ae6ef5789c76d | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/MedicalImageUtils.ets | arkts | calculateSharpness | 计算图像的清晰度(使用拉普拉斯方差)
@param pixelMap 图像
@returns 清晰度分数 | static async calculateSharpness(pixelMap: image.PixelMap): Promise<number> {
try {
// 获取图像信息
const imageInfo = await pixelMap.getImageInfo();
const width = imageInfo.size.width;
const height = imageInfo.size.height;
// 读取像素数据
const pixelBytesNumber = pixelMap.getPixelBytesNumb... | 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 calculateSharpness AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identifier#R... | static async calculateSharpness(pixelMap: image.PixelMap): Promise<number> {
try {
// 获取图像信息
const imageInfo = await pixelMap.getImageInfo();
const width = imageInfo.size.width;
const height = imageInfo.size.height;
// 读取像素数据
const pixelBytesNumber = pixelMap.getPixelBytesNumb... | https://github.com/LJ666-ui/harmony-health-care | bcbb733c9c7e5d74a6707ffbee748ea0ae677e3a | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/viewmodel/PlayerViewModel.ets | arkts | seek | Seeks current playback to ms (delegates to MediaService). | public seek(ms: number): void {
PlayerDataUtil.seek(ms);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left seek AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public seek(ms: number): void {
PlayerDataUtil.seek(ms);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | e18d744fc5259dbcc2d31b4e444d6bf41513f94a | gitcode |
harmonyos/codelabs | CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets | arkts | drawInnerArc | Draw the interior fan-shaped raffle area. | drawInnerArc() {
let colors = [
ColorConstants.ARC_PINK_COLOR, ColorConstants.ARC_YELLOW_COLOR,
ColorConstants.ARC_GREEN_COLOR, ColorConstants.ARC_PINK_COLOR,
ColorConstants.ARC_YELLOW_COLOR, ColorConstants.ARC_GREEN_COLOR
];
let radius = this.screenWidth * CommonConstants.INNER_ARC_RATI... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawInnerArc 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 ... | drawInnerArc() {
let colors = [
ColorConstants.ARC_PINK_COLOR, ColorConstants.ARC_YELLOW_COLOR,
ColorConstants.ARC_GREEN_COLOR, ColorConstants.ARC_PINK_COLOR,
ColorConstants.ARC_YELLOW_COLOR, ColorConstants.ARC_GREEN_COLOR
];
let radius = this.screenWidth * CommonConstants.INNER_ARC_RATI... | https://gitee.com/harmonyos/codelabs.git | ce4b0dd072ab5276ebc6f4d6eacaa9a474f5f0bf | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Initialization/DataInitializer.ets | arkts | validateInitialization | 验证初始化结果 | private async validateInitialization(): Promise<ValidationResult> {
const errors: string[] = [];
const warnings: string[] = [];
try {
// 验证数据服务是否可用
const dataService = DataService.getInstance();
// 尝试获取基本统计信息
try {
await dataService.getAppDataStats();
} catch ... | 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 validateInitialization AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#... | private async validateInitialization(): Promise<ValidationResult> {
const errors: string[] = [];
const warnings: string[] = [];
try {
// 验证数据服务是否可用
const dataService = DataService.getInstance();
// 尝试获取基本统计信息
try {
await dataService.getAppDataStats();
} catch ... | https://github.com/DaLongZhuaZi/manxia | 54dc8ea1a98766f56890ccbcd0826f92fa21aa69 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | migrateExistingProviders | 迁移现有供应商数据(为图标类型字段设置默认值) | private async migrateExistingProviders(): Promise<void> {
if (this.rdbStore === null) {
return
}
try {
// 查询所有供应商
const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS)
const resultSet = await this.rdbStore.query(predicates)
while (resultSet.goToNextRow()... | 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 migrateExistingProviders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressio... | private async migrateExistingProviders(): Promise<void> {
if (this.rdbStore === null) {
return
}
try {
// 查询所有供应商
const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS)
const resultSet = await this.rdbStore.query(predicates)
while (resultSet.goToNextRow()... | https://github.com/LongLiveY96/chatcube | 21776498ef6c45b452542aec9b3da1c399e2fd74 | github |
openharmony-sig/ohos_sdl2 | ohos-project/entry/src/main/ets/service/adapter_c/common/Node.ets | arkts | constructor | Other attributes are not supported now. | constructor(x?: Length, y?: Length, w?: Length, h?: Length, node_type?: NodeType, node_xcomponent?: XComponentModel) {
if (node_type != undefined) this.node_type = node_type;
if (node_xcomponent != undefined) this.node_xcomponent = node_xcomponent;
if (w != undefined) this.width = w;
if (h != undefine... | 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 x AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Length ... | constructor(x?: Length, y?: Length, w?: Length, h?: Length, node_type?: NodeType, node_xcomponent?: XComponentModel) {
if (node_type != undefined) this.node_type = node_type;
if (node_xcomponent != undefined) this.node_xcomponent = node_xcomponent;
if (w != undefined) this.width = w;
if (h != undefine... | https://gitee.com/openharmony-sig/ohos_sdl2.git | bce540ae6976b148884eaa6442e79625f54a4231 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/LogUtil.ets | arkts | init | true-hilog、false-console
初始化日志参数(该方法建议在Ability里调用)
@param domain
@param tag
@param showLog | static init(domain: number = LogUtil.domain, tag: string = LogUtil.tag, showLog: boolean = true, isHilog: boolean = true) {
LogUtil.domain = domain;
LogUtil.tag = tag;
LogUtil.showLog = showLog;
LogUtil.isHilog = isHilog;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST... | static init(domain: number = LogUtil.domain, tag: string = LogUtil.tag, showLog: boolean = true, isHilog: boolean = true) {
LogUtil.domain = domain;
LogUtil.tag = tag;
LogUtil.showLog = showLog;
LogUtil.isHilog = isHilog;
} | https://github.com/tdcare/tdwebrtc | 9f8f5c703a25dde1c6fa5fd59ed2621bc028f974 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/ColorUtil.ets | arkts | getBlendColor | Overlay the background color with the foreground color to obtain the final color.
@param tag Calling Components
@param backgroundColor BackgroundColor
@param foregroundColor ForegroundColor
@returns Overlay color | public static getBlendColor(tag: string, backgroundColor: ResourceColor,
foregroundColor: ResourceColor): ResourceColor {
let resultColor: ResourceColor;
try {
resultColor =
ColorMetrics.resourceColor(backgroundColor).blendColor(ColorMetrics.resourceColor(foregroundColor)).color;
} catch... | 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 getBlendColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST... | public static getBlendColor(tag: string, backgroundColor: ResourceColor,
foregroundColor: ResourceColor): ResourceColor {
let resultColor: ResourceColor;
try {
resultColor =
ColorMetrics.resourceColor(backgroundColor).blendColor(ColorMetrics.resourceColor(foregroundColor)).color;
} catch... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 03b64b6cb93c9e8527cc756d55d3d6e2532b080a | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | getGCDeviceInfoCached | 获取缓存的 GC Kit 设备信息(用于去重比较) | private getGCDeviceInfoCached(deviceId: string): GameControllerDeviceInfo | null {
return this.gcDeviceInfoCache.get(deviceId) ?? null;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getGCDeviceInfoCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | private getGCDeviceInfoCached(deviceId: string): GameControllerDeviceInfo | null {
return this.gcDeviceInfoCache.get(deviceId) ?? null;
} | https://github.com/AlkaidLab/moonlight-harmony | 057c145f8678ba658542946602de6784d0af2a3d | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleHealthCheck.ets | arkts | triggerPostUcmSend | Called by `CountlyInstance.resolveUnknownConsent` on UCM exit (both
grant and revoke paths) to fire the health check that `onInit`
deferred while UCM was active. No-op if HC is disabled, in temp-id
mode, or has already been sent successfully this lifecycle. Fire-
and-forget per the Dart parity protocol. | public triggerPostUcmSend(): void {
if (this.config.disableHealthCheck) return;
if (this.core.deviceIdModule.isTemporary()) return;
if (this.sent) return;
this.sendHealthCheck().catch((err: Object) => {
this.config.logger.e(`[ModuleHealthCheck] post-UCM sendHealthCheck rejected: ${err}`);
})... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left triggerPostUcmSend 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#... | public triggerPostUcmSend(): void {
if (this.config.disableHealthCheck) return;
if (this.core.deviceIdModule.isTemporary()) return;
if (this.sent) return;
this.sendHealthCheck().catch((err: Object) => {
this.config.logger.e(`[ModuleHealthCheck] post-UCM sendHealthCheck rejected: ${err}`);
})... | https://github.com/Countly/countly-sdk-hos | d13b34ced856b8cbfee772604bca63c87c37a0ec | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/component/GoodsDetailTopBar.ets | arkts | build | 构建商品详情顶部导航栏
@returns {void} 无返回值 | build(): void {
Stack({ alignContent: Alignment.TopStart }) {
Column() {
if (this.topInset > 0) {
Blank().height(this.topInset);
}
this.TopBarRow(false);
}
.width(P100)
.backgroundColor($r("app.color.bg_white"))
.opacity(this.getBackgroundOpacity())
... | 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 {
Stack({ alignContent: Alignment.TopStart }) {
Column() {
if (this.topInset > 0) {
Blank().height(this.topInset);
}
this.TopBarRow(false);
}
.width(P100)
.backgroundColor($r("app.color.bg_white"))
.opacity(this.getBackgroundOpacity())
... | https://github.com/Joker-x-dev/CoolMallArkTS | c5e8469bd120ba5ab05a05fc803e58581a824a26 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrCodeGenerator.ets | arkts | reserveFormatAreas | Reserve format info areas | reserveFormatAreas(): void {
// Around top-left finder
for (let i = 0; i < 9; i++) {
if (!this.reserved[8][i]) this.reserved[8][i] = true;
if (!this.reserved[i][8]) this.reserved[i][8] = true;
}
// Around top-right finder
for (let i = 0; i < 8; i++) {
if (!this.reserved[8][this.s... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reserveFormatAreas 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... | reserveFormatAreas(): void {
// Around top-left finder
for (let i = 0; i < 9; i++) {
if (!this.reserved[8][i]) this.reserved[8][i] = true;
if (!this.reserved[i][8]) this.reserved[i][8] = true;
}
// Around top-right finder
for (let i = 0; i < 8; i++) {
if (!this.reserved[8][this.s... | https://github.com/AlkaidLab/moonlight-harmony | b985b635ef90b817ba44770eabaefa30945e08b4 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/feedback/FeedbackNetworkDataSourceImpl.ets | arkts | getFeedbackDetail | 获取反馈详情
@param {number} id - 反馈 ID
@returns {Promise<NetworkResponse<Feedback>>} 反馈详情 | async getFeedbackDetail(id: number): Promise<NetworkResponse<Feedback>> {
const resp: AxiosResponse<NetworkResponse<Feedback>> =
await NetworkClient.http.get("app/feedback/detail", { params: { id } });
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFeedbackDetail AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async getFeedbackDetail(id: number): Promise<NetworkResponse<Feedback>> {
const resp: AxiosResponse<NetworkResponse<Feedback>> =
await NetworkClient.http.get("app/feedback/detail", { params: { id } });
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2ec58b9bca7a4bc7d123d074ae61f7e74436ed3b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | toSorted | Creates a sorted copy
@returns { Uint8ClampedArray } - a sorted copy
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toSorted(): Uint8ClampedArray {
return new Uint8ClampedArray(this).sort()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSorted 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 Uint8ClampedA... | public toSorted(): Uint8ClampedArray {
return new Uint8ClampedArray(this).sort()
} | https://gitcode.com/iop123123/arkts-static-skills | 38c02a655cfdeeb90d46c4fe35aa89d6776e2330 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/Preferences/entry/src/main/ets/model/PreferenceModel.ets | arkts | writeData | write data.
@param fruit Fruit data. | writeData(fruit: Fruit) {
// Check whether the data is null.
let isDataNull = this.checkFruitData(fruit);
if (isDataNull) {
return;
}
// The data is inserted into the preferences database if it is not empty.
this.putPreference(fruit);
this.showToastMessage($r('app.string.write_succes... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left writeData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fruit AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Fruit AST#identifier#Right AST... | writeData(fruit: Fruit) {
// Check whether the data is null.
let isDataNull = this.checkFruitData(fruit);
if (isDataNull) {
return;
}
// The data is inserted into the preferences database if it is not empty.
this.putPreference(fruit);
this.showToastMessage($r('app.string.write_succes... | https://gitee.com/harmonyos/codelabs.git | 43b5ec50121ceb5776a37033451872359ad4ad01 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/AutoPageTurnController.ets | arkts | destroy | 销毁控制器 | public destroy(): void {
this.stop();
this.onPageTurn = null;
this.getCurrentPageIndex = null;
this.getTotalPages = null;
this.onChapterEnd = null;
logger.info(TAG, '自动翻页控制器已销毁');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroy 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_sta... | public destroy(): void {
this.stop();
this.onPageTurn = null;
this.getCurrentPageIndex = null;
this.getTotalPages = null;
this.onChapterEnd = null;
logger.info(TAG, '自动翻页控制器已销毁');
} | https://github.com/DaLongZhuaZi/manxia | a0a87873df035ed20530d226c19b3660518db53d | github |
arkui-x/samples | CodeLab/Cases/feature/cardswiperanimation/src/main/ets/utils/CardComponent.ets | arkts | animateFunc | 设置卡片组件点击图片后的动画
duration: 动画时长
curve: 动画曲线,默认Friction(阻尼曲线) | animateFunc() {
animateTo({
duration: Constants.DURATION,
curve: Constants.DEFAULT_ANIMATION_CURVE
}, () => {
this.isPhotoShow = !this.isPhotoShow;
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left animateFunc 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... | animateFunc() {
animateTo({
duration: Constants.DURATION,
curve: Constants.DEFAULT_ANIMATION_CURVE
}, () => {
this.isPhotoShow = !this.isPhotoShow;
})
} | https://gitcode.com/arkui-x/samples | a4605eb6fadbf4b02b828c74749e8045bf239f36 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/SettingsService.ets | arkts | setDarkMode | @deprecated 使用 setThemeMode 代替
设置深色模式
@param enabled 是否启用深色模式 | public async setDarkMode(enabled: boolean): Promise<void> {
await this.setThemeMode(enabled ? ThemeMode.DARK : ThemeMode.LIGHT);
} | 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 setDarkMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AS... | public async setDarkMode(enabled: boolean): Promise<void> {
await this.setThemeMode(enabled ? ThemeMode.DARK : ThemeMode.LIGHT);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L151-L153 | 9b1b251522a59c54bf70d14d53e2f120807816b6 | github |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | toDetail | 跳转到订单详情
@param {number} orderId - 订单 ID
@returns {void} 无返回值 | static toDetail(orderId: number): void {
const params: OrderIdParam = { orderId };
navigateTo(OrderRoutes.Detail, params);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left orderId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right ... | static toDetail(orderId: number): void {
const params: OrderIdParam = { orderId };
navigateTo(OrderRoutes.Detail, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 7479fe390b257ba3c558f0f531c0d47f05251d4f | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/HomeVM.ets | arkts | loadMoreSection | 分页加载更多(热度 / 上传日期 tab)。
section: 1 = popular, 2 = recent | static async loadMoreSection(section: number, page: number): Promise<LoadMoreResult> {
const langs: string[] | undefined = await HomeVM.resolveLanguages();
const order: string = section === 1 ? 'popular' : 'date';
const opts: SearchOptions = {
order: order,
page: page,
limit: 30,
};
... | 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 loadMoreSection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left section AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static async loadMoreSection(section: number, page: number): Promise<LoadMoreResult> {
const langs: string[] | undefined = await HomeVM.resolveLanguages();
const order: string = section === 1 ? 'popular' : 'date';
const opts: SearchOptions = {
order: order,
page: page,
limit: 30,
};
... | https://github.com/LZZLHY/hlib | b9ab201c8230884a45667157bc391b32e462c2b9 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ThemeService.ets | arkts | applyThemeToStorage | 应用主题颜色到 AppStorage | private applyThemeToStorage(): void {
const colors = this.getCurrentColors()
applyThemeToAppUiState(this.currentTheme, colors)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyThemeToStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void ... | private applyThemeToStorage(): void {
const colors = this.getCurrentColors()
applyThemeToAppUiState(this.currentTheme, colors)
} | https://github.com/LongLiveY96/chatcube | acc1b546e912a5688e79db6da64b1915e441e338 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.